var JY = Object.defineProperty;
var eX = (t, e, r) => e in t ? JY(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
var ur = (t, e, r) => eX(t, typeof e != "symbol" ? e + "" : e, r);
var G5 = {
  name: "mermaid",
  version: "11.12.1",
  description: "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",
  type: "module",
  module: "./dist/mermaid.core.mjs",
  types: "./dist/mermaid.d.ts",
  exports: {
    ".": {
      types: "./dist/mermaid.d.ts",
      import: "./dist/mermaid.core.mjs",
      default: "./dist/mermaid.core.mjs"
    },
    "./*": "./*"
  },
  keywords: [
    "diagram",
    "markdown",
    "flowchart",
    "sequence diagram",
    "gantt",
    "class diagram",
    "git graph",
    "mindmap",
    "packet diagram",
    "c4 diagram",
    "er diagram",
    "pie chart",
    "pie diagram",
    "quadrant chart",
    "requirement diagram",
    "graph"
  ],
  scripts: {
    clean: "rimraf dist",
    dev: "pnpm -w dev",
    "docs:code": "typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup",
    "docs:build": "rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts",
    "docs:verify": "pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify",
    "docs:pre:vitepress": "pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts",
    "docs:build:vitepress": "pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing",
    "docs:dev": 'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',
    "docs:dev:docker": 'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',
    "docs:serve": "pnpm docs:build:vitepress && vitepress serve src/vitepress",
    "docs:spellcheck": 'cspell "src/docs/**/*.md"',
    "docs:release-version": "tsx scripts/update-release-version.mts",
    "docs:verify-version": "tsx scripts/update-release-version.mts --verify",
    "types:build-config": "tsx scripts/create-types-from-json-schema.mts",
    "types:verify-config": "tsx scripts/create-types-from-json-schema.mts --verify",
    checkCircle: "npx madge --circular ./src",
    prepublishOnly: "pnpm docs:verify-version"
  },
  repository: {
    type: "git",
    url: "https://github.com/mermaid-js/mermaid"
  },
  author: "Knut Sveidqvist",
  license: "MIT",
  standard: {
    ignore: [
      "**/parser/*.js",
      "dist/**/*.js",
      "cypress/**/*.js"
    ],
    globals: [
      "page"
    ]
  },
  dependencies: {
    "@braintree/sanitize-url": "^7.1.1",
    "@iconify/utils": "^3.0.1",
    "@mermaid-js/parser": "workspace:^",
    "@types/d3": "^7.4.3",
    cytoscape: "^3.29.3",
    "cytoscape-cose-bilkent": "^4.1.0",
    "cytoscape-fcose": "^2.2.0",
    d3: "^7.9.0",
    "d3-sankey": "^0.12.3",
    "dagre-d3-es": "7.0.13",
    dayjs: "^1.11.18",
    dompurify: "^3.2.5",
    katex: "^0.16.22",
    khroma: "^2.1.0",
    "lodash-es": "^4.17.21",
    marked: "^16.2.1",
    roughjs: "^4.6.6",
    stylis: "^4.3.6",
    "ts-dedent": "^2.2.0",
    uuid: "^11.1.0"
  },
  devDependencies: {
    "@adobe/jsonschema2md": "^8.0.5",
    "@iconify/types": "^2.0.0",
    "@types/cytoscape": "^3.21.9",
    "@types/cytoscape-fcose": "^2.2.4",
    "@types/d3-sankey": "^0.12.4",
    "@types/d3-scale": "^4.0.9",
    "@types/d3-scale-chromatic": "^3.1.0",
    "@types/d3-selection": "^3.0.11",
    "@types/d3-shape": "^3.1.7",
    "@types/jsdom": "^21.1.7",
    "@types/katex": "^0.16.7",
    "@types/lodash-es": "^4.17.12",
    "@types/micromatch": "^4.0.9",
    "@types/stylis": "^4.2.7",
    "@types/uuid": "^10.0.0",
    ajv: "^8.17.1",
    canvas: "^3.1.2",
    chokidar: "3.6.0",
    concurrently: "^9.1.2",
    "csstree-validator": "^4.0.1",
    globby: "^14.1.0",
    jison: "^0.4.18",
    "js-base64": "^3.7.8",
    jsdom: "^26.1.0",
    "json-schema-to-typescript": "^15.0.4",
    micromatch: "^4.0.8",
    "path-browserify": "^1.0.1",
    prettier: "^3.5.3",
    remark: "^15.0.1",
    "remark-frontmatter": "^5.0.0",
    "remark-gfm": "^4.0.1",
    rimraf: "^6.0.1",
    "start-server-and-test": "^2.0.13",
    "type-fest": "^4.35.0",
    typedoc: "^0.28.12",
    "typedoc-plugin-markdown": "^4.8.1",
    typescript: "~5.7.3",
    "unist-util-flatmap": "^1.0.0",
    "unist-util-visit": "^5.0.0",
    vitepress: "^1.6.4",
    "vitepress-plugin-search": "1.0.4-alpha.22"
  },
  files: [
    "dist/",
    "README.md"
  ],
  publishConfig: {
    access: "public"
  }
}, ro = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function bf(t) {
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var uM = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(ro, function() {
    var r = 1e3, n = 6e4, i = 36e5, a = "millisecond", s = "second", o = "minute", l = "hour", u = "day", h = "week", d = "month", f = "quarter", p = "year", g = "date", m = "Invalid Date", v = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|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, b = { 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(S) {
      var R = ["th", "st", "nd", "rd"], I = S % 100;
      return "[" + S + (R[(I - 20) % 10] || R[I] || R[0]) + "]";
    } }, w = function(S, R, I) {
      var D = String(S);
      return !D || D.length >= R ? S : "" + Array(R + 1 - D.length).join(I) + S;
    }, T = { s: w, z: function(S) {
      var R = -S.utcOffset(), I = Math.abs(R), D = Math.floor(I / 60), M = I % 60;
      return (R <= 0 ? "+" : "-") + w(D, 2, "0") + ":" + w(M, 2, "0");
    }, m: function S(R, I) {
      if (R.date() < I.date()) return -S(I, R);
      var D = 12 * (I.year() - R.year()) + (I.month() - R.month()), M = R.clone().add(D, d), B = I - M < 0, $ = R.clone().add(D + (B ? -1 : 1), d);
      return +(-(D + (I - M) / (B ? M - $ : $ - M)) || 0);
    }, a: function(S) {
      return S < 0 ? Math.ceil(S) || 0 : Math.floor(S);
    }, p: function(S) {
      return { M: d, y: p, w: h, d: u, D: g, h: l, m: o, s, ms: a, Q: f }[S] || String(S || "").toLowerCase().replace(/s$/, "");
    }, u: function(S) {
      return S === void 0;
    } }, E = "en", C = {};
    C[E] = b;
    var k = "$isDayjsObject", _ = function(S) {
      return S instanceof O || !(!S || !S[k]);
    }, L = function S(R, I, D) {
      var M;
      if (!R) return E;
      if (typeof R == "string") {
        var B = R.toLowerCase();
        C[B] && (M = B), I && (C[B] = I, M = B);
        var $ = R.split("-");
        if (!M && $.length > 1) return S($[0]);
      } else {
        var F = R.name;
        C[F] = R, M = F;
      }
      return !D && M && (E = M), M || !D && E;
    }, N = function(S, R) {
      if (_(S)) return S.clone();
      var I = typeof R == "object" ? R : {};
      return I.date = S, I.args = arguments, new O(I);
    }, A = T;
    A.l = L, A.i = _, A.w = function(S, R) {
      return N(S, { locale: R.$L, utc: R.$u, x: R.$x, $offset: R.$offset });
    };
    var O = function() {
      function S(I) {
        this.$L = L(I.locale, null, !0), this.parse(I), this.$x = this.$x || I.x || {}, this[k] = !0;
      }
      var R = S.prototype;
      return R.parse = function(I) {
        this.$d = function(D) {
          var M = D.date, B = D.utc;
          if (M === null) return /* @__PURE__ */ new Date(NaN);
          if (A.u(M)) return /* @__PURE__ */ new Date();
          if (M instanceof Date) return new Date(M);
          if (typeof M == "string" && !/Z$/i.test(M)) {
            var $ = M.match(v);
            if ($) {
              var F = $[2] - 1 || 0, G = ($[7] || "0").substring(0, 3);
              return B ? new Date(Date.UTC($[1], F, $[3] || 1, $[4] || 0, $[5] || 0, $[6] || 0, G)) : new Date($[1], F, $[3] || 1, $[4] || 0, $[5] || 0, $[6] || 0, G);
            }
          }
          return new Date(M);
        }(I), this.init();
      }, R.init = function() {
        var I = this.$d;
        this.$y = I.getFullYear(), this.$M = I.getMonth(), this.$D = I.getDate(), this.$W = I.getDay(), this.$H = I.getHours(), this.$m = I.getMinutes(), this.$s = I.getSeconds(), this.$ms = I.getMilliseconds();
      }, R.$utils = function() {
        return A;
      }, R.isValid = function() {
        return this.$d.toString() !== m;
      }, R.isSame = function(I, D) {
        var M = N(I);
        return this.startOf(D) <= M && M <= this.endOf(D);
      }, R.isAfter = function(I, D) {
        return N(I) < this.startOf(D);
      }, R.isBefore = function(I, D) {
        return this.endOf(D) < N(I);
      }, R.$g = function(I, D, M) {
        return A.u(I) ? this[D] : this.set(M, I);
      }, R.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, R.valueOf = function() {
        return this.$d.getTime();
      }, R.startOf = function(I, D) {
        var M = this, B = !!A.u(D) || D, $ = A.p(I), F = function(K, Z) {
          var X = A.w(M.$u ? Date.UTC(M.$y, Z, K) : new Date(M.$y, Z, K), M);
          return B ? X : X.endOf(u);
        }, G = function(K, Z) {
          return A.w(M.toDate()[K].apply(M.toDate("s"), (B ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(Z)), M);
        }, H = this.$W, ee = this.$M, Y = this.$D, re = "set" + (this.$u ? "UTC" : "");
        switch ($) {
          case p:
            return B ? F(1, 0) : F(31, 11);
          case d:
            return B ? F(1, ee) : F(0, ee + 1);
          case h:
            var ne = this.$locale().weekStart || 0, he = (H < ne ? H + 7 : H) - ne;
            return F(B ? Y - he : Y + (6 - he), ee);
          case u:
          case g:
            return G(re + "Hours", 0);
          case l:
            return G(re + "Minutes", 1);
          case o:
            return G(re + "Seconds", 2);
          case s:
            return G(re + "Milliseconds", 3);
          default:
            return this.clone();
        }
      }, R.endOf = function(I) {
        return this.startOf(I, !1);
      }, R.$set = function(I, D) {
        var M, B = A.p(I), $ = "set" + (this.$u ? "UTC" : ""), F = (M = {}, M[u] = $ + "Date", M[g] = $ + "Date", M[d] = $ + "Month", M[p] = $ + "FullYear", M[l] = $ + "Hours", M[o] = $ + "Minutes", M[s] = $ + "Seconds", M[a] = $ + "Milliseconds", M)[B], G = B === u ? this.$D + (D - this.$W) : D;
        if (B === d || B === p) {
          var H = this.clone().set(g, 1);
          H.$d[F](G), H.init(), this.$d = H.set(g, Math.min(this.$D, H.daysInMonth())).$d;
        } else F && this.$d[F](G);
        return this.init(), this;
      }, R.set = function(I, D) {
        return this.clone().$set(I, D);
      }, R.get = function(I) {
        return this[A.p(I)]();
      }, R.add = function(I, D) {
        var M, B = this;
        I = Number(I);
        var $ = A.p(D), F = function(ee) {
          var Y = N(B);
          return A.w(Y.date(Y.date() + Math.round(ee * I)), B);
        };
        if ($ === d) return this.set(d, this.$M + I);
        if ($ === p) return this.set(p, this.$y + I);
        if ($ === u) return F(1);
        if ($ === h) return F(7);
        var G = (M = {}, M[o] = n, M[l] = i, M[s] = r, M)[$] || 1, H = this.$d.getTime() + I * G;
        return A.w(H, this);
      }, R.subtract = function(I, D) {
        return this.add(-1 * I, D);
      }, R.format = function(I) {
        var D = this, M = this.$locale();
        if (!this.isValid()) return M.invalidDate || m;
        var B = I || "YYYY-MM-DDTHH:mm:ssZ", $ = A.z(this), F = this.$H, G = this.$m, H = this.$M, ee = M.weekdays, Y = M.months, re = M.meridiem, ne = function(Z, X, q, J) {
          return Z && (Z[X] || Z(D, B)) || q[X].slice(0, J);
        }, he = function(Z) {
          return A.s(F % 12 || 12, Z, "0");
        }, K = re || function(Z, X, q) {
          var J = Z < 12 ? "AM" : "PM";
          return q ? J.toLowerCase() : J;
        };
        return B.replace(y, function(Z, X) {
          return X || function(q) {
            switch (q) {
              case "YY":
                return String(D.$y).slice(-2);
              case "YYYY":
                return A.s(D.$y, 4, "0");
              case "M":
                return H + 1;
              case "MM":
                return A.s(H + 1, 2, "0");
              case "MMM":
                return ne(M.monthsShort, H, Y, 3);
              case "MMMM":
                return ne(Y, H);
              case "D":
                return D.$D;
              case "DD":
                return A.s(D.$D, 2, "0");
              case "d":
                return String(D.$W);
              case "dd":
                return ne(M.weekdaysMin, D.$W, ee, 2);
              case "ddd":
                return ne(M.weekdaysShort, D.$W, ee, 3);
              case "dddd":
                return ee[D.$W];
              case "H":
                return String(F);
              case "HH":
                return A.s(F, 2, "0");
              case "h":
                return he(1);
              case "hh":
                return he(2);
              case "a":
                return K(F, G, !0);
              case "A":
                return K(F, G, !1);
              case "m":
                return String(G);
              case "mm":
                return A.s(G, 2, "0");
              case "s":
                return String(D.$s);
              case "ss":
                return A.s(D.$s, 2, "0");
              case "SSS":
                return A.s(D.$ms, 3, "0");
              case "Z":
                return $;
            }
            return null;
          }(Z) || $.replace(":", "");
        });
      }, R.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, R.diff = function(I, D, M) {
        var B, $ = this, F = A.p(D), G = N(I), H = (G.utcOffset() - this.utcOffset()) * n, ee = this - G, Y = function() {
          return A.m($, G);
        };
        switch (F) {
          case p:
            B = Y() / 12;
            break;
          case d:
            B = Y();
            break;
          case f:
            B = Y() / 3;
            break;
          case h:
            B = (ee - H) / 6048e5;
            break;
          case u:
            B = (ee - H) / 864e5;
            break;
          case l:
            B = ee / i;
            break;
          case o:
            B = ee / n;
            break;
          case s:
            B = ee / r;
            break;
          default:
            B = ee;
        }
        return M ? B : A.a(B);
      }, R.daysInMonth = function() {
        return this.endOf(d).$D;
      }, R.$locale = function() {
        return C[this.$L];
      }, R.locale = function(I, D) {
        if (!I) return this.$L;
        var M = this.clone(), B = L(I, D, !0);
        return B && (M.$L = B), M;
      }, R.clone = function() {
        return A.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();
      }, S;
    }(), P = O.prototype;
    return N.prototype = P, [["$ms", a], ["$s", s], ["$m", o], ["$H", l], ["$W", u], ["$M", d], ["$y", p], ["$D", g]].forEach(function(S) {
      P[S[1]] = function(R) {
        return this.$g(R, S[0], S[1]);
      };
    }), N.extend = function(S, R) {
      return S.$i || (S(R, O, N), S.$i = !0), N;
    }, N.locale = L, N.isDayjs = _, N.unix = function(S) {
      return N(1e3 * S);
    }, N.en = C[E], N.Ls = C, N.p = {}, N;
  });
})(uM);
var tX = uM.exports;
const Ti = /* @__PURE__ */ bf(tX);
var hM = Object.defineProperty, x = (t, e) => hM(t, "name", { value: e, configurable: !0 }), I2 = (t, e) => {
  for (var r in e)
    hM(t, r, { get: e[r], enumerable: !0 });
}, go = {
  trace: 0,
  debug: 1,
  info: 2,
  warn: 3,
  error: 4,
  fatal: 5
}, ae = {
  trace: /* @__PURE__ */ x((...t) => {
  }, "trace"),
  debug: /* @__PURE__ */ x((...t) => {
  }, "debug"),
  info: /* @__PURE__ */ x((...t) => {
  }, "info"),
  warn: /* @__PURE__ */ x((...t) => {
  }, "warn"),
  error: /* @__PURE__ */ x((...t) => {
  }, "error"),
  fatal: /* @__PURE__ */ x((...t) => {
  }, "fatal")
}, j6 = /* @__PURE__ */ x(function(t = "fatal") {
  let e = go.fatal;
  typeof t == "string" ? t.toLowerCase() in go && (e = go[t]) : typeof t == "number" && (e = t), ae.trace = () => {
  }, ae.debug = () => {
  }, ae.info = () => {
  }, ae.warn = () => {
  }, ae.error = () => {
  }, ae.fatal = () => {
  }, e <= go.fatal && (ae.fatal = console.error ? console.error.bind(console, $a("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", $a("FATAL"))), e <= go.error && (ae.error = console.error ? console.error.bind(console, $a("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", $a("ERROR"))), e <= go.warn && (ae.warn = console.warn ? console.warn.bind(console, $a("WARN"), "color: orange") : console.log.bind(console, "\x1B[33m", $a("WARN"))), e <= go.info && (ae.info = console.info ? console.info.bind(console, $a("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", $a("INFO"))), e <= go.debug && (ae.debug = console.debug ? console.debug.bind(console, $a("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", $a("DEBUG"))), e <= go.trace && (ae.trace = console.debug ? console.debug.bind(console, $a("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", $a("TRACE")));
}, "setLogLevel"), $a = /* @__PURE__ */ x((t) => `%c${Ti().format("ss.SSS")} : ${t} : `, "format");
const Bm = {
  /* 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, r) => (r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (e - t) * 6 * r : r < 1 / 2 ? e : r < 2 / 3 ? t + (e - t) * (2 / 3 - r) * 6 : t),
  hsl2rgb: ({ h: t, s: e, l: r }, n) => {
    if (!e)
      return r * 2.55;
    t /= 360, e /= 100, r /= 100;
    const i = r < 0.5 ? r * (1 + e) : r + e - r * e, a = 2 * r - i;
    switch (n) {
      case "r":
        return Bm.hue2rgb(a, i, t + 1 / 3) * 255;
      case "g":
        return Bm.hue2rgb(a, i, t) * 255;
      case "b":
        return Bm.hue2rgb(a, i, t - 1 / 3) * 255;
    }
  },
  rgb2hsl: ({ r: t, g: e, b: r }, n) => {
    t /= 255, e /= 255, r /= 255;
    const i = Math.max(t, e, r), a = Math.min(t, e, r), s = (i + a) / 2;
    if (n === "l")
      return s * 100;
    if (i === a)
      return 0;
    const o = i - a, l = s > 0.5 ? o / (2 - i - a) : o / (i + a);
    if (n === "s")
      return l * 100;
    switch (i) {
      case t:
        return ((e - r) / o + (e < r ? 6 : 0)) * 60;
      case e:
        return ((r - t) / o + 2) * 60;
      case r:
        return ((t - e) / o + 4) * 60;
      default:
        return -1;
    }
  }
}, rX = {
  /* API */
  clamp: (t, e, r) => e > r ? Math.min(e, Math.max(r, t)) : Math.min(r, Math.max(e, t)),
  round: (t) => Math.round(t * 1e10) / 1e10
}, nX = {
  /* API */
  dec2hex: (t) => {
    const e = Math.round(t).toString(16);
    return e.length > 1 ? e : `0${e}`;
  }
}, Xt = {
  channel: Bm,
  lang: rX,
  unit: nX
}, pl = {};
for (let t = 0; t <= 255; t++)
  pl[t] = Xt.unit.dec2hex(t);
const mi = {
  ALL: 0,
  RGB: 1,
  HSL: 2
};
let iX = class {
  constructor() {
    this.type = mi.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 = mi.ALL;
  }
  is(e) {
    return this.type === e;
  }
};
class aX {
  /* CONSTRUCTOR */
  constructor(e, r) {
    this.color = r, this.changed = !1, this.data = e, this.type = new iX();
  }
  /* API */
  set(e, r) {
    return this.color = r, this.changed = !1, this.data = e, this.type.type = mi.ALL, this;
  }
  /* HELPERS */
  _ensureHSL() {
    const e = this.data, { h: r, s: n, l: i } = e;
    r === void 0 && (e.h = Xt.channel.rgb2hsl(e, "h")), n === void 0 && (e.s = Xt.channel.rgb2hsl(e, "s")), i === void 0 && (e.l = Xt.channel.rgb2hsl(e, "l"));
  }
  _ensureRGB() {
    const e = this.data, { r, g: n, b: i } = e;
    r === void 0 && (e.r = Xt.channel.hsl2rgb(e, "r")), n === void 0 && (e.g = Xt.channel.hsl2rgb(e, "g")), i === void 0 && (e.b = Xt.channel.hsl2rgb(e, "b"));
  }
  /* GETTERS */
  get r() {
    const e = this.data, r = e.r;
    return !this.type.is(mi.HSL) && r !== void 0 ? r : (this._ensureHSL(), Xt.channel.hsl2rgb(e, "r"));
  }
  get g() {
    const e = this.data, r = e.g;
    return !this.type.is(mi.HSL) && r !== void 0 ? r : (this._ensureHSL(), Xt.channel.hsl2rgb(e, "g"));
  }
  get b() {
    const e = this.data, r = e.b;
    return !this.type.is(mi.HSL) && r !== void 0 ? r : (this._ensureHSL(), Xt.channel.hsl2rgb(e, "b"));
  }
  get h() {
    const e = this.data, r = e.h;
    return !this.type.is(mi.RGB) && r !== void 0 ? r : (this._ensureRGB(), Xt.channel.rgb2hsl(e, "h"));
  }
  get s() {
    const e = this.data, r = e.s;
    return !this.type.is(mi.RGB) && r !== void 0 ? r : (this._ensureRGB(), Xt.channel.rgb2hsl(e, "s"));
  }
  get l() {
    const e = this.data, r = e.l;
    return !this.type.is(mi.RGB) && r !== void 0 ? r : (this._ensureRGB(), Xt.channel.rgb2hsl(e, "l"));
  }
  get a() {
    return this.data.a;
  }
  /* SETTERS */
  set r(e) {
    this.type.set(mi.RGB), this.changed = !0, this.data.r = e;
  }
  set g(e) {
    this.type.set(mi.RGB), this.changed = !0, this.data.g = e;
  }
  set b(e) {
    this.type.set(mi.RGB), this.changed = !0, this.data.b = e;
  }
  set h(e) {
    this.type.set(mi.HSL), this.changed = !0, this.data.h = e;
  }
  set s(e) {
    this.type.set(mi.HSL), this.changed = !0, this.data.s = e;
  }
  set l(e) {
    this.type.set(mi.HSL), this.changed = !0, this.data.l = e;
  }
  set a(e) {
    this.changed = !0, this.data.a = e;
  }
}
const O2 = new aX({ r: 0, g: 0, b: 0, a: 0 }, "transparent"), Ah = {
  /* 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(Ah.re);
    if (!e)
      return;
    const r = e[1], n = parseInt(r, 16), i = r.length, a = i % 4 === 0, s = i > 4, o = s ? 1 : 17, l = s ? 8 : 4, u = a ? 0 : -1, h = s ? 255 : 15;
    return O2.set({
      r: (n >> l * (u + 3) & h) * o,
      g: (n >> l * (u + 2) & h) * o,
      b: (n >> l * (u + 1) & h) * o,
      a: a ? (n & h) * o / 255 : 1
    }, t);
  },
  stringify: (t) => {
    const { r: e, g: r, b: n, a: i } = t;
    return i < 1 ? `#${pl[Math.round(e)]}${pl[Math.round(r)]}${pl[Math.round(n)]}${pl[Math.round(i * 255)]}` : `#${pl[Math.round(e)]}${pl[Math.round(r)]}${pl[Math.round(n)]}`;
  }
}, Gc = {
  /* 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(Gc.hueRe);
    if (e) {
      const [, r, n] = e;
      switch (n) {
        case "grad":
          return Xt.channel.clamp.h(parseFloat(r) * 0.9);
        case "rad":
          return Xt.channel.clamp.h(parseFloat(r) * 180 / Math.PI);
        case "turn":
          return Xt.channel.clamp.h(parseFloat(r) * 360);
      }
    }
    return Xt.channel.clamp.h(parseFloat(t));
  },
  /* API */
  parse: (t) => {
    const e = t.charCodeAt(0);
    if (e !== 104 && e !== 72)
      return;
    const r = t.match(Gc.re);
    if (!r)
      return;
    const [, n, i, a, s, o] = r;
    return O2.set({
      h: Gc._hue2deg(n),
      s: Xt.channel.clamp.s(parseFloat(i)),
      l: Xt.channel.clamp.l(parseFloat(a)),
      a: s ? Xt.channel.clamp.a(o ? parseFloat(s) / 100 : parseFloat(s)) : 1
    }, t);
  },
  stringify: (t) => {
    const { h: e, s: r, l: n, a: i } = t;
    return i < 1 ? `hsla(${Xt.lang.round(e)}, ${Xt.lang.round(r)}%, ${Xt.lang.round(n)}%, ${i})` : `hsl(${Xt.lang.round(e)}, ${Xt.lang.round(r)}%, ${Xt.lang.round(n)}%)`;
  }
}, xp = {
  /* 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 = xp.colors[t];
    if (e)
      return Ah.parse(e);
  },
  stringify: (t) => {
    const e = Ah.stringify(t);
    for (const r in xp.colors)
      if (xp.colors[r] === e)
        return r;
  }
}, v0 = {
  /* 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 r = t.match(v0.re);
    if (!r)
      return;
    const [, n, i, a, s, o, l, u, h] = r;
    return O2.set({
      r: Xt.channel.clamp.r(i ? parseFloat(n) * 2.55 : parseFloat(n)),
      g: Xt.channel.clamp.g(s ? parseFloat(a) * 2.55 : parseFloat(a)),
      b: Xt.channel.clamp.b(l ? parseFloat(o) * 2.55 : parseFloat(o)),
      a: u ? Xt.channel.clamp.a(h ? parseFloat(u) / 100 : parseFloat(u)) : 1
    }, t);
  },
  stringify: (t) => {
    const { r: e, g: r, b: n, a: i } = t;
    return i < 1 ? `rgba(${Xt.lang.round(e)}, ${Xt.lang.round(r)}, ${Xt.lang.round(n)}, ${Xt.lang.round(i)})` : `rgb(${Xt.lang.round(e)}, ${Xt.lang.round(r)}, ${Xt.lang.round(n)})`;
  }
}, Ts = {
  /* VARIABLES */
  format: {
    keyword: xp,
    hex: Ah,
    rgb: v0,
    rgba: v0,
    hsl: Gc,
    hsla: Gc
  },
  /* API */
  parse: (t) => {
    if (typeof t != "string")
      return t;
    const e = Ah.parse(t) || v0.parse(t) || Gc.parse(t) || xp.parse(t);
    if (e)
      return e;
    throw new Error(`Unsupported color format: "${t}"`);
  },
  stringify: (t) => !t.changed && t.color ? t.color : t.type.is(mi.HSL) || t.data.r === void 0 ? Gc.stringify(t) : t.a < 1 || !Number.isInteger(t.r) || !Number.isInteger(t.g) || !Number.isInteger(t.b) ? v0.stringify(t) : Ah.stringify(t)
}, dM = (t, e) => {
  const r = Ts.parse(t);
  for (const n in e)
    r[n] = Xt.channel.clamp[n](e[n]);
  return Ts.stringify(r);
}, _l = (t, e, r = 0, n = 1) => {
  if (typeof t != "number")
    return dM(t, { a: e });
  const i = O2.set({
    r: Xt.channel.clamp.r(t),
    g: Xt.channel.clamp.g(e),
    b: Xt.channel.clamp.b(r),
    a: Xt.channel.clamp.a(n)
  });
  return Ts.stringify(i);
}, K6 = (t, e) => Xt.lang.round(Ts.parse(t)[e]), sX = (t) => {
  const { r: e, g: r, b: n } = Ts.parse(t), i = 0.2126 * Xt.channel.toLinear(e) + 0.7152 * Xt.channel.toLinear(r) + 0.0722 * Xt.channel.toLinear(n);
  return Xt.lang.round(i);
}, oX = (t) => sX(t) >= 0.5, tc = (t) => !oX(t), fM = (t, e, r) => {
  const n = Ts.parse(t), i = n[e], a = Xt.channel.clamp[e](i + r);
  return i !== a && (n[e] = a), Ts.stringify(n);
}, _t = (t, e) => fM(t, "l", e), It = (t, e) => fM(t, "l", -e), De = (t, e) => {
  const r = Ts.parse(t), n = {};
  for (const i in e)
    e[i] && (n[i] = r[i] + e[i]);
  return dM(t, n);
}, lX = (t, e, r = 50) => {
  const { r: n, g: i, b: a, a: s } = Ts.parse(t), { r: o, g: l, b: u, a: h } = Ts.parse(e), d = r / 100, f = d * 2 - 1, p = s - h, m = ((f * p === -1 ? f : (f + p) / (1 + f * p)) + 1) / 2, v = 1 - m, y = n * m + o * v, b = i * m + l * v, w = a * m + u * v, T = s * d + h * (1 - d);
  return _l(y, b, w, T);
}, xt = (t, e = 100) => {
  const r = Ts.parse(t);
  return r.r = 255 - r.r, r.g = 255 - r.g, r.b = 255 - r.b, lX(r, t, e);
};
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
const {
  entries: pM,
  setPrototypeOf: L7,
  isFrozen: cX,
  getPrototypeOf: uX,
  getOwnPropertyDescriptor: hX
} = Object;
let {
  freeze: Wi,
  seal: Za,
  create: U5
} = Object, {
  apply: W5,
  construct: H5
} = typeof Reflect < "u" && Reflect;
Wi || (Wi = function(e) {
  return e;
});
Za || (Za = function(e) {
  return e;
});
W5 || (W5 = function(e, r) {
  for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), a = 2; a < n; a++)
    i[a - 2] = arguments[a];
  return e.apply(r, i);
});
H5 || (H5 = function(e) {
  for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
    n[i - 1] = arguments[i];
  return new e(...n);
});
const k1 = Hi(Array.prototype.forEach), dX = Hi(Array.prototype.lastIndexOf), R7 = Hi(Array.prototype.pop), Uf = Hi(Array.prototype.push), fX = Hi(Array.prototype.splice), Fm = Hi(String.prototype.toLowerCase), Cb = Hi(String.prototype.toString), Ab = Hi(String.prototype.match), Wf = Hi(String.prototype.replace), pX = Hi(String.prototype.indexOf), gX = Hi(String.prototype.trim), ss = Hi(Object.prototype.hasOwnProperty), Mi = Hi(RegExp.prototype.test), Hf = mX(TypeError);
function Hi(t) {
  return function(e) {
    e instanceof RegExp && (e.lastIndex = 0);
    for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
      n[i - 1] = arguments[i];
    return W5(t, e, n);
  };
}
function mX(t) {
  return function() {
    for (var e = arguments.length, r = new Array(e), n = 0; n < e; n++)
      r[n] = arguments[n];
    return H5(t, r);
  };
}
function nr(t, e) {
  let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Fm;
  L7 && L7(t, null);
  let n = e.length;
  for (; n--; ) {
    let i = e[n];
    if (typeof i == "string") {
      const a = r(i);
      a !== i && (cX(e) || (e[n] = a), i = a);
    }
    t[i] = !0;
  }
  return t;
}
function vX(t) {
  for (let e = 0; e < t.length; e++)
    ss(t, e) || (t[e] = null);
  return t;
}
function wo(t) {
  const e = U5(null);
  for (const [r, n] of pM(t))
    ss(t, r) && (Array.isArray(n) ? e[r] = vX(n) : n && typeof n == "object" && n.constructor === Object ? e[r] = wo(n) : e[r] = n);
  return e;
}
function qf(t, e) {
  for (; t !== null; ) {
    const n = hX(t, e);
    if (n) {
      if (n.get)
        return Hi(n.get);
      if (typeof n.value == "function")
        return Hi(n.value);
    }
    t = uX(t);
  }
  function r() {
    return null;
  }
  return r;
}
const N7 = Wi(["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", "search", "section", "select", "shadow", "slot", "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"]), _b = Wi(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Lb = Wi(["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"]), yX = Wi(["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"]), Rb = Wi(["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"]), xX = Wi(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), M7 = Wi(["#text"]), D7 = Wi(["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", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "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", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Nb = Wi(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "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", "exponent", "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", "intercept", "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", "mask-type", "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", "slope", "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", "tablevalues", "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"]), I7 = Wi(["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"]), S1 = Wi(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), bX = Za(/\{\{[\w\W]*|[\w\W]*\}\}/gm), wX = Za(/<%[\w\W]*|[\w\W]*%>/gm), TX = Za(/\$\{[\w\W]*/gm), EX = Za(/^data-[\-\w.\u00B7-\uFFFF]+$/), kX = Za(/^aria-[\-\w]+$/), gM = Za(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), SX = Za(/^(?:\w+script|data):/i), CX = Za(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), mM = Za(/^html$/i), AX = Za(/^[a-z][.\w]*(-[.\w]+)+$/i);
var O7 = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ARIA_ATTR: kX,
  ATTR_WHITESPACE: CX,
  CUSTOM_ELEMENT: AX,
  DATA_ATTR: EX,
  DOCTYPE_NAME: mM,
  ERB_EXPR: wX,
  IS_ALLOWED_URI: gM,
  IS_SCRIPT_OR_DATA: SX,
  MUSTACHE_EXPR: bX,
  TMPLIT_EXPR: TX
});
const Yf = {
  element: 1,
  text: 3,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9
}, _X = function() {
  return typeof window > "u" ? null : window;
}, LX = function(e, r) {
  if (typeof e != "object" || typeof e.createPolicy != "function")
    return null;
  let n = null;
  const i = "data-tt-policy-suffix";
  r && r.hasAttribute(i) && (n = r.getAttribute(i));
  const a = "dompurify" + (n ? "#" + n : "");
  try {
    return e.createPolicy(a, {
      createHTML(s) {
        return s;
      },
      createScriptURL(s) {
        return s;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + a + " could not be created."), null;
  }
}, P7 = function() {
  return {
    afterSanitizeAttributes: [],
    afterSanitizeElements: [],
    afterSanitizeShadowDOM: [],
    beforeSanitizeAttributes: [],
    beforeSanitizeElements: [],
    beforeSanitizeShadowDOM: [],
    uponSanitizeAttribute: [],
    uponSanitizeElement: [],
    uponSanitizeShadowNode: []
  };
};
function vM() {
  let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _X();
  const e = (dt) => vM(dt);
  if (e.version = "3.3.0", e.removed = [], !t || !t.document || t.document.nodeType !== Yf.document || !t.Element)
    return e.isSupported = !1, e;
  let {
    document: r
  } = t;
  const n = r, i = n.currentScript, {
    DocumentFragment: a,
    HTMLTemplateElement: s,
    Node: o,
    Element: l,
    NodeFilter: u,
    NamedNodeMap: h = t.NamedNodeMap || t.MozNamedAttrMap,
    HTMLFormElement: d,
    DOMParser: f,
    trustedTypes: p
  } = t, g = l.prototype, m = qf(g, "cloneNode"), v = qf(g, "remove"), y = qf(g, "nextSibling"), b = qf(g, "childNodes"), w = qf(g, "parentNode");
  if (typeof s == "function") {
    const dt = r.createElement("template");
    dt.content && dt.content.ownerDocument && (r = dt.content.ownerDocument);
  }
  let T, E = "";
  const {
    implementation: C,
    createNodeIterator: k,
    createDocumentFragment: _,
    getElementsByTagName: L
  } = r, {
    importNode: N
  } = n;
  let A = P7();
  e.isSupported = typeof pM == "function" && typeof w == "function" && C && C.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: O,
    ERB_EXPR: P,
    TMPLIT_EXPR: S,
    DATA_ATTR: R,
    ARIA_ATTR: I,
    IS_SCRIPT_OR_DATA: D,
    ATTR_WHITESPACE: M,
    CUSTOM_ELEMENT: B
  } = O7;
  let {
    IS_ALLOWED_URI: $
  } = O7, F = null;
  const G = nr({}, [...N7, ..._b, ...Lb, ...Rb, ...M7]);
  let H = null;
  const ee = nr({}, [...D7, ...Nb, ...I7, ...S1]);
  let Y = Object.seal(U5(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
    }
  })), re = null, ne = null;
  const he = Object.seal(U5(null, {
    tagCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    }
  }));
  let K = !0, Z = !0, X = !1, q = !0, J = !1, j = !0, pe = !1, te = !1, Ae = !1, W = !1, Oe = !1, ue = !1, Ve = !0, Ge = !1;
  const Ue = "user-content-";
  let ke = !0, Pe = !1, Se = {}, _e = null;
  const ze = nr({}, ["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 me = null;
  const Me = nr({}, ["audio", "video", "img", "source", "image", "track"]);
  let Q = null;
  const ce = nr({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), z = "http://www.w3.org/1998/Math/MathML", oe = "http://www.w3.org/2000/svg", se = "http://www.w3.org/1999/xhtml";
  let ge = se, de = !1, be = null;
  const Ce = nr({}, [z, oe, se], Cb);
  let Te = nr({}, ["mi", "mo", "mn", "ms", "mtext"]), Ne = nr({}, ["annotation-xml"]);
  const Xe = nr({}, ["title", "style", "font", "a", "script"]);
  let Ye = null;
  const Ke = ["application/xhtml+xml", "text/html"], Ze = "text/html";
  let Be = null, He = null;
  const ht = r.createElement("form"), st = function(Ee) {
    return Ee instanceof RegExp || Ee instanceof Function;
  }, We = function() {
    let Ee = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(He && He === Ee)) {
      if ((!Ee || typeof Ee != "object") && (Ee = {}), Ee = wo(Ee), Ye = // eslint-disable-next-line unicorn/prefer-includes
      Ke.indexOf(Ee.PARSER_MEDIA_TYPE) === -1 ? Ze : Ee.PARSER_MEDIA_TYPE, Be = Ye === "application/xhtml+xml" ? Cb : Fm, F = ss(Ee, "ALLOWED_TAGS") ? nr({}, Ee.ALLOWED_TAGS, Be) : G, H = ss(Ee, "ALLOWED_ATTR") ? nr({}, Ee.ALLOWED_ATTR, Be) : ee, be = ss(Ee, "ALLOWED_NAMESPACES") ? nr({}, Ee.ALLOWED_NAMESPACES, Cb) : Ce, Q = ss(Ee, "ADD_URI_SAFE_ATTR") ? nr(wo(ce), Ee.ADD_URI_SAFE_ATTR, Be) : ce, me = ss(Ee, "ADD_DATA_URI_TAGS") ? nr(wo(Me), Ee.ADD_DATA_URI_TAGS, Be) : Me, _e = ss(Ee, "FORBID_CONTENTS") ? nr({}, Ee.FORBID_CONTENTS, Be) : ze, re = ss(Ee, "FORBID_TAGS") ? nr({}, Ee.FORBID_TAGS, Be) : wo({}), ne = ss(Ee, "FORBID_ATTR") ? nr({}, Ee.FORBID_ATTR, Be) : wo({}), Se = ss(Ee, "USE_PROFILES") ? Ee.USE_PROFILES : !1, K = Ee.ALLOW_ARIA_ATTR !== !1, Z = Ee.ALLOW_DATA_ATTR !== !1, X = Ee.ALLOW_UNKNOWN_PROTOCOLS || !1, q = Ee.ALLOW_SELF_CLOSE_IN_ATTR !== !1, J = Ee.SAFE_FOR_TEMPLATES || !1, j = Ee.SAFE_FOR_XML !== !1, pe = Ee.WHOLE_DOCUMENT || !1, W = Ee.RETURN_DOM || !1, Oe = Ee.RETURN_DOM_FRAGMENT || !1, ue = Ee.RETURN_TRUSTED_TYPE || !1, Ae = Ee.FORCE_BODY || !1, Ve = Ee.SANITIZE_DOM !== !1, Ge = Ee.SANITIZE_NAMED_PROPS || !1, ke = Ee.KEEP_CONTENT !== !1, Pe = Ee.IN_PLACE || !1, $ = Ee.ALLOWED_URI_REGEXP || gM, ge = Ee.NAMESPACE || se, Te = Ee.MATHML_TEXT_INTEGRATION_POINTS || Te, Ne = Ee.HTML_INTEGRATION_POINTS || Ne, Y = Ee.CUSTOM_ELEMENT_HANDLING || {}, Ee.CUSTOM_ELEMENT_HANDLING && st(Ee.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (Y.tagNameCheck = Ee.CUSTOM_ELEMENT_HANDLING.tagNameCheck), Ee.CUSTOM_ELEMENT_HANDLING && st(Ee.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (Y.attributeNameCheck = Ee.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), Ee.CUSTOM_ELEMENT_HANDLING && typeof Ee.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (Y.allowCustomizedBuiltInElements = Ee.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), J && (Z = !1), Oe && (W = !0), Se && (F = nr({}, M7), H = [], Se.html === !0 && (nr(F, N7), nr(H, D7)), Se.svg === !0 && (nr(F, _b), nr(H, Nb), nr(H, S1)), Se.svgFilters === !0 && (nr(F, Lb), nr(H, Nb), nr(H, S1)), Se.mathMl === !0 && (nr(F, Rb), nr(H, I7), nr(H, S1))), Ee.ADD_TAGS && (typeof Ee.ADD_TAGS == "function" ? he.tagCheck = Ee.ADD_TAGS : (F === G && (F = wo(F)), nr(F, Ee.ADD_TAGS, Be))), Ee.ADD_ATTR && (typeof Ee.ADD_ATTR == "function" ? he.attributeCheck = Ee.ADD_ATTR : (H === ee && (H = wo(H)), nr(H, Ee.ADD_ATTR, Be))), Ee.ADD_URI_SAFE_ATTR && nr(Q, Ee.ADD_URI_SAFE_ATTR, Be), Ee.FORBID_CONTENTS && (_e === ze && (_e = wo(_e)), nr(_e, Ee.FORBID_CONTENTS, Be)), ke && (F["#text"] = !0), pe && nr(F, ["html", "head", "body"]), F.table && (nr(F, ["tbody"]), delete re.tbody), Ee.TRUSTED_TYPES_POLICY) {
        if (typeof Ee.TRUSTED_TYPES_POLICY.createHTML != "function")
          throw Hf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        if (typeof Ee.TRUSTED_TYPES_POLICY.createScriptURL != "function")
          throw Hf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        T = Ee.TRUSTED_TYPES_POLICY, E = T.createHTML("");
      } else
        T === void 0 && (T = LX(p, i)), T !== null && typeof E == "string" && (E = T.createHTML(""));
      Wi && Wi(Ee), He = Ee;
    }
  }, kt = nr({}, [..._b, ...Lb, ...yX]), qe = nr({}, [...Rb, ...xX]), rt = function(Ee) {
    let Je = w(Ee);
    (!Je || !Je.tagName) && (Je = {
      namespaceURI: ge,
      tagName: "template"
    });
    const wt = Fm(Ee.tagName), sr = Fm(Je.tagName);
    return be[Ee.namespaceURI] ? Ee.namespaceURI === oe ? Je.namespaceURI === se ? wt === "svg" : Je.namespaceURI === z ? wt === "svg" && (sr === "annotation-xml" || Te[sr]) : !!kt[wt] : Ee.namespaceURI === z ? Je.namespaceURI === se ? wt === "math" : Je.namespaceURI === oe ? wt === "math" && Ne[sr] : !!qe[wt] : Ee.namespaceURI === se ? Je.namespaceURI === oe && !Ne[sr] || Je.namespaceURI === z && !Te[sr] ? !1 : !qe[wt] && (Xe[wt] || !kt[wt]) : !!(Ye === "application/xhtml+xml" && be[Ee.namespaceURI]) : !1;
  }, ct = function(Ee) {
    Uf(e.removed, {
      element: Ee
    });
    try {
      w(Ee).removeChild(Ee);
    } catch {
      v(Ee);
    }
  }, ut = function(Ee, Je) {
    try {
      Uf(e.removed, {
        attribute: Je.getAttributeNode(Ee),
        from: Je
      });
    } catch {
      Uf(e.removed, {
        attribute: null,
        from: Je
      });
    }
    if (Je.removeAttribute(Ee), Ee === "is")
      if (W || Oe)
        try {
          ct(Je);
        } catch {
        }
      else
        try {
          Je.setAttribute(Ee, "");
        } catch {
        }
  }, nt = function(Ee) {
    let Je = null, wt = null;
    if (Ae)
      Ee = "<remove></remove>" + Ee;
    else {
      const cr = Ab(Ee, /^[\r\n\t ]+/);
      wt = cr && cr[0];
    }
    Ye === "application/xhtml+xml" && ge === se && (Ee = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + Ee + "</body></html>");
    const sr = T ? T.createHTML(Ee) : Ee;
    if (ge === se)
      try {
        Je = new f().parseFromString(sr, Ye);
      } catch {
      }
    if (!Je || !Je.documentElement) {
      Je = C.createDocument(ge, "template", null);
      try {
        Je.documentElement.innerHTML = de ? E : sr;
      } catch {
      }
    }
    const Ur = Je.body || Je.documentElement;
    return Ee && wt && Ur.insertBefore(r.createTextNode(wt), Ur.childNodes[0] || null), ge === se ? L.call(Je, pe ? "html" : "body")[0] : pe ? Je.documentElement : Ur;
  }, bt = function(Ee) {
    return k.call(
      Ee.ownerDocument || Ee,
      Ee,
      // eslint-disable-next-line no-bitwise
      u.SHOW_ELEMENT | u.SHOW_COMMENT | u.SHOW_TEXT | u.SHOW_PROCESSING_INSTRUCTION | u.SHOW_CDATA_SECTION,
      null
    );
  }, Zt = function(Ee) {
    return Ee instanceof d && (typeof Ee.nodeName != "string" || typeof Ee.textContent != "string" || typeof Ee.removeChild != "function" || !(Ee.attributes instanceof h) || typeof Ee.removeAttribute != "function" || typeof Ee.setAttribute != "function" || typeof Ee.namespaceURI != "string" || typeof Ee.insertBefore != "function" || typeof Ee.hasChildNodes != "function");
  }, Ot = function(Ee) {
    return typeof o == "function" && Ee instanceof o;
  };
  function tr(dt, Ee, Je) {
    k1(dt, (wt) => {
      wt.call(e, Ee, Je, He);
    });
  }
  const xr = function(Ee) {
    let Je = null;
    if (tr(A.beforeSanitizeElements, Ee, null), Zt(Ee))
      return ct(Ee), !0;
    const wt = Be(Ee.nodeName);
    if (tr(A.uponSanitizeElement, Ee, {
      tagName: wt,
      allowedTags: F
    }), j && Ee.hasChildNodes() && !Ot(Ee.firstElementChild) && Mi(/<[/\w!]/g, Ee.innerHTML) && Mi(/<[/\w!]/g, Ee.textContent) || Ee.nodeType === Yf.progressingInstruction || j && Ee.nodeType === Yf.comment && Mi(/<[/\w]/g, Ee.data))
      return ct(Ee), !0;
    if (!(he.tagCheck instanceof Function && he.tagCheck(wt)) && (!F[wt] || re[wt])) {
      if (!re[wt] && Wt(wt) && (Y.tagNameCheck instanceof RegExp && Mi(Y.tagNameCheck, wt) || Y.tagNameCheck instanceof Function && Y.tagNameCheck(wt)))
        return !1;
      if (ke && !_e[wt]) {
        const sr = w(Ee) || Ee.parentNode, Ur = b(Ee) || Ee.childNodes;
        if (Ur && sr) {
          const cr = Ur.length;
          for (let Yr = cr - 1; Yr >= 0; --Yr) {
            const pi = m(Ur[Yr], !0);
            pi.__removalCount = (Ee.__removalCount || 0) + 1, sr.insertBefore(pi, y(Ee));
          }
        }
      }
      return ct(Ee), !0;
    }
    return Ee instanceof l && !rt(Ee) || (wt === "noscript" || wt === "noembed" || wt === "noframes") && Mi(/<\/no(script|embed|frames)/i, Ee.innerHTML) ? (ct(Ee), !0) : (J && Ee.nodeType === Yf.text && (Je = Ee.textContent, k1([O, P, S], (sr) => {
      Je = Wf(Je, sr, " ");
    }), Ee.textContent !== Je && (Uf(e.removed, {
      element: Ee.cloneNode()
    }), Ee.textContent = Je)), tr(A.afterSanitizeElements, Ee, null), !1);
  }, rr = function(Ee, Je, wt) {
    if (Ve && (Je === "id" || Je === "name") && (wt in r || wt in ht))
      return !1;
    if (!(Z && !ne[Je] && Mi(R, Je))) {
      if (!(K && Mi(I, Je))) {
        if (!(he.attributeCheck instanceof Function && he.attributeCheck(Je, Ee))) {
          if (!H[Je] || ne[Je]) {
            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
              !(Wt(Ee) && (Y.tagNameCheck instanceof RegExp && Mi(Y.tagNameCheck, Ee) || Y.tagNameCheck instanceof Function && Y.tagNameCheck(Ee)) && (Y.attributeNameCheck instanceof RegExp && Mi(Y.attributeNameCheck, Je) || Y.attributeNameCheck instanceof Function && Y.attributeNameCheck(Je, Ee)) || // Alternative, second condition checks if it's an `is`-attribute, AND
              // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
              Je === "is" && Y.allowCustomizedBuiltInElements && (Y.tagNameCheck instanceof RegExp && Mi(Y.tagNameCheck, wt) || Y.tagNameCheck instanceof Function && Y.tagNameCheck(wt)))
            ) return !1;
          } else if (!Q[Je]) {
            if (!Mi($, Wf(wt, M, ""))) {
              if (!((Je === "src" || Je === "xlink:href" || Je === "href") && Ee !== "script" && pX(wt, "data:") === 0 && me[Ee])) {
                if (!(X && !Mi(D, Wf(wt, M, "")))) {
                  if (wt)
                    return !1;
                }
              }
            }
          }
        }
      }
    }
    return !0;
  }, Wt = function(Ee) {
    return Ee !== "annotation-xml" && Ab(Ee, B);
  }, lr = function(Ee) {
    tr(A.beforeSanitizeAttributes, Ee, null);
    const {
      attributes: Je
    } = Ee;
    if (!Je || Zt(Ee))
      return;
    const wt = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: H,
      forceKeepAttr: void 0
    };
    let sr = Je.length;
    for (; sr--; ) {
      const Ur = Je[sr], {
        name: cr,
        namespaceURI: Yr,
        value: pi
      } = Ur, xn = Be(cr), bn = pi;
      let pt = cr === "value" ? bn : gX(bn);
      if (wt.attrName = xn, wt.attrValue = pt, wt.keepAttr = !0, wt.forceKeepAttr = void 0, tr(A.uponSanitizeAttribute, Ee, wt), pt = wt.attrValue, Ge && (xn === "id" || xn === "name") && (ut(cr, Ee), pt = Ue + pt), j && Mi(/((--!?|])>)|<\/(style|title|textarea)/i, pt)) {
        ut(cr, Ee);
        continue;
      }
      if (xn === "attributename" && Ab(pt, "href")) {
        ut(cr, Ee);
        continue;
      }
      if (wt.forceKeepAttr)
        continue;
      if (!wt.keepAttr) {
        ut(cr, Ee);
        continue;
      }
      if (!q && Mi(/\/>/i, pt)) {
        ut(cr, Ee);
        continue;
      }
      J && k1([O, P, S], (lt) => {
        pt = Wf(pt, lt, " ");
      });
      const Tt = Be(Ee.nodeName);
      if (!rr(Tt, xn, pt)) {
        ut(cr, Ee);
        continue;
      }
      if (T && typeof p == "object" && typeof p.getAttributeType == "function" && !Yr)
        switch (p.getAttributeType(Tt, xn)) {
          case "TrustedHTML": {
            pt = T.createHTML(pt);
            break;
          }
          case "TrustedScriptURL": {
            pt = T.createScriptURL(pt);
            break;
          }
        }
      if (pt !== bn)
        try {
          Yr ? Ee.setAttributeNS(Yr, cr, pt) : Ee.setAttribute(cr, pt), Zt(Ee) ? ct(Ee) : R7(e.removed);
        } catch {
          ut(cr, Ee);
        }
    }
    tr(A.afterSanitizeAttributes, Ee, null);
  }, an = function dt(Ee) {
    let Je = null;
    const wt = bt(Ee);
    for (tr(A.beforeSanitizeShadowDOM, Ee, null); Je = wt.nextNode(); )
      tr(A.uponSanitizeShadowNode, Je, null), xr(Je), lr(Je), Je.content instanceof a && dt(Je.content);
    tr(A.afterSanitizeShadowDOM, Ee, null);
  };
  return e.sanitize = function(dt) {
    let Ee = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Je = null, wt = null, sr = null, Ur = null;
    if (de = !dt, de && (dt = "<!-->"), typeof dt != "string" && !Ot(dt))
      if (typeof dt.toString == "function") {
        if (dt = dt.toString(), typeof dt != "string")
          throw Hf("dirty is not a string, aborting");
      } else
        throw Hf("toString is not a function");
    if (!e.isSupported)
      return dt;
    if (te || We(Ee), e.removed = [], typeof dt == "string" && (Pe = !1), Pe) {
      if (dt.nodeName) {
        const pi = Be(dt.nodeName);
        if (!F[pi] || re[pi])
          throw Hf("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (dt instanceof o)
      Je = nt("<!---->"), wt = Je.ownerDocument.importNode(dt, !0), wt.nodeType === Yf.element && wt.nodeName === "BODY" || wt.nodeName === "HTML" ? Je = wt : Je.appendChild(wt);
    else {
      if (!W && !J && !pe && // eslint-disable-next-line unicorn/prefer-includes
      dt.indexOf("<") === -1)
        return T && ue ? T.createHTML(dt) : dt;
      if (Je = nt(dt), !Je)
        return W ? null : ue ? E : "";
    }
    Je && Ae && ct(Je.firstChild);
    const cr = bt(Pe ? dt : Je);
    for (; sr = cr.nextNode(); )
      xr(sr), lr(sr), sr.content instanceof a && an(sr.content);
    if (Pe)
      return dt;
    if (W) {
      if (Oe)
        for (Ur = _.call(Je.ownerDocument); Je.firstChild; )
          Ur.appendChild(Je.firstChild);
      else
        Ur = Je;
      return (H.shadowroot || H.shadowrootmode) && (Ur = N.call(n, Ur, !0)), Ur;
    }
    let Yr = pe ? Je.outerHTML : Je.innerHTML;
    return pe && F["!doctype"] && Je.ownerDocument && Je.ownerDocument.doctype && Je.ownerDocument.doctype.name && Mi(mM, Je.ownerDocument.doctype.name) && (Yr = "<!DOCTYPE " + Je.ownerDocument.doctype.name + `>
` + Yr), J && k1([O, P, S], (pi) => {
      Yr = Wf(Yr, pi, " ");
    }), T && ue ? T.createHTML(Yr) : Yr;
  }, e.setConfig = function() {
    let dt = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    We(dt), te = !0;
  }, e.clearConfig = function() {
    He = null, te = !1;
  }, e.isValidAttribute = function(dt, Ee, Je) {
    He || We({});
    const wt = Be(dt), sr = Be(Ee);
    return rr(wt, sr, Je);
  }, e.addHook = function(dt, Ee) {
    typeof Ee == "function" && Uf(A[dt], Ee);
  }, e.removeHook = function(dt, Ee) {
    if (Ee !== void 0) {
      const Je = dX(A[dt], Ee);
      return Je === -1 ? void 0 : fX(A[dt], Je, 1)[0];
    }
    return R7(A[dt]);
  }, e.removeHooks = function(dt) {
    A[dt] = [];
  }, e.removeAllHooks = function() {
    A = P7();
  }, e;
}
var Vd = vM(), yM = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s, bp = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, RX = /\s*%%.*\n/gm, Uh, xM = (Uh = class extends Error {
  constructor(e) {
    super(e), this.name = "UnknownDiagramError";
  }
}, x(Uh, "UnknownDiagramError"), Uh), ru = {}, Z6 = /* @__PURE__ */ x(function(t, e) {
  t = t.replace(yM, "").replace(bp, "").replace(RX, `
`);
  for (const [r, { detector: n }] of Object.entries(ru))
    if (n(t, e))
      return r;
  throw new xM(
    `No diagram type detected matching given configuration for text: ${t}`
  );
}, "detectType"), q5 = /* @__PURE__ */ x((...t) => {
  for (const { id: e, detector: r, loader: n } of t)
    bM(e, r, n);
}, "registerLazyLoadedDiagrams"), bM = /* @__PURE__ */ x((t, e, r) => {
  ru[t] && ae.warn(`Detector with key ${t} already exists. Overwriting.`), ru[t] = { detector: e, loader: r }, ae.debug(`Detector with key ${t} added${r ? " with loader" : ""}`);
}, "addDetector"), NX = /* @__PURE__ */ x((t) => ru[t].loader, "getDiagramLoader"), Y5 = /* @__PURE__ */ x((t, e, { depth: r = 2, clobber: n = !1 } = {}) => {
  const i = { depth: r, clobber: n };
  return Array.isArray(e) && !Array.isArray(t) ? (e.forEach((a) => Y5(t, a, i)), t) : Array.isArray(e) && Array.isArray(t) ? (e.forEach((a) => {
    t.includes(a) || t.push(a);
  }), t) : t === void 0 || r <= 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((a) => {
    typeof e[a] == "object" && (t[a] === void 0 || typeof t[a] == "object") ? (t[a] === void 0 && (t[a] = Array.isArray(e[a]) ? [] : {}), t[a] = Y5(t[a], e[a], { depth: r - 1, clobber: n })) : (n || typeof t[a] != "object" && typeof e[a] != "object") && (t[a] = e[a]);
  }), t);
}, "assignWithDepth"), mn = Y5, P2 = "#ffffff", B2 = "#f2f2f2", Fi = /* @__PURE__ */ x((t, e) => e ? De(t, { s: -40, l: 10 }) : De(t, { s: -40, l: -10 }), "mkBorder"), Wh, MX = (Wh = 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 r, n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b, w, T, E, C;
    if (this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333"), this.secondaryColor = this.secondaryColor || De(this.primaryColor, { h: -120 }), this.tertiaryColor = this.tertiaryColor || De(this.primaryColor, { h: 180, l: 5 }), this.primaryBorderColor = this.primaryBorderColor || Fi(this.primaryColor, this.darkMode), this.secondaryBorderColor = this.secondaryBorderColor || Fi(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = this.tertiaryBorderColor || Fi(this.tertiaryColor, this.darkMode), this.noteBorderColor = this.noteBorderColor || Fi(this.noteBkgColor, this.darkMode), this.noteBkgColor = this.noteBkgColor || "#fff5ad", this.noteTextColor = this.noteTextColor || "#333", this.secondaryTextColor = this.secondaryTextColor || xt(this.secondaryColor), this.tertiaryTextColor = this.tertiaryTextColor || xt(this.tertiaryColor), this.lineColor = this.lineColor || xt(this.background), this.arrowheadColor = this.arrowheadColor || xt(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 ? It(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 || this.actorBorder, 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 || It(this.secondaryColor, 10), this.activationBkgColor = this.activationBkgColor || this.secondaryColor, this.sequenceNumberColor = this.sequenceNumberColor || xt(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 || _t(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.vertLineColor = this.vertLineColor || "navy", 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.darkMode ? (this.rowOdd = this.rowOdd || It(this.mainBkg, 5) || "#ffffff", this.rowEven = this.rowEven || It(this.mainBkg, 10)) : (this.rowOdd = this.rowOdd || _t(this.mainBkg, 75) || "#ffffff", this.rowEven = this.rowEven || _t(this.mainBkg, 5)), 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 || De(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || De(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || De(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || De(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || De(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || De(this.primaryColor, { h: 210, l: 150 }), this.cScale9 = this.cScale9 || De(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || De(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || De(this.primaryColor, { h: 330 }), this.darkMode)
      for (let k = 0; k < this.THEME_COLOR_LIMIT; k++)
        this["cScale" + k] = It(this["cScale" + k], 75);
    else
      for (let k = 0; k < this.THEME_COLOR_LIMIT; k++)
        this["cScale" + k] = It(this["cScale" + k], 25);
    for (let k = 0; k < this.THEME_COLOR_LIMIT; k++)
      this["cScaleInv" + k] = this["cScaleInv" + k] || xt(this["cScale" + k]);
    for (let k = 0; k < this.THEME_COLOR_LIMIT; k++)
      this.darkMode ? this["cScalePeer" + k] = this["cScalePeer" + k] || _t(this["cScale" + k], 10) : this["cScalePeer" + k] = this["cScalePeer" + k] || It(this["cScale" + k], 10);
    this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
    for (let k = 0; k < this.THEME_COLOR_LIMIT; k++)
      this["cScaleLabel" + k] = this["cScaleLabel" + k] || this.scaleLabelColor;
    const e = this.darkMode ? -4 : -1;
    for (let k = 0; k < 5; k++)
      this["surface" + k] = this["surface" + k] || De(this.mainBkg, { h: 180, s: -15, l: e * (5 + k * 3) }), this["surfacePeer" + k] = this["surfacePeer" + k] || De(this.mainBkg, { h: 180, s: -15, l: e * (8 + k * 3) });
    this.classText = this.classText || this.textColor, this.fillType0 = this.fillType0 || this.primaryColor, this.fillType1 = this.fillType1 || this.secondaryColor, this.fillType2 = this.fillType2 || De(this.primaryColor, { h: 64 }), this.fillType3 = this.fillType3 || De(this.secondaryColor, { h: 64 }), this.fillType4 = this.fillType4 || De(this.primaryColor, { h: -64 }), this.fillType5 = this.fillType5 || De(this.secondaryColor, { h: -64 }), this.fillType6 = this.fillType6 || De(this.primaryColor, { h: 128 }), this.fillType7 = this.fillType7 || De(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 || De(this.primaryColor, { l: -10 }), this.pie5 = this.pie5 || De(this.secondaryColor, { l: -10 }), this.pie6 = this.pie6 || De(this.tertiaryColor, { l: -10 }), this.pie7 = this.pie7 || De(this.primaryColor, { h: 60, l: -10 }), this.pie8 = this.pie8 || De(this.primaryColor, { h: -60, l: -10 }), this.pie9 = this.pie9 || De(this.primaryColor, { h: 120, l: 0 }), this.pie10 = this.pie10 || De(this.primaryColor, { h: 60, l: -20 }), this.pie11 = this.pie11 || De(this.primaryColor, { h: -60, l: -20 }), this.pie12 = this.pie12 || De(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.radar = {
      axisColor: ((r = this.radar) == null ? void 0 : r.axisColor) || this.lineColor,
      axisStrokeWidth: ((n = this.radar) == null ? void 0 : n.axisStrokeWidth) || 2,
      axisLabelFontSize: ((i = this.radar) == null ? void 0 : i.axisLabelFontSize) || 12,
      curveOpacity: ((a = this.radar) == null ? void 0 : a.curveOpacity) || 0.5,
      curveStrokeWidth: ((s = this.radar) == null ? void 0 : s.curveStrokeWidth) || 2,
      graticuleColor: ((o = this.radar) == null ? void 0 : o.graticuleColor) || "#DEDEDE",
      graticuleStrokeWidth: ((l = this.radar) == null ? void 0 : l.graticuleStrokeWidth) || 1,
      graticuleOpacity: ((u = this.radar) == null ? void 0 : u.graticuleOpacity) || 0.3,
      legendBoxSize: ((h = this.radar) == null ? void 0 : h.legendBoxSize) || 12,
      legendFontSize: ((d = this.radar) == null ? void 0 : d.legendFontSize) || 12
    }, this.archEdgeColor = this.archEdgeColor || "#777", this.archEdgeArrowColor = this.archEdgeArrowColor || "#777", this.archEdgeWidth = this.archEdgeWidth || "3", this.archGroupBorderColor = this.archGroupBorderColor || "#000", this.archGroupBorderWidth = this.archGroupBorderWidth || "2px", this.quadrant1Fill = this.quadrant1Fill || this.primaryColor, this.quadrant2Fill = this.quadrant2Fill || De(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || De(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || De(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || De(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || De(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || De(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || tc(this.quadrant1Fill) ? _t(this.quadrant1Fill) : It(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: ((f = this.xyChart) == null ? void 0 : f.backgroundColor) || this.background,
      titleColor: ((p = this.xyChart) == null ? void 0 : p.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((g = this.xyChart) == null ? void 0 : g.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((m = this.xyChart) == null ? void 0 : m.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((v = this.xyChart) == null ? void 0 : v.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((y = this.xyChart) == null ? void 0 : y.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((b = this.xyChart) == null ? void 0 : b.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((w = this.xyChart) == null ? void 0 : w.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((T = this.xyChart) == null ? void 0 : T.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((E = this.xyChart) == null ? void 0 : E.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((C = this.xyChart) == null ? void 0 : C.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 ? It(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 || De(this.primaryColor, { h: -30 }), this.git4 = this.git4 || De(this.primaryColor, { h: -60 }), this.git5 = this.git5 || De(this.primaryColor, { h: -90 }), this.git6 = this.git6 || De(this.primaryColor, { h: 60 }), this.git7 = this.git7 || De(this.primaryColor, { h: 120 }), this.darkMode ? (this.git0 = _t(this.git0, 25), this.git1 = _t(this.git1, 25), this.git2 = _t(this.git2, 25), this.git3 = _t(this.git3, 25), this.git4 = _t(this.git4, 25), this.git5 = _t(this.git5, 25), this.git6 = _t(this.git6, 25), this.git7 = _t(this.git7, 25)) : (this.git0 = It(this.git0, 25), this.git1 = It(this.git1, 25), this.git2 = It(this.git2, 25), this.git3 = It(this.git3, 25), this.git4 = It(this.git4, 25), this.git5 = It(this.git5, 25), this.git6 = It(this.git6, 25), this.git7 = It(this.git7, 25)), this.gitInv0 = this.gitInv0 || xt(this.git0), this.gitInv1 = this.gitInv1 || xt(this.git1), this.gitInv2 = this.gitInv2 || xt(this.git2), this.gitInv3 = this.gitInv3 || xt(this.git3), this.gitInv4 = this.gitInv4 || xt(this.git4), this.gitInv5 = this.gitInv5 || xt(this.git5), this.gitInv6 = this.gitInv6 || xt(this.git6), this.gitInv7 = this.gitInv7 || xt(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 || P2, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || B2;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const r = Object.keys(e);
    r.forEach((n) => {
      this[n] = e[n];
    }), this.updateColors(), r.forEach((n) => {
      this[n] = e[n];
    });
  }
}, x(Wh, "Theme"), Wh), DX = /* @__PURE__ */ x((t) => {
  const e = new MX();
  return e.calculate(t), e;
}, "getThemeVariables"), Hh, IX = (Hh = class {
  constructor() {
    this.background = "#333", this.primaryColor = "#1f2020", this.secondaryColor = _t(this.primaryColor, 16), this.tertiaryColor = De(this.primaryColor, { h: -160 }), this.primaryBorderColor = xt(this.background), this.secondaryBorderColor = Fi(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = Fi(this.tertiaryColor, this.darkMode), this.primaryTextColor = xt(this.primaryColor), this.secondaryTextColor = xt(this.secondaryColor), this.tertiaryTextColor = xt(this.tertiaryColor), this.lineColor = xt(this.background), this.textColor = xt(this.background), this.mainBkg = "#1f2020", this.secondBkg = "calculated", this.mainContrastColor = "lightgrey", this.darkTextColor = _t(xt("#323D47"), 10), this.lineColor = "calculated", this.border1 = "#ccc", this.border2 = _l(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 = It("#EAE8D9", 30), this.altSectionBkgColor = "calculated", this.sectionBkgColor2 = "#EAE8D9", this.excludeBkgColor = It(this.sectionBkgColor, 10), this.taskBorderColor = _l(255, 255, 255, 70), this.taskBkgColor = "calculated", this.taskTextColor = "calculated", this.taskTextLightColor = "calculated", this.taskTextOutsideColor = "calculated", this.taskTextClickableColor = "#003163", this.activeTaskBorderColor = _l(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.vertLineColor = "#00BFFF", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.archEdgeColor = "calculated", this.archEdgeArrowColor = "calculated", this.archEdgeWidth = "3", this.archGroupBorderColor = this.primaryBorderColor, this.archGroupBorderWidth = "2px", this.rowOdd = this.rowOdd || _t(this.mainBkg, 5) || "#ffffff", this.rowEven = this.rowEven || It(this.mainBkg, 10), this.labelColor = "calculated", this.errorBkgColor = "#a44141", this.errorTextColor = "#ddd";
  }
  updateColors() {
    var e, r, n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b, w, T, E;
    this.secondBkg = _t(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 = _t(this.labelBackground, 25), this.actorBorder = this.border1, this.actorBkg = this.mainBkg, this.actorTextColor = this.mainContrastColor, this.actorLineColor = this.actorBorder, 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 = _t(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.archEdgeColor = this.lineColor, this.archEdgeArrowColor = this.lineColor, 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 = De(this.primaryColor, { h: 64 }), this.fillType3 = De(this.secondaryColor, { h: 64 }), this.fillType4 = De(this.primaryColor, { h: -64 }), this.fillType5 = De(this.secondaryColor, { h: -64 }), this.fillType6 = De(this.primaryColor, { h: 128 }), this.fillType7 = De(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 || De(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || De(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || De(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || De(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || De(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || De(this.primaryColor, { h: 210 }), this.cScale9 = this.cScale9 || De(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || De(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || De(this.primaryColor, { h: 330 });
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleInv" + C] = this["cScaleInv" + C] || xt(this["cScale" + C]);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScalePeer" + C] = this["cScalePeer" + C] || _t(this["cScale" + C], 10);
    for (let C = 0; C < 5; C++)
      this["surface" + C] = this["surface" + C] || De(this.mainBkg, { h: 30, s: -30, l: -(-10 + C * 4) }), this["surfacePeer" + C] = this["surfacePeer" + C] || De(this.mainBkg, { h: 30, s: -30, l: -(-7 + C * 4) });
    this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleLabel" + C] = this["cScaleLabel" + C] || this.scaleLabelColor;
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["pie" + C] = this["cScale" + C];
    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 || De(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || De(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || De(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || De(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || De(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || De(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || tc(this.quadrant1Fill) ? _t(this.quadrant1Fill) : It(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: ((r = this.xyChart) == null ? void 0 : r.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((n = this.xyChart) == null ? void 0 : n.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((i = this.xyChart) == null ? void 0 : i.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((a = this.xyChart) == null ? void 0 : a.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((s = this.xyChart) == null ? void 0 : s.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: ((d = this.xyChart) == null ? void 0 : d.plotColorPalette) || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"
    }, this.packet = {
      startByteColor: this.primaryTextColor,
      endByteColor: this.primaryTextColor,
      labelColor: this.primaryTextColor,
      titleColor: this.primaryTextColor,
      blockStrokeColor: this.primaryTextColor,
      blockFillColor: this.background
    }, this.radar = {
      axisColor: ((f = this.radar) == null ? void 0 : f.axisColor) || this.lineColor,
      axisStrokeWidth: ((p = this.radar) == null ? void 0 : p.axisStrokeWidth) || 2,
      axisLabelFontSize: ((g = this.radar) == null ? void 0 : g.axisLabelFontSize) || 12,
      curveOpacity: ((m = this.radar) == null ? void 0 : m.curveOpacity) || 0.5,
      curveStrokeWidth: ((v = this.radar) == null ? void 0 : v.curveStrokeWidth) || 2,
      graticuleColor: ((y = this.radar) == null ? void 0 : y.graticuleColor) || "#DEDEDE",
      graticuleStrokeWidth: ((b = this.radar) == null ? void 0 : b.graticuleStrokeWidth) || 1,
      graticuleOpacity: ((w = this.radar) == null ? void 0 : w.graticuleOpacity) || 0.3,
      legendBoxSize: ((T = this.radar) == null ? void 0 : T.legendBoxSize) || 12,
      legendFontSize: ((E = this.radar) == null ? void 0 : E.legendFontSize) || 12
    }, 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 ? It(this.secondaryColor, 30) : this.secondaryColor), this.relationLabelColor = this.relationLabelColor || this.actorTextColor, this.git0 = _t(this.secondaryColor, 20), this.git1 = _t(this.pie2 || this.secondaryColor, 20), this.git2 = _t(this.pie3 || this.tertiaryColor, 20), this.git3 = _t(this.pie4 || De(this.primaryColor, { h: -30 }), 20), this.git4 = _t(this.pie5 || De(this.primaryColor, { h: -60 }), 20), this.git5 = _t(this.pie6 || De(this.primaryColor, { h: -90 }), 10), this.git6 = _t(this.pie7 || De(this.primaryColor, { h: 60 }), 10), this.git7 = _t(this.pie8 || De(this.primaryColor, { h: 120 }), 20), this.gitInv0 = this.gitInv0 || xt(this.git0), this.gitInv1 = this.gitInv1 || xt(this.git1), this.gitInv2 = this.gitInv2 || xt(this.git2), this.gitInv3 = this.gitInv3 || xt(this.git3), this.gitInv4 = this.gitInv4 || xt(this.git4), this.gitInv5 = this.gitInv5 || xt(this.git5), this.gitInv6 = this.gitInv6 || xt(this.git6), this.gitInv7 = this.gitInv7 || xt(this.git7), this.gitBranchLabel0 = this.gitBranchLabel0 || xt(this.labelTextColor), this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor, this.gitBranchLabel3 = this.gitBranchLabel3 || xt(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 || _t(this.background, 12), this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || _t(this.background, 2), this.nodeBorder = this.nodeBorder || "#999";
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const r = Object.keys(e);
    r.forEach((n) => {
      this[n] = e[n];
    }), this.updateColors(), r.forEach((n) => {
      this[n] = e[n];
    });
  }
}, x(Hh, "Theme"), Hh), OX = /* @__PURE__ */ x((t) => {
  const e = new IX();
  return e.calculate(t), e;
}, "getThemeVariables"), qh, PX = (qh = class {
  constructor() {
    this.background = "#f4f4f4", this.primaryColor = "#ECECFF", this.secondaryColor = De(this.primaryColor, { h: 120 }), this.secondaryColor = "#ffffde", this.tertiaryColor = De(this.primaryColor, { h: -160 }), this.primaryBorderColor = Fi(this.primaryColor, this.darkMode), this.secondaryBorderColor = Fi(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = Fi(this.tertiaryColor, this.darkMode), this.primaryTextColor = xt(this.primaryColor), this.secondaryTextColor = xt(this.secondaryColor), this.tertiaryTextColor = xt(this.tertiaryColor), this.lineColor = xt(this.background), this.textColor = xt(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 = "rgba(232,232,232, 0.8)", 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 = "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 = "#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.vertLineColor = "calculated", this.sectionBkgColor = _l(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.vertLineColor = "navy", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.archEdgeColor = "calculated", this.archEdgeArrowColor = "calculated", this.archEdgeWidth = "3", this.archGroupBorderColor = this.primaryBorderColor, this.archGroupBorderWidth = "2px", this.rowOdd = "calculated", this.rowEven = "calculated", this.labelColor = "black", this.errorBkgColor = "#552222", this.errorTextColor = "#552222", this.updateColors();
  }
  updateColors() {
    var e, r, n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b, w, T, E;
    this.cScale0 = this.cScale0 || this.primaryColor, this.cScale1 = this.cScale1 || this.secondaryColor, this.cScale2 = this.cScale2 || this.tertiaryColor, this.cScale3 = this.cScale3 || De(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || De(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || De(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || De(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || De(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || De(this.primaryColor, { h: 210 }), this.cScale9 = this.cScale9 || De(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || De(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || De(this.primaryColor, { h: 330 }), this.cScalePeer1 = this.cScalePeer1 || It(this.secondaryColor, 45), this.cScalePeer2 = this.cScalePeer2 || It(this.tertiaryColor, 40);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScale" + C] = It(this["cScale" + C], 10), this["cScalePeer" + C] = this["cScalePeer" + C] || It(this["cScale" + C], 25);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleInv" + C] = this["cScaleInv" + C] || De(this["cScale" + C], { h: 180 });
    for (let C = 0; C < 5; C++)
      this["surface" + C] = this["surface" + C] || De(this.mainBkg, { h: 30, l: -(5 + C * 5) }), this["surfacePeer" + C] = this["surfacePeer" + C] || De(this.mainBkg, { h: 30, l: -(7 + C * 5) });
    if (this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor, this.labelTextColor !== "calculated") {
      this.cScaleLabel0 = this.cScaleLabel0 || xt(this.labelTextColor), this.cScaleLabel3 = this.cScaleLabel3 || xt(this.labelTextColor);
      for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
        this["cScaleLabel" + C] = this["cScaleLabel" + C] || 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 = _t(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.actorLineColor = this.actorBorder, this.taskTextColor = this.taskTextLightColor, this.taskTextOutsideColor = this.taskTextDarkColor, this.archEdgeColor = this.lineColor, this.archEdgeArrowColor = this.lineColor, this.rowOdd = this.rowOdd || _t(this.primaryColor, 75) || "#ffffff", this.rowEven = this.rowEven || _t(this.primaryColor, 1), 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 = De(this.primaryColor, { h: 64 }), this.fillType3 = De(this.secondaryColor, { h: 64 }), this.fillType4 = De(this.primaryColor, { h: -64 }), this.fillType5 = De(this.secondaryColor, { h: -64 }), this.fillType6 = De(this.primaryColor, { h: 128 }), this.fillType7 = De(this.secondaryColor, { h: 128 }), this.pie1 = this.pie1 || this.primaryColor, this.pie2 = this.pie2 || this.secondaryColor, this.pie3 = this.pie3 || De(this.tertiaryColor, { l: -40 }), this.pie4 = this.pie4 || De(this.primaryColor, { l: -10 }), this.pie5 = this.pie5 || De(this.secondaryColor, { l: -30 }), this.pie6 = this.pie6 || De(this.tertiaryColor, { l: -20 }), this.pie7 = this.pie7 || De(this.primaryColor, { h: 60, l: -20 }), this.pie8 = this.pie8 || De(this.primaryColor, { h: -60, l: -40 }), this.pie9 = this.pie9 || De(this.primaryColor, { h: 120, l: -40 }), this.pie10 = this.pie10 || De(this.primaryColor, { h: 60, l: -40 }), this.pie11 = this.pie11 || De(this.primaryColor, { h: -90, l: -40 }), this.pie12 = this.pie12 || De(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 || De(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || De(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || De(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || De(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || De(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || De(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || tc(this.quadrant1Fill) ? _t(this.quadrant1Fill) : It(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.radar = {
      axisColor: ((e = this.radar) == null ? void 0 : e.axisColor) || this.lineColor,
      axisStrokeWidth: ((r = this.radar) == null ? void 0 : r.axisStrokeWidth) || 2,
      axisLabelFontSize: ((n = this.radar) == null ? void 0 : n.axisLabelFontSize) || 12,
      curveOpacity: ((i = this.radar) == null ? void 0 : i.curveOpacity) || 0.5,
      curveStrokeWidth: ((a = this.radar) == null ? void 0 : a.curveStrokeWidth) || 2,
      graticuleColor: ((s = this.radar) == null ? void 0 : s.graticuleColor) || "#DEDEDE",
      graticuleStrokeWidth: ((o = this.radar) == null ? void 0 : o.graticuleStrokeWidth) || 1,
      graticuleOpacity: ((l = this.radar) == null ? void 0 : l.graticuleOpacity) || 0.3,
      legendBoxSize: ((u = this.radar) == null ? void 0 : u.legendBoxSize) || 12,
      legendFontSize: ((h = this.radar) == null ? void 0 : h.legendFontSize) || 12
    }, this.xyChart = {
      backgroundColor: ((d = this.xyChart) == null ? void 0 : d.backgroundColor) || this.background,
      titleColor: ((f = this.xyChart) == null ? void 0 : f.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((p = this.xyChart) == null ? void 0 : p.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((g = this.xyChart) == null ? void 0 : g.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((m = this.xyChart) == null ? void 0 : m.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((v = this.xyChart) == null ? void 0 : v.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((y = this.xyChart) == null ? void 0 : y.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((b = this.xyChart) == null ? void 0 : b.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((w = this.xyChart) == null ? void 0 : w.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((T = this.xyChart) == null ? void 0 : T.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((E = this.xyChart) == null ? void 0 : E.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 || De(this.primaryColor, { h: -30 }), this.git4 = this.git4 || De(this.primaryColor, { h: -60 }), this.git5 = this.git5 || De(this.primaryColor, { h: -90 }), this.git6 = this.git6 || De(this.primaryColor, { h: 60 }), this.git7 = this.git7 || De(this.primaryColor, { h: 120 }), this.darkMode ? (this.git0 = _t(this.git0, 25), this.git1 = _t(this.git1, 25), this.git2 = _t(this.git2, 25), this.git3 = _t(this.git3, 25), this.git4 = _t(this.git4, 25), this.git5 = _t(this.git5, 25), this.git6 = _t(this.git6, 25), this.git7 = _t(this.git7, 25)) : (this.git0 = It(this.git0, 25), this.git1 = It(this.git1, 25), this.git2 = It(this.git2, 25), this.git3 = It(this.git3, 25), this.git4 = It(this.git4, 25), this.git5 = It(this.git5, 25), this.git6 = It(this.git6, 25), this.git7 = It(this.git7, 25)), this.gitInv0 = this.gitInv0 || It(xt(this.git0), 25), this.gitInv1 = this.gitInv1 || xt(this.git1), this.gitInv2 = this.gitInv2 || xt(this.git2), this.gitInv3 = this.gitInv3 || xt(this.git3), this.gitInv4 = this.gitInv4 || xt(this.git4), this.gitInv5 = this.gitInv5 || xt(this.git5), this.gitInv6 = this.gitInv6 || xt(this.git6), this.gitInv7 = this.gitInv7 || xt(this.git7), this.gitBranchLabel0 = this.gitBranchLabel0 || xt(this.labelTextColor), this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor, this.gitBranchLabel3 = this.gitBranchLabel3 || xt(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 || P2, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || B2;
  }
  calculate(e) {
    if (Object.keys(this).forEach((n) => {
      this[n] === "calculated" && (this[n] = void 0);
    }), typeof e != "object") {
      this.updateColors();
      return;
    }
    const r = Object.keys(e);
    r.forEach((n) => {
      this[n] = e[n];
    }), this.updateColors(), r.forEach((n) => {
      this[n] = e[n];
    });
  }
}, x(qh, "Theme"), qh), F2 = /* @__PURE__ */ x((t) => {
  const e = new PX();
  return e.calculate(t), e;
}, "getThemeVariables"), Yh, BX = (Yh = 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 = _t("#cde498", 10), this.primaryBorderColor = Fi(this.primaryColor, this.darkMode), this.secondaryBorderColor = Fi(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = Fi(this.tertiaryColor, this.darkMode), this.primaryTextColor = xt(this.primaryColor), this.secondaryTextColor = xt(this.secondaryColor), this.tertiaryTextColor = xt(this.primaryColor), this.lineColor = xt(this.background), this.textColor = xt(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 = "calculated", 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.vertLineColor = "#00BFFF", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.archEdgeColor = "calculated", this.archEdgeArrowColor = "calculated", this.archEdgeWidth = "3", this.archGroupBorderColor = this.primaryBorderColor, this.archGroupBorderWidth = "2px", this.labelColor = "black", this.errorBkgColor = "#552222", this.errorTextColor = "#552222";
  }
  updateColors() {
    var e, r, n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b, w, T, E;
    this.actorBorder = It(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.actorLineColor = this.actorBorder, this.cScale0 = this.cScale0 || this.primaryColor, this.cScale1 = this.cScale1 || this.secondaryColor, this.cScale2 = this.cScale2 || this.tertiaryColor, this.cScale3 = this.cScale3 || De(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || De(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || De(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || De(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || De(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || De(this.primaryColor, { h: 210 }), this.cScale9 = this.cScale9 || De(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || De(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || De(this.primaryColor, { h: 330 }), this.cScalePeer1 = this.cScalePeer1 || It(this.secondaryColor, 45), this.cScalePeer2 = this.cScalePeer2 || It(this.tertiaryColor, 40);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScale" + C] = It(this["cScale" + C], 10), this["cScalePeer" + C] = this["cScalePeer" + C] || It(this["cScale" + C], 25);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleInv" + C] = this["cScaleInv" + C] || De(this["cScale" + C], { h: 180 });
    this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleLabel" + C] = this["cScaleLabel" + C] || this.scaleLabelColor;
    for (let C = 0; C < 5; C++)
      this["surface" + C] = this["surface" + C] || De(this.mainBkg, { h: 30, s: -30, l: -(5 + C * 5) }), this["surfacePeer" + C] = this["surfacePeer" + C] || De(this.mainBkg, { h: 30, s: -30, l: -(8 + C * 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.archEdgeColor = this.lineColor, this.archEdgeArrowColor = this.lineColor, this.rowOdd = this.rowOdd || _t(this.mainBkg, 75) || "#ffffff", this.rowEven = this.rowEven || _t(this.mainBkg, 20), 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 = De(this.primaryColor, { h: 64 }), this.fillType3 = De(this.secondaryColor, { h: 64 }), this.fillType4 = De(this.primaryColor, { h: -64 }), this.fillType5 = De(this.secondaryColor, { h: -64 }), this.fillType6 = De(this.primaryColor, { h: 128 }), this.fillType7 = De(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 || De(this.primaryColor, { l: -30 }), this.pie5 = this.pie5 || De(this.secondaryColor, { l: -30 }), this.pie6 = this.pie6 || De(this.tertiaryColor, { h: 40, l: -40 }), this.pie7 = this.pie7 || De(this.primaryColor, { h: 60, l: -10 }), this.pie8 = this.pie8 || De(this.primaryColor, { h: -60, l: -10 }), this.pie9 = this.pie9 || De(this.primaryColor, { h: 120, l: 0 }), this.pie10 = this.pie10 || De(this.primaryColor, { h: 60, l: -50 }), this.pie11 = this.pie11 || De(this.primaryColor, { h: -60, l: -50 }), this.pie12 = this.pie12 || De(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 || De(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || De(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || De(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || De(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || De(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || De(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || tc(this.quadrant1Fill) ? _t(this.quadrant1Fill) : It(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.packet = {
      startByteColor: this.primaryTextColor,
      endByteColor: this.primaryTextColor,
      labelColor: this.primaryTextColor,
      titleColor: this.primaryTextColor,
      blockStrokeColor: this.primaryTextColor,
      blockFillColor: this.mainBkg
    }, this.radar = {
      axisColor: ((e = this.radar) == null ? void 0 : e.axisColor) || this.lineColor,
      axisStrokeWidth: ((r = this.radar) == null ? void 0 : r.axisStrokeWidth) || 2,
      axisLabelFontSize: ((n = this.radar) == null ? void 0 : n.axisLabelFontSize) || 12,
      curveOpacity: ((i = this.radar) == null ? void 0 : i.curveOpacity) || 0.5,
      curveStrokeWidth: ((a = this.radar) == null ? void 0 : a.curveStrokeWidth) || 2,
      graticuleColor: ((s = this.radar) == null ? void 0 : s.graticuleColor) || "#DEDEDE",
      graticuleStrokeWidth: ((o = this.radar) == null ? void 0 : o.graticuleStrokeWidth) || 1,
      graticuleOpacity: ((l = this.radar) == null ? void 0 : l.graticuleOpacity) || 0.3,
      legendBoxSize: ((u = this.radar) == null ? void 0 : u.legendBoxSize) || 12,
      legendFontSize: ((h = this.radar) == null ? void 0 : h.legendFontSize) || 12
    }, this.xyChart = {
      backgroundColor: ((d = this.xyChart) == null ? void 0 : d.backgroundColor) || this.background,
      titleColor: ((f = this.xyChart) == null ? void 0 : f.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((p = this.xyChart) == null ? void 0 : p.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((g = this.xyChart) == null ? void 0 : g.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((m = this.xyChart) == null ? void 0 : m.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((v = this.xyChart) == null ? void 0 : v.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((y = this.xyChart) == null ? void 0 : y.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((b = this.xyChart) == null ? void 0 : b.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((w = this.xyChart) == null ? void 0 : w.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((T = this.xyChart) == null ? void 0 : T.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((E = this.xyChart) == null ? void 0 : E.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 || De(this.primaryColor, { h: -30 }), this.git4 = this.git4 || De(this.primaryColor, { h: -60 }), this.git5 = this.git5 || De(this.primaryColor, { h: -90 }), this.git6 = this.git6 || De(this.primaryColor, { h: 60 }), this.git7 = this.git7 || De(this.primaryColor, { h: 120 }), this.darkMode ? (this.git0 = _t(this.git0, 25), this.git1 = _t(this.git1, 25), this.git2 = _t(this.git2, 25), this.git3 = _t(this.git3, 25), this.git4 = _t(this.git4, 25), this.git5 = _t(this.git5, 25), this.git6 = _t(this.git6, 25), this.git7 = _t(this.git7, 25)) : (this.git0 = It(this.git0, 25), this.git1 = It(this.git1, 25), this.git2 = It(this.git2, 25), this.git3 = It(this.git3, 25), this.git4 = It(this.git4, 25), this.git5 = It(this.git5, 25), this.git6 = It(this.git6, 25), this.git7 = It(this.git7, 25)), this.gitInv0 = this.gitInv0 || xt(this.git0), this.gitInv1 = this.gitInv1 || xt(this.git1), this.gitInv2 = this.gitInv2 || xt(this.git2), this.gitInv3 = this.gitInv3 || xt(this.git3), this.gitInv4 = this.gitInv4 || xt(this.git4), this.gitInv5 = this.gitInv5 || xt(this.git5), this.gitInv6 = this.gitInv6 || xt(this.git6), this.gitInv7 = this.gitInv7 || xt(this.git7), this.gitBranchLabel0 = this.gitBranchLabel0 || xt(this.labelTextColor), this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor, this.gitBranchLabel3 = this.gitBranchLabel3 || xt(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 || P2, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || B2;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const r = Object.keys(e);
    r.forEach((n) => {
      this[n] = e[n];
    }), this.updateColors(), r.forEach((n) => {
      this[n] = e[n];
    });
  }
}, x(Yh, "Theme"), Yh), FX = /* @__PURE__ */ x((t) => {
  const e = new BX();
  return e.calculate(t), e;
}, "getThemeVariables"), Xh, $X = (Xh = class {
  constructor() {
    this.primaryColor = "#eee", this.contrast = "#707070", this.secondaryColor = _t(this.contrast, 55), this.background = "#ffffff", this.tertiaryColor = De(this.primaryColor, { h: -160 }), this.primaryBorderColor = Fi(this.primaryColor, this.darkMode), this.secondaryBorderColor = Fi(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = Fi(this.tertiaryColor, this.darkMode), this.primaryTextColor = xt(this.primaryColor), this.secondaryTextColor = xt(this.secondaryColor), this.tertiaryTextColor = xt(this.tertiaryColor), this.lineColor = xt(this.background), this.textColor = xt(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 = this.actorBorder, 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.vertLineColor = "calculated", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.archEdgeColor = "calculated", this.archEdgeArrowColor = "calculated", this.archEdgeWidth = "3", this.archGroupBorderColor = this.primaryBorderColor, this.archGroupBorderWidth = "2px", this.rowOdd = this.rowOdd || _t(this.mainBkg, 75) || "#ffffff", this.rowEven = this.rowEven || "#f4f4f4", this.labelColor = "black", this.errorBkgColor = "#552222", this.errorTextColor = "#552222";
  }
  updateColors() {
    var e, r, n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b, w, T, E;
    this.secondBkg = _t(this.contrast, 55), this.border2 = this.contrast, this.actorBorder = _t(this.border1, 23), this.actorBkg = this.mainBkg, this.actorTextColor = this.text, this.actorLineColor = this.actorBorder, 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 C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleInv" + C] = this["cScaleInv" + C] || xt(this["cScale" + C]);
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this.darkMode ? this["cScalePeer" + C] = this["cScalePeer" + C] || _t(this["cScale" + C], 10) : this["cScalePeer" + C] = this["cScalePeer" + C] || It(this["cScale" + C], 10);
    this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor), this.cScaleLabel0 = this.cScaleLabel0 || this.cScale1, this.cScaleLabel2 = this.cScaleLabel2 || this.cScale1;
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["cScaleLabel" + C] = this["cScaleLabel" + C] || this.scaleLabelColor;
    for (let C = 0; C < 5; C++)
      this["surface" + C] = this["surface" + C] || De(this.mainBkg, { l: -(5 + C * 5) }), this["surfacePeer" + C] = this["surfacePeer" + C] || De(this.mainBkg, { l: -(8 + C * 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 = _t(this.contrast, 30), this.sectionBkgColor2 = _t(this.contrast, 30), this.taskBorderColor = It(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 = _t(this.border1, 30), this.doneTaskBkgColor = this.done, this.doneTaskBorderColor = this.lineColor, this.critBkgColor = this.critical, this.critBorderColor = It(this.critBkgColor, 10), this.todayLineColor = this.critBkgColor, this.vertLineColor = this.critBkgColor, this.archEdgeColor = this.lineColor, this.archEdgeArrowColor = this.lineColor, 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 = De(this.primaryColor, { h: 64 }), this.fillType3 = De(this.secondaryColor, { h: 64 }), this.fillType4 = De(this.primaryColor, { h: -64 }), this.fillType5 = De(this.secondaryColor, { h: -64 }), this.fillType6 = De(this.primaryColor, { h: 128 }), this.fillType7 = De(this.secondaryColor, { h: 128 });
    for (let C = 0; C < this.THEME_COLOR_LIMIT; C++)
      this["pie" + C] = this["cScale" + C];
    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 || De(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || De(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || De(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || De(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || De(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || De(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || tc(this.quadrant1Fill) ? _t(this.quadrant1Fill) : It(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: ((r = this.xyChart) == null ? void 0 : r.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((n = this.xyChart) == null ? void 0 : n.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((i = this.xyChart) == null ? void 0 : i.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((a = this.xyChart) == null ? void 0 : a.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((s = this.xyChart) == null ? void 0 : s.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: ((d = this.xyChart) == null ? void 0 : d.plotColorPalette) || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"
    }, this.radar = {
      axisColor: ((f = this.radar) == null ? void 0 : f.axisColor) || this.lineColor,
      axisStrokeWidth: ((p = this.radar) == null ? void 0 : p.axisStrokeWidth) || 2,
      axisLabelFontSize: ((g = this.radar) == null ? void 0 : g.axisLabelFontSize) || 12,
      curveOpacity: ((m = this.radar) == null ? void 0 : m.curveOpacity) || 0.5,
      curveStrokeWidth: ((v = this.radar) == null ? void 0 : v.curveStrokeWidth) || 2,
      graticuleColor: ((y = this.radar) == null ? void 0 : y.graticuleColor) || "#DEDEDE",
      graticuleStrokeWidth: ((b = this.radar) == null ? void 0 : b.graticuleStrokeWidth) || 1,
      graticuleOpacity: ((w = this.radar) == null ? void 0 : w.graticuleOpacity) || 0.3,
      legendBoxSize: ((T = this.radar) == null ? void 0 : T.legendBoxSize) || 12,
      legendFontSize: ((E = this.radar) == null ? void 0 : E.legendFontSize) || 12
    }, 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 = It(this.pie1, 25) || this.primaryColor, this.git1 = this.pie2 || this.secondaryColor, this.git2 = this.pie3 || this.tertiaryColor, this.git3 = this.pie4 || De(this.primaryColor, { h: -30 }), this.git4 = this.pie5 || De(this.primaryColor, { h: -60 }), this.git5 = this.pie6 || De(this.primaryColor, { h: -90 }), this.git6 = this.pie7 || De(this.primaryColor, { h: 60 }), this.git7 = this.pie8 || De(this.primaryColor, { h: 120 }), this.gitInv0 = this.gitInv0 || xt(this.git0), this.gitInv1 = this.gitInv1 || xt(this.git1), this.gitInv2 = this.gitInv2 || xt(this.git2), this.gitInv3 = this.gitInv3 || xt(this.git3), this.gitInv4 = this.gitInv4 || xt(this.git4), this.gitInv5 = this.gitInv5 || xt(this.git5), this.gitInv6 = this.gitInv6 || xt(this.git6), this.gitInv7 = this.gitInv7 || xt(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 || P2, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || B2;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const r = Object.keys(e);
    r.forEach((n) => {
      this[n] = e[n];
    }), this.updateColors(), r.forEach((n) => {
      this[n] = e[n];
    });
  }
}, x(Xh, "Theme"), Xh), zX = /* @__PURE__ */ x((t) => {
  const e = new $X();
  return e.calculate(t), e;
}, "getThemeVariables"), Fo = {
  base: {
    getThemeVariables: DX
  },
  dark: {
    getThemeVariables: OX
  },
  default: {
    getThemeVariables: F2
  },
  forest: {
    getThemeVariables: FX
  },
  neutral: {
    getThemeVariables: zX
  }
}, Rs = {
  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,
    inheritDir: !1
  },
  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,
    maxLabelWidth: 360,
    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"
    ],
    titleColor: "",
    titleFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
    titleFontSize: "4ex"
  },
  class: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    arrowMarkerAbsolute: !1,
    dividerMargin: 10,
    padding: 5,
    textHeight: 10,
    defaultRenderer: "dagre-wrapper",
    htmlLabels: !1,
    hideEmptyMembersBox: !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,
    nodeSpacing: 140,
    rankSpacing: 80,
    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,
    showDataLabel: !1,
    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,
    layoutAlgorithm: "cose-bilkent"
  },
  kanban: {
    useMaxWidth: !0,
    padding: 8,
    sectionWidth: 200,
    ticketBaseUrl: ""
  },
  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
  },
  packet: {
    useMaxWidth: !0,
    rowHeight: 32,
    bitWidth: 32,
    bitsPerRow: 32,
    showBits: !0,
    paddingX: 5,
    paddingY: 5
  },
  architecture: {
    useMaxWidth: !0,
    padding: 40,
    iconSize: 80,
    fontSize: 16
  },
  radar: {
    useMaxWidth: !0,
    width: 600,
    height: 600,
    marginTop: 50,
    marginRight: 50,
    marginBottom: 50,
    marginLeft: 50,
    axisScaleFactor: 1,
    axisLabelFactor: 1.05,
    curveTension: 0.17
  },
  theme: "default",
  look: "classic",
  handDrawnSeed: 0,
  layout: "dagre",
  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",
    "suppressErrorRendering",
    "maxEdges"
  ],
  legacyMathML: !1,
  forceLegacyMathML: !1,
  deterministicIds: !1,
  fontSize: 16,
  markdownAutoWrap: !0,
  suppressErrorRendering: !1
}, wM = {
  ...Rs,
  // 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,
  elk: {
    // mergeEdges is needed here to be considered
    mergeEdges: !1,
    nodePlacementStrategy: "BRANDES_KOEPF",
    forceNodeModelOrder: !1,
    considerModelOrder: "NODES_AND_EDGES"
  },
  themeCSS: void 0,
  // add non-JSON default config values
  themeVariables: Fo.default.getThemeVariables(),
  sequence: {
    ...Rs.sequence,
    messageFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.messageFontFamily,
        fontSize: this.messageFontSize,
        fontWeight: this.messageFontWeight
      };
    }, "messageFont"),
    noteFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.noteFontFamily,
        fontSize: this.noteFontSize,
        fontWeight: this.noteFontWeight
      };
    }, "noteFont"),
    actorFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.actorFontFamily,
        fontSize: this.actorFontSize,
        fontWeight: this.actorFontWeight
      };
    }, "actorFont")
  },
  class: {
    hideEmptyMembersBox: !1
  },
  gantt: {
    ...Rs.gantt,
    tickInterval: void 0,
    useWidth: void 0
    // can probably be removed since `configKeys` already includes this
  },
  c4: {
    ...Rs.c4,
    useWidth: void 0,
    personFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.personFontFamily,
        fontSize: this.personFontSize,
        fontWeight: this.personFontWeight
      };
    }, "personFont"),
    flowchart: {
      ...Rs.flowchart,
      inheritDir: !1
      // default to legacy behavior
    },
    external_personFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_personFontFamily,
        fontSize: this.external_personFontSize,
        fontWeight: this.external_personFontWeight
      };
    }, "external_personFont"),
    systemFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.systemFontFamily,
        fontSize: this.systemFontSize,
        fontWeight: this.systemFontWeight
      };
    }, "systemFont"),
    external_systemFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_systemFontFamily,
        fontSize: this.external_systemFontSize,
        fontWeight: this.external_systemFontWeight
      };
    }, "external_systemFont"),
    system_dbFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.system_dbFontFamily,
        fontSize: this.system_dbFontSize,
        fontWeight: this.system_dbFontWeight
      };
    }, "system_dbFont"),
    external_system_dbFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_system_dbFontFamily,
        fontSize: this.external_system_dbFontSize,
        fontWeight: this.external_system_dbFontWeight
      };
    }, "external_system_dbFont"),
    system_queueFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.system_queueFontFamily,
        fontSize: this.system_queueFontSize,
        fontWeight: this.system_queueFontWeight
      };
    }, "system_queueFont"),
    external_system_queueFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_system_queueFontFamily,
        fontSize: this.external_system_queueFontSize,
        fontWeight: this.external_system_queueFontWeight
      };
    }, "external_system_queueFont"),
    containerFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.containerFontFamily,
        fontSize: this.containerFontSize,
        fontWeight: this.containerFontWeight
      };
    }, "containerFont"),
    external_containerFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_containerFontFamily,
        fontSize: this.external_containerFontSize,
        fontWeight: this.external_containerFontWeight
      };
    }, "external_containerFont"),
    container_dbFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.container_dbFontFamily,
        fontSize: this.container_dbFontSize,
        fontWeight: this.container_dbFontWeight
      };
    }, "container_dbFont"),
    external_container_dbFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_container_dbFontFamily,
        fontSize: this.external_container_dbFontSize,
        fontWeight: this.external_container_dbFontWeight
      };
    }, "external_container_dbFont"),
    container_queueFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.container_queueFontFamily,
        fontSize: this.container_queueFontSize,
        fontWeight: this.container_queueFontWeight
      };
    }, "container_queueFont"),
    external_container_queueFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_container_queueFontFamily,
        fontSize: this.external_container_queueFontSize,
        fontWeight: this.external_container_queueFontWeight
      };
    }, "external_container_queueFont"),
    componentFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.componentFontFamily,
        fontSize: this.componentFontSize,
        fontWeight: this.componentFontWeight
      };
    }, "componentFont"),
    external_componentFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_componentFontFamily,
        fontSize: this.external_componentFontSize,
        fontWeight: this.external_componentFontWeight
      };
    }, "external_componentFont"),
    component_dbFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.component_dbFontFamily,
        fontSize: this.component_dbFontSize,
        fontWeight: this.component_dbFontWeight
      };
    }, "component_dbFont"),
    external_component_dbFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_component_dbFontFamily,
        fontSize: this.external_component_dbFontSize,
        fontWeight: this.external_component_dbFontWeight
      };
    }, "external_component_dbFont"),
    component_queueFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.component_queueFontFamily,
        fontSize: this.component_queueFontSize,
        fontWeight: this.component_queueFontWeight
      };
    }, "component_queueFont"),
    external_component_queueFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.external_component_queueFontFamily,
        fontSize: this.external_component_queueFontSize,
        fontWeight: this.external_component_queueFontWeight
      };
    }, "external_component_queueFont"),
    boundaryFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.boundaryFontFamily,
        fontSize: this.boundaryFontSize,
        fontWeight: this.boundaryFontWeight
      };
    }, "boundaryFont"),
    messageFont: /* @__PURE__ */ x(function() {
      return {
        fontFamily: this.messageFontFamily,
        fontSize: this.messageFontSize,
        fontWeight: this.messageFontWeight
      };
    }, "messageFont")
  },
  pie: {
    ...Rs.pie,
    useWidth: 984
  },
  xyChart: {
    ...Rs.xyChart,
    useWidth: void 0
  },
  requirement: {
    ...Rs.requirement,
    useWidth: void 0
  },
  packet: {
    ...Rs.packet
  },
  radar: {
    ...Rs.radar
  },
  treemap: {
    useMaxWidth: !0,
    padding: 10,
    diagramPadding: 8,
    showValues: !0,
    nodeWidth: 100,
    nodeHeight: 40,
    borderWidth: 1,
    valueFontSize: 12,
    labelFontSize: 14,
    valueFormat: ","
  }
}, TM = /* @__PURE__ */ x((t, e = "") => Object.keys(t).reduce((r, n) => Array.isArray(t[n]) ? r : typeof t[n] == "object" && t[n] !== null ? [...r, e + n, ...TM(t[n], "")] : [...r, e + n], []), "keyify"), VX = new Set(TM(wM, "")), hr = wM, Iv = /* @__PURE__ */ x((t) => {
  if (ae.debug("sanitizeDirective called with", t), !(typeof t != "object" || t == null)) {
    if (Array.isArray(t)) {
      t.forEach((e) => Iv(e));
      return;
    }
    for (const e of Object.keys(t)) {
      if (ae.debug("Checking key", e), e.startsWith("__") || e.includes("proto") || e.includes("constr") || !VX.has(e) || t[e] == null) {
        ae.debug("sanitize deleting key: ", e), delete t[e];
        continue;
      }
      if (typeof t[e] == "object") {
        ae.debug("sanitizing object", e), Iv(t[e]);
        continue;
      }
      const r = ["themeCSS", "fontFamily", "altFontFamily"];
      for (const n of r)
        e.includes(n) && (ae.debug("sanitizing css option", e), t[e] = GX(t[e]));
    }
    if (t.themeVariables)
      for (const e of Object.keys(t.themeVariables)) {
        const r = t.themeVariables[e];
        r != null && r.match && !r.match(/^[\d "#%(),.;A-Za-z]+$/) && (t.themeVariables[e] = "");
      }
    ae.debug("After sanitization", t);
  }
}, "sanitizeDirective"), GX = /* @__PURE__ */ x((t) => {
  let e = 0, r = 0;
  for (const n of t) {
    if (e < r)
      return "{ /* ERROR: Unbalanced CSS */ }";
    n === "{" ? e++ : n === "}" && r++;
  }
  return e !== r ? "{ /* ERROR: Unbalanced CSS */ }" : t;
}, "sanitizeCss"), Gd = Object.freeze(hr), ia = mn({}, Gd), Ov, nu = [], wp = mn({}, Gd), $2 = /* @__PURE__ */ x((t, e) => {
  let r = mn({}, t), n = {};
  for (const i of e)
    SM(i), n = mn(n, i);
  if (r = mn(r, n), n.theme && n.theme in Fo) {
    const i = mn({}, Ov), a = mn(
      i.themeVariables || {},
      n.themeVariables
    );
    r.theme && r.theme in Fo && (r.themeVariables = Fo[r.theme].getThemeVariables(a));
  }
  return wp = r, CM(wp), wp;
}, "updateCurrentConfig"), UX = /* @__PURE__ */ x((t) => (ia = mn({}, Gd), ia = mn(ia, t), t.theme && Fo[t.theme] && (ia.themeVariables = Fo[t.theme].getThemeVariables(t.themeVariables)), $2(ia, nu), ia), "setSiteConfig"), WX = /* @__PURE__ */ x((t) => {
  Ov = mn({}, t);
}, "saveConfigFromInitialize"), HX = /* @__PURE__ */ x((t) => (ia = mn(ia, t), $2(ia, nu), ia), "updateSiteConfig"), EM = /* @__PURE__ */ x(() => mn({}, ia), "getSiteConfig"), kM = /* @__PURE__ */ x((t) => (CM(t), mn(wp, t), gr()), "setConfig"), gr = /* @__PURE__ */ x(() => mn({}, wp), "getConfig"), SM = /* @__PURE__ */ x((t) => {
  t && (["secure", ...ia.secure ?? []].forEach((e) => {
    Object.hasOwn(t, e) && (ae.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" && SM(t[e]);
  }));
}, "sanitize"), qX = /* @__PURE__ */ x((t) => {
  var e;
  Iv(t), t.fontFamily && !((e = t.themeVariables) != null && e.fontFamily) && (t.themeVariables = {
    ...t.themeVariables,
    fontFamily: t.fontFamily
  }), nu.push(t), $2(ia, nu);
}, "addDirective"), Pv = /* @__PURE__ */ x((t = ia) => {
  nu = [], $2(t, nu);
}, "reset"), YX = {
  LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."
}, B7 = {}, XX = /* @__PURE__ */ x((t) => {
  B7[t] || (ae.warn(YX[t]), B7[t] = !0);
}, "issueWarning"), CM = /* @__PURE__ */ x((t) => {
  t && (t.lazyLoadedDiagrams || t.loadExternalDiagramsAtStartup) && XX("LAZY_LOAD_DEPRECATED");
}, "checkConfig"), jX = /* @__PURE__ */ x(() => {
  let t = {};
  Ov && (t = mn(t, Ov));
  for (const e of nu)
    t = mn(t, e);
  return t;
}, "getUserDefinedConfig"), wf = /<br\s*\/?>/gi, KX = /* @__PURE__ */ x((t) => t ? LM(t).replace(/\\n/g, "#br#").split("#br#") : [""], "getRows"), ZX = /* @__PURE__ */ (() => {
  let t = !1;
  return () => {
    t || (AM(), t = !0);
  };
})();
function AM() {
  const t = "data-temp-href-target";
  Vd.addHook("beforeSanitizeAttributes", (e) => {
    e.tagName === "A" && e.hasAttribute("target") && e.setAttribute(t, e.getAttribute("target") ?? "");
  }), Vd.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"));
  });
}
x(AM, "setupDompurifyHooks");
var _M = /* @__PURE__ */ x((t) => (ZX(), Vd.sanitize(t)), "removeScript"), F7 = /* @__PURE__ */ x((t, e) => {
  var r;
  if (((r = e.flowchart) == null ? void 0 : r.htmlLabels) !== !1) {
    const n = e.securityLevel;
    n === "antiscript" || n === "strict" ? t = _M(t) : n !== "loose" && (t = LM(t), t = t.replace(/</g, "&lt;").replace(/>/g, "&gt;"), t = t.replace(/=/g, "&equals;"), t = tj(t));
  }
  return t;
}, "sanitizeMore"), fr = /* @__PURE__ */ x((t, e) => t && (e.dompurifyConfig ? t = Vd.sanitize(F7(t, e), e.dompurifyConfig).toString() : t = Vd.sanitize(F7(t, e), {
  FORBID_TAGS: ["style"]
}).toString(), t), "sanitizeText"), QX = /* @__PURE__ */ x((t, e) => typeof t == "string" ? fr(t, e) : t.flat().map((r) => fr(r, e)), "sanitizeTextOrArray"), JX = /* @__PURE__ */ x((t) => wf.test(t), "hasBreaks"), ej = /* @__PURE__ */ x((t) => t.split(wf), "splitBreaks"), tj = /* @__PURE__ */ x((t) => t.replace(/#br#/g, "<br/>"), "placeholderToBreak"), LM = /* @__PURE__ */ x((t) => t.replace(wf, "#br#"), "breakToPlaceholder"), z2 = /* @__PURE__ */ x((t) => {
  let e = "";
  return t && (e = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, e = CSS.escape(e)), e;
}, "getUrl"), Ir = /* @__PURE__ */ x((t) => !(t === !1 || ["false", "null", "0"].includes(String(t).trim().toLowerCase())), "evaluate"), rj = /* @__PURE__ */ x(function(...t) {
  const e = t.filter((r) => !isNaN(r));
  return Math.max(...e);
}, "getMax"), nj = /* @__PURE__ */ x(function(...t) {
  const e = t.filter((r) => !isNaN(r));
  return Math.min(...e);
}, "getMin"), gl = /* @__PURE__ */ x(function(t) {
  const e = t.split(/(,)/), r = [];
  for (let n = 0; n < e.length; n++) {
    let i = e[n];
    if (i === "," && n > 0 && n + 1 < e.length) {
      const a = e[n - 1], s = e[n + 1];
      ij(a, s) && (i = a + "," + s, n++, r.pop());
    }
    r.push(aj(i));
  }
  return r.join("");
}, "parseGenericTypes"), X5 = /* @__PURE__ */ x((t, e) => Math.max(0, t.split(e).length - 1), "countOccurrence"), ij = /* @__PURE__ */ x((t, e) => {
  const r = X5(t, "~"), n = X5(e, "~");
  return r === 1 && n === 1;
}, "shouldCombineSets"), aj = /* @__PURE__ */ x((t) => {
  const e = X5(t, "~");
  let r = !1;
  if (e <= 1)
    return t;
  e % 2 !== 0 && t.startsWith("~") && (t = t.substring(1), r = !0);
  const n = [...t];
  let i = n.indexOf("~"), a = n.lastIndexOf("~");
  for (; i !== -1 && a !== -1 && i !== a; )
    n[i] = "<", n[a] = ">", i = n.indexOf("~"), a = n.lastIndexOf("~");
  return r && n.unshift("~"), n.join("");
}, "processSet"), $7 = /* @__PURE__ */ x(() => window.MathMLElement !== void 0, "isMathMLSupported"), j5 = /\$\$(.*)\$\$/g, un = /* @__PURE__ */ x((t) => {
  var e;
  return (((e = t.match(j5)) == null ? void 0 : e.length) ?? 0) > 0;
}, "hasKatex"), Ag = /* @__PURE__ */ x(async (t, e) => {
  const r = document.createElement("div");
  r.innerHTML = await _g(t, e), r.id = "katex-temp", r.style.visibility = "hidden", r.style.position = "absolute", r.style.top = "0";
  const n = document.querySelector("body");
  n == null || n.insertAdjacentElement("beforeend", r);
  const i = { width: r.clientWidth, height: r.clientHeight };
  return r.remove(), i;
}, "calculateMathMLDimensions"), sj = /* @__PURE__ */ x(async (t, e) => {
  if (!un(t))
    return t;
  if (!($7() || e.legacyMathML || e.forceLegacyMathML))
    return t.replace(j5, "MathML is unsupported in this environment.");
  {
    const { default: r } = await Promise.resolve().then(() => Zde), n = e.forceLegacyMathML || !$7() && e.legacyMathML ? "htmlAndMathml" : "mathml";
    return t.split(wf).map(
      (i) => un(i) ? `<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>` : `<div>${i}</div>`
    ).join("").replace(
      j5,
      (i, a) => r.renderToString(a, {
        throwOnError: !0,
        displayMode: !0,
        output: n
      }).replace(/\n/g, " ").replace(/<annotation.*<\/annotation>/g, "")
    );
  }
}, "renderKatexUnsanitized"), _g = /* @__PURE__ */ x(async (t, e) => fr(await sj(t, e), e), "renderKatexSanitized"), at = {
  getRows: KX,
  sanitizeText: fr,
  sanitizeTextOrArray: QX,
  hasBreaks: JX,
  splitBreaks: ej,
  lineBreakRegex: wf,
  removeScript: _M,
  getUrl: z2,
  evaluate: Ir,
  getMax: rj,
  getMin: nj
}, oj = /* @__PURE__ */ x(function(t, e) {
  for (let r of e)
    t.attr(r[0], r[1]);
}, "d3Attrs"), lj = /* @__PURE__ */ x(function(t, e, r) {
  let n = /* @__PURE__ */ new Map();
  return r ? (n.set("width", "100%"), n.set("style", `max-width: ${e}px;`)) : (n.set("height", t), n.set("width", e)), n;
}, "calculateSvgSizeAttrs"), Ki = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = lj(e, r, n);
  oj(t, i);
}, "configureSvgSize"), Lg = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = e.node().getBBox(), a = i.width, s = i.height;
  ae.info(`SVG bounds: ${a}x${s}`, i);
  let o = 0, l = 0;
  ae.info(`Graph bounds: ${o}x${l}`, t), o = a + r * 2, l = s + r * 2, ae.info(`Calculated bounds: ${o}x${l}`), Ki(e, l, o, n);
  const u = `${i.x - r} ${i.y - r} ${i.width + 2 * r} ${i.height + 2 * r}`;
  e.attr("viewBox", u);
}, "setupGraphViewbox"), $m = {}, cj = /* @__PURE__ */ x((t, e, r) => {
  let n = "";
  return t in $m && $m[t] ? n = $m[t](r) : ae.warn(`No theme found for ${t}`), ` & {
    font-family: ${r.fontFamily};
    font-size: ${r.fontSize};
    fill: ${r.textColor}
  }
  @keyframes edge-animation-frame {
    from {
      stroke-dashoffset: 0;
    }
  }
  @keyframes dash {
    to {
      stroke-dashoffset: 0;
    }
  }
  & .edge-animation-slow {
    stroke-dasharray: 9,5 !important;
    stroke-dashoffset: 900;
    animation: dash 50s linear infinite;
    stroke-linecap: round;
  }
  & .edge-animation-fast {
    stroke-dasharray: 9,5 !important;
    stroke-dashoffset: 900;
    animation: dash 20s linear infinite;
    stroke-linecap: round;
  }
  /* Classes common for multiple diagrams */

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

  & .edge-thickness-normal {
    stroke-width: 1px;
  }
  & .edge-thickness-thick {
    stroke-width: 3.5px
  }
  & .edge-pattern-solid {
    stroke-dasharray: 0;
  }
  & .edge-thickness-invisible {
    stroke-width: 0;
    fill: none;
  }
  & .edge-pattern-dashed{
    stroke-dasharray: 3;
  }
  .edge-pattern-dotted {
    stroke-dasharray: 2;
  }

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

  & svg {
    font-family: ${r.fontFamily};
    font-size: ${r.fontSize};
  }
   & p {
    margin: 0
   }

  ${n}

  ${e}
`;
}, "getStyles"), uj = /* @__PURE__ */ x((t, e) => {
  e !== void 0 && ($m[t] = e);
}, "addStylesForDiagram"), hj = cj, Q6 = {};
I2(Q6, {
  clear: () => _n,
  getAccDescription: () => Un,
  getAccTitle: () => Vn,
  getDiagramTitle: () => Ln,
  setAccDescription: () => Gn,
  setAccTitle: () => Cn,
  setDiagramTitle: () => Qn
});
var J6 = "", eE = "", tE = "", rE = /* @__PURE__ */ x((t) => fr(t, gr()), "sanitizeText"), _n = /* @__PURE__ */ x(() => {
  J6 = "", tE = "", eE = "";
}, "clear"), Cn = /* @__PURE__ */ x((t) => {
  J6 = rE(t).replace(/^\s+/g, "");
}, "setAccTitle"), Vn = /* @__PURE__ */ x(() => J6, "getAccTitle"), Gn = /* @__PURE__ */ x((t) => {
  tE = rE(t).replace(/\n\s+/g, `
`);
}, "setAccDescription"), Un = /* @__PURE__ */ x(() => tE, "getAccDescription"), Qn = /* @__PURE__ */ x((t) => {
  eE = rE(t);
}, "setDiagramTitle"), Ln = /* @__PURE__ */ x(() => eE, "getDiagramTitle"), z7 = ae, dj = j6, we = gr, K5 = kM, RM = Gd, nE = /* @__PURE__ */ x((t) => fr(t, we()), "sanitizeText"), NM = Lg, fj = /* @__PURE__ */ x(() => Q6, "getCommonDb"), Bv = {}, Fv = /* @__PURE__ */ x((t, e, r) => {
  var n;
  Bv[t] && z7.warn(`Diagram with id ${t} already registered. Overwriting.`), Bv[t] = e, r && bM(t, r), uj(t, e.styles), (n = e.injectUtils) == null || n.call(
    e,
    z7,
    dj,
    we,
    nE,
    NM,
    fj(),
    () => {
    }
  );
}, "registerDiagram"), Z5 = /* @__PURE__ */ x((t) => {
  if (t in Bv)
    return Bv[t];
  throw new pj(t);
}, "getDiagram"), jh, pj = (jh = class extends Error {
  constructor(e) {
    super(`Diagram ${e} not found.`);
  }
}, x(jh, "DiagramNotFoundError"), jh);
function zm(t, e) {
  return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function gj(t, e) {
  return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function iE(t) {
  let e, r, n;
  t.length !== 2 ? (e = zm, r = (o, l) => zm(t(o), l), n = (o, l) => t(o) - l) : (e = t === zm || t === gj ? t : mj, r = t, n = t);
  function i(o, l, u = 0, h = o.length) {
    if (u < h) {
      if (e(l, l) !== 0) return h;
      do {
        const d = u + h >>> 1;
        r(o[d], l) < 0 ? u = d + 1 : h = d;
      } while (u < h);
    }
    return u;
  }
  function a(o, l, u = 0, h = o.length) {
    if (u < h) {
      if (e(l, l) !== 0) return h;
      do {
        const d = u + h >>> 1;
        r(o[d], l) <= 0 ? u = d + 1 : h = d;
      } while (u < h);
    }
    return u;
  }
  function s(o, l, u = 0, h = o.length) {
    const d = i(o, l, u, h - 1);
    return d > u && n(o[d - 1], l) > -n(o[d], l) ? d - 1 : d;
  }
  return { left: i, center: s, right: a };
}
function mj() {
  return 0;
}
function vj(t) {
  return t === null ? NaN : +t;
}
const yj = iE(zm), xj = yj.right;
iE(vj).center;
class V7 extends Map {
  constructor(e, r = Tj) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: r } }), e != null) for (const [n, i] of e) this.set(n, i);
  }
  get(e) {
    return super.get(G7(this, e));
  }
  has(e) {
    return super.has(G7(this, e));
  }
  set(e, r) {
    return super.set(bj(this, e), r);
  }
  delete(e) {
    return super.delete(wj(this, e));
  }
}
function G7({ _intern: t, _key: e }, r) {
  const n = e(r);
  return t.has(n) ? t.get(n) : r;
}
function bj({ _intern: t, _key: e }, r) {
  const n = e(r);
  return t.has(n) ? t.get(n) : (t.set(n, r), r);
}
function wj({ _intern: t, _key: e }, r) {
  const n = e(r);
  return t.has(n) && (r = t.get(n), t.delete(n)), r;
}
function Tj(t) {
  return t !== null && typeof t == "object" ? t.valueOf() : t;
}
const Ej = Math.sqrt(50), kj = Math.sqrt(10), Sj = Math.sqrt(2);
function $v(t, e, r) {
  const n = (e - t) / Math.max(0, r), i = Math.floor(Math.log10(n)), a = n / Math.pow(10, i), s = a >= Ej ? 10 : a >= kj ? 5 : a >= Sj ? 2 : 1;
  let o, l, u;
  return i < 0 ? (u = Math.pow(10, -i) / s, o = Math.round(t * u), l = Math.round(e * u), o / u < t && ++o, l / u > e && --l, u = -u) : (u = Math.pow(10, i) * s, o = Math.round(t / u), l = Math.round(e / u), o * u < t && ++o, l * u > e && --l), l < o && 0.5 <= r && r < 2 ? $v(t, e, r * 2) : [o, l, u];
}
function Cj(t, e, r) {
  if (e = +e, t = +t, r = +r, !(r > 0)) return [];
  if (t === e) return [t];
  const n = e < t, [i, a, s] = n ? $v(e, t, r) : $v(t, e, r);
  if (!(a >= i)) return [];
  const o = a - i + 1, l = new Array(o);
  if (n)
    if (s < 0) for (let u = 0; u < o; ++u) l[u] = (a - u) / -s;
    else for (let u = 0; u < o; ++u) l[u] = (a - u) * s;
  else if (s < 0) for (let u = 0; u < o; ++u) l[u] = (i + u) / -s;
  else for (let u = 0; u < o; ++u) l[u] = (i + u) * s;
  return l;
}
function Q5(t, e, r) {
  return e = +e, t = +t, r = +r, $v(t, e, r)[2];
}
function J5(t, e, r) {
  e = +e, t = +t, r = +r;
  const n = e < t, i = n ? Q5(e, t, r) : Q5(t, e, r);
  return (n ? -1 : 1) * (i < 0 ? 1 / -i : i);
}
function Aj(t, e) {
  let r;
  if (e === void 0)
    for (const n of t)
      n != null && (r < n || r === void 0 && n >= n) && (r = n);
  else {
    let n = -1;
    for (let i of t)
      (i = e(i, ++n, t)) != null && (r < i || r === void 0 && i >= i) && (r = i);
  }
  return r;
}
function _j(t, e) {
  let r;
  if (e === void 0)
    for (const n of t)
      n != null && (r > n || r === void 0 && n >= n) && (r = n);
  else {
    let n = -1;
    for (let i of t)
      (i = e(i, ++n, t)) != null && (r > i || r === void 0 && i >= i) && (r = i);
  }
  return r;
}
function Lj(t, e, r) {
  t = +t, e = +e, r = (i = arguments.length) < 2 ? (e = t, t = 0, 1) : i < 3 ? 1 : +r;
  for (var n = -1, i = Math.max(0, Math.ceil((e - t) / r)) | 0, a = new Array(i); ++n < i; )
    a[n] = t + n * r;
  return a;
}
function Rj(t) {
  return t;
}
var Vm = 1, Mb = 2, ew = 3, C1 = 4, U7 = 1e-6;
function Nj(t) {
  return "translate(" + t + ",0)";
}
function Mj(t) {
  return "translate(0," + t + ")";
}
function Dj(t) {
  return (e) => +t(e);
}
function Ij(t, e) {
  return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (r) => +t(r) + e;
}
function Oj() {
  return !this.__axis;
}
function MM(t, e) {
  var r = [], n = null, i = null, a = 6, s = 6, o = 3, l = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, u = t === Vm || t === C1 ? -1 : 1, h = t === C1 || t === Mb ? "x" : "y", d = t === Vm || t === ew ? Nj : Mj;
  function f(p) {
    var g = n ?? (e.ticks ? e.ticks.apply(e, r) : e.domain()), m = i ?? (e.tickFormat ? e.tickFormat.apply(e, r) : Rj), v = Math.max(a, 0) + o, y = e.range(), b = +y[0] + l, w = +y[y.length - 1] + l, T = (e.bandwidth ? Ij : Dj)(e.copy(), l), E = p.selection ? p.selection() : p, C = E.selectAll(".domain").data([null]), k = E.selectAll(".tick").data(g, e).order(), _ = k.exit(), L = k.enter().append("g").attr("class", "tick"), N = k.select("line"), A = k.select("text");
    C = C.merge(C.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), k = k.merge(L), N = N.merge(L.append("line").attr("stroke", "currentColor").attr(h + "2", u * a)), A = A.merge(L.append("text").attr("fill", "currentColor").attr(h, u * v).attr("dy", t === Vm ? "0em" : t === ew ? "0.71em" : "0.32em")), p !== E && (C = C.transition(p), k = k.transition(p), N = N.transition(p), A = A.transition(p), _ = _.transition(p).attr("opacity", U7).attr("transform", function(O) {
      return isFinite(O = T(O)) ? d(O + l) : this.getAttribute("transform");
    }), L.attr("opacity", U7).attr("transform", function(O) {
      var P = this.parentNode.__axis;
      return d((P && isFinite(P = P(O)) ? P : T(O)) + l);
    })), _.remove(), C.attr("d", t === C1 || t === Mb ? s ? "M" + u * s + "," + b + "H" + l + "V" + w + "H" + u * s : "M" + l + "," + b + "V" + w : s ? "M" + b + "," + u * s + "V" + l + "H" + w + "V" + u * s : "M" + b + "," + l + "H" + w), k.attr("opacity", 1).attr("transform", function(O) {
      return d(T(O) + l);
    }), N.attr(h + "2", u * a), A.attr(h, u * v).text(m), E.filter(Oj).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === Mb ? "start" : t === C1 ? "end" : "middle"), E.each(function() {
      this.__axis = T;
    });
  }
  return f.scale = function(p) {
    return arguments.length ? (e = p, f) : e;
  }, f.ticks = function() {
    return r = Array.from(arguments), f;
  }, f.tickArguments = function(p) {
    return arguments.length ? (r = p == null ? [] : Array.from(p), f) : r.slice();
  }, f.tickValues = function(p) {
    return arguments.length ? (n = p == null ? null : Array.from(p), f) : n && n.slice();
  }, f.tickFormat = function(p) {
    return arguments.length ? (i = p, f) : i;
  }, f.tickSize = function(p) {
    return arguments.length ? (a = s = +p, f) : a;
  }, f.tickSizeInner = function(p) {
    return arguments.length ? (a = +p, f) : a;
  }, f.tickSizeOuter = function(p) {
    return arguments.length ? (s = +p, f) : s;
  }, f.tickPadding = function(p) {
    return arguments.length ? (o = +p, f) : o;
  }, f.offset = function(p) {
    return arguments.length ? (l = +p, f) : l;
  }, f;
}
function Pj(t) {
  return MM(Vm, t);
}
function Bj(t) {
  return MM(ew, t);
}
var Fj = { value: () => {
} };
function DM() {
  for (var t = 0, e = arguments.length, r = {}, n; t < e; ++t) {
    if (!(n = arguments[t] + "") || n in r || /[\s.]/.test(n)) throw new Error("illegal type: " + n);
    r[n] = [];
  }
  return new Gm(r);
}
function Gm(t) {
  this._ = t;
}
function $j(t, e) {
  return t.trim().split(/^|\s+/).map(function(r) {
    var n = "", i = r.indexOf(".");
    if (i >= 0 && (n = r.slice(i + 1), r = r.slice(0, i)), r && !e.hasOwnProperty(r)) throw new Error("unknown type: " + r);
    return { type: r, name: n };
  });
}
Gm.prototype = DM.prototype = {
  constructor: Gm,
  on: function(t, e) {
    var r = this._, n = $j(t + "", r), i, a = -1, s = n.length;
    if (arguments.length < 2) {
      for (; ++a < s; ) if ((i = (t = n[a]).type) && (i = zj(r[i], t.name))) return i;
      return;
    }
    if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
    for (; ++a < s; )
      if (i = (t = n[a]).type) r[i] = W7(r[i], t.name, e);
      else if (e == null) for (i in r) r[i] = W7(r[i], t.name, null);
    return this;
  },
  copy: function() {
    var t = {}, e = this._;
    for (var r in e) t[r] = e[r].slice();
    return new Gm(t);
  },
  call: function(t, e) {
    if ((i = arguments.length - 2) > 0) for (var r = new Array(i), n = 0, i, a; n < i; ++n) r[n] = arguments[n + 2];
    if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
    for (a = this._[t], n = 0, i = a.length; n < i; ++n) a[n].value.apply(e, r);
  },
  apply: function(t, e, r) {
    if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
    for (var n = this._[t], i = 0, a = n.length; i < a; ++i) n[i].value.apply(e, r);
  }
};
function zj(t, e) {
  for (var r = 0, n = t.length, i; r < n; ++r)
    if ((i = t[r]).name === e)
      return i.value;
}
function W7(t, e, r) {
  for (var n = 0, i = t.length; n < i; ++n)
    if (t[n].name === e) {
      t[n] = Fj, t = t.slice(0, n).concat(t.slice(n + 1));
      break;
    }
  return r != null && t.push({ name: e, value: r }), t;
}
var tw = "http://www.w3.org/1999/xhtml";
const H7 = {
  svg: "http://www.w3.org/2000/svg",
  xhtml: tw,
  xlink: "http://www.w3.org/1999/xlink",
  xml: "http://www.w3.org/XML/1998/namespace",
  xmlns: "http://www.w3.org/2000/xmlns/"
};
function V2(t) {
  var e = t += "", r = e.indexOf(":");
  return r >= 0 && (e = t.slice(0, r)) !== "xmlns" && (t = t.slice(r + 1)), H7.hasOwnProperty(e) ? { space: H7[e], local: t } : t;
}
function Vj(t) {
  return function() {
    var e = this.ownerDocument, r = this.namespaceURI;
    return r === tw && e.documentElement.namespaceURI === tw ? e.createElement(t) : e.createElementNS(r, t);
  };
}
function Gj(t) {
  return function() {
    return this.ownerDocument.createElementNS(t.space, t.local);
  };
}
function IM(t) {
  var e = V2(t);
  return (e.local ? Gj : Vj)(e);
}
function Uj() {
}
function aE(t) {
  return t == null ? Uj : function() {
    return this.querySelector(t);
  };
}
function Wj(t) {
  typeof t != "function" && (t = aE(t));
  for (var e = this._groups, r = e.length, n = new Array(r), i = 0; i < r; ++i)
    for (var a = e[i], s = a.length, o = n[i] = new Array(s), l, u, h = 0; h < s; ++h)
      (l = a[h]) && (u = t.call(l, l.__data__, h, a)) && ("__data__" in l && (u.__data__ = l.__data__), o[h] = u);
  return new Ra(n, this._parents);
}
function Hj(t) {
  return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
}
function qj() {
  return [];
}
function OM(t) {
  return t == null ? qj : function() {
    return this.querySelectorAll(t);
  };
}
function Yj(t) {
  return function() {
    return Hj(t.apply(this, arguments));
  };
}
function Xj(t) {
  typeof t == "function" ? t = Yj(t) : t = OM(t);
  for (var e = this._groups, r = e.length, n = [], i = [], a = 0; a < r; ++a)
    for (var s = e[a], o = s.length, l, u = 0; u < o; ++u)
      (l = s[u]) && (n.push(t.call(l, l.__data__, u, s)), i.push(l));
  return new Ra(n, i);
}
function PM(t) {
  return function() {
    return this.matches(t);
  };
}
function BM(t) {
  return function(e) {
    return e.matches(t);
  };
}
var jj = Array.prototype.find;
function Kj(t) {
  return function() {
    return jj.call(this.children, t);
  };
}
function Zj() {
  return this.firstElementChild;
}
function Qj(t) {
  return this.select(t == null ? Zj : Kj(typeof t == "function" ? t : BM(t)));
}
var Jj = Array.prototype.filter;
function eK() {
  return Array.from(this.children);
}
function tK(t) {
  return function() {
    return Jj.call(this.children, t);
  };
}
function rK(t) {
  return this.selectAll(t == null ? eK : tK(typeof t == "function" ? t : BM(t)));
}
function nK(t) {
  typeof t != "function" && (t = PM(t));
  for (var e = this._groups, r = e.length, n = new Array(r), i = 0; i < r; ++i)
    for (var a = e[i], s = a.length, o = n[i] = [], l, u = 0; u < s; ++u)
      (l = a[u]) && t.call(l, l.__data__, u, a) && o.push(l);
  return new Ra(n, this._parents);
}
function FM(t) {
  return new Array(t.length);
}
function iK() {
  return new Ra(this._enter || this._groups.map(FM), this._parents);
}
function zv(t, e) {
  this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
}
zv.prototype = {
  constructor: zv,
  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 aK(t) {
  return function() {
    return t;
  };
}
function sK(t, e, r, n, i, a) {
  for (var s = 0, o, l = e.length, u = a.length; s < u; ++s)
    (o = e[s]) ? (o.__data__ = a[s], n[s] = o) : r[s] = new zv(t, a[s]);
  for (; s < l; ++s)
    (o = e[s]) && (i[s] = o);
}
function oK(t, e, r, n, i, a, s) {
  var o, l, u = /* @__PURE__ */ new Map(), h = e.length, d = a.length, f = new Array(h), p;
  for (o = 0; o < h; ++o)
    (l = e[o]) && (f[o] = p = s.call(l, l.__data__, o, e) + "", u.has(p) ? i[o] = l : u.set(p, l));
  for (o = 0; o < d; ++o)
    p = s.call(t, a[o], o, a) + "", (l = u.get(p)) ? (n[o] = l, l.__data__ = a[o], u.delete(p)) : r[o] = new zv(t, a[o]);
  for (o = 0; o < h; ++o)
    (l = e[o]) && u.get(f[o]) === l && (i[o] = l);
}
function lK(t) {
  return t.__data__;
}
function cK(t, e) {
  if (!arguments.length) return Array.from(this, lK);
  var r = e ? oK : sK, n = this._parents, i = this._groups;
  typeof t != "function" && (t = aK(t));
  for (var a = i.length, s = new Array(a), o = new Array(a), l = new Array(a), u = 0; u < a; ++u) {
    var h = n[u], d = i[u], f = d.length, p = uK(t.call(h, h && h.__data__, u, n)), g = p.length, m = o[u] = new Array(g), v = s[u] = new Array(g), y = l[u] = new Array(f);
    r(h, d, m, v, y, p, e);
    for (var b = 0, w = 0, T, E; b < g; ++b)
      if (T = m[b]) {
        for (b >= w && (w = b + 1); !(E = v[w]) && ++w < g; ) ;
        T._next = E || null;
      }
  }
  return s = new Ra(s, n), s._enter = o, s._exit = l, s;
}
function uK(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function hK() {
  return new Ra(this._exit || this._groups.map(FM), this._parents);
}
function dK(t, e, r) {
  var n = this.enter(), i = this, a = this.exit();
  return typeof t == "function" ? (n = t(n), n && (n = n.selection())) : n = n.append(t + ""), e != null && (i = e(i), i && (i = i.selection())), r == null ? a.remove() : r(a), n && i ? n.merge(i).order() : i;
}
function fK(t) {
  for (var e = t.selection ? t.selection() : t, r = this._groups, n = e._groups, i = r.length, a = n.length, s = Math.min(i, a), o = new Array(i), l = 0; l < s; ++l)
    for (var u = r[l], h = n[l], d = u.length, f = o[l] = new Array(d), p, g = 0; g < d; ++g)
      (p = u[g] || h[g]) && (f[g] = p);
  for (; l < i; ++l)
    o[l] = r[l];
  return new Ra(o, this._parents);
}
function pK() {
  for (var t = this._groups, e = -1, r = t.length; ++e < r; )
    for (var n = t[e], i = n.length - 1, a = n[i], s; --i >= 0; )
      (s = n[i]) && (a && s.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(s, a), a = s);
  return this;
}
function gK(t) {
  t || (t = mK);
  function e(d, f) {
    return d && f ? t(d.__data__, f.__data__) : !d - !f;
  }
  for (var r = this._groups, n = r.length, i = new Array(n), a = 0; a < n; ++a) {
    for (var s = r[a], o = s.length, l = i[a] = new Array(o), u, h = 0; h < o; ++h)
      (u = s[h]) && (l[h] = u);
    l.sort(e);
  }
  return new Ra(i, this._parents).order();
}
function mK(t, e) {
  return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function vK() {
  var t = arguments[0];
  return arguments[0] = this, t.apply(null, arguments), this;
}
function yK() {
  return Array.from(this);
}
function xK() {
  for (var t = this._groups, e = 0, r = t.length; e < r; ++e)
    for (var n = t[e], i = 0, a = n.length; i < a; ++i) {
      var s = n[i];
      if (s) return s;
    }
  return null;
}
function bK() {
  let t = 0;
  for (const e of this) ++t;
  return t;
}
function wK() {
  return !this.node();
}
function TK(t) {
  for (var e = this._groups, r = 0, n = e.length; r < n; ++r)
    for (var i = e[r], a = 0, s = i.length, o; a < s; ++a)
      (o = i[a]) && t.call(o, o.__data__, a, i);
  return this;
}
function EK(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function kK(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function SK(t, e) {
  return function() {
    this.setAttribute(t, e);
  };
}
function CK(t, e) {
  return function() {
    this.setAttributeNS(t.space, t.local, e);
  };
}
function AK(t, e) {
  return function() {
    var r = e.apply(this, arguments);
    r == null ? this.removeAttribute(t) : this.setAttribute(t, r);
  };
}
function _K(t, e) {
  return function() {
    var r = e.apply(this, arguments);
    r == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, r);
  };
}
function LK(t, e) {
  var r = V2(t);
  if (arguments.length < 2) {
    var n = this.node();
    return r.local ? n.getAttributeNS(r.space, r.local) : n.getAttribute(r);
  }
  return this.each((e == null ? r.local ? kK : EK : typeof e == "function" ? r.local ? _K : AK : r.local ? CK : SK)(r, e));
}
function $M(t) {
  return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
}
function RK(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function NK(t, e, r) {
  return function() {
    this.style.setProperty(t, e, r);
  };
}
function MK(t, e, r) {
  return function() {
    var n = e.apply(this, arguments);
    n == null ? this.style.removeProperty(t) : this.style.setProperty(t, n, r);
  };
}
function DK(t, e, r) {
  return arguments.length > 1 ? this.each((e == null ? RK : typeof e == "function" ? MK : NK)(t, e, r ?? "")) : Ud(this.node(), t);
}
function Ud(t, e) {
  return t.style.getPropertyValue(e) || $M(t).getComputedStyle(t, null).getPropertyValue(e);
}
function IK(t) {
  return function() {
    delete this[t];
  };
}
function OK(t, e) {
  return function() {
    this[t] = e;
  };
}
function PK(t, e) {
  return function() {
    var r = e.apply(this, arguments);
    r == null ? delete this[t] : this[t] = r;
  };
}
function BK(t, e) {
  return arguments.length > 1 ? this.each((e == null ? IK : typeof e == "function" ? PK : OK)(t, e)) : this.node()[t];
}
function zM(t) {
  return t.trim().split(/^|\s+/);
}
function sE(t) {
  return t.classList || new VM(t);
}
function VM(t) {
  this._node = t, this._names = zM(t.getAttribute("class") || "");
}
VM.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 GM(t, e) {
  for (var r = sE(t), n = -1, i = e.length; ++n < i; ) r.add(e[n]);
}
function UM(t, e) {
  for (var r = sE(t), n = -1, i = e.length; ++n < i; ) r.remove(e[n]);
}
function FK(t) {
  return function() {
    GM(this, t);
  };
}
function $K(t) {
  return function() {
    UM(this, t);
  };
}
function zK(t, e) {
  return function() {
    (e.apply(this, arguments) ? GM : UM)(this, t);
  };
}
function VK(t, e) {
  var r = zM(t + "");
  if (arguments.length < 2) {
    for (var n = sE(this.node()), i = -1, a = r.length; ++i < a; ) if (!n.contains(r[i])) return !1;
    return !0;
  }
  return this.each((typeof e == "function" ? zK : e ? FK : $K)(r, e));
}
function GK() {
  this.textContent = "";
}
function UK(t) {
  return function() {
    this.textContent = t;
  };
}
function WK(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.textContent = e ?? "";
  };
}
function HK(t) {
  return arguments.length ? this.each(t == null ? GK : (typeof t == "function" ? WK : UK)(t)) : this.node().textContent;
}
function qK() {
  this.innerHTML = "";
}
function YK(t) {
  return function() {
    this.innerHTML = t;
  };
}
function XK(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.innerHTML = e ?? "";
  };
}
function jK(t) {
  return arguments.length ? this.each(t == null ? qK : (typeof t == "function" ? XK : YK)(t)) : this.node().innerHTML;
}
function KK() {
  this.nextSibling && this.parentNode.appendChild(this);
}
function ZK() {
  return this.each(KK);
}
function QK() {
  this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function JK() {
  return this.each(QK);
}
function eZ(t) {
  var e = typeof t == "function" ? t : IM(t);
  return this.select(function() {
    return this.appendChild(e.apply(this, arguments));
  });
}
function tZ() {
  return null;
}
function rZ(t, e) {
  var r = typeof t == "function" ? t : IM(t), n = e == null ? tZ : typeof e == "function" ? e : aE(e);
  return this.select(function() {
    return this.insertBefore(r.apply(this, arguments), n.apply(this, arguments) || null);
  });
}
function nZ() {
  var t = this.parentNode;
  t && t.removeChild(this);
}
function iZ() {
  return this.each(nZ);
}
function aZ() {
  var t = this.cloneNode(!1), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function sZ() {
  var t = this.cloneNode(!0), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function oZ(t) {
  return this.select(t ? sZ : aZ);
}
function lZ(t) {
  return arguments.length ? this.property("__data__", t) : this.node().__data__;
}
function cZ(t) {
  return function(e) {
    t.call(this, e, this.__data__);
  };
}
function uZ(t) {
  return t.trim().split(/^|\s+/).map(function(e) {
    var r = "", n = e.indexOf(".");
    return n >= 0 && (r = e.slice(n + 1), e = e.slice(0, n)), { type: e, name: r };
  });
}
function hZ(t) {
  return function() {
    var e = this.__on;
    if (e) {
      for (var r = 0, n = -1, i = e.length, a; r < i; ++r)
        a = e[r], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++n] = a;
      ++n ? e.length = n : delete this.__on;
    }
  };
}
function dZ(t, e, r) {
  return function() {
    var n = this.__on, i, a = cZ(e);
    if (n) {
      for (var s = 0, o = n.length; s < o; ++s)
        if ((i = n[s]).type === t.type && i.name === t.name) {
          this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = r), i.value = e;
          return;
        }
    }
    this.addEventListener(t.type, a, r), i = { type: t.type, name: t.name, value: e, listener: a, options: r }, n ? n.push(i) : this.__on = [i];
  };
}
function fZ(t, e, r) {
  var n = uZ(t + ""), i, a = n.length, s;
  if (arguments.length < 2) {
    var o = this.node().__on;
    if (o) {
      for (var l = 0, u = o.length, h; l < u; ++l)
        for (i = 0, h = o[l]; i < a; ++i)
          if ((s = n[i]).type === h.type && s.name === h.name)
            return h.value;
    }
    return;
  }
  for (o = e ? dZ : hZ, i = 0; i < a; ++i) this.each(o(n[i], e, r));
  return this;
}
function WM(t, e, r) {
  var n = $M(t), i = n.CustomEvent;
  typeof i == "function" ? i = new i(e, r) : (i = n.document.createEvent("Event"), r ? (i.initEvent(e, r.bubbles, r.cancelable), i.detail = r.detail) : i.initEvent(e, !1, !1)), t.dispatchEvent(i);
}
function pZ(t, e) {
  return function() {
    return WM(this, t, e);
  };
}
function gZ(t, e) {
  return function() {
    return WM(this, t, e.apply(this, arguments));
  };
}
function mZ(t, e) {
  return this.each((typeof e == "function" ? gZ : pZ)(t, e));
}
function* vZ() {
  for (var t = this._groups, e = 0, r = t.length; e < r; ++e)
    for (var n = t[e], i = 0, a = n.length, s; i < a; ++i)
      (s = n[i]) && (yield s);
}
var HM = [null];
function Ra(t, e) {
  this._groups = t, this._parents = e;
}
function Rg() {
  return new Ra([[document.documentElement]], HM);
}
function yZ() {
  return this;
}
Ra.prototype = Rg.prototype = {
  constructor: Ra,
  select: Wj,
  selectAll: Xj,
  selectChild: Qj,
  selectChildren: rK,
  filter: nK,
  data: cK,
  enter: iK,
  exit: hK,
  join: dK,
  merge: fK,
  selection: yZ,
  order: pK,
  sort: gK,
  call: vK,
  nodes: yK,
  node: xK,
  size: bK,
  empty: wK,
  each: TK,
  attr: LK,
  style: DK,
  property: BK,
  classed: VK,
  text: HK,
  html: jK,
  raise: ZK,
  lower: JK,
  append: eZ,
  insert: rZ,
  remove: iZ,
  clone: oZ,
  datum: lZ,
  on: fZ,
  dispatch: mZ,
  [Symbol.iterator]: vZ
};
function Qe(t) {
  return typeof t == "string" ? new Ra([[document.querySelector(t)]], [document.documentElement]) : new Ra([[t]], HM);
}
function Ng(t, e, r) {
  t.prototype = e.prototype = r, r.constructor = t;
}
function G2(t, e) {
  var r = Object.create(t.prototype);
  for (var n in e) r[n] = e[n];
  return r;
}
function Au() {
}
var Ip = 0.7, Vv = 1 / Ip, _h = "\\s*([+-]?\\d+)\\s*", Op = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", Xs = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", xZ = /^#([0-9a-f]{3,8})$/, bZ = new RegExp(`^rgb\\(${_h},${_h},${_h}\\)$`), wZ = new RegExp(`^rgb\\(${Xs},${Xs},${Xs}\\)$`), TZ = new RegExp(`^rgba\\(${_h},${_h},${_h},${Op}\\)$`), EZ = new RegExp(`^rgba\\(${Xs},${Xs},${Xs},${Op}\\)$`), kZ = new RegExp(`^hsl\\(${Op},${Xs},${Xs}\\)$`), SZ = new RegExp(`^hsla\\(${Op},${Xs},${Xs},${Op}\\)$`), q7 = {
  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
};
Ng(Au, iu, {
  copy(t) {
    return Object.assign(new this.constructor(), this, t);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: Y7,
  // Deprecated! Use color.formatHex.
  formatHex: Y7,
  formatHex8: CZ,
  formatHsl: AZ,
  formatRgb: X7,
  toString: X7
});
function Y7() {
  return this.rgb().formatHex();
}
function CZ() {
  return this.rgb().formatHex8();
}
function AZ() {
  return YM(this).formatHsl();
}
function X7() {
  return this.rgb().formatRgb();
}
function iu(t) {
  var e, r;
  return t = (t + "").trim().toLowerCase(), (e = xZ.exec(t)) ? (r = e[1].length, e = parseInt(e[1], 16), r === 6 ? j7(e) : r === 3 ? new Ei(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : r === 8 ? A1(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : r === 4 ? A1(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 = bZ.exec(t)) ? new Ei(e[1], e[2], e[3], 1) : (e = wZ.exec(t)) ? new Ei(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = TZ.exec(t)) ? A1(e[1], e[2], e[3], e[4]) : (e = EZ.exec(t)) ? A1(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = kZ.exec(t)) ? Q7(e[1], e[2] / 100, e[3] / 100, 1) : (e = SZ.exec(t)) ? Q7(e[1], e[2] / 100, e[3] / 100, e[4]) : q7.hasOwnProperty(t) ? j7(q7[t]) : t === "transparent" ? new Ei(NaN, NaN, NaN, 0) : null;
}
function j7(t) {
  return new Ei(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
}
function A1(t, e, r, n) {
  return n <= 0 && (t = e = r = NaN), new Ei(t, e, r, n);
}
function qM(t) {
  return t instanceof Au || (t = iu(t)), t ? (t = t.rgb(), new Ei(t.r, t.g, t.b, t.opacity)) : new Ei();
}
function rw(t, e, r, n) {
  return arguments.length === 1 ? qM(t) : new Ei(t, e, r, n ?? 1);
}
function Ei(t, e, r, n) {
  this.r = +t, this.g = +e, this.b = +r, this.opacity = +n;
}
Ng(Ei, rw, G2(Au, {
  brighter(t) {
    return t = t == null ? Vv : Math.pow(Vv, t), new Ei(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? Ip : Math.pow(Ip, t), new Ei(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  rgb() {
    return this;
  },
  clamp() {
    return new Ei(Zc(this.r), Zc(this.g), Zc(this.b), Gv(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: K7,
  // Deprecated! Use color.formatHex.
  formatHex: K7,
  formatHex8: _Z,
  formatRgb: Z7,
  toString: Z7
}));
function K7() {
  return `#${Uc(this.r)}${Uc(this.g)}${Uc(this.b)}`;
}
function _Z() {
  return `#${Uc(this.r)}${Uc(this.g)}${Uc(this.b)}${Uc((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function Z7() {
  const t = Gv(this.opacity);
  return `${t === 1 ? "rgb(" : "rgba("}${Zc(this.r)}, ${Zc(this.g)}, ${Zc(this.b)}${t === 1 ? ")" : `, ${t})`}`;
}
function Gv(t) {
  return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
}
function Zc(t) {
  return Math.max(0, Math.min(255, Math.round(t) || 0));
}
function Uc(t) {
  return t = Zc(t), (t < 16 ? "0" : "") + t.toString(16);
}
function Q7(t, e, r, n) {
  return n <= 0 ? t = e = r = NaN : r <= 0 || r >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new fs(t, e, r, n);
}
function YM(t) {
  if (t instanceof fs) return new fs(t.h, t.s, t.l, t.opacity);
  if (t instanceof Au || (t = iu(t)), !t) return new fs();
  if (t instanceof fs) return t;
  t = t.rgb();
  var e = t.r / 255, r = t.g / 255, n = t.b / 255, i = Math.min(e, r, n), a = Math.max(e, r, n), s = NaN, o = a - i, l = (a + i) / 2;
  return o ? (e === a ? s = (r - n) / o + (r < n) * 6 : r === a ? s = (n - e) / o + 2 : s = (e - r) / o + 4, o /= l < 0.5 ? a + i : 2 - a - i, s *= 60) : o = l > 0 && l < 1 ? 0 : s, new fs(s, o, l, t.opacity);
}
function LZ(t, e, r, n) {
  return arguments.length === 1 ? YM(t) : new fs(t, e, r, n ?? 1);
}
function fs(t, e, r, n) {
  this.h = +t, this.s = +e, this.l = +r, this.opacity = +n;
}
Ng(fs, LZ, G2(Au, {
  brighter(t) {
    return t = t == null ? Vv : Math.pow(Vv, t), new fs(this.h, this.s, this.l * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? Ip : Math.pow(Ip, t), new fs(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, r = this.l, n = r + (r < 0.5 ? r : 1 - r) * e, i = 2 * r - n;
    return new Ei(
      Db(t >= 240 ? t - 240 : t + 120, i, n),
      Db(t, i, n),
      Db(t < 120 ? t + 240 : t - 120, i, n),
      this.opacity
    );
  },
  clamp() {
    return new fs(J7(this.h), _1(this.s), _1(this.l), Gv(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 = Gv(this.opacity);
    return `${t === 1 ? "hsl(" : "hsla("}${J7(this.h)}, ${_1(this.s) * 100}%, ${_1(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
  }
}));
function J7(t) {
  return t = (t || 0) % 360, t < 0 ? t + 360 : t;
}
function _1(t) {
  return Math.max(0, Math.min(1, t || 0));
}
function Db(t, e, r) {
  return (t < 60 ? e + (r - e) * t / 60 : t < 180 ? r : t < 240 ? e + (r - e) * (240 - t) / 60 : e) * 255;
}
const RZ = Math.PI / 180, NZ = 180 / Math.PI, Uv = 18, XM = 0.96422, jM = 1, KM = 0.82521, ZM = 4 / 29, Lh = 6 / 29, QM = 3 * Lh * Lh, MZ = Lh * Lh * Lh;
function JM(t) {
  if (t instanceof js) return new js(t.l, t.a, t.b, t.opacity);
  if (t instanceof No) return eD(t);
  t instanceof Ei || (t = qM(t));
  var e = Bb(t.r), r = Bb(t.g), n = Bb(t.b), i = Ib((0.2225045 * e + 0.7168786 * r + 0.0606169 * n) / jM), a, s;
  return e === r && r === n ? a = s = i : (a = Ib((0.4360747 * e + 0.3850649 * r + 0.1430804 * n) / XM), s = Ib((0.0139322 * e + 0.0971045 * r + 0.7141733 * n) / KM)), new js(116 * i - 16, 500 * (a - i), 200 * (i - s), t.opacity);
}
function DZ(t, e, r, n) {
  return arguments.length === 1 ? JM(t) : new js(t, e, r, n ?? 1);
}
function js(t, e, r, n) {
  this.l = +t, this.a = +e, this.b = +r, this.opacity = +n;
}
Ng(js, DZ, G2(Au, {
  brighter(t) {
    return new js(this.l + Uv * (t ?? 1), this.a, this.b, this.opacity);
  },
  darker(t) {
    return new js(this.l - Uv * (t ?? 1), this.a, this.b, this.opacity);
  },
  rgb() {
    var t = (this.l + 16) / 116, e = isNaN(this.a) ? t : t + this.a / 500, r = isNaN(this.b) ? t : t - this.b / 200;
    return e = XM * Ob(e), t = jM * Ob(t), r = KM * Ob(r), new Ei(
      Pb(3.1338561 * e - 1.6168667 * t - 0.4906146 * r),
      Pb(-0.9787684 * e + 1.9161415 * t + 0.033454 * r),
      Pb(0.0719453 * e - 0.2289914 * t + 1.4052427 * r),
      this.opacity
    );
  }
}));
function Ib(t) {
  return t > MZ ? Math.pow(t, 1 / 3) : t / QM + ZM;
}
function Ob(t) {
  return t > Lh ? t * t * t : QM * (t - ZM);
}
function Pb(t) {
  return 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - 0.055);
}
function Bb(t) {
  return (t /= 255) <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
}
function IZ(t) {
  if (t instanceof No) return new No(t.h, t.c, t.l, t.opacity);
  if (t instanceof js || (t = JM(t)), t.a === 0 && t.b === 0) return new No(NaN, 0 < t.l && t.l < 100 ? 0 : NaN, t.l, t.opacity);
  var e = Math.atan2(t.b, t.a) * NZ;
  return new No(e < 0 ? e + 360 : e, Math.sqrt(t.a * t.a + t.b * t.b), t.l, t.opacity);
}
function nw(t, e, r, n) {
  return arguments.length === 1 ? IZ(t) : new No(t, e, r, n ?? 1);
}
function No(t, e, r, n) {
  this.h = +t, this.c = +e, this.l = +r, this.opacity = +n;
}
function eD(t) {
  if (isNaN(t.h)) return new js(t.l, 0, 0, t.opacity);
  var e = t.h * RZ;
  return new js(t.l, Math.cos(e) * t.c, Math.sin(e) * t.c, t.opacity);
}
Ng(No, nw, G2(Au, {
  brighter(t) {
    return new No(this.h, this.c, this.l + Uv * (t ?? 1), this.opacity);
  },
  darker(t) {
    return new No(this.h, this.c, this.l - Uv * (t ?? 1), this.opacity);
  },
  rgb() {
    return eD(this).rgb();
  }
}));
const U2 = (t) => () => t;
function tD(t, e) {
  return function(r) {
    return t + r * e;
  };
}
function OZ(t, e, r) {
  return t = Math.pow(t, r), e = Math.pow(e, r) - t, r = 1 / r, function(n) {
    return Math.pow(t + n * e, r);
  };
}
function PZ(t, e) {
  var r = e - t;
  return r ? tD(t, r > 180 || r < -180 ? r - 360 * Math.round(r / 360) : r) : U2(isNaN(t) ? e : t);
}
function BZ(t) {
  return (t = +t) == 1 ? Tp : function(e, r) {
    return r - e ? OZ(e, r, t) : U2(isNaN(e) ? r : e);
  };
}
function Tp(t, e) {
  var r = e - t;
  return r ? tD(t, r) : U2(isNaN(t) ? e : t);
}
const Wv = function t(e) {
  var r = BZ(e);
  function n(i, a) {
    var s = r((i = rw(i)).r, (a = rw(a)).r), o = r(i.g, a.g), l = r(i.b, a.b), u = Tp(i.opacity, a.opacity);
    return function(h) {
      return i.r = s(h), i.g = o(h), i.b = l(h), i.opacity = u(h), i + "";
    };
  }
  return n.gamma = t, n;
}(1);
function FZ(t, e) {
  e || (e = []);
  var r = t ? Math.min(e.length, t.length) : 0, n = e.slice(), i;
  return function(a) {
    for (i = 0; i < r; ++i) n[i] = t[i] * (1 - a) + e[i] * a;
    return n;
  };
}
function $Z(t) {
  return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function zZ(t, e) {
  var r = e ? e.length : 0, n = t ? Math.min(r, t.length) : 0, i = new Array(n), a = new Array(r), s;
  for (s = 0; s < n; ++s) i[s] = oE(t[s], e[s]);
  for (; s < r; ++s) a[s] = e[s];
  return function(o) {
    for (s = 0; s < n; ++s) a[s] = i[s](o);
    return a;
  };
}
function VZ(t, e) {
  var r = /* @__PURE__ */ new Date();
  return t = +t, e = +e, function(n) {
    return r.setTime(t * (1 - n) + e * n), r;
  };
}
function us(t, e) {
  return t = +t, e = +e, function(r) {
    return t * (1 - r) + e * r;
  };
}
function GZ(t, e) {
  var r = {}, n = {}, i;
  (t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
  for (i in e)
    i in t ? r[i] = oE(t[i], e[i]) : n[i] = e[i];
  return function(a) {
    for (i in r) n[i] = r[i](a);
    return n;
  };
}
var iw = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Fb = new RegExp(iw.source, "g");
function UZ(t) {
  return function() {
    return t;
  };
}
function WZ(t) {
  return function(e) {
    return t(e) + "";
  };
}
function rD(t, e) {
  var r = iw.lastIndex = Fb.lastIndex = 0, n, i, a, s = -1, o = [], l = [];
  for (t = t + "", e = e + ""; (n = iw.exec(t)) && (i = Fb.exec(e)); )
    (a = i.index) > r && (a = e.slice(r, a), o[s] ? o[s] += a : o[++s] = a), (n = n[0]) === (i = i[0]) ? o[s] ? o[s] += i : o[++s] = i : (o[++s] = null, l.push({ i: s, x: us(n, i) })), r = Fb.lastIndex;
  return r < e.length && (a = e.slice(r), o[s] ? o[s] += a : o[++s] = a), o.length < 2 ? l[0] ? WZ(l[0].x) : UZ(e) : (e = l.length, function(u) {
    for (var h = 0, d; h < e; ++h) o[(d = l[h]).i] = d.x(u);
    return o.join("");
  });
}
function oE(t, e) {
  var r = typeof e, n;
  return e == null || r === "boolean" ? U2(e) : (r === "number" ? us : r === "string" ? (n = iu(e)) ? (e = n, Wv) : rD : e instanceof iu ? Wv : e instanceof Date ? VZ : $Z(e) ? FZ : Array.isArray(e) ? zZ : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? GZ : us)(t, e);
}
function HZ(t, e) {
  return t = +t, e = +e, function(r) {
    return Math.round(t * (1 - r) + e * r);
  };
}
var eC = 180 / Math.PI, aw = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
function nD(t, e, r, n, i, a) {
  var s, o, l;
  return (s = Math.sqrt(t * t + e * e)) && (t /= s, e /= s), (l = t * r + e * n) && (r -= t * l, n -= e * l), (o = Math.sqrt(r * r + n * n)) && (r /= o, n /= o, l /= o), t * n < e * r && (t = -t, e = -e, l = -l, s = -s), {
    translateX: i,
    translateY: a,
    rotate: Math.atan2(e, t) * eC,
    skewX: Math.atan(l) * eC,
    scaleX: s,
    scaleY: o
  };
}
var L1;
function qZ(t) {
  const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
  return e.isIdentity ? aw : nD(e.a, e.b, e.c, e.d, e.e, e.f);
}
function YZ(t) {
  return t == null || (L1 || (L1 = document.createElementNS("http://www.w3.org/2000/svg", "g")), L1.setAttribute("transform", t), !(t = L1.transform.baseVal.consolidate())) ? aw : (t = t.matrix, nD(t.a, t.b, t.c, t.d, t.e, t.f));
}
function iD(t, e, r, n) {
  function i(u) {
    return u.length ? u.pop() + " " : "";
  }
  function a(u, h, d, f, p, g) {
    if (u !== d || h !== f) {
      var m = p.push("translate(", null, e, null, r);
      g.push({ i: m - 4, x: us(u, d) }, { i: m - 2, x: us(h, f) });
    } else (d || f) && p.push("translate(" + d + e + f + r);
  }
  function s(u, h, d, f) {
    u !== h ? (u - h > 180 ? h += 360 : h - u > 180 && (u += 360), f.push({ i: d.push(i(d) + "rotate(", null, n) - 2, x: us(u, h) })) : h && d.push(i(d) + "rotate(" + h + n);
  }
  function o(u, h, d, f) {
    u !== h ? f.push({ i: d.push(i(d) + "skewX(", null, n) - 2, x: us(u, h) }) : h && d.push(i(d) + "skewX(" + h + n);
  }
  function l(u, h, d, f, p, g) {
    if (u !== d || h !== f) {
      var m = p.push(i(p) + "scale(", null, ",", null, ")");
      g.push({ i: m - 4, x: us(u, d) }, { i: m - 2, x: us(h, f) });
    } else (d !== 1 || f !== 1) && p.push(i(p) + "scale(" + d + "," + f + ")");
  }
  return function(u, h) {
    var d = [], f = [];
    return u = t(u), h = t(h), a(u.translateX, u.translateY, h.translateX, h.translateY, d, f), s(u.rotate, h.rotate, d, f), o(u.skewX, h.skewX, d, f), l(u.scaleX, u.scaleY, h.scaleX, h.scaleY, d, f), u = h = null, function(p) {
      for (var g = -1, m = f.length, v; ++g < m; ) d[(v = f[g]).i] = v.x(p);
      return d.join("");
    };
  };
}
var XZ = iD(qZ, "px, ", "px)", "deg)"), jZ = iD(YZ, ", ", ")", ")");
function KZ(t) {
  return function(e, r) {
    var n = t((e = nw(e)).h, (r = nw(r)).h), i = Tp(e.c, r.c), a = Tp(e.l, r.l), s = Tp(e.opacity, r.opacity);
    return function(o) {
      return e.h = n(o), e.c = i(o), e.l = a(o), e.opacity = s(o), e + "";
    };
  };
}
const ZZ = KZ(PZ);
var Wd = 0, y0 = 0, Xf = 0, aD = 1e3, Hv, x0, qv = 0, au = 0, W2 = 0, Pp = typeof performance == "object" && performance.now ? performance : Date, sD = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
  setTimeout(t, 17);
};
function lE() {
  return au || (sD(QZ), au = Pp.now() + W2);
}
function QZ() {
  au = 0;
}
function Yv() {
  this._call = this._time = this._next = null;
}
Yv.prototype = oD.prototype = {
  constructor: Yv,
  restart: function(t, e, r) {
    if (typeof t != "function") throw new TypeError("callback is not a function");
    r = (r == null ? lE() : +r) + (e == null ? 0 : +e), !this._next && x0 !== this && (x0 ? x0._next = this : Hv = this, x0 = this), this._call = t, this._time = r, sw();
  },
  stop: function() {
    this._call && (this._call = null, this._time = 1 / 0, sw());
  }
};
function oD(t, e, r) {
  var n = new Yv();
  return n.restart(t, e, r), n;
}
function JZ() {
  lE(), ++Wd;
  for (var t = Hv, e; t; )
    (e = au - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
  --Wd;
}
function tC() {
  au = (qv = Pp.now()) + W2, Wd = y0 = 0;
  try {
    JZ();
  } finally {
    Wd = 0, tQ(), au = 0;
  }
}
function eQ() {
  var t = Pp.now(), e = t - qv;
  e > aD && (W2 -= e, qv = t);
}
function tQ() {
  for (var t, e = Hv, r, n = 1 / 0; e; )
    e._call ? (n > e._time && (n = e._time), t = e, e = e._next) : (r = e._next, e._next = null, e = t ? t._next = r : Hv = r);
  x0 = t, sw(n);
}
function sw(t) {
  if (!Wd) {
    y0 && (y0 = clearTimeout(y0));
    var e = t - au;
    e > 24 ? (t < 1 / 0 && (y0 = setTimeout(tC, t - Pp.now() - W2)), Xf && (Xf = clearInterval(Xf))) : (Xf || (qv = Pp.now(), Xf = setInterval(eQ, aD)), Wd = 1, sD(tC));
  }
}
function rC(t, e, r) {
  var n = new Yv();
  return e = e == null ? 0 : +e, n.restart((i) => {
    n.stop(), t(i + e);
  }, e, r), n;
}
var rQ = DM("start", "end", "cancel", "interrupt"), nQ = [], lD = 0, nC = 1, ow = 2, Um = 3, iC = 4, lw = 5, Wm = 6;
function H2(t, e, r, n, i, a) {
  var s = t.__transition;
  if (!s) t.__transition = {};
  else if (r in s) return;
  iQ(t, r, {
    name: e,
    index: n,
    // For context during callback.
    group: i,
    // For context during callback.
    on: rQ,
    tween: nQ,
    time: a.time,
    delay: a.delay,
    duration: a.duration,
    ease: a.ease,
    timer: null,
    state: lD
  });
}
function cE(t, e) {
  var r = Cs(t, e);
  if (r.state > lD) throw new Error("too late; already scheduled");
  return r;
}
function no(t, e) {
  var r = Cs(t, e);
  if (r.state > Um) throw new Error("too late; already running");
  return r;
}
function Cs(t, e) {
  var r = t.__transition;
  if (!r || !(r = r[e])) throw new Error("transition not found");
  return r;
}
function iQ(t, e, r) {
  var n = t.__transition, i;
  n[e] = r, r.timer = oD(a, 0, r.time);
  function a(u) {
    r.state = nC, r.timer.restart(s, r.delay, r.time), r.delay <= u && s(u - r.delay);
  }
  function s(u) {
    var h, d, f, p;
    if (r.state !== nC) return l();
    for (h in n)
      if (p = n[h], p.name === r.name) {
        if (p.state === Um) return rC(s);
        p.state === iC ? (p.state = Wm, p.timer.stop(), p.on.call("interrupt", t, t.__data__, p.index, p.group), delete n[h]) : +h < e && (p.state = Wm, p.timer.stop(), p.on.call("cancel", t, t.__data__, p.index, p.group), delete n[h]);
      }
    if (rC(function() {
      r.state === Um && (r.state = iC, r.timer.restart(o, r.delay, r.time), o(u));
    }), r.state = ow, r.on.call("start", t, t.__data__, r.index, r.group), r.state === ow) {
      for (r.state = Um, i = new Array(f = r.tween.length), h = 0, d = -1; h < f; ++h)
        (p = r.tween[h].value.call(t, t.__data__, r.index, r.group)) && (i[++d] = p);
      i.length = d + 1;
    }
  }
  function o(u) {
    for (var h = u < r.duration ? r.ease.call(null, u / r.duration) : (r.timer.restart(l), r.state = lw, 1), d = -1, f = i.length; ++d < f; )
      i[d].call(t, h);
    r.state === lw && (r.on.call("end", t, t.__data__, r.index, r.group), l());
  }
  function l() {
    r.state = Wm, r.timer.stop(), delete n[e];
    for (var u in n) return;
    delete t.__transition;
  }
}
function aQ(t, e) {
  var r = t.__transition, n, i, a = !0, s;
  if (r) {
    e = e == null ? null : e + "";
    for (s in r) {
      if ((n = r[s]).name !== e) {
        a = !1;
        continue;
      }
      i = n.state > ow && n.state < lw, n.state = Wm, n.timer.stop(), n.on.call(i ? "interrupt" : "cancel", t, t.__data__, n.index, n.group), delete r[s];
    }
    a && delete t.__transition;
  }
}
function sQ(t) {
  return this.each(function() {
    aQ(this, t);
  });
}
function oQ(t, e) {
  var r, n;
  return function() {
    var i = no(this, t), a = i.tween;
    if (a !== r) {
      n = r = a;
      for (var s = 0, o = n.length; s < o; ++s)
        if (n[s].name === e) {
          n = n.slice(), n.splice(s, 1);
          break;
        }
    }
    i.tween = n;
  };
}
function lQ(t, e, r) {
  var n, i;
  if (typeof r != "function") throw new Error();
  return function() {
    var a = no(this, t), s = a.tween;
    if (s !== n) {
      i = (n = s).slice();
      for (var o = { name: e, value: r }, l = 0, u = i.length; l < u; ++l)
        if (i[l].name === e) {
          i[l] = o;
          break;
        }
      l === u && i.push(o);
    }
    a.tween = i;
  };
}
function cQ(t, e) {
  var r = this._id;
  if (t += "", arguments.length < 2) {
    for (var n = Cs(this.node(), r).tween, i = 0, a = n.length, s; i < a; ++i)
      if ((s = n[i]).name === t)
        return s.value;
    return null;
  }
  return this.each((e == null ? oQ : lQ)(r, t, e));
}
function uE(t, e, r) {
  var n = t._id;
  return t.each(function() {
    var i = no(this, n);
    (i.value || (i.value = {}))[e] = r.apply(this, arguments);
  }), function(i) {
    return Cs(i, n).value[e];
  };
}
function cD(t, e) {
  var r;
  return (typeof e == "number" ? us : e instanceof iu ? Wv : (r = iu(e)) ? (e = r, Wv) : rD)(t, e);
}
function uQ(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function hQ(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function dQ(t, e, r) {
  var n, i = r + "", a;
  return function() {
    var s = this.getAttribute(t);
    return s === i ? null : s === n ? a : a = e(n = s, r);
  };
}
function fQ(t, e, r) {
  var n, i = r + "", a;
  return function() {
    var s = this.getAttributeNS(t.space, t.local);
    return s === i ? null : s === n ? a : a = e(n = s, r);
  };
}
function pQ(t, e, r) {
  var n, i, a;
  return function() {
    var s, o = r(this), l;
    return o == null ? void this.removeAttribute(t) : (s = this.getAttribute(t), l = o + "", s === l ? null : s === n && l === i ? a : (i = l, a = e(n = s, o)));
  };
}
function gQ(t, e, r) {
  var n, i, a;
  return function() {
    var s, o = r(this), l;
    return o == null ? void this.removeAttributeNS(t.space, t.local) : (s = this.getAttributeNS(t.space, t.local), l = o + "", s === l ? null : s === n && l === i ? a : (i = l, a = e(n = s, o)));
  };
}
function mQ(t, e) {
  var r = V2(t), n = r === "transform" ? jZ : cD;
  return this.attrTween(t, typeof e == "function" ? (r.local ? gQ : pQ)(r, n, uE(this, "attr." + t, e)) : e == null ? (r.local ? hQ : uQ)(r) : (r.local ? fQ : dQ)(r, n, e));
}
function vQ(t, e) {
  return function(r) {
    this.setAttribute(t, e.call(this, r));
  };
}
function yQ(t, e) {
  return function(r) {
    this.setAttributeNS(t.space, t.local, e.call(this, r));
  };
}
function xQ(t, e) {
  var r, n;
  function i() {
    var a = e.apply(this, arguments);
    return a !== n && (r = (n = a) && yQ(t, a)), r;
  }
  return i._value = e, i;
}
function bQ(t, e) {
  var r, n;
  function i() {
    var a = e.apply(this, arguments);
    return a !== n && (r = (n = a) && vQ(t, a)), r;
  }
  return i._value = e, i;
}
function wQ(t, e) {
  var r = "attr." + t;
  if (arguments.length < 2) return (r = this.tween(r)) && r._value;
  if (e == null) return this.tween(r, null);
  if (typeof e != "function") throw new Error();
  var n = V2(t);
  return this.tween(r, (n.local ? xQ : bQ)(n, e));
}
function TQ(t, e) {
  return function() {
    cE(this, t).delay = +e.apply(this, arguments);
  };
}
function EQ(t, e) {
  return e = +e, function() {
    cE(this, t).delay = e;
  };
}
function kQ(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? TQ : EQ)(e, t)) : Cs(this.node(), e).delay;
}
function SQ(t, e) {
  return function() {
    no(this, t).duration = +e.apply(this, arguments);
  };
}
function CQ(t, e) {
  return e = +e, function() {
    no(this, t).duration = e;
  };
}
function AQ(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? SQ : CQ)(e, t)) : Cs(this.node(), e).duration;
}
function _Q(t, e) {
  if (typeof e != "function") throw new Error();
  return function() {
    no(this, t).ease = e;
  };
}
function LQ(t) {
  var e = this._id;
  return arguments.length ? this.each(_Q(e, t)) : Cs(this.node(), e).ease;
}
function RQ(t, e) {
  return function() {
    var r = e.apply(this, arguments);
    if (typeof r != "function") throw new Error();
    no(this, t).ease = r;
  };
}
function NQ(t) {
  if (typeof t != "function") throw new Error();
  return this.each(RQ(this._id, t));
}
function MQ(t) {
  typeof t != "function" && (t = PM(t));
  for (var e = this._groups, r = e.length, n = new Array(r), i = 0; i < r; ++i)
    for (var a = e[i], s = a.length, o = n[i] = [], l, u = 0; u < s; ++u)
      (l = a[u]) && t.call(l, l.__data__, u, a) && o.push(l);
  return new Uo(n, this._parents, this._name, this._id);
}
function DQ(t) {
  if (t._id !== this._id) throw new Error();
  for (var e = this._groups, r = t._groups, n = e.length, i = r.length, a = Math.min(n, i), s = new Array(n), o = 0; o < a; ++o)
    for (var l = e[o], u = r[o], h = l.length, d = s[o] = new Array(h), f, p = 0; p < h; ++p)
      (f = l[p] || u[p]) && (d[p] = f);
  for (; o < n; ++o)
    s[o] = e[o];
  return new Uo(s, this._parents, this._name, this._id);
}
function IQ(t) {
  return (t + "").trim().split(/^|\s+/).every(function(e) {
    var r = e.indexOf(".");
    return r >= 0 && (e = e.slice(0, r)), !e || e === "start";
  });
}
function OQ(t, e, r) {
  var n, i, a = IQ(e) ? cE : no;
  return function() {
    var s = a(this, t), o = s.on;
    o !== n && (i = (n = o).copy()).on(e, r), s.on = i;
  };
}
function PQ(t, e) {
  var r = this._id;
  return arguments.length < 2 ? Cs(this.node(), r).on.on(t) : this.each(OQ(r, t, e));
}
function BQ(t) {
  return function() {
    var e = this.parentNode;
    for (var r in this.__transition) if (+r !== t) return;
    e && e.removeChild(this);
  };
}
function FQ() {
  return this.on("end.remove", BQ(this._id));
}
function $Q(t) {
  var e = this._name, r = this._id;
  typeof t != "function" && (t = aE(t));
  for (var n = this._groups, i = n.length, a = new Array(i), s = 0; s < i; ++s)
    for (var o = n[s], l = o.length, u = a[s] = new Array(l), h, d, f = 0; f < l; ++f)
      (h = o[f]) && (d = t.call(h, h.__data__, f, o)) && ("__data__" in h && (d.__data__ = h.__data__), u[f] = d, H2(u[f], e, r, f, u, Cs(h, r)));
  return new Uo(a, this._parents, e, r);
}
function zQ(t) {
  var e = this._name, r = this._id;
  typeof t != "function" && (t = OM(t));
  for (var n = this._groups, i = n.length, a = [], s = [], o = 0; o < i; ++o)
    for (var l = n[o], u = l.length, h, d = 0; d < u; ++d)
      if (h = l[d]) {
        for (var f = t.call(h, h.__data__, d, l), p, g = Cs(h, r), m = 0, v = f.length; m < v; ++m)
          (p = f[m]) && H2(p, e, r, m, f, g);
        a.push(f), s.push(h);
      }
  return new Uo(a, s, e, r);
}
var VQ = Rg.prototype.constructor;
function GQ() {
  return new VQ(this._groups, this._parents);
}
function UQ(t, e) {
  var r, n, i;
  return function() {
    var a = Ud(this, t), s = (this.style.removeProperty(t), Ud(this, t));
    return a === s ? null : a === r && s === n ? i : i = e(r = a, n = s);
  };
}
function uD(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function WQ(t, e, r) {
  var n, i = r + "", a;
  return function() {
    var s = Ud(this, t);
    return s === i ? null : s === n ? a : a = e(n = s, r);
  };
}
function HQ(t, e, r) {
  var n, i, a;
  return function() {
    var s = Ud(this, t), o = r(this), l = o + "";
    return o == null && (l = o = (this.style.removeProperty(t), Ud(this, t))), s === l ? null : s === n && l === i ? a : (i = l, a = e(n = s, o));
  };
}
function qQ(t, e) {
  var r, n, i, a = "style." + e, s = "end." + a, o;
  return function() {
    var l = no(this, t), u = l.on, h = l.value[a] == null ? o || (o = uD(e)) : void 0;
    (u !== r || i !== h) && (n = (r = u).copy()).on(s, i = h), l.on = n;
  };
}
function YQ(t, e, r) {
  var n = (t += "") == "transform" ? XZ : cD;
  return e == null ? this.styleTween(t, UQ(t, n)).on("end.style." + t, uD(t)) : typeof e == "function" ? this.styleTween(t, HQ(t, n, uE(this, "style." + t, e))).each(qQ(this._id, t)) : this.styleTween(t, WQ(t, n, e), r).on("end.style." + t, null);
}
function XQ(t, e, r) {
  return function(n) {
    this.style.setProperty(t, e.call(this, n), r);
  };
}
function jQ(t, e, r) {
  var n, i;
  function a() {
    var s = e.apply(this, arguments);
    return s !== i && (n = (i = s) && XQ(t, s, r)), n;
  }
  return a._value = e, a;
}
function KQ(t, e, r) {
  var n = "style." + (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();
  return this.tween(n, jQ(t, e, r ?? ""));
}
function ZQ(t) {
  return function() {
    this.textContent = t;
  };
}
function QQ(t) {
  return function() {
    var e = t(this);
    this.textContent = e ?? "";
  };
}
function JQ(t) {
  return this.tween("text", typeof t == "function" ? QQ(uE(this, "text", t)) : ZQ(t == null ? "" : t + ""));
}
function eJ(t) {
  return function(e) {
    this.textContent = t.call(this, e);
  };
}
function tJ(t) {
  var e, r;
  function n() {
    var i = t.apply(this, arguments);
    return i !== r && (e = (r = i) && eJ(i)), e;
  }
  return n._value = t, n;
}
function rJ(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, tJ(t));
}
function nJ() {
  for (var t = this._name, e = this._id, r = hD(), n = this._groups, i = n.length, a = 0; a < i; ++a)
    for (var s = n[a], o = s.length, l, u = 0; u < o; ++u)
      if (l = s[u]) {
        var h = Cs(l, e);
        H2(l, t, r, u, s, {
          time: h.time + h.delay + h.duration,
          delay: 0,
          duration: h.duration,
          ease: h.ease
        });
      }
  return new Uo(n, this._parents, t, r);
}
function iJ() {
  var t, e, r = this, n = r._id, i = r.size();
  return new Promise(function(a, s) {
    var o = { value: s }, l = { value: function() {
      --i === 0 && a();
    } };
    r.each(function() {
      var u = no(this, n), h = u.on;
      h !== t && (e = (t = h).copy(), e._.cancel.push(o), e._.interrupt.push(o), e._.end.push(l)), u.on = e;
    }), i === 0 && a();
  });
}
var aJ = 0;
function Uo(t, e, r, n) {
  this._groups = t, this._parents = e, this._name = r, this._id = n;
}
function hD() {
  return ++aJ;
}
var mo = Rg.prototype;
Uo.prototype = {
  constructor: Uo,
  select: $Q,
  selectAll: zQ,
  selectChild: mo.selectChild,
  selectChildren: mo.selectChildren,
  filter: MQ,
  merge: DQ,
  selection: GQ,
  transition: nJ,
  call: mo.call,
  nodes: mo.nodes,
  node: mo.node,
  size: mo.size,
  empty: mo.empty,
  each: mo.each,
  on: PQ,
  attr: mQ,
  attrTween: wQ,
  style: YQ,
  styleTween: KQ,
  text: JQ,
  textTween: rJ,
  remove: FQ,
  tween: cQ,
  delay: kQ,
  duration: AQ,
  ease: LQ,
  easeVarying: NQ,
  end: iJ,
  [Symbol.iterator]: mo[Symbol.iterator]
};
function sJ(t) {
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
var oJ = {
  time: null,
  // Set on use.
  delay: 0,
  duration: 250,
  ease: sJ
};
function lJ(t, e) {
  for (var r; !(r = t.__transition) || !(r = r[e]); )
    if (!(t = t.parentNode))
      throw new Error(`transition ${e} not found`);
  return r;
}
function cJ(t) {
  var e, r;
  t instanceof Uo ? (e = t._id, t = t._name) : (e = hD(), (r = oJ).time = lE(), t = t == null ? null : t + "");
  for (var n = this._groups, i = n.length, a = 0; a < i; ++a)
    for (var s = n[a], o = s.length, l, u = 0; u < o; ++u)
      (l = s[u]) && H2(l, t, e, u, s, r || lJ(l, e));
  return new Uo(n, this._parents, t, e);
}
Rg.prototype.interrupt = sQ;
Rg.prototype.transition = cJ;
const cw = Math.PI, uw = 2 * cw, Nc = 1e-6, uJ = uw - Nc;
function dD(t) {
  this._ += t[0];
  for (let e = 1, r = t.length; e < r; ++e)
    this._ += arguments[e] + t[e];
}
function hJ(t) {
  let e = Math.floor(t);
  if (!(e >= 0)) throw new Error(`invalid digits: ${t}`);
  if (e > 15) return dD;
  const r = 10 ** e;
  return function(n) {
    this._ += n[0];
    for (let i = 1, a = n.length; i < a; ++i)
      this._ += Math.round(arguments[i] * r) / r + n[i];
  };
}
let dJ = class {
  constructor(e) {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null, this._ = "", this._append = e == null ? dD : hJ(e);
  }
  moveTo(e, r) {
    this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +r}`;
  }
  closePath() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
  }
  lineTo(e, r) {
    this._append`L${this._x1 = +e},${this._y1 = +r}`;
  }
  quadraticCurveTo(e, r, n, i) {
    this._append`Q${+e},${+r},${this._x1 = +n},${this._y1 = +i}`;
  }
  bezierCurveTo(e, r, n, i, a, s) {
    this._append`C${+e},${+r},${+n},${+i},${this._x1 = +a},${this._y1 = +s}`;
  }
  arcTo(e, r, n, i, a) {
    if (e = +e, r = +r, n = +n, i = +i, a = +a, a < 0) throw new Error(`negative radius: ${a}`);
    let s = this._x1, o = this._y1, l = n - e, u = i - r, h = s - e, d = o - r, f = h * h + d * d;
    if (this._x1 === null)
      this._append`M${this._x1 = e},${this._y1 = r}`;
    else if (f > Nc) if (!(Math.abs(d * l - u * h) > Nc) || !a)
      this._append`L${this._x1 = e},${this._y1 = r}`;
    else {
      let p = n - s, g = i - o, m = l * l + u * u, v = p * p + g * g, y = Math.sqrt(m), b = Math.sqrt(f), w = a * Math.tan((cw - Math.acos((m + f - v) / (2 * y * b))) / 2), T = w / b, E = w / y;
      Math.abs(T - 1) > Nc && this._append`L${e + T * h},${r + T * d}`, this._append`A${a},${a},0,0,${+(d * p > h * g)},${this._x1 = e + E * l},${this._y1 = r + E * u}`;
    }
  }
  arc(e, r, n, i, a, s) {
    if (e = +e, r = +r, n = +n, s = !!s, n < 0) throw new Error(`negative radius: ${n}`);
    let o = n * Math.cos(i), l = n * Math.sin(i), u = e + o, h = r + l, d = 1 ^ s, f = s ? i - a : a - i;
    this._x1 === null ? this._append`M${u},${h}` : (Math.abs(this._x1 - u) > Nc || Math.abs(this._y1 - h) > Nc) && this._append`L${u},${h}`, n && (f < 0 && (f = f % uw + uw), f > uJ ? this._append`A${n},${n},0,1,${d},${e - o},${r - l}A${n},${n},0,1,${d},${this._x1 = u},${this._y1 = h}` : f > Nc && this._append`A${n},${n},0,${+(f >= cw)},${d},${this._x1 = e + n * Math.cos(a)},${this._y1 = r + n * Math.sin(a)}`);
  }
  rect(e, r, n, i) {
    this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +r}h${n = +n}v${+i}h${-n}Z`;
  }
  toString() {
    return this._;
  }
};
function fJ(t) {
  return Math.abs(t = Math.round(t)) >= 1e21 ? t.toLocaleString("en").replace(/,/g, "") : t.toString(10);
}
function Xv(t, e) {
  if ((r = (t = e ? t.toExponential(e - 1) : t.toExponential()).indexOf("e")) < 0) return null;
  var r, n = t.slice(0, r);
  return [
    n.length > 1 ? n[0] + n.slice(2) : n,
    +t.slice(r + 1)
  ];
}
function Hd(t) {
  return t = Xv(Math.abs(t)), t ? t[1] : NaN;
}
function pJ(t, e) {
  return function(r, n) {
    for (var i = r.length, a = [], s = 0, o = t[0], l = 0; i > 0 && o > 0 && (l + o + 1 > n && (o = Math.max(1, n - l)), a.push(r.substring(i -= o, i + o)), !((l += o + 1) > n)); )
      o = t[s = (s + 1) % t.length];
    return a.reverse().join(e);
  };
}
function gJ(t) {
  return function(e) {
    return e.replace(/[0-9]/g, function(r) {
      return t[+r];
    });
  };
}
var mJ = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function jv(t) {
  if (!(e = mJ.exec(t))) throw new Error("invalid format: " + t);
  var e;
  return new hE({
    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]
  });
}
jv.prototype = hE.prototype;
function hE(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 + "";
}
hE.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 vJ(t) {
  e: for (var e = t.length, r = 1, n = -1, i; r < e; ++r)
    switch (t[r]) {
      case ".":
        n = i = r;
        break;
      case "0":
        n === 0 && (n = r), i = r;
        break;
      default:
        if (!+t[r]) break e;
        n > 0 && (n = 0);
        break;
    }
  return n > 0 ? t.slice(0, n) + t.slice(i + 1) : t;
}
var fD;
function yJ(t, e) {
  var r = Xv(t, e);
  if (!r) return t + "";
  var n = r[0], i = r[1], a = i - (fD = Math.max(-8, Math.min(8, Math.floor(i / 3))) * 3) + 1, s = n.length;
  return a === s ? n : a > s ? n + new Array(a - s + 1).join("0") : a > 0 ? n.slice(0, a) + "." + n.slice(a) : "0." + new Array(1 - a).join("0") + Xv(t, Math.max(0, e + a - 1))[0];
}
function aC(t, e) {
  var r = Xv(t, e);
  if (!r) return t + "";
  var n = r[0], i = r[1];
  return i < 0 ? "0." + new Array(-i).join("0") + n : n.length > i + 1 ? n.slice(0, i + 1) + "." + n.slice(i + 1) : n + new Array(i - n.length + 2).join("0");
}
const sC = {
  "%": (t, e) => (t * 100).toFixed(e),
  b: (t) => Math.round(t).toString(2),
  c: (t) => t + "",
  d: fJ,
  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) => aC(t * 100, e),
  r: aC,
  s: yJ,
  X: (t) => Math.round(t).toString(16).toUpperCase(),
  x: (t) => Math.round(t).toString(16)
};
function oC(t) {
  return t;
}
var lC = Array.prototype.map, cC = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function xJ(t) {
  var e = t.grouping === void 0 || t.thousands === void 0 ? oC : pJ(lC.call(t.grouping, Number), t.thousands + ""), r = t.currency === void 0 ? "" : t.currency[0] + "", n = t.currency === void 0 ? "" : t.currency[1] + "", i = t.decimal === void 0 ? "." : t.decimal + "", a = t.numerals === void 0 ? oC : gJ(lC.call(t.numerals, String)), s = t.percent === void 0 ? "%" : t.percent + "", o = t.minus === void 0 ? "−" : t.minus + "", l = t.nan === void 0 ? "NaN" : t.nan + "";
  function u(d) {
    d = jv(d);
    var f = d.fill, p = d.align, g = d.sign, m = d.symbol, v = d.zero, y = d.width, b = d.comma, w = d.precision, T = d.trim, E = d.type;
    E === "n" ? (b = !0, E = "g") : sC[E] || (w === void 0 && (w = 12), T = !0, E = "g"), (v || f === "0" && p === "=") && (v = !0, f = "0", p = "=");
    var C = m === "$" ? r : m === "#" && /[boxX]/.test(E) ? "0" + E.toLowerCase() : "", k = m === "$" ? n : /[%p]/.test(E) ? s : "", _ = sC[E], L = /[defgprs%]/.test(E);
    w = w === void 0 ? 6 : /[gprs]/.test(E) ? Math.max(1, Math.min(21, w)) : Math.max(0, Math.min(20, w));
    function N(A) {
      var O = C, P = k, S, R, I;
      if (E === "c")
        P = _(A) + P, A = "";
      else {
        A = +A;
        var D = A < 0 || 1 / A < 0;
        if (A = isNaN(A) ? l : _(Math.abs(A), w), T && (A = vJ(A)), D && +A == 0 && g !== "+" && (D = !1), O = (D ? g === "(" ? g : o : g === "-" || g === "(" ? "" : g) + O, P = (E === "s" ? cC[8 + fD / 3] : "") + P + (D && g === "(" ? ")" : ""), L) {
          for (S = -1, R = A.length; ++S < R; )
            if (I = A.charCodeAt(S), 48 > I || I > 57) {
              P = (I === 46 ? i + A.slice(S + 1) : A.slice(S)) + P, A = A.slice(0, S);
              break;
            }
        }
      }
      b && !v && (A = e(A, 1 / 0));
      var M = O.length + A.length + P.length, B = M < y ? new Array(y - M + 1).join(f) : "";
      switch (b && v && (A = e(B + A, B.length ? y - P.length : 1 / 0), B = ""), p) {
        case "<":
          A = O + A + P + B;
          break;
        case "=":
          A = O + B + A + P;
          break;
        case "^":
          A = B.slice(0, M = B.length >> 1) + O + A + P + B.slice(M);
          break;
        default:
          A = B + O + A + P;
          break;
      }
      return a(A);
    }
    return N.toString = function() {
      return d + "";
    }, N;
  }
  function h(d, f) {
    var p = u((d = jv(d), d.type = "f", d)), g = Math.max(-8, Math.min(8, Math.floor(Hd(f) / 3))) * 3, m = Math.pow(10, -g), v = cC[8 + g / 3];
    return function(y) {
      return p(m * y) + v;
    };
  }
  return {
    format: u,
    formatPrefix: h
  };
}
var R1, Pc, pD;
bJ({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});
function bJ(t) {
  return R1 = xJ(t), Pc = R1.format, pD = R1.formatPrefix, R1;
}
function wJ(t) {
  return Math.max(0, -Hd(Math.abs(t)));
}
function TJ(t, e) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Hd(e) / 3))) * 3 - Hd(Math.abs(t)));
}
function EJ(t, e) {
  return t = Math.abs(t), e = Math.abs(e) - t, Math.max(0, Hd(e) - Hd(t)) + 1;
}
function kJ(t) {
  var e = 0, r = t.children, n = r && r.length;
  if (!n) e = 1;
  else for (; --n >= 0; ) e += r[n].value;
  t.value = e;
}
function SJ() {
  return this.eachAfter(kJ);
}
function CJ(t, e) {
  let r = -1;
  for (const n of this)
    t.call(e, n, ++r, this);
  return this;
}
function AJ(t, e) {
  for (var r = this, n = [r], i, a, s = -1; r = n.pop(); )
    if (t.call(e, r, ++s, this), i = r.children)
      for (a = i.length - 1; a >= 0; --a)
        n.push(i[a]);
  return this;
}
function _J(t, e) {
  for (var r = this, n = [r], i = [], a, s, o, l = -1; r = n.pop(); )
    if (i.push(r), a = r.children)
      for (s = 0, o = a.length; s < o; ++s)
        n.push(a[s]);
  for (; r = i.pop(); )
    t.call(e, r, ++l, this);
  return this;
}
function LJ(t, e) {
  let r = -1;
  for (const n of this)
    if (t.call(e, n, ++r, this))
      return n;
}
function RJ(t) {
  return this.eachAfter(function(e) {
    for (var r = +t(e.data) || 0, n = e.children, i = n && n.length; --i >= 0; ) r += n[i].value;
    e.value = r;
  });
}
function NJ(t) {
  return this.eachBefore(function(e) {
    e.children && e.children.sort(t);
  });
}
function MJ(t) {
  for (var e = this, r = DJ(e, t), n = [e]; e !== r; )
    e = e.parent, n.push(e);
  for (var i = n.length; t !== r; )
    n.splice(i, 0, t), t = t.parent;
  return n;
}
function DJ(t, e) {
  if (t === e) return t;
  var r = t.ancestors(), n = e.ancestors(), i = null;
  for (t = r.pop(), e = n.pop(); t === e; )
    i = t, t = r.pop(), e = n.pop();
  return i;
}
function IJ() {
  for (var t = this, e = [t]; t = t.parent; )
    e.push(t);
  return e;
}
function OJ() {
  return Array.from(this);
}
function PJ() {
  var t = [];
  return this.eachBefore(function(e) {
    e.children || t.push(e);
  }), t;
}
function BJ() {
  var t = this, e = [];
  return t.each(function(r) {
    r !== t && e.push({ source: r.parent, target: r });
  }), e;
}
function* FJ() {
  var t = this, e, r = [t], n, i, a;
  do
    for (e = r.reverse(), r = []; t = e.pop(); )
      if (yield t, n = t.children)
        for (i = 0, a = n.length; i < a; ++i)
          r.push(n[i]);
  while (r.length);
}
function dE(t, e) {
  t instanceof Map ? (t = [void 0, t], e === void 0 && (e = VJ)) : e === void 0 && (e = zJ);
  for (var r = new Kv(t), n, i = [r], a, s, o, l; n = i.pop(); )
    if ((s = e(n.data)) && (l = (s = Array.from(s)).length))
      for (n.children = s, o = l - 1; o >= 0; --o)
        i.push(a = s[o] = new Kv(s[o])), a.parent = n, a.depth = n.depth + 1;
  return r.eachBefore(UJ);
}
function $J() {
  return dE(this).eachBefore(GJ);
}
function zJ(t) {
  return t.children;
}
function VJ(t) {
  return Array.isArray(t) ? t[1] : null;
}
function GJ(t) {
  t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
}
function UJ(t) {
  var e = 0;
  do
    t.height = e;
  while ((t = t.parent) && t.height < ++e);
}
function Kv(t) {
  this.data = t, this.depth = this.height = 0, this.parent = null;
}
Kv.prototype = dE.prototype = {
  constructor: Kv,
  count: SJ,
  each: CJ,
  eachAfter: _J,
  eachBefore: AJ,
  find: LJ,
  sum: RJ,
  sort: NJ,
  path: MJ,
  ancestors: IJ,
  descendants: OJ,
  leaves: PJ,
  links: BJ,
  copy: $J,
  [Symbol.iterator]: FJ
};
function WJ(t) {
  if (typeof t != "function") throw new Error();
  return t;
}
function jf() {
  return 0;
}
function Kf(t) {
  return function() {
    return t;
  };
}
function HJ(t) {
  t.x0 = Math.round(t.x0), t.y0 = Math.round(t.y0), t.x1 = Math.round(t.x1), t.y1 = Math.round(t.y1);
}
function qJ(t, e, r, n, i) {
  for (var a = t.children, s, o = -1, l = a.length, u = t.value && (n - e) / t.value; ++o < l; )
    s = a[o], s.y0 = r, s.y1 = i, s.x0 = e, s.x1 = e += s.value * u;
}
function YJ(t, e, r, n, i) {
  for (var a = t.children, s, o = -1, l = a.length, u = t.value && (i - r) / t.value; ++o < l; )
    s = a[o], s.x0 = e, s.x1 = n, s.y0 = r, s.y1 = r += s.value * u;
}
var XJ = (1 + Math.sqrt(5)) / 2;
function jJ(t, e, r, n, i, a) {
  for (var s = [], o = e.children, l, u, h = 0, d = 0, f = o.length, p, g, m = e.value, v, y, b, w, T, E, C; h < f; ) {
    p = i - r, g = a - n;
    do
      v = o[d++].value;
    while (!v && d < f);
    for (y = b = v, E = Math.max(g / p, p / g) / (m * t), C = v * v * E, T = Math.max(b / C, C / y); d < f; ++d) {
      if (v += u = o[d].value, u < y && (y = u), u > b && (b = u), C = v * v * E, w = Math.max(b / C, C / y), w > T) {
        v -= u;
        break;
      }
      T = w;
    }
    s.push(l = { value: v, dice: p < g, children: o.slice(h, d) }), l.dice ? qJ(l, r, n, i, m ? n += g * v / m : a) : YJ(l, r, n, m ? r += p * v / m : i, a), m -= v, h = d;
  }
  return s;
}
const KJ = function t(e) {
  function r(n, i, a, s, o) {
    jJ(e, n, i, a, s, o);
  }
  return r.ratio = function(n) {
    return t((n = +n) > 1 ? n : 1);
  }, r;
}(XJ);
function ZJ() {
  var t = KJ, e = !1, r = 1, n = 1, i = [0], a = jf, s = jf, o = jf, l = jf, u = jf;
  function h(f) {
    return f.x0 = f.y0 = 0, f.x1 = r, f.y1 = n, f.eachBefore(d), i = [0], e && f.eachBefore(HJ), f;
  }
  function d(f) {
    var p = i[f.depth], g = f.x0 + p, m = f.y0 + p, v = f.x1 - p, y = f.y1 - p;
    v < g && (g = v = (g + v) / 2), y < m && (m = y = (m + y) / 2), f.x0 = g, f.y0 = m, f.x1 = v, f.y1 = y, f.children && (p = i[f.depth + 1] = a(f) / 2, g += u(f) - p, m += s(f) - p, v -= o(f) - p, y -= l(f) - p, v < g && (g = v = (g + v) / 2), y < m && (m = y = (m + y) / 2), t(f, g, m, v, y));
  }
  return h.round = function(f) {
    return arguments.length ? (e = !!f, h) : e;
  }, h.size = function(f) {
    return arguments.length ? (r = +f[0], n = +f[1], h) : [r, n];
  }, h.tile = function(f) {
    return arguments.length ? (t = WJ(f), h) : t;
  }, h.padding = function(f) {
    return arguments.length ? h.paddingInner(f).paddingOuter(f) : h.paddingInner();
  }, h.paddingInner = function(f) {
    return arguments.length ? (a = typeof f == "function" ? f : Kf(+f), h) : a;
  }, h.paddingOuter = function(f) {
    return arguments.length ? h.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f) : h.paddingTop();
  }, h.paddingTop = function(f) {
    return arguments.length ? (s = typeof f == "function" ? f : Kf(+f), h) : s;
  }, h.paddingRight = function(f) {
    return arguments.length ? (o = typeof f == "function" ? f : Kf(+f), h) : o;
  }, h.paddingBottom = function(f) {
    return arguments.length ? (l = typeof f == "function" ? f : Kf(+f), h) : l;
  }, h.paddingLeft = function(f) {
    return arguments.length ? (u = typeof f == "function" ? f : Kf(+f), h) : u;
  }, h;
}
function q2(t, e) {
  switch (arguments.length) {
    case 0:
      break;
    case 1:
      this.range(t);
      break;
    default:
      this.range(e).domain(t);
      break;
  }
  return this;
}
const uC = Symbol("implicit");
function Qc() {
  var t = new V7(), e = [], r = [], n = uC;
  function i(a) {
    let s = t.get(a);
    if (s === void 0) {
      if (n !== uC) return n;
      t.set(a, s = e.push(a) - 1);
    }
    return r[s % r.length];
  }
  return i.domain = function(a) {
    if (!arguments.length) return e.slice();
    e = [], t = new V7();
    for (const s of a)
      t.has(s) || t.set(s, e.push(s) - 1);
    return i;
  }, i.range = function(a) {
    return arguments.length ? (r = Array.from(a), i) : r.slice();
  }, i.unknown = function(a) {
    return arguments.length ? (n = a, i) : n;
  }, i.copy = function() {
    return Qc(e, r).unknown(n);
  }, q2.apply(i, arguments), i;
}
function hw() {
  var t = Qc().unknown(void 0), e = t.domain, r = t.range, n = 0, i = 1, a, s, o = !1, l = 0, u = 0, h = 0.5;
  delete t.unknown;
  function d() {
    var f = e().length, p = i < n, g = p ? i : n, m = p ? n : i;
    a = (m - g) / Math.max(1, f - l + u * 2), o && (a = Math.floor(a)), g += (m - g - a * (f - l)) * h, s = a * (1 - l), o && (g = Math.round(g), s = Math.round(s));
    var v = Lj(f).map(function(y) {
      return g + a * y;
    });
    return r(p ? v.reverse() : v);
  }
  return t.domain = function(f) {
    return arguments.length ? (e(f), d()) : e();
  }, t.range = function(f) {
    return arguments.length ? ([n, i] = f, n = +n, i = +i, d()) : [n, i];
  }, t.rangeRound = function(f) {
    return [n, i] = f, n = +n, i = +i, o = !0, d();
  }, t.bandwidth = function() {
    return s;
  }, t.step = function() {
    return a;
  }, t.round = function(f) {
    return arguments.length ? (o = !!f, d()) : o;
  }, t.padding = function(f) {
    return arguments.length ? (l = Math.min(1, u = +f), d()) : l;
  }, t.paddingInner = function(f) {
    return arguments.length ? (l = Math.min(1, f), d()) : l;
  }, t.paddingOuter = function(f) {
    return arguments.length ? (u = +f, d()) : u;
  }, t.align = function(f) {
    return arguments.length ? (h = Math.max(0, Math.min(1, f)), d()) : h;
  }, t.copy = function() {
    return hw(e(), [n, i]).round(o).paddingInner(l).paddingOuter(u).align(h);
  }, q2.apply(d(), arguments);
}
function QJ(t) {
  return function() {
    return t;
  };
}
function JJ(t) {
  return +t;
}
var hC = [0, 1];
function yh(t) {
  return t;
}
function dw(t, e) {
  return (e -= t = +t) ? function(r) {
    return (r - t) / e;
  } : QJ(isNaN(e) ? NaN : 0.5);
}
function eee(t, e) {
  var r;
  return t > e && (r = t, t = e, e = r), function(n) {
    return Math.max(t, Math.min(e, n));
  };
}
function tee(t, e, r) {
  var n = t[0], i = t[1], a = e[0], s = e[1];
  return i < n ? (n = dw(i, n), a = r(s, a)) : (n = dw(n, i), a = r(a, s)), function(o) {
    return a(n(o));
  };
}
function ree(t, e, r) {
  var n = Math.min(t.length, e.length) - 1, i = new Array(n), a = new Array(n), s = -1;
  for (t[n] < t[0] && (t = t.slice().reverse(), e = e.slice().reverse()); ++s < n; )
    i[s] = dw(t[s], t[s + 1]), a[s] = r(e[s], e[s + 1]);
  return function(o) {
    var l = xj(t, o, 1, n) - 1;
    return a[l](i[l](o));
  };
}
function gD(t, e) {
  return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());
}
function nee() {
  var t = hC, e = hC, r = oE, n, i, a, s = yh, o, l, u;
  function h() {
    var f = Math.min(t.length, e.length);
    return s !== yh && (s = eee(t[0], t[f - 1])), o = f > 2 ? ree : tee, l = u = null, d;
  }
  function d(f) {
    return f == null || isNaN(f = +f) ? a : (l || (l = o(t.map(n), e, r)))(n(s(f)));
  }
  return d.invert = function(f) {
    return s(i((u || (u = o(e, t.map(n), us)))(f)));
  }, d.domain = function(f) {
    return arguments.length ? (t = Array.from(f, JJ), h()) : t.slice();
  }, d.range = function(f) {
    return arguments.length ? (e = Array.from(f), h()) : e.slice();
  }, d.rangeRound = function(f) {
    return e = Array.from(f), r = HZ, h();
  }, d.clamp = function(f) {
    return arguments.length ? (s = f ? !0 : yh, h()) : s !== yh;
  }, d.interpolate = function(f) {
    return arguments.length ? (r = f, h()) : r;
  }, d.unknown = function(f) {
    return arguments.length ? (a = f, d) : a;
  }, function(f, p) {
    return n = f, i = p, h();
  };
}
function mD() {
  return nee()(yh, yh);
}
function iee(t, e, r, n) {
  var i = J5(t, e, r), a;
  switch (n = jv(n ?? ",f"), n.type) {
    case "s": {
      var s = Math.max(Math.abs(t), Math.abs(e));
      return n.precision == null && !isNaN(a = TJ(i, s)) && (n.precision = a), pD(n, s);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      n.precision == null && !isNaN(a = EJ(i, Math.max(Math.abs(t), Math.abs(e)))) && (n.precision = a - (n.type === "e"));
      break;
    }
    case "f":
    case "%": {
      n.precision == null && !isNaN(a = wJ(i)) && (n.precision = a - (n.type === "%") * 2);
      break;
    }
  }
  return Pc(n);
}
function aee(t) {
  var e = t.domain;
  return t.ticks = function(r) {
    var n = e();
    return Cj(n[0], n[n.length - 1], r ?? 10);
  }, t.tickFormat = function(r, n) {
    var i = e();
    return iee(i[0], i[i.length - 1], r ?? 10, n);
  }, t.nice = function(r) {
    r == null && (r = 10);
    var n = e(), i = 0, a = n.length - 1, s = n[i], o = n[a], l, u, h = 10;
    for (o < s && (u = s, s = o, o = u, u = i, i = a, a = u); h-- > 0; ) {
      if (u = Q5(s, o, r), u === l)
        return n[i] = s, n[a] = o, e(n);
      if (u > 0)
        s = Math.floor(s / u) * u, o = Math.ceil(o / u) * u;
      else if (u < 0)
        s = Math.ceil(s * u) / u, o = Math.floor(o * u) / u;
      else
        break;
      l = u;
    }
    return t;
  }, t;
}
function qd() {
  var t = mD();
  return t.copy = function() {
    return gD(t, qd());
  }, q2.apply(t, arguments), aee(t);
}
function see(t, e) {
  t = t.slice();
  var r = 0, n = t.length - 1, i = t[r], a = t[n], s;
  return a < i && (s = r, r = n, n = s, s = i, i = a, a = s), t[r] = e.floor(i), t[n] = e.ceil(a), t;
}
const $b = /* @__PURE__ */ new Date(), zb = /* @__PURE__ */ new Date();
function Wn(t, e, r, n) {
  function i(a) {
    return t(a = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+a)), a;
  }
  return i.floor = (a) => (t(a = /* @__PURE__ */ new Date(+a)), a), i.ceil = (a) => (t(a = new Date(a - 1)), e(a, 1), t(a), a), i.round = (a) => {
    const s = i(a), o = i.ceil(a);
    return a - s < o - a ? s : o;
  }, i.offset = (a, s) => (e(a = /* @__PURE__ */ new Date(+a), s == null ? 1 : Math.floor(s)), a), i.range = (a, s, o) => {
    const l = [];
    if (a = i.ceil(a), o = o == null ? 1 : Math.floor(o), !(a < s) || !(o > 0)) return l;
    let u;
    do
      l.push(u = /* @__PURE__ */ new Date(+a)), e(a, o), t(a);
    while (u < a && a < s);
    return l;
  }, i.filter = (a) => Wn((s) => {
    if (s >= s) for (; t(s), !a(s); ) s.setTime(s - 1);
  }, (s, o) => {
    if (s >= s)
      if (o < 0) for (; ++o <= 0; )
        for (; e(s, -1), !a(s); )
          ;
      else for (; --o >= 0; )
        for (; e(s, 1), !a(s); )
          ;
  }), r && (i.count = (a, s) => ($b.setTime(+a), zb.setTime(+s), t($b), t(zb), Math.floor(r($b, zb))), i.every = (a) => (a = Math.floor(a), !isFinite(a) || !(a > 0) ? null : a > 1 ? i.filter(n ? (s) => n(s) % a === 0 : (s) => i.count(0, s) % a === 0) : i)), i;
}
const Yd = Wn(() => {
}, (t, e) => {
  t.setTime(+t + e);
}, (t, e) => e - t);
Yd.every = (t) => (t = Math.floor(t), !isFinite(t) || !(t > 0) ? null : t > 1 ? Wn((e) => {
  e.setTime(Math.floor(e / t) * t);
}, (e, r) => {
  e.setTime(+e + r * t);
}, (e, r) => (r - e) / t) : Yd);
Yd.range;
const Mo = 1e3, Ya = Mo * 60, Do = Ya * 60, Wo = Do * 24, fE = Wo * 7, dC = Wo * 30, Vb = Wo * 365, bl = Wn((t) => {
  t.setTime(t - t.getMilliseconds());
}, (t, e) => {
  t.setTime(+t + e * Mo);
}, (t, e) => (e - t) / Mo, (t) => t.getUTCSeconds());
bl.range;
const Bp = Wn((t) => {
  t.setTime(t - t.getMilliseconds() - t.getSeconds() * Mo);
}, (t, e) => {
  t.setTime(+t + e * Ya);
}, (t, e) => (e - t) / Ya, (t) => t.getMinutes());
Bp.range;
const oee = Wn((t) => {
  t.setUTCSeconds(0, 0);
}, (t, e) => {
  t.setTime(+t + e * Ya);
}, (t, e) => (e - t) / Ya, (t) => t.getUTCMinutes());
oee.range;
const Fp = Wn((t) => {
  t.setTime(t - t.getMilliseconds() - t.getSeconds() * Mo - t.getMinutes() * Ya);
}, (t, e) => {
  t.setTime(+t + e * Do);
}, (t, e) => (e - t) / Do, (t) => t.getHours());
Fp.range;
const lee = Wn((t) => {
  t.setUTCMinutes(0, 0, 0);
}, (t, e) => {
  t.setTime(+t + e * Do);
}, (t, e) => (e - t) / Do, (t) => t.getUTCHours());
lee.range;
const su = Wn(
  (t) => t.setHours(0, 0, 0, 0),
  (t, e) => t.setDate(t.getDate() + e),
  (t, e) => (e - t - (e.getTimezoneOffset() - t.getTimezoneOffset()) * Ya) / Wo,
  (t) => t.getDate() - 1
);
su.range;
const pE = Wn((t) => {
  t.setUTCHours(0, 0, 0, 0);
}, (t, e) => {
  t.setUTCDate(t.getUTCDate() + e);
}, (t, e) => (e - t) / Wo, (t) => t.getUTCDate() - 1);
pE.range;
const cee = Wn((t) => {
  t.setUTCHours(0, 0, 0, 0);
}, (t, e) => {
  t.setUTCDate(t.getUTCDate() + e);
}, (t, e) => (e - t) / Wo, (t) => Math.floor(t / Wo));
cee.range;
function _u(t) {
  return Wn((e) => {
    e.setDate(e.getDate() - (e.getDay() + 7 - t) % 7), e.setHours(0, 0, 0, 0);
  }, (e, r) => {
    e.setDate(e.getDate() + r * 7);
  }, (e, r) => (r - e - (r.getTimezoneOffset() - e.getTimezoneOffset()) * Ya) / fE);
}
const Mg = _u(0), $p = _u(1), vD = _u(2), yD = _u(3), ou = _u(4), xD = _u(5), bD = _u(6);
Mg.range;
$p.range;
vD.range;
yD.range;
ou.range;
xD.range;
bD.range;
function Lu(t) {
  return Wn((e) => {
    e.setUTCDate(e.getUTCDate() - (e.getUTCDay() + 7 - t) % 7), e.setUTCHours(0, 0, 0, 0);
  }, (e, r) => {
    e.setUTCDate(e.getUTCDate() + r * 7);
  }, (e, r) => (r - e) / fE);
}
const wD = Lu(0), Zv = Lu(1), uee = Lu(2), hee = Lu(3), Xd = Lu(4), dee = Lu(5), fee = Lu(6);
wD.range;
Zv.range;
uee.range;
hee.range;
Xd.range;
dee.range;
fee.range;
const zp = Wn((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());
zp.range;
const pee = Wn((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());
pee.range;
const Ho = Wn((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());
Ho.every = (t) => !isFinite(t = Math.floor(t)) || !(t > 0) ? null : Wn((e) => {
  e.setFullYear(Math.floor(e.getFullYear() / t) * t), e.setMonth(0, 1), e.setHours(0, 0, 0, 0);
}, (e, r) => {
  e.setFullYear(e.getFullYear() + r * t);
});
Ho.range;
const lu = Wn((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());
lu.every = (t) => !isFinite(t = Math.floor(t)) || !(t > 0) ? null : Wn((e) => {
  e.setUTCFullYear(Math.floor(e.getUTCFullYear() / t) * t), e.setUTCMonth(0, 1), e.setUTCHours(0, 0, 0, 0);
}, (e, r) => {
  e.setUTCFullYear(e.getUTCFullYear() + r * t);
});
lu.range;
function gee(t, e, r, n, i, a) {
  const s = [
    [bl, 1, Mo],
    [bl, 5, 5 * Mo],
    [bl, 15, 15 * Mo],
    [bl, 30, 30 * Mo],
    [a, 1, Ya],
    [a, 5, 5 * Ya],
    [a, 15, 15 * Ya],
    [a, 30, 30 * Ya],
    [i, 1, Do],
    [i, 3, 3 * Do],
    [i, 6, 6 * Do],
    [i, 12, 12 * Do],
    [n, 1, Wo],
    [n, 2, 2 * Wo],
    [r, 1, fE],
    [e, 1, dC],
    [e, 3, 3 * dC],
    [t, 1, Vb]
  ];
  function o(u, h, d) {
    const f = h < u;
    f && ([u, h] = [h, u]);
    const p = d && typeof d.range == "function" ? d : l(u, h, d), g = p ? p.range(u, +h + 1) : [];
    return f ? g.reverse() : g;
  }
  function l(u, h, d) {
    const f = Math.abs(h - u) / d, p = iE(([, , v]) => v).right(s, f);
    if (p === s.length) return t.every(J5(u / Vb, h / Vb, d));
    if (p === 0) return Yd.every(Math.max(J5(u, h, d), 1));
    const [g, m] = s[f / s[p - 1][2] < s[p][2] / f ? p - 1 : p];
    return g.every(m);
  }
  return [o, l];
}
const [mee, vee] = gee(Ho, zp, Mg, su, Fp, Bp);
function Gb(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 Ub(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 Zf(t, e, r) {
  return { y: t, m: e, d: r, H: 0, M: 0, S: 0, L: 0 };
}
function yee(t) {
  var e = t.dateTime, r = t.date, n = t.time, i = t.periods, a = t.days, s = t.shortDays, o = t.months, l = t.shortMonths, u = Qf(i), h = Jf(i), d = Qf(a), f = Jf(a), p = Qf(s), g = Jf(s), m = Qf(o), v = Jf(o), y = Qf(l), b = Jf(l), w = {
    a: D,
    A: M,
    b: B,
    B: $,
    c: null,
    d: yC,
    e: yC,
    f: Vee,
    g: Zee,
    G: Jee,
    H: Fee,
    I: $ee,
    j: zee,
    L: TD,
    m: Gee,
    M: Uee,
    p: F,
    q: G,
    Q: wC,
    s: TC,
    S: Wee,
    u: Hee,
    U: qee,
    V: Yee,
    w: Xee,
    W: jee,
    x: null,
    X: null,
    y: Kee,
    Y: Qee,
    Z: ete,
    "%": bC
  }, T = {
    a: H,
    A: ee,
    b: Y,
    B: re,
    c: null,
    d: xC,
    e: xC,
    f: ite,
    g: pte,
    G: mte,
    H: tte,
    I: rte,
    j: nte,
    L: kD,
    m: ate,
    M: ste,
    p: ne,
    q: he,
    Q: wC,
    s: TC,
    S: ote,
    u: lte,
    U: cte,
    V: ute,
    w: hte,
    W: dte,
    x: null,
    X: null,
    y: fte,
    Y: gte,
    Z: vte,
    "%": bC
  }, E = {
    a: N,
    A,
    b: O,
    B: P,
    c: S,
    d: mC,
    e: mC,
    f: Iee,
    g: gC,
    G: pC,
    H: vC,
    I: vC,
    j: Ree,
    L: Dee,
    m: Lee,
    M: Nee,
    p: L,
    q: _ee,
    Q: Pee,
    s: Bee,
    S: Mee,
    u: Eee,
    U: kee,
    V: See,
    w: Tee,
    W: Cee,
    x: R,
    X: I,
    y: gC,
    Y: pC,
    Z: Aee,
    "%": Oee
  };
  w.x = C(r, w), w.X = C(n, w), w.c = C(e, w), T.x = C(r, T), T.X = C(n, T), T.c = C(e, T);
  function C(K, Z) {
    return function(X) {
      var q = [], J = -1, j = 0, pe = K.length, te, Ae, W;
      for (X instanceof Date || (X = /* @__PURE__ */ new Date(+X)); ++J < pe; )
        K.charCodeAt(J) === 37 && (q.push(K.slice(j, J)), (Ae = fC[te = K.charAt(++J)]) != null ? te = K.charAt(++J) : Ae = te === "e" ? " " : "0", (W = Z[te]) && (te = W(X, Ae)), q.push(te), j = J + 1);
      return q.push(K.slice(j, J)), q.join("");
    };
  }
  function k(K, Z) {
    return function(X) {
      var q = Zf(1900, void 0, 1), J = _(q, K, X += "", 0), j, pe;
      if (J != X.length) return null;
      if ("Q" in q) return new Date(q.Q);
      if ("s" in q) return new Date(q.s * 1e3 + ("L" in q ? q.L : 0));
      if (Z && !("Z" in q) && (q.Z = 0), "p" in q && (q.H = q.H % 12 + q.p * 12), q.m === void 0 && (q.m = "q" in q ? q.q : 0), "V" in q) {
        if (q.V < 1 || q.V > 53) return null;
        "w" in q || (q.w = 1), "Z" in q ? (j = Ub(Zf(q.y, 0, 1)), pe = j.getUTCDay(), j = pe > 4 || pe === 0 ? Zv.ceil(j) : Zv(j), j = pE.offset(j, (q.V - 1) * 7), q.y = j.getUTCFullYear(), q.m = j.getUTCMonth(), q.d = j.getUTCDate() + (q.w + 6) % 7) : (j = Gb(Zf(q.y, 0, 1)), pe = j.getDay(), j = pe > 4 || pe === 0 ? $p.ceil(j) : $p(j), j = su.offset(j, (q.V - 1) * 7), q.y = j.getFullYear(), q.m = j.getMonth(), q.d = j.getDate() + (q.w + 6) % 7);
      } else ("W" in q || "U" in q) && ("w" in q || (q.w = "u" in q ? q.u % 7 : "W" in q ? 1 : 0), pe = "Z" in q ? Ub(Zf(q.y, 0, 1)).getUTCDay() : Gb(Zf(q.y, 0, 1)).getDay(), q.m = 0, q.d = "W" in q ? (q.w + 6) % 7 + q.W * 7 - (pe + 5) % 7 : q.w + q.U * 7 - (pe + 6) % 7);
      return "Z" in q ? (q.H += q.Z / 100 | 0, q.M += q.Z % 100, Ub(q)) : Gb(q);
    };
  }
  function _(K, Z, X, q) {
    for (var J = 0, j = Z.length, pe = X.length, te, Ae; J < j; ) {
      if (q >= pe) return -1;
      if (te = Z.charCodeAt(J++), te === 37) {
        if (te = Z.charAt(J++), Ae = E[te in fC ? Z.charAt(J++) : te], !Ae || (q = Ae(K, X, q)) < 0) return -1;
      } else if (te != X.charCodeAt(q++))
        return -1;
    }
    return q;
  }
  function L(K, Z, X) {
    var q = u.exec(Z.slice(X));
    return q ? (K.p = h.get(q[0].toLowerCase()), X + q[0].length) : -1;
  }
  function N(K, Z, X) {
    var q = p.exec(Z.slice(X));
    return q ? (K.w = g.get(q[0].toLowerCase()), X + q[0].length) : -1;
  }
  function A(K, Z, X) {
    var q = d.exec(Z.slice(X));
    return q ? (K.w = f.get(q[0].toLowerCase()), X + q[0].length) : -1;
  }
  function O(K, Z, X) {
    var q = y.exec(Z.slice(X));
    return q ? (K.m = b.get(q[0].toLowerCase()), X + q[0].length) : -1;
  }
  function P(K, Z, X) {
    var q = m.exec(Z.slice(X));
    return q ? (K.m = v.get(q[0].toLowerCase()), X + q[0].length) : -1;
  }
  function S(K, Z, X) {
    return _(K, e, Z, X);
  }
  function R(K, Z, X) {
    return _(K, r, Z, X);
  }
  function I(K, Z, X) {
    return _(K, n, Z, X);
  }
  function D(K) {
    return s[K.getDay()];
  }
  function M(K) {
    return a[K.getDay()];
  }
  function B(K) {
    return l[K.getMonth()];
  }
  function $(K) {
    return o[K.getMonth()];
  }
  function F(K) {
    return i[+(K.getHours() >= 12)];
  }
  function G(K) {
    return 1 + ~~(K.getMonth() / 3);
  }
  function H(K) {
    return s[K.getUTCDay()];
  }
  function ee(K) {
    return a[K.getUTCDay()];
  }
  function Y(K) {
    return l[K.getUTCMonth()];
  }
  function re(K) {
    return o[K.getUTCMonth()];
  }
  function ne(K) {
    return i[+(K.getUTCHours() >= 12)];
  }
  function he(K) {
    return 1 + ~~(K.getUTCMonth() / 3);
  }
  return {
    format: function(K) {
      var Z = C(K += "", w);
      return Z.toString = function() {
        return K;
      }, Z;
    },
    parse: function(K) {
      var Z = k(K += "", !1);
      return Z.toString = function() {
        return K;
      }, Z;
    },
    utcFormat: function(K) {
      var Z = C(K += "", T);
      return Z.toString = function() {
        return K;
      }, Z;
    },
    utcParse: function(K) {
      var Z = k(K += "", !0);
      return Z.toString = function() {
        return K;
      }, Z;
    }
  };
}
var fC = { "-": "", _: " ", 0: "0" }, Jn = /^\s*\d+/, xee = /^%/, bee = /[\\^$*+?|[\]().{}]/g;
function Er(t, e, r) {
  var n = t < 0 ? "-" : "", i = (n ? -t : t) + "", a = i.length;
  return n + (a < r ? new Array(r - a + 1).join(e) + i : i);
}
function wee(t) {
  return t.replace(bee, "\\$&");
}
function Qf(t) {
  return new RegExp("^(?:" + t.map(wee).join("|") + ")", "i");
}
function Jf(t) {
  return new Map(t.map((e, r) => [e.toLowerCase(), r]));
}
function Tee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 1));
  return n ? (t.w = +n[0], r + n[0].length) : -1;
}
function Eee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 1));
  return n ? (t.u = +n[0], r + n[0].length) : -1;
}
function kee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.U = +n[0], r + n[0].length) : -1;
}
function See(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.V = +n[0], r + n[0].length) : -1;
}
function Cee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.W = +n[0], r + n[0].length) : -1;
}
function pC(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 4));
  return n ? (t.y = +n[0], r + n[0].length) : -1;
}
function gC(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), r + n[0].length) : -1;
}
function Aee(t, e, r) {
  var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r, r + 6));
  return n ? (t.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), r + n[0].length) : -1;
}
function _ee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 1));
  return n ? (t.q = n[0] * 3 - 3, r + n[0].length) : -1;
}
function Lee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.m = n[0] - 1, r + n[0].length) : -1;
}
function mC(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.d = +n[0], r + n[0].length) : -1;
}
function Ree(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 3));
  return n ? (t.m = 0, t.d = +n[0], r + n[0].length) : -1;
}
function vC(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.H = +n[0], r + n[0].length) : -1;
}
function Nee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.M = +n[0], r + n[0].length) : -1;
}
function Mee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 2));
  return n ? (t.S = +n[0], r + n[0].length) : -1;
}
function Dee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 3));
  return n ? (t.L = +n[0], r + n[0].length) : -1;
}
function Iee(t, e, r) {
  var n = Jn.exec(e.slice(r, r + 6));
  return n ? (t.L = Math.floor(n[0] / 1e3), r + n[0].length) : -1;
}
function Oee(t, e, r) {
  var n = xee.exec(e.slice(r, r + 1));
  return n ? r + n[0].length : -1;
}
function Pee(t, e, r) {
  var n = Jn.exec(e.slice(r));
  return n ? (t.Q = +n[0], r + n[0].length) : -1;
}
function Bee(t, e, r) {
  var n = Jn.exec(e.slice(r));
  return n ? (t.s = +n[0], r + n[0].length) : -1;
}
function yC(t, e) {
  return Er(t.getDate(), e, 2);
}
function Fee(t, e) {
  return Er(t.getHours(), e, 2);
}
function $ee(t, e) {
  return Er(t.getHours() % 12 || 12, e, 2);
}
function zee(t, e) {
  return Er(1 + su.count(Ho(t), t), e, 3);
}
function TD(t, e) {
  return Er(t.getMilliseconds(), e, 3);
}
function Vee(t, e) {
  return TD(t, e) + "000";
}
function Gee(t, e) {
  return Er(t.getMonth() + 1, e, 2);
}
function Uee(t, e) {
  return Er(t.getMinutes(), e, 2);
}
function Wee(t, e) {
  return Er(t.getSeconds(), e, 2);
}
function Hee(t) {
  var e = t.getDay();
  return e === 0 ? 7 : e;
}
function qee(t, e) {
  return Er(Mg.count(Ho(t) - 1, t), e, 2);
}
function ED(t) {
  var e = t.getDay();
  return e >= 4 || e === 0 ? ou(t) : ou.ceil(t);
}
function Yee(t, e) {
  return t = ED(t), Er(ou.count(Ho(t), t) + (Ho(t).getDay() === 4), e, 2);
}
function Xee(t) {
  return t.getDay();
}
function jee(t, e) {
  return Er($p.count(Ho(t) - 1, t), e, 2);
}
function Kee(t, e) {
  return Er(t.getFullYear() % 100, e, 2);
}
function Zee(t, e) {
  return t = ED(t), Er(t.getFullYear() % 100, e, 2);
}
function Qee(t, e) {
  return Er(t.getFullYear() % 1e4, e, 4);
}
function Jee(t, e) {
  var r = t.getDay();
  return t = r >= 4 || r === 0 ? ou(t) : ou.ceil(t), Er(t.getFullYear() % 1e4, e, 4);
}
function ete(t) {
  var e = t.getTimezoneOffset();
  return (e > 0 ? "-" : (e *= -1, "+")) + Er(e / 60 | 0, "0", 2) + Er(e % 60, "0", 2);
}
function xC(t, e) {
  return Er(t.getUTCDate(), e, 2);
}
function tte(t, e) {
  return Er(t.getUTCHours(), e, 2);
}
function rte(t, e) {
  return Er(t.getUTCHours() % 12 || 12, e, 2);
}
function nte(t, e) {
  return Er(1 + pE.count(lu(t), t), e, 3);
}
function kD(t, e) {
  return Er(t.getUTCMilliseconds(), e, 3);
}
function ite(t, e) {
  return kD(t, e) + "000";
}
function ate(t, e) {
  return Er(t.getUTCMonth() + 1, e, 2);
}
function ste(t, e) {
  return Er(t.getUTCMinutes(), e, 2);
}
function ote(t, e) {
  return Er(t.getUTCSeconds(), e, 2);
}
function lte(t) {
  var e = t.getUTCDay();
  return e === 0 ? 7 : e;
}
function cte(t, e) {
  return Er(wD.count(lu(t) - 1, t), e, 2);
}
function SD(t) {
  var e = t.getUTCDay();
  return e >= 4 || e === 0 ? Xd(t) : Xd.ceil(t);
}
function ute(t, e) {
  return t = SD(t), Er(Xd.count(lu(t), t) + (lu(t).getUTCDay() === 4), e, 2);
}
function hte(t) {
  return t.getUTCDay();
}
function dte(t, e) {
  return Er(Zv.count(lu(t) - 1, t), e, 2);
}
function fte(t, e) {
  return Er(t.getUTCFullYear() % 100, e, 2);
}
function pte(t, e) {
  return t = SD(t), Er(t.getUTCFullYear() % 100, e, 2);
}
function gte(t, e) {
  return Er(t.getUTCFullYear() % 1e4, e, 4);
}
function mte(t, e) {
  var r = t.getUTCDay();
  return t = r >= 4 || r === 0 ? Xd(t) : Xd.ceil(t), Er(t.getUTCFullYear() % 1e4, e, 4);
}
function vte() {
  return "+0000";
}
function bC() {
  return "%";
}
function wC(t) {
  return +t;
}
function TC(t) {
  return Math.floor(+t / 1e3);
}
var Ku, Qv;
yte({
  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 yte(t) {
  return Ku = yee(t), Qv = Ku.format, Ku.parse, Ku.utcFormat, Ku.utcParse, Ku;
}
function xte(t) {
  return new Date(t);
}
function bte(t) {
  return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t);
}
function CD(t, e, r, n, i, a, s, o, l, u) {
  var h = mD(), d = h.invert, f = h.domain, p = u(".%L"), g = u(":%S"), m = u("%I:%M"), v = u("%I %p"), y = u("%a %d"), b = u("%b %d"), w = u("%B"), T = u("%Y");
  function E(C) {
    return (l(C) < C ? p : o(C) < C ? g : s(C) < C ? m : a(C) < C ? v : n(C) < C ? i(C) < C ? y : b : r(C) < C ? w : T)(C);
  }
  return h.invert = function(C) {
    return new Date(d(C));
  }, h.domain = function(C) {
    return arguments.length ? f(Array.from(C, bte)) : f().map(xte);
  }, h.ticks = function(C) {
    var k = f();
    return t(k[0], k[k.length - 1], C ?? 10);
  }, h.tickFormat = function(C, k) {
    return k == null ? E : u(k);
  }, h.nice = function(C) {
    var k = f();
    return (!C || typeof C.range != "function") && (C = e(k[0], k[k.length - 1], C ?? 10)), C ? f(see(k, C)) : h;
  }, h.copy = function() {
    return gD(h, CD(t, e, r, n, i, a, s, o, l, u));
  }, h;
}
function wte() {
  return q2.apply(CD(mee, vee, Ho, zp, Mg, su, Fp, Bp, bl, Qv).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
}
function Tte(t) {
  for (var e = t.length / 6 | 0, r = new Array(e), n = 0; n < e; ) r[n] = "#" + t.slice(n * 6, ++n * 6);
  return r;
}
const Ete = Tte("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
function gn(t) {
  return function() {
    return t;
  };
}
const EC = Math.abs, gi = Math.atan2, Ec = Math.cos, kte = Math.max, Wb = Math.min, Ns = Math.sin, xh = Math.sqrt, vi = 1e-12, Vp = Math.PI, Jv = Vp / 2, Hm = 2 * Vp;
function Ste(t) {
  return t > 1 ? 0 : t < -1 ? Vp : Math.acos(t);
}
function kC(t) {
  return t >= 1 ? Jv : t <= -1 ? -Jv : Math.asin(t);
}
function AD(t) {
  let e = 3;
  return t.digits = function(r) {
    if (!arguments.length) return e;
    if (r == null)
      e = null;
    else {
      const n = Math.floor(r);
      if (!(n >= 0)) throw new RangeError(`invalid digits: ${r}`);
      e = n;
    }
    return t;
  }, () => new dJ(e);
}
function Cte(t) {
  return t.innerRadius;
}
function Ate(t) {
  return t.outerRadius;
}
function _te(t) {
  return t.startAngle;
}
function Lte(t) {
  return t.endAngle;
}
function Rte(t) {
  return t && t.padAngle;
}
function Nte(t, e, r, n, i, a, s, o) {
  var l = r - t, u = n - e, h = s - i, d = o - a, f = d * l - h * u;
  if (!(f * f < vi))
    return f = (h * (e - a) - d * (t - i)) / f, [t + f * l, e + f * u];
}
function N1(t, e, r, n, i, a, s) {
  var o = t - r, l = e - n, u = (s ? a : -a) / xh(o * o + l * l), h = u * l, d = -u * o, f = t + h, p = e + d, g = r + h, m = n + d, v = (f + g) / 2, y = (p + m) / 2, b = g - f, w = m - p, T = b * b + w * w, E = i - a, C = f * m - g * p, k = (w < 0 ? -1 : 1) * xh(kte(0, E * E * T - C * C)), _ = (C * w - b * k) / T, L = (-C * b - w * k) / T, N = (C * w + b * k) / T, A = (-C * b + w * k) / T, O = _ - v, P = L - y, S = N - v, R = A - y;
  return O * O + P * P > S * S + R * R && (_ = N, L = A), {
    cx: _,
    cy: L,
    x01: -h,
    y01: -d,
    x11: _ * (i / E - 1),
    y11: L * (i / E - 1)
  };
}
function jd() {
  var t = Cte, e = Ate, r = gn(0), n = null, i = _te, a = Lte, s = Rte, o = null, l = AD(u);
  function u() {
    var h, d, f = +t.apply(this, arguments), p = +e.apply(this, arguments), g = i.apply(this, arguments) - Jv, m = a.apply(this, arguments) - Jv, v = EC(m - g), y = m > g;
    if (o || (o = h = l()), p < f && (d = p, p = f, f = d), !(p > vi)) o.moveTo(0, 0);
    else if (v > Hm - vi)
      o.moveTo(p * Ec(g), p * Ns(g)), o.arc(0, 0, p, g, m, !y), f > vi && (o.moveTo(f * Ec(m), f * Ns(m)), o.arc(0, 0, f, m, g, y));
    else {
      var b = g, w = m, T = g, E = m, C = v, k = v, _ = s.apply(this, arguments) / 2, L = _ > vi && (n ? +n.apply(this, arguments) : xh(f * f + p * p)), N = Wb(EC(p - f) / 2, +r.apply(this, arguments)), A = N, O = N, P, S;
      if (L > vi) {
        var R = kC(L / f * Ns(_)), I = kC(L / p * Ns(_));
        (C -= R * 2) > vi ? (R *= y ? 1 : -1, T += R, E -= R) : (C = 0, T = E = (g + m) / 2), (k -= I * 2) > vi ? (I *= y ? 1 : -1, b += I, w -= I) : (k = 0, b = w = (g + m) / 2);
      }
      var D = p * Ec(b), M = p * Ns(b), B = f * Ec(E), $ = f * Ns(E);
      if (N > vi) {
        var F = p * Ec(w), G = p * Ns(w), H = f * Ec(T), ee = f * Ns(T), Y;
        if (v < Vp)
          if (Y = Nte(D, M, H, ee, F, G, B, $)) {
            var re = D - Y[0], ne = M - Y[1], he = F - Y[0], K = G - Y[1], Z = 1 / Ns(Ste((re * he + ne * K) / (xh(re * re + ne * ne) * xh(he * he + K * K))) / 2), X = xh(Y[0] * Y[0] + Y[1] * Y[1]);
            A = Wb(N, (f - X) / (Z - 1)), O = Wb(N, (p - X) / (Z + 1));
          } else
            A = O = 0;
      }
      k > vi ? O > vi ? (P = N1(H, ee, D, M, p, O, y), S = N1(F, G, B, $, p, O, y), o.moveTo(P.cx + P.x01, P.cy + P.y01), O < N ? o.arc(P.cx, P.cy, O, gi(P.y01, P.x01), gi(S.y01, S.x01), !y) : (o.arc(P.cx, P.cy, O, gi(P.y01, P.x01), gi(P.y11, P.x11), !y), o.arc(0, 0, p, gi(P.cy + P.y11, P.cx + P.x11), gi(S.cy + S.y11, S.cx + S.x11), !y), o.arc(S.cx, S.cy, O, gi(S.y11, S.x11), gi(S.y01, S.x01), !y))) : (o.moveTo(D, M), o.arc(0, 0, p, b, w, !y)) : o.moveTo(D, M), !(f > vi) || !(C > vi) ? o.lineTo(B, $) : A > vi ? (P = N1(B, $, F, G, f, -A, y), S = N1(D, M, H, ee, f, -A, y), o.lineTo(P.cx + P.x01, P.cy + P.y01), A < N ? o.arc(P.cx, P.cy, A, gi(P.y01, P.x01), gi(S.y01, S.x01), !y) : (o.arc(P.cx, P.cy, A, gi(P.y01, P.x01), gi(P.y11, P.x11), !y), o.arc(0, 0, f, gi(P.cy + P.y11, P.cx + P.x11), gi(S.cy + S.y11, S.cx + S.x11), y), o.arc(S.cx, S.cy, A, gi(S.y11, S.x11), gi(S.y01, S.x01), !y))) : o.arc(0, 0, f, E, T, y);
    }
    if (o.closePath(), h) return o = null, h + "" || null;
  }
  return u.centroid = function() {
    var h = (+t.apply(this, arguments) + +e.apply(this, arguments)) / 2, d = (+i.apply(this, arguments) + +a.apply(this, arguments)) / 2 - Vp / 2;
    return [Ec(d) * h, Ns(d) * h];
  }, u.innerRadius = function(h) {
    return arguments.length ? (t = typeof h == "function" ? h : gn(+h), u) : t;
  }, u.outerRadius = function(h) {
    return arguments.length ? (e = typeof h == "function" ? h : gn(+h), u) : e;
  }, u.cornerRadius = function(h) {
    return arguments.length ? (r = typeof h == "function" ? h : gn(+h), u) : r;
  }, u.padRadius = function(h) {
    return arguments.length ? (n = h == null ? null : typeof h == "function" ? h : gn(+h), u) : n;
  }, u.startAngle = function(h) {
    return arguments.length ? (i = typeof h == "function" ? h : gn(+h), u) : i;
  }, u.endAngle = function(h) {
    return arguments.length ? (a = typeof h == "function" ? h : gn(+h), u) : a;
  }, u.padAngle = function(h) {
    return arguments.length ? (s = typeof h == "function" ? h : gn(+h), u) : s;
  }, u.context = function(h) {
    return arguments.length ? (o = h ?? null, u) : o;
  }, u;
}
function _D(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function LD(t) {
  this._context = t;
}
LD.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;
      default:
        this._context.lineTo(t, e);
        break;
    }
  }
};
function ey(t) {
  return new LD(t);
}
function Mte(t) {
  return t[0];
}
function Dte(t) {
  return t[1];
}
function Gp(t, e) {
  var r = gn(!0), n = null, i = ey, a = null, s = AD(o);
  t = typeof t == "function" ? t : t === void 0 ? Mte : gn(t), e = typeof e == "function" ? e : e === void 0 ? Dte : gn(e);
  function o(l) {
    var u, h = (l = _D(l)).length, d, f = !1, p;
    for (n == null && (a = i(p = s())), u = 0; u <= h; ++u)
      !(u < h && r(d = l[u], u, l)) === f && ((f = !f) ? a.lineStart() : a.lineEnd()), f && a.point(+t(d, u, l), +e(d, u, l));
    if (p) return a = null, p + "" || null;
  }
  return o.x = function(l) {
    return arguments.length ? (t = typeof l == "function" ? l : gn(+l), o) : t;
  }, o.y = function(l) {
    return arguments.length ? (e = typeof l == "function" ? l : gn(+l), o) : e;
  }, o.defined = function(l) {
    return arguments.length ? (r = typeof l == "function" ? l : gn(!!l), o) : r;
  }, o.curve = function(l) {
    return arguments.length ? (i = l, n != null && (a = i(n)), o) : i;
  }, o.context = function(l) {
    return arguments.length ? (l == null ? n = a = null : a = i(n = l), o) : n;
  }, o;
}
function Ite(t, e) {
  return e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function Ote(t) {
  return t;
}
function Pte() {
  var t = Ote, e = Ite, r = null, n = gn(0), i = gn(Hm), a = gn(0);
  function s(o) {
    var l, u = (o = _D(o)).length, h, d, f = 0, p = new Array(u), g = new Array(u), m = +n.apply(this, arguments), v = Math.min(Hm, Math.max(-Hm, i.apply(this, arguments) - m)), y, b = Math.min(Math.abs(v) / u, a.apply(this, arguments)), w = b * (v < 0 ? -1 : 1), T;
    for (l = 0; l < u; ++l)
      (T = g[p[l] = l] = +t(o[l], l, o)) > 0 && (f += T);
    for (e != null ? p.sort(function(E, C) {
      return e(g[E], g[C]);
    }) : r != null && p.sort(function(E, C) {
      return r(o[E], o[C]);
    }), l = 0, d = f ? (v - u * w) / f : 0; l < u; ++l, m = y)
      h = p[l], T = g[h], y = m + (T > 0 ? T * d : 0) + w, g[h] = {
        data: o[h],
        index: l,
        value: T,
        startAngle: m,
        endAngle: y,
        padAngle: b
      };
    return g;
  }
  return s.value = function(o) {
    return arguments.length ? (t = typeof o == "function" ? o : gn(+o), s) : t;
  }, s.sortValues = function(o) {
    return arguments.length ? (e = o, r = null, s) : e;
  }, s.sort = function(o) {
    return arguments.length ? (r = o, e = null, s) : r;
  }, s.startAngle = function(o) {
    return arguments.length ? (n = typeof o == "function" ? o : gn(+o), s) : n;
  }, s.endAngle = function(o) {
    return arguments.length ? (i = typeof o == "function" ? o : gn(+o), s) : i;
  }, s.padAngle = function(o) {
    return arguments.length ? (a = typeof o == "function" ? o : gn(+o), s) : a;
  }, s;
}
class RD {
  constructor(e, r) {
    this._context = e, this._x = r;
  }
  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, r) {
    switch (e = +e, r = +r, this._point) {
      case 0: {
        this._point = 1, this._line ? this._context.lineTo(e, r) : this._context.moveTo(e, r);
        break;
      }
      case 1:
        this._point = 2;
      default: {
        this._x ? this._context.bezierCurveTo(this._x0 = (this._x0 + e) / 2, this._y0, this._x0, r, e, r) : this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + r) / 2, e, this._y0, e, r);
        break;
      }
    }
    this._x0 = e, this._y0 = r;
  }
}
function ND(t) {
  return new RD(t, !0);
}
function MD(t) {
  return new RD(t, !1);
}
function Dl() {
}
function ty(t, e, r) {
  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 + r) / 6
  );
}
function Y2(t) {
  this._context = t;
}
Y2.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:
        ty(this, this._x1, this._y1);
      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);
      default:
        ty(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e;
  }
};
function Rh(t) {
  return new Y2(t);
}
function DD(t) {
  this._context = t;
}
DD.prototype = {
  areaStart: Dl,
  areaEnd: Dl,
  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:
        ty(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e;
  }
};
function Bte(t) {
  return new DD(t);
}
function ID(t) {
  this._context = t;
}
ID.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 r = (this._x0 + 4 * this._x1 + t) / 6, n = (this._y0 + 4 * this._y1 + e) / 6;
        this._line ? this._context.lineTo(r, n) : this._context.moveTo(r, n);
        break;
      case 3:
        this._point = 4;
      default:
        ty(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e;
  }
};
function Fte(t) {
  return new ID(t);
}
function OD(t, e) {
  this._basis = new Y2(t), this._beta = e;
}
OD.prototype = {
  lineStart: function() {
    this._x = [], this._y = [], this._basis.lineStart();
  },
  lineEnd: function() {
    var t = this._x, e = this._y, r = t.length - 1;
    if (r > 0)
      for (var n = t[0], i = e[0], a = t[r] - n, s = e[r] - i, o = -1, l; ++o <= r; )
        l = o / r, this._basis.point(
          this._beta * t[o] + (1 - this._beta) * (n + l * a),
          this._beta * e[o] + (1 - this._beta) * (i + l * s)
        );
    this._x = this._y = null, this._basis.lineEnd();
  },
  point: function(t, e) {
    this._x.push(+t), this._y.push(+e);
  }
};
const $te = function t(e) {
  function r(n) {
    return e === 1 ? new Y2(n) : new OD(n, e);
  }
  return r.beta = function(n) {
    return t(+n);
  }, r;
}(0.85);
function ry(t, e, r) {
  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 - r),
    t._x2,
    t._y2
  );
}
function gE(t, e) {
  this._context = t, this._k = (1 - e) / 6;
}
gE.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:
        ry(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;
      default:
        ry(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 PD = function t(e) {
  function r(n) {
    return new gE(n, e);
  }
  return r.tension = function(n) {
    return t(+n);
  }, r;
}(0);
function mE(t, e) {
  this._context = t, this._k = (1 - e) / 6;
}
mE.prototype = {
  areaStart: Dl,
  areaEnd: Dl,
  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:
        ry(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 zte = function t(e) {
  function r(n) {
    return new mE(n, e);
  }
  return r.tension = function(n) {
    return t(+n);
  }, r;
}(0);
function vE(t, e) {
  this._context = t, this._k = (1 - e) / 6;
}
vE.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;
      default:
        ry(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 Vte = function t(e) {
  function r(n) {
    return new vE(n, e);
  }
  return r.tension = function(n) {
    return t(+n);
  }, r;
}(0);
function yE(t, e, r) {
  var n = t._x1, i = t._y1, a = t._x2, s = t._y2;
  if (t._l01_a > vi) {
    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);
    n = (n * o - t._x0 * t._l12_2a + t._x2 * t._l01_2a) / l, i = (i * o - t._y0 * t._l12_2a + t._y2 * t._l01_2a) / l;
  }
  if (t._l23_a > vi) {
    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);
    a = (a * u + t._x1 * t._l23_2a - e * t._l12_2a) / h, s = (s * u + t._y1 * t._l23_2a - r * t._l12_2a) / h;
  }
  t._context.bezierCurveTo(n, i, a, s, t._x2, t._y2);
}
function BD(t, e) {
  this._context = t, this._alpha = e;
}
BD.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 r = this._x2 - t, n = this._y2 - e;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(r * r + n * n, 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;
      default:
        yE(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 FD = function t(e) {
  function r(n) {
    return e ? new BD(n, e) : new gE(n, 0);
  }
  return r.alpha = function(n) {
    return t(+n);
  }, r;
}(0.5);
function $D(t, e) {
  this._context = t, this._alpha = e;
}
$D.prototype = {
  areaStart: Dl,
  areaEnd: Dl,
  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 r = this._x2 - t, n = this._y2 - e;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(r * r + n * n, 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:
        yE(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 Gte = function t(e) {
  function r(n) {
    return e ? new $D(n, e) : new mE(n, 0);
  }
  return r.alpha = function(n) {
    return t(+n);
  }, r;
}(0.5);
function zD(t, e) {
  this._context = t, this._alpha = e;
}
zD.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 r = this._x2 - t, n = this._y2 - e;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(r * r + n * n, 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;
      default:
        yE(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 Ute = function t(e) {
  function r(n) {
    return e ? new zD(n, e) : new vE(n, 0);
  }
  return r.alpha = function(n) {
    return t(+n);
  }, r;
}(0.5);
function VD(t) {
  this._context = t;
}
VD.prototype = {
  areaStart: Dl,
  areaEnd: Dl,
  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 Wte(t) {
  return new VD(t);
}
function SC(t) {
  return t < 0 ? -1 : 1;
}
function CC(t, e, r) {
  var n = t._x1 - t._x0, i = e - t._x1, a = (t._y1 - t._y0) / (n || i < 0 && -0), s = (r - t._y1) / (i || n < 0 && -0), o = (a * i + s * n) / (n + i);
  return (SC(a) + SC(s)) * Math.min(Math.abs(a), Math.abs(s), 0.5 * Math.abs(o)) || 0;
}
function AC(t, e) {
  var r = t._x1 - t._x0;
  return r ? (3 * (t._y1 - t._y0) / r - e) / 2 : e;
}
function Hb(t, e, r) {
  var n = t._x0, i = t._y0, a = t._x1, s = t._y1, o = (a - n) / 3;
  t._context.bezierCurveTo(n + o, i + o * e, a - o, s - o * r, a, s);
}
function ny(t) {
  this._context = t;
}
ny.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:
        Hb(this, this._t0, AC(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 r = 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, Hb(this, AC(this, r = CC(this, t, e)), r);
          break;
        default:
          Hb(this, this._t0, r = CC(this, t, e));
          break;
      }
      this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e, this._t0 = r;
    }
  }
};
function GD(t) {
  this._context = new UD(t);
}
(GD.prototype = Object.create(ny.prototype)).point = function(t, e) {
  ny.prototype.point.call(this, e, t);
};
function UD(t) {
  this._context = t;
}
UD.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, r, n, i, a) {
    this._context.bezierCurveTo(e, t, n, r, a, i);
  }
};
function WD(t) {
  return new ny(t);
}
function HD(t) {
  return new GD(t);
}
function qD(t) {
  this._context = t;
}
qD.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, r = t.length;
    if (r)
      if (this._line ? this._context.lineTo(t[0], e[0]) : this._context.moveTo(t[0], e[0]), r === 2)
        this._context.lineTo(t[1], e[1]);
      else
        for (var n = _C(t), i = _C(e), a = 0, s = 1; s < r; ++a, ++s)
          this._context.bezierCurveTo(n[0][a], i[0][a], n[1][a], i[1][a], t[s], e[s]);
    (this._line || this._line !== 0 && r === 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 _C(t) {
  var e, r = t.length - 1, n, i = new Array(r), a = new Array(r), s = new Array(r);
  for (i[0] = 0, a[0] = 2, s[0] = t[0] + 2 * t[1], e = 1; e < r - 1; ++e) i[e] = 1, a[e] = 4, s[e] = 4 * t[e] + 2 * t[e + 1];
  for (i[r - 1] = 2, a[r - 1] = 7, s[r - 1] = 8 * t[r - 1] + t[r], e = 1; e < r; ++e) n = i[e] / a[e - 1], a[e] -= n, s[e] -= n * s[e - 1];
  for (i[r - 1] = s[r - 1] / a[r - 1], e = r - 2; e >= 0; --e) i[e] = (s[e] - i[e + 1]) / a[e];
  for (a[r - 1] = (t[r] + i[r - 1]) / 2, e = 0; e < r - 1; ++e) a[e] = 2 * t[e + 1] - i[e + 1];
  return [i, a];
}
function YD(t) {
  return new qD(t);
}
function X2(t, e) {
  this._context = t, this._t = e;
}
X2.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;
      default: {
        if (this._t <= 0)
          this._context.lineTo(this._x, e), this._context.lineTo(t, e);
        else {
          var r = this._x * (1 - this._t) + t * this._t;
          this._context.lineTo(r, this._y), this._context.lineTo(r, e);
        }
        break;
      }
    }
    this._x = t, this._y = e;
  }
};
function XD(t) {
  return new X2(t, 0.5);
}
function jD(t) {
  return new X2(t, 0);
}
function KD(t) {
  return new X2(t, 1);
}
function b0(t, e, r) {
  this.k = t, this.x = e, this.y = r;
}
b0.prototype = {
  constructor: b0,
  scale: function(t) {
    return t === 1 ? this : new b0(this.k * t, this.x, this.y);
  },
  translate: function(t, e) {
    return t === 0 & e === 0 ? this : new b0(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 + ")";
  }
};
b0.prototype;
var tl = /* @__PURE__ */ x((t) => {
  var i;
  const { securityLevel: e } = we();
  let r = Qe("body");
  if (e === "sandbox") {
    const s = ((i = Qe(`#i${t}`).node()) == null ? void 0 : i.contentDocument) ?? document;
    r = Qe(s.body);
  }
  return r.select(`#${t}`);
}, "selectSvgElement");
function xE(t) {
  return typeof t > "u" || t === null;
}
x(xE, "isNothing");
function ZD(t) {
  return typeof t == "object" && t !== null;
}
x(ZD, "isObject");
function QD(t) {
  return Array.isArray(t) ? t : xE(t) ? [] : [t];
}
x(QD, "toArray");
function JD(t, e) {
  var r, n, i, a;
  if (e)
    for (a = Object.keys(e), r = 0, n = a.length; r < n; r += 1)
      i = a[r], t[i] = e[i];
  return t;
}
x(JD, "extend");
function eI(t, e) {
  var r = "", n;
  for (n = 0; n < e; n += 1)
    r += t;
  return r;
}
x(eI, "repeat");
function tI(t) {
  return t === 0 && Number.NEGATIVE_INFINITY === 1 / t;
}
x(tI, "isNegativeZero");
var Hte = xE, qte = ZD, Yte = QD, Xte = eI, jte = tI, Kte = JD, Pn = {
  isNothing: Hte,
  isObject: qte,
  toArray: Yte,
  repeat: Xte,
  isNegativeZero: jte,
  extend: Kte
};
function bE(t, e) {
  var r = "", n = t.reason || "(unknown reason)";
  return t.mark ? (t.mark.name && (r += 'in "' + t.mark.name + '" '), r += "(" + (t.mark.line + 1) + ":" + (t.mark.column + 1) + ")", !e && t.mark.snippet && (r += `

` + t.mark.snippet), n + " " + r) : n;
}
x(bE, "formatError");
function Kd(t, e) {
  Error.call(this), this.name = "YAMLException", this.reason = t, this.mark = e, this.message = bE(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
}
x(Kd, "YAMLException$1");
Kd.prototype = Object.create(Error.prototype);
Kd.prototype.constructor = Kd;
Kd.prototype.toString = /* @__PURE__ */ x(function(e) {
  return this.name + ": " + bE(this, e);
}, "toString");
var oa = Kd;
function qm(t, e, r, n, i) {
  var a = "", s = "", o = Math.floor(i / 2) - 1;
  return n - e > o && (a = " ... ", e = n - o + a.length), r - n > o && (s = " ...", r = n + o - s.length), {
    str: a + t.slice(e, r).replace(/\t/g, "→") + s,
    pos: n - e + a.length
    // relative position
  };
}
x(qm, "getLine");
function Ym(t, e) {
  return Pn.repeat(" ", e - t.length) + t;
}
x(Ym, "padStart");
function rI(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 r = /\r?\n|\r|\0/g, n = [0], i = [], a, s = -1; a = r.exec(t.buffer); )
    i.push(a.index), n.push(a.index + a[0].length), t.position <= a.index && s < 0 && (s = n.length - 2);
  s < 0 && (s = n.length - 1);
  var o = "", l, u, h = Math.min(t.line + e.linesAfter, i.length).toString().length, d = e.maxLength - (e.indent + h + 3);
  for (l = 1; l <= e.linesBefore && !(s - l < 0); l++)
    u = qm(
      t.buffer,
      n[s - l],
      i[s - l],
      t.position - (n[s] - n[s - l]),
      d
    ), o = Pn.repeat(" ", e.indent) + Ym((t.line - l + 1).toString(), h) + " | " + u.str + `
` + o;
  for (u = qm(t.buffer, n[s], i[s], t.position, d), o += Pn.repeat(" ", e.indent) + Ym((t.line + 1).toString(), h) + " | " + u.str + `
`, o += Pn.repeat("-", e.indent + h + 3 + u.pos) + `^
`, l = 1; l <= e.linesAfter && !(s + l >= i.length); l++)
    u = qm(
      t.buffer,
      n[s + l],
      i[s + l],
      t.position - (n[s] - n[s + l]),
      d
    ), o += Pn.repeat(" ", e.indent) + Ym((t.line + l + 1).toString(), h) + " | " + u.str + `
`;
  return o.replace(/\n$/, "");
}
x(rI, "makeSnippet");
var Zte = rI, Qte = [
  "kind",
  "multi",
  "resolve",
  "construct",
  "instanceOf",
  "predicate",
  "represent",
  "representName",
  "defaultStyle",
  "styleAliases"
], Jte = [
  "scalar",
  "sequence",
  "mapping"
];
function nI(t) {
  var e = {};
  return t !== null && Object.keys(t).forEach(function(r) {
    t[r].forEach(function(n) {
      e[String(n)] = r;
    });
  }), e;
}
x(nI, "compileStyleAliases");
function iI(t, e) {
  if (e = e || {}, Object.keys(e).forEach(function(r) {
    if (Qte.indexOf(r) === -1)
      throw new oa('Unknown option "' + r + '" 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(r) {
    return r;
  }, 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 = nI(e.styleAliases || null), Jte.indexOf(this.kind) === -1)
    throw new oa('Unknown kind "' + this.kind + '" is specified for "' + t + '" YAML type.');
}
x(iI, "Type$1");
var Si = iI;
function fw(t, e) {
  var r = [];
  return t[e].forEach(function(n) {
    var i = r.length;
    r.forEach(function(a, s) {
      a.tag === n.tag && a.kind === n.kind && a.multi === n.multi && (i = s);
    }), r[i] = n;
  }), r;
}
x(fw, "compileList");
function aI() {
  var t = {
    scalar: {},
    sequence: {},
    mapping: {},
    fallback: {},
    multi: {
      scalar: [],
      sequence: [],
      mapping: [],
      fallback: []
    }
  }, e, r;
  function n(i) {
    i.multi ? (t.multi[i.kind].push(i), t.multi.fallback.push(i)) : t[i.kind][i.tag] = t.fallback[i.tag] = i;
  }
  for (x(n, "collectType"), e = 0, r = arguments.length; e < r; e += 1)
    arguments[e].forEach(n);
  return t;
}
x(aI, "compileMap");
function iy(t) {
  return this.extend(t);
}
x(iy, "Schema$1");
iy.prototype.extend = /* @__PURE__ */ x(function(e) {
  var r = [], n = [];
  if (e instanceof Si)
    n.push(e);
  else if (Array.isArray(e))
    n = n.concat(e);
  else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit)))
    e.implicit && (r = r.concat(e.implicit)), e.explicit && (n = n.concat(e.explicit));
  else
    throw new oa("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
  r.forEach(function(a) {
    if (!(a instanceof Si))
      throw new oa("Specified list of YAML types (or a single Type object) contains a non-Type object.");
    if (a.loadKind && a.loadKind !== "scalar")
      throw new oa("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
    if (a.multi)
      throw new oa("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
  }), n.forEach(function(a) {
    if (!(a instanceof Si))
      throw new oa("Specified list of YAML types (or a single Type object) contains a non-Type object.");
  });
  var i = Object.create(iy.prototype);
  return i.implicit = (this.implicit || []).concat(r), i.explicit = (this.explicit || []).concat(n), i.compiledImplicit = fw(i, "implicit"), i.compiledExplicit = fw(i, "explicit"), i.compiledTypeMap = aI(i.compiledImplicit, i.compiledExplicit), i;
}, "extend");
var ere = iy, tre = new Si("tag:yaml.org,2002:str", {
  kind: "scalar",
  construct: /* @__PURE__ */ x(function(t) {
    return t !== null ? t : "";
  }, "construct")
}), rre = new Si("tag:yaml.org,2002:seq", {
  kind: "sequence",
  construct: /* @__PURE__ */ x(function(t) {
    return t !== null ? t : [];
  }, "construct")
}), nre = new Si("tag:yaml.org,2002:map", {
  kind: "mapping",
  construct: /* @__PURE__ */ x(function(t) {
    return t !== null ? t : {};
  }, "construct")
}), ire = new ere({
  explicit: [
    tre,
    rre,
    nre
  ]
});
function sI(t) {
  if (t === null) return !0;
  var e = t.length;
  return e === 1 && t === "~" || e === 4 && (t === "null" || t === "Null" || t === "NULL");
}
x(sI, "resolveYamlNull");
function oI() {
  return null;
}
x(oI, "constructYamlNull");
function lI(t) {
  return t === null;
}
x(lI, "isNull");
var are = new Si("tag:yaml.org,2002:null", {
  kind: "scalar",
  resolve: sI,
  construct: oI,
  predicate: lI,
  represent: {
    canonical: /* @__PURE__ */ x(function() {
      return "~";
    }, "canonical"),
    lowercase: /* @__PURE__ */ x(function() {
      return "null";
    }, "lowercase"),
    uppercase: /* @__PURE__ */ x(function() {
      return "NULL";
    }, "uppercase"),
    camelcase: /* @__PURE__ */ x(function() {
      return "Null";
    }, "camelcase"),
    empty: /* @__PURE__ */ x(function() {
      return "";
    }, "empty")
  },
  defaultStyle: "lowercase"
});
function cI(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");
}
x(cI, "resolveYamlBoolean");
function uI(t) {
  return t === "true" || t === "True" || t === "TRUE";
}
x(uI, "constructYamlBoolean");
function hI(t) {
  return Object.prototype.toString.call(t) === "[object Boolean]";
}
x(hI, "isBoolean");
var sre = new Si("tag:yaml.org,2002:bool", {
  kind: "scalar",
  resolve: cI,
  construct: uI,
  predicate: hI,
  represent: {
    lowercase: /* @__PURE__ */ x(function(t) {
      return t ? "true" : "false";
    }, "lowercase"),
    uppercase: /* @__PURE__ */ x(function(t) {
      return t ? "TRUE" : "FALSE";
    }, "uppercase"),
    camelcase: /* @__PURE__ */ x(function(t) {
      return t ? "True" : "False";
    }, "camelcase")
  },
  defaultStyle: "lowercase"
});
function dI(t) {
  return 48 <= t && t <= 57 || 65 <= t && t <= 70 || 97 <= t && t <= 102;
}
x(dI, "isHexCode");
function fI(t) {
  return 48 <= t && t <= 55;
}
x(fI, "isOctCode");
function pI(t) {
  return 48 <= t && t <= 57;
}
x(pI, "isDecCode");
function gI(t) {
  if (t === null) return !1;
  var e = t.length, r = 0, n = !1, i;
  if (!e) return !1;
  if (i = t[r], (i === "-" || i === "+") && (i = t[++r]), i === "0") {
    if (r + 1 === e) return !0;
    if (i = t[++r], i === "b") {
      for (r++; r < e; r++)
        if (i = t[r], i !== "_") {
          if (i !== "0" && i !== "1") return !1;
          n = !0;
        }
      return n && i !== "_";
    }
    if (i === "x") {
      for (r++; r < e; r++)
        if (i = t[r], i !== "_") {
          if (!dI(t.charCodeAt(r))) return !1;
          n = !0;
        }
      return n && i !== "_";
    }
    if (i === "o") {
      for (r++; r < e; r++)
        if (i = t[r], i !== "_") {
          if (!fI(t.charCodeAt(r))) return !1;
          n = !0;
        }
      return n && i !== "_";
    }
  }
  if (i === "_") return !1;
  for (; r < e; r++)
    if (i = t[r], i !== "_") {
      if (!pI(t.charCodeAt(r)))
        return !1;
      n = !0;
    }
  return !(!n || i === "_");
}
x(gI, "resolveYamlInteger");
function mI(t) {
  var e = t, r = 1, n;
  if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), n = e[0], (n === "-" || n === "+") && (n === "-" && (r = -1), e = e.slice(1), n = e[0]), e === "0") return 0;
  if (n === "0") {
    if (e[1] === "b") return r * parseInt(e.slice(2), 2);
    if (e[1] === "x") return r * parseInt(e.slice(2), 16);
    if (e[1] === "o") return r * parseInt(e.slice(2), 8);
  }
  return r * parseInt(e, 10);
}
x(mI, "constructYamlInteger");
function vI(t) {
  return Object.prototype.toString.call(t) === "[object Number]" && t % 1 === 0 && !Pn.isNegativeZero(t);
}
x(vI, "isInteger");
var ore = new Si("tag:yaml.org,2002:int", {
  kind: "scalar",
  resolve: gI,
  construct: mI,
  predicate: vI,
  represent: {
    binary: /* @__PURE__ */ x(function(t) {
      return t >= 0 ? "0b" + t.toString(2) : "-0b" + t.toString(2).slice(1);
    }, "binary"),
    octal: /* @__PURE__ */ x(function(t) {
      return t >= 0 ? "0o" + t.toString(8) : "-0o" + t.toString(8).slice(1);
    }, "octal"),
    decimal: /* @__PURE__ */ x(function(t) {
      return t.toString(10);
    }, "decimal"),
    /* eslint-disable max-len */
    hexadecimal: /* @__PURE__ */ x(function(t) {
      return t >= 0 ? "0x" + t.toString(16).toUpperCase() : "-0x" + t.toString(16).toUpperCase().slice(1);
    }, "hexadecimal")
  },
  defaultStyle: "decimal",
  styleAliases: {
    binary: [2, "bin"],
    octal: [8, "oct"],
    decimal: [10, "dec"],
    hexadecimal: [16, "hex"]
  }
}), lre = 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 yI(t) {
  return !(t === null || !lre.test(t) || // Quick hack to not allow integers end with `_`
  // Probably should update regexp & check speed
  t[t.length - 1] === "_");
}
x(yI, "resolveYamlFloat");
function xI(t) {
  var e, r;
  return e = t.replace(/_/g, "").toLowerCase(), r = e[0] === "-" ? -1 : 1, "+-".indexOf(e[0]) >= 0 && (e = e.slice(1)), e === ".inf" ? r === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : e === ".nan" ? NaN : r * parseFloat(e, 10);
}
x(xI, "constructYamlFloat");
var cre = /^[-+]?[0-9]+e/;
function bI(t, e) {
  var r;
  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 (Pn.isNegativeZero(t))
    return "-0.0";
  return r = t.toString(10), cre.test(r) ? r.replace("e", ".e") : r;
}
x(bI, "representYamlFloat");
function wI(t) {
  return Object.prototype.toString.call(t) === "[object Number]" && (t % 1 !== 0 || Pn.isNegativeZero(t));
}
x(wI, "isFloat");
var ure = new Si("tag:yaml.org,2002:float", {
  kind: "scalar",
  resolve: yI,
  construct: xI,
  predicate: wI,
  represent: bI,
  defaultStyle: "lowercase"
}), TI = ire.extend({
  implicit: [
    are,
    sre,
    ore,
    ure
  ]
}), hre = TI, EI = new RegExp(
  "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
), kI = 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 SI(t) {
  return t === null ? !1 : EI.exec(t) !== null || kI.exec(t) !== null;
}
x(SI, "resolveYamlTimestamp");
function CI(t) {
  var e, r, n, i, a, s, o, l = 0, u = null, h, d, f;
  if (e = EI.exec(t), e === null && (e = kI.exec(t)), e === null) throw new Error("Date resolve error");
  if (r = +e[1], n = +e[2] - 1, i = +e[3], !e[4])
    return new Date(Date.UTC(r, n, i));
  if (a = +e[4], s = +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], d = +(e[11] || 0), u = (h * 60 + d) * 6e4, e[9] === "-" && (u = -u)), f = new Date(Date.UTC(r, n, i, a, s, o, l)), u && f.setTime(f.getTime() - u), f;
}
x(CI, "constructYamlTimestamp");
function AI(t) {
  return t.toISOString();
}
x(AI, "representYamlTimestamp");
var dre = new Si("tag:yaml.org,2002:timestamp", {
  kind: "scalar",
  resolve: SI,
  construct: CI,
  instanceOf: Date,
  represent: AI
});
function _I(t) {
  return t === "<<" || t === null;
}
x(_I, "resolveYamlMerge");
var fre = new Si("tag:yaml.org,2002:merge", {
  kind: "scalar",
  resolve: _I
}), wE = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;
function LI(t) {
  if (t === null) return !1;
  var e, r, n = 0, i = t.length, a = wE;
  for (r = 0; r < i; r++)
    if (e = a.indexOf(t.charAt(r)), !(e > 64)) {
      if (e < 0) return !1;
      n += 6;
    }
  return n % 8 === 0;
}
x(LI, "resolveYamlBinary");
function RI(t) {
  var e, r, n = t.replace(/[\r\n=]/g, ""), i = n.length, a = wE, s = 0, o = [];
  for (e = 0; e < i; e++)
    e % 4 === 0 && e && (o.push(s >> 16 & 255), o.push(s >> 8 & 255), o.push(s & 255)), s = s << 6 | a.indexOf(n.charAt(e));
  return r = i % 4 * 6, r === 0 ? (o.push(s >> 16 & 255), o.push(s >> 8 & 255), o.push(s & 255)) : r === 18 ? (o.push(s >> 10 & 255), o.push(s >> 2 & 255)) : r === 12 && o.push(s >> 4 & 255), new Uint8Array(o);
}
x(RI, "constructYamlBinary");
function NI(t) {
  var e = "", r = 0, n, i, a = t.length, s = wE;
  for (n = 0; n < a; n++)
    n % 3 === 0 && n && (e += s[r >> 18 & 63], e += s[r >> 12 & 63], e += s[r >> 6 & 63], e += s[r & 63]), r = (r << 8) + t[n];
  return i = a % 3, i === 0 ? (e += s[r >> 18 & 63], e += s[r >> 12 & 63], e += s[r >> 6 & 63], e += s[r & 63]) : i === 2 ? (e += s[r >> 10 & 63], e += s[r >> 4 & 63], e += s[r << 2 & 63], e += s[64]) : i === 1 && (e += s[r >> 2 & 63], e += s[r << 4 & 63], e += s[64], e += s[64]), e;
}
x(NI, "representYamlBinary");
function MI(t) {
  return Object.prototype.toString.call(t) === "[object Uint8Array]";
}
x(MI, "isBinary");
var pre = new Si("tag:yaml.org,2002:binary", {
  kind: "scalar",
  resolve: LI,
  construct: RI,
  predicate: MI,
  represent: NI
}), gre = Object.prototype.hasOwnProperty, mre = Object.prototype.toString;
function DI(t) {
  if (t === null) return !0;
  var e = [], r, n, i, a, s, o = t;
  for (r = 0, n = o.length; r < n; r += 1) {
    if (i = o[r], s = !1, mre.call(i) !== "[object Object]") return !1;
    for (a in i)
      if (gre.call(i, a))
        if (!s) s = !0;
        else return !1;
    if (!s) return !1;
    if (e.indexOf(a) === -1) e.push(a);
    else return !1;
  }
  return !0;
}
x(DI, "resolveYamlOmap");
function II(t) {
  return t !== null ? t : [];
}
x(II, "constructYamlOmap");
var vre = new Si("tag:yaml.org,2002:omap", {
  kind: "sequence",
  resolve: DI,
  construct: II
}), yre = Object.prototype.toString;
function OI(t) {
  if (t === null) return !0;
  var e, r, n, i, a, s = t;
  for (a = new Array(s.length), e = 0, r = s.length; e < r; e += 1) {
    if (n = s[e], yre.call(n) !== "[object Object]" || (i = Object.keys(n), i.length !== 1)) return !1;
    a[e] = [i[0], n[i[0]]];
  }
  return !0;
}
x(OI, "resolveYamlPairs");
function PI(t) {
  if (t === null) return [];
  var e, r, n, i, a, s = t;
  for (a = new Array(s.length), e = 0, r = s.length; e < r; e += 1)
    n = s[e], i = Object.keys(n), a[e] = [i[0], n[i[0]]];
  return a;
}
x(PI, "constructYamlPairs");
var xre = new Si("tag:yaml.org,2002:pairs", {
  kind: "sequence",
  resolve: OI,
  construct: PI
}), bre = Object.prototype.hasOwnProperty;
function BI(t) {
  if (t === null) return !0;
  var e, r = t;
  for (e in r)
    if (bre.call(r, e) && r[e] !== null)
      return !1;
  return !0;
}
x(BI, "resolveYamlSet");
function FI(t) {
  return t !== null ? t : {};
}
x(FI, "constructYamlSet");
var wre = new Si("tag:yaml.org,2002:set", {
  kind: "mapping",
  resolve: BI,
  construct: FI
}), $I = hre.extend({
  implicit: [
    dre,
    fre
  ],
  explicit: [
    pre,
    vre,
    xre,
    wre
  ]
}), Il = Object.prototype.hasOwnProperty, ay = 1, zI = 2, VI = 3, sy = 4, qb = 1, Tre = 2, LC = 3, Ere = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, kre = /[\x85\u2028\u2029]/, Sre = /[,\[\]\{\}]/, GI = /^(?:!|!!|![a-z\-]+!)$/i, UI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function pw(t) {
  return Object.prototype.toString.call(t);
}
x(pw, "_class");
function gs(t) {
  return t === 10 || t === 13;
}
x(gs, "is_EOL");
function Ll(t) {
  return t === 9 || t === 32;
}
x(Ll, "is_WHITE_SPACE");
function $i(t) {
  return t === 9 || t === 32 || t === 10 || t === 13;
}
x($i, "is_WS_OR_EOL");
function Wc(t) {
  return t === 44 || t === 91 || t === 93 || t === 123 || t === 125;
}
x(Wc, "is_FLOW_INDICATOR");
function WI(t) {
  var e;
  return 48 <= t && t <= 57 ? t - 48 : (e = t | 32, 97 <= e && e <= 102 ? e - 97 + 10 : -1);
}
x(WI, "fromHexCode");
function HI(t) {
  return t === 120 ? 2 : t === 117 ? 4 : t === 85 ? 8 : 0;
}
x(HI, "escapedHexLen");
function qI(t) {
  return 48 <= t && t <= 57 ? t - 48 : -1;
}
x(qI, "fromDecimalCode");
function gw(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" : "";
}
x(gw, "simpleEscapeSequence");
function YI(t) {
  return t <= 65535 ? String.fromCharCode(t) : String.fromCharCode(
    (t - 65536 >> 10) + 55296,
    (t - 65536 & 1023) + 56320
  );
}
x(YI, "charFromCodepoint");
var XI = new Array(256), jI = new Array(256);
for (kc = 0; kc < 256; kc++)
  XI[kc] = gw(kc) ? 1 : 0, jI[kc] = gw(kc);
var kc;
function KI(t, e) {
  this.input = t, this.filename = e.filename || null, this.schema = e.schema || $I, 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 = [];
}
x(KI, "State$1");
function TE(t, e) {
  var r = {
    name: t.filename,
    buffer: t.input.slice(0, -1),
    // omit trailing \0
    position: t.position,
    line: t.line,
    column: t.position - t.lineStart
  };
  return r.snippet = Zte(r), new oa(e, r);
}
x(TE, "generateError");
function Pt(t, e) {
  throw TE(t, e);
}
x(Pt, "throwError");
function Up(t, e) {
  t.onWarning && t.onWarning.call(null, TE(t, e));
}
x(Up, "throwWarning");
var RC = {
  YAML: /* @__PURE__ */ x(function(e, r, n) {
    var i, a, s;
    e.version !== null && Pt(e, "duplication of %YAML directive"), n.length !== 1 && Pt(e, "YAML directive accepts exactly one argument"), i = /^([0-9]+)\.([0-9]+)$/.exec(n[0]), i === null && Pt(e, "ill-formed argument of the YAML directive"), a = parseInt(i[1], 10), s = parseInt(i[2], 10), a !== 1 && Pt(e, "unacceptable YAML version of the document"), e.version = n[0], e.checkLineBreaks = s < 2, s !== 1 && s !== 2 && Up(e, "unsupported YAML version of the document");
  }, "handleYamlDirective"),
  TAG: /* @__PURE__ */ x(function(e, r, n) {
    var i, a;
    n.length !== 2 && Pt(e, "TAG directive accepts exactly two arguments"), i = n[0], a = n[1], GI.test(i) || Pt(e, "ill-formed tag handle (first argument) of the TAG directive"), Il.call(e.tagMap, i) && Pt(e, 'there is a previously declared suffix for "' + i + '" tag handle'), UI.test(a) || Pt(e, "ill-formed tag prefix (second argument) of the TAG directive");
    try {
      a = decodeURIComponent(a);
    } catch {
      Pt(e, "tag prefix is malformed: " + a);
    }
    e.tagMap[i] = a;
  }, "handleTagDirective")
};
function $o(t, e, r, n) {
  var i, a, s, o;
  if (e < r) {
    if (o = t.input.slice(e, r), n)
      for (i = 0, a = o.length; i < a; i += 1)
        s = o.charCodeAt(i), s === 9 || 32 <= s && s <= 1114111 || Pt(t, "expected valid JSON character");
    else Ere.test(o) && Pt(t, "the stream contains non-printable characters");
    t.result += o;
  }
}
x($o, "captureSegment");
function mw(t, e, r, n) {
  var i, a, s, o;
  for (Pn.isObject(r) || Pt(t, "cannot merge mappings; the provided source object is unacceptable"), i = Object.keys(r), s = 0, o = i.length; s < o; s += 1)
    a = i[s], Il.call(e, a) || (e[a] = r[a], n[a] = !0);
}
x(mw, "mergeMappings");
function Hc(t, e, r, n, i, a, s, o, l) {
  var u, h;
  if (Array.isArray(i))
    for (i = Array.prototype.slice.call(i), u = 0, h = i.length; u < h; u += 1)
      Array.isArray(i[u]) && Pt(t, "nested arrays are not supported inside keys"), typeof i == "object" && pw(i[u]) === "[object Object]" && (i[u] = "[object Object]");
  if (typeof i == "object" && pw(i) === "[object Object]" && (i = "[object Object]"), i = String(i), e === null && (e = {}), n === "tag:yaml.org,2002:merge")
    if (Array.isArray(a))
      for (u = 0, h = a.length; u < h; u += 1)
        mw(t, e, a[u], r);
    else
      mw(t, e, a, r);
  else
    !t.json && !Il.call(r, i) && Il.call(e, i) && (t.line = s || t.line, t.lineStart = o || t.lineStart, t.position = l || t.position, Pt(t, "duplicated mapping key")), i === "__proto__" ? Object.defineProperty(e, i, {
      configurable: !0,
      enumerable: !0,
      writable: !0,
      value: a
    }) : e[i] = a, delete r[i];
  return e;
}
x(Hc, "storeMappingPair");
function j2(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++) : Pt(t, "a line break is expected"), t.line += 1, t.lineStart = t.position, t.firstTabInLine = -1;
}
x(j2, "readLineBreak");
function vn(t, e, r) {
  for (var n = 0, i = t.input.charCodeAt(t.position); i !== 0; ) {
    for (; Ll(i); )
      i === 9 && t.firstTabInLine === -1 && (t.firstTabInLine = t.position), i = t.input.charCodeAt(++t.position);
    if (e && i === 35)
      do
        i = t.input.charCodeAt(++t.position);
      while (i !== 10 && i !== 13 && i !== 0);
    if (gs(i))
      for (j2(t), i = t.input.charCodeAt(t.position), n++, t.lineIndent = 0; i === 32; )
        t.lineIndent++, i = t.input.charCodeAt(++t.position);
    else
      break;
  }
  return r !== -1 && n !== 0 && t.lineIndent < r && Up(t, "deficient indentation"), n;
}
x(vn, "skipSeparationSpace");
function Dg(t) {
  var e = t.position, r;
  return r = t.input.charCodeAt(e), !!((r === 45 || r === 46) && r === t.input.charCodeAt(e + 1) && r === t.input.charCodeAt(e + 2) && (e += 3, r = t.input.charCodeAt(e), r === 0 || $i(r)));
}
x(Dg, "testDocumentSeparator");
function K2(t, e) {
  e === 1 ? t.result += " " : e > 1 && (t.result += Pn.repeat(`
`, e - 1));
}
x(K2, "writeFoldedLines");
function ZI(t, e, r) {
  var n, i, a, s, o, l, u, h, d = t.kind, f = t.result, p;
  if (p = t.input.charCodeAt(t.position), $i(p) || Wc(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) && (i = t.input.charCodeAt(t.position + 1), $i(i) || r && Wc(i)))
    return !1;
  for (t.kind = "scalar", t.result = "", a = s = t.position, o = !1; p !== 0; ) {
    if (p === 58) {
      if (i = t.input.charCodeAt(t.position + 1), $i(i) || r && Wc(i))
        break;
    } else if (p === 35) {
      if (n = t.input.charCodeAt(t.position - 1), $i(n))
        break;
    } else {
      if (t.position === t.lineStart && Dg(t) || r && Wc(p))
        break;
      if (gs(p))
        if (l = t.line, u = t.lineStart, h = t.lineIndent, vn(t, !1, -1), t.lineIndent >= e) {
          o = !0, p = t.input.charCodeAt(t.position);
          continue;
        } else {
          t.position = s, t.line = l, t.lineStart = u, t.lineIndent = h;
          break;
        }
    }
    o && ($o(t, a, s, !1), K2(t, t.line - l), a = s = t.position, o = !1), Ll(p) || (s = t.position + 1), p = t.input.charCodeAt(++t.position);
  }
  return $o(t, a, s, !1), t.result ? !0 : (t.kind = d, t.result = f, !1);
}
x(ZI, "readPlainScalar");
function QI(t, e) {
  var r, n, i;
  if (r = t.input.charCodeAt(t.position), r !== 39)
    return !1;
  for (t.kind = "scalar", t.result = "", t.position++, n = i = t.position; (r = t.input.charCodeAt(t.position)) !== 0; )
    if (r === 39)
      if ($o(t, n, t.position, !0), r = t.input.charCodeAt(++t.position), r === 39)
        n = t.position, t.position++, i = t.position;
      else
        return !0;
    else gs(r) ? ($o(t, n, i, !0), K2(t, vn(t, !1, e)), n = i = t.position) : t.position === t.lineStart && Dg(t) ? Pt(t, "unexpected end of the document within a single quoted scalar") : (t.position++, i = t.position);
  Pt(t, "unexpected end of the stream within a single quoted scalar");
}
x(QI, "readSingleQuotedScalar");
function JI(t, e) {
  var r, n, i, a, s, o;
  if (o = t.input.charCodeAt(t.position), o !== 34)
    return !1;
  for (t.kind = "scalar", t.result = "", t.position++, r = n = t.position; (o = t.input.charCodeAt(t.position)) !== 0; ) {
    if (o === 34)
      return $o(t, r, t.position, !0), t.position++, !0;
    if (o === 92) {
      if ($o(t, r, t.position, !0), o = t.input.charCodeAt(++t.position), gs(o))
        vn(t, !1, e);
      else if (o < 256 && XI[o])
        t.result += jI[o], t.position++;
      else if ((s = HI(o)) > 0) {
        for (i = s, a = 0; i > 0; i--)
          o = t.input.charCodeAt(++t.position), (s = WI(o)) >= 0 ? a = (a << 4) + s : Pt(t, "expected hexadecimal character");
        t.result += YI(a), t.position++;
      } else
        Pt(t, "unknown escape sequence");
      r = n = t.position;
    } else gs(o) ? ($o(t, r, n, !0), K2(t, vn(t, !1, e)), r = n = t.position) : t.position === t.lineStart && Dg(t) ? Pt(t, "unexpected end of the document within a double quoted scalar") : (t.position++, n = t.position);
  }
  Pt(t, "unexpected end of the stream within a double quoted scalar");
}
x(JI, "readDoubleQuotedScalar");
function eO(t, e) {
  var r = !0, n, i, a, s = t.tag, o, l = t.anchor, u, h, d, f, p, g = /* @__PURE__ */ Object.create(null), m, v, y, b;
  if (b = t.input.charCodeAt(t.position), b === 91)
    h = 93, p = !1, o = [];
  else if (b === 123)
    h = 125, p = !0, o = {};
  else
    return !1;
  for (t.anchor !== null && (t.anchorMap[t.anchor] = o), b = t.input.charCodeAt(++t.position); b !== 0; ) {
    if (vn(t, !0, e), b = t.input.charCodeAt(t.position), b === h)
      return t.position++, t.tag = s, t.anchor = l, t.kind = p ? "mapping" : "sequence", t.result = o, !0;
    r ? b === 44 && Pt(t, "expected the node content, but found ','") : Pt(t, "missed comma between flow collection entries"), v = m = y = null, d = f = !1, b === 63 && (u = t.input.charCodeAt(t.position + 1), $i(u) && (d = f = !0, t.position++, vn(t, !0, e))), n = t.line, i = t.lineStart, a = t.position, cu(t, e, ay, !1, !0), v = t.tag, m = t.result, vn(t, !0, e), b = t.input.charCodeAt(t.position), (f || t.line === n) && b === 58 && (d = !0, b = t.input.charCodeAt(++t.position), vn(t, !0, e), cu(t, e, ay, !1, !0), y = t.result), p ? Hc(t, o, g, v, m, y, n, i, a) : d ? o.push(Hc(t, null, g, v, m, y, n, i, a)) : o.push(m), vn(t, !0, e), b = t.input.charCodeAt(t.position), b === 44 ? (r = !0, b = t.input.charCodeAt(++t.position)) : r = !1;
  }
  Pt(t, "unexpected end of the stream within a flow collection");
}
x(eO, "readFlowCollection");
function tO(t, e) {
  var r, n, i = qb, a = !1, s = !1, o = e, l = 0, u = !1, h, d;
  if (d = t.input.charCodeAt(t.position), d === 124)
    n = !1;
  else if (d === 62)
    n = !0;
  else
    return !1;
  for (t.kind = "scalar", t.result = ""; d !== 0; )
    if (d = t.input.charCodeAt(++t.position), d === 43 || d === 45)
      qb === i ? i = d === 43 ? LC : Tre : Pt(t, "repeat of a chomping mode identifier");
    else if ((h = qI(d)) >= 0)
      h === 0 ? Pt(t, "bad explicit indentation width of a block scalar; it cannot be less than one") : s ? Pt(t, "repeat of an indentation width identifier") : (o = e + h - 1, s = !0);
    else
      break;
  if (Ll(d)) {
    do
      d = t.input.charCodeAt(++t.position);
    while (Ll(d));
    if (d === 35)
      do
        d = t.input.charCodeAt(++t.position);
      while (!gs(d) && d !== 0);
  }
  for (; d !== 0; ) {
    for (j2(t), t.lineIndent = 0, d = t.input.charCodeAt(t.position); (!s || t.lineIndent < o) && d === 32; )
      t.lineIndent++, d = t.input.charCodeAt(++t.position);
    if (!s && t.lineIndent > o && (o = t.lineIndent), gs(d)) {
      l++;
      continue;
    }
    if (t.lineIndent < o) {
      i === LC ? t.result += Pn.repeat(`
`, a ? 1 + l : l) : i === qb && a && (t.result += `
`);
      break;
    }
    for (n ? Ll(d) ? (u = !0, t.result += Pn.repeat(`
`, a ? 1 + l : l)) : u ? (u = !1, t.result += Pn.repeat(`
`, l + 1)) : l === 0 ? a && (t.result += " ") : t.result += Pn.repeat(`
`, l) : t.result += Pn.repeat(`
`, a ? 1 + l : l), a = !0, s = !0, l = 0, r = t.position; !gs(d) && d !== 0; )
      d = t.input.charCodeAt(++t.position);
    $o(t, r, t.position, !1);
  }
  return !0;
}
x(tO, "readBlockScalar");
function vw(t, e) {
  var r, n = t.tag, i = t.anchor, a = [], s, o = !1, l;
  if (t.firstTabInLine !== -1) return !1;
  for (t.anchor !== null && (t.anchorMap[t.anchor] = a), l = t.input.charCodeAt(t.position); l !== 0 && (t.firstTabInLine !== -1 && (t.position = t.firstTabInLine, Pt(t, "tab characters must not be used in indentation")), !(l !== 45 || (s = t.input.charCodeAt(t.position + 1), !$i(s)))); ) {
    if (o = !0, t.position++, vn(t, !0, -1) && t.lineIndent <= e) {
      a.push(null), l = t.input.charCodeAt(t.position);
      continue;
    }
    if (r = t.line, cu(t, e, VI, !1, !0), a.push(t.result), vn(t, !0, -1), l = t.input.charCodeAt(t.position), (t.line === r || t.lineIndent > e) && l !== 0)
      Pt(t, "bad indentation of a sequence entry");
    else if (t.lineIndent < e)
      break;
  }
  return o ? (t.tag = n, t.anchor = i, t.kind = "sequence", t.result = a, !0) : !1;
}
x(vw, "readBlockSequence");
function rO(t, e, r) {
  var n, i, a, s, o, l, u = t.tag, h = t.anchor, d = {}, f = /* @__PURE__ */ Object.create(null), p = null, g = null, m = null, v = !1, y = !1, b;
  if (t.firstTabInLine !== -1) return !1;
  for (t.anchor !== null && (t.anchorMap[t.anchor] = d), b = t.input.charCodeAt(t.position); b !== 0; ) {
    if (!v && t.firstTabInLine !== -1 && (t.position = t.firstTabInLine, Pt(t, "tab characters must not be used in indentation")), n = t.input.charCodeAt(t.position + 1), a = t.line, (b === 63 || b === 58) && $i(n))
      b === 63 ? (v && (Hc(t, d, f, p, g, null, s, o, l), p = g = m = null), y = !0, v = !0, i = !0) : v ? (v = !1, i = !0) : Pt(t, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), t.position += 1, b = n;
    else {
      if (s = t.line, o = t.lineStart, l = t.position, !cu(t, r, zI, !1, !0))
        break;
      if (t.line === a) {
        for (b = t.input.charCodeAt(t.position); Ll(b); )
          b = t.input.charCodeAt(++t.position);
        if (b === 58)
          b = t.input.charCodeAt(++t.position), $i(b) || Pt(t, "a whitespace character is expected after the key-value separator within a block mapping"), v && (Hc(t, d, f, p, g, null, s, o, l), p = g = m = null), y = !0, v = !1, i = !1, p = t.tag, g = t.result;
        else if (y)
          Pt(t, "can not read an implicit mapping pair; a colon is missed");
        else
          return t.tag = u, t.anchor = h, !0;
      } else if (y)
        Pt(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 === a || t.lineIndent > e) && (v && (s = t.line, o = t.lineStart, l = t.position), cu(t, e, sy, !0, i) && (v ? g = t.result : m = t.result), v || (Hc(t, d, f, p, g, m, s, o, l), p = g = m = null), vn(t, !0, -1), b = t.input.charCodeAt(t.position)), (t.line === a || t.lineIndent > e) && b !== 0)
      Pt(t, "bad indentation of a mapping entry");
    else if (t.lineIndent < e)
      break;
  }
  return v && Hc(t, d, f, p, g, null, s, o, l), y && (t.tag = u, t.anchor = h, t.kind = "mapping", t.result = d), y;
}
x(rO, "readBlockMapping");
function nO(t) {
  var e, r = !1, n = !1, i, a, s;
  if (s = t.input.charCodeAt(t.position), s !== 33) return !1;
  if (t.tag !== null && Pt(t, "duplication of a tag property"), s = t.input.charCodeAt(++t.position), s === 60 ? (r = !0, s = t.input.charCodeAt(++t.position)) : s === 33 ? (n = !0, i = "!!", s = t.input.charCodeAt(++t.position)) : i = "!", e = t.position, r) {
    do
      s = t.input.charCodeAt(++t.position);
    while (s !== 0 && s !== 62);
    t.position < t.length ? (a = t.input.slice(e, t.position), s = t.input.charCodeAt(++t.position)) : Pt(t, "unexpected end of the stream within a verbatim tag");
  } else {
    for (; s !== 0 && !$i(s); )
      s === 33 && (n ? Pt(t, "tag suffix cannot contain exclamation marks") : (i = t.input.slice(e - 1, t.position + 1), GI.test(i) || Pt(t, "named tag handle cannot contain such characters"), n = !0, e = t.position + 1)), s = t.input.charCodeAt(++t.position);
    a = t.input.slice(e, t.position), Sre.test(a) && Pt(t, "tag suffix cannot contain flow indicator characters");
  }
  a && !UI.test(a) && Pt(t, "tag name cannot contain such characters: " + a);
  try {
    a = decodeURIComponent(a);
  } catch {
    Pt(t, "tag name is malformed: " + a);
  }
  return r ? t.tag = a : Il.call(t.tagMap, i) ? t.tag = t.tagMap[i] + a : i === "!" ? t.tag = "!" + a : i === "!!" ? t.tag = "tag:yaml.org,2002:" + a : Pt(t, 'undeclared tag handle "' + i + '"'), !0;
}
x(nO, "readTagProperty");
function iO(t) {
  var e, r;
  if (r = t.input.charCodeAt(t.position), r !== 38) return !1;
  for (t.anchor !== null && Pt(t, "duplication of an anchor property"), r = t.input.charCodeAt(++t.position), e = t.position; r !== 0 && !$i(r) && !Wc(r); )
    r = t.input.charCodeAt(++t.position);
  return t.position === e && Pt(t, "name of an anchor node must contain at least one character"), t.anchor = t.input.slice(e, t.position), !0;
}
x(iO, "readAnchorProperty");
function aO(t) {
  var e, r, n;
  if (n = t.input.charCodeAt(t.position), n !== 42) return !1;
  for (n = t.input.charCodeAt(++t.position), e = t.position; n !== 0 && !$i(n) && !Wc(n); )
    n = t.input.charCodeAt(++t.position);
  return t.position === e && Pt(t, "name of an alias node must contain at least one character"), r = t.input.slice(e, t.position), Il.call(t.anchorMap, r) || Pt(t, 'unidentified alias "' + r + '"'), t.result = t.anchorMap[r], vn(t, !0, -1), !0;
}
x(aO, "readAlias");
function cu(t, e, r, n, i) {
  var a, s, o, l = 1, u = !1, h = !1, d, f, p, g, m, v;
  if (t.listener !== null && t.listener("open", t), t.tag = null, t.anchor = null, t.kind = null, t.result = null, a = s = o = sy === r || VI === r, n && vn(t, !0, -1) && (u = !0, t.lineIndent > e ? l = 1 : t.lineIndent === e ? l = 0 : t.lineIndent < e && (l = -1)), l === 1)
    for (; nO(t) || iO(t); )
      vn(t, !0, -1) ? (u = !0, o = a, t.lineIndent > e ? l = 1 : t.lineIndent === e ? l = 0 : t.lineIndent < e && (l = -1)) : o = !1;
  if (o && (o = u || i), (l === 1 || sy === r) && (ay === r || zI === r ? m = e : m = e + 1, v = t.position - t.lineStart, l === 1 ? o && (vw(t, v) || rO(t, v, m)) || eO(t, m) ? h = !0 : (s && tO(t, m) || QI(t, m) || JI(t, m) ? h = !0 : aO(t) ? (h = !0, (t.tag !== null || t.anchor !== null) && Pt(t, "alias node should not have any properties")) : ZI(t, m, ay === r) && (h = !0, t.tag === null && (t.tag = "?")), t.anchor !== null && (t.anchorMap[t.anchor] = t.result)) : l === 0 && (h = o && vw(t, v))), t.tag === null)
    t.anchor !== null && (t.anchorMap[t.anchor] = t.result);
  else if (t.tag === "?") {
    for (t.result !== null && t.kind !== "scalar" && Pt(t, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + t.kind + '"'), d = 0, f = t.implicitTypes.length; d < f; d += 1)
      if (g = t.implicitTypes[d], g.resolve(t.result)) {
        t.result = g.construct(t.result), t.tag = g.tag, t.anchor !== null && (t.anchorMap[t.anchor] = t.result);
        break;
      }
  } else if (t.tag !== "!") {
    if (Il.call(t.typeMap[t.kind || "fallback"], t.tag))
      g = t.typeMap[t.kind || "fallback"][t.tag];
    else
      for (g = null, p = t.typeMap.multi[t.kind || "fallback"], d = 0, f = p.length; d < f; d += 1)
        if (t.tag.slice(0, p[d].tag.length) === p[d].tag) {
          g = p[d];
          break;
        }
    g || Pt(t, "unknown tag !<" + t.tag + ">"), t.result !== null && g.kind !== t.kind && Pt(t, "unacceptable node kind for !<" + t.tag + '> tag; it should be "' + g.kind + '", not "' + t.kind + '"'), g.resolve(t.result, t.tag) ? (t.result = g.construct(t.result, t.tag), t.anchor !== null && (t.anchorMap[t.anchor] = t.result)) : Pt(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;
}
x(cu, "composeNode");
function sO(t) {
  var e = t.position, r, n, i, a = !1, s;
  for (t.version = null, t.checkLineBreaks = t.legacy, t.tagMap = /* @__PURE__ */ Object.create(null), t.anchorMap = /* @__PURE__ */ Object.create(null); (s = t.input.charCodeAt(t.position)) !== 0 && (vn(t, !0, -1), s = t.input.charCodeAt(t.position), !(t.lineIndent > 0 || s !== 37)); ) {
    for (a = !0, s = t.input.charCodeAt(++t.position), r = t.position; s !== 0 && !$i(s); )
      s = t.input.charCodeAt(++t.position);
    for (n = t.input.slice(r, t.position), i = [], n.length < 1 && Pt(t, "directive name must not be less than one character in length"); s !== 0; ) {
      for (; Ll(s); )
        s = t.input.charCodeAt(++t.position);
      if (s === 35) {
        do
          s = t.input.charCodeAt(++t.position);
        while (s !== 0 && !gs(s));
        break;
      }
      if (gs(s)) break;
      for (r = t.position; s !== 0 && !$i(s); )
        s = t.input.charCodeAt(++t.position);
      i.push(t.input.slice(r, t.position));
    }
    s !== 0 && j2(t), Il.call(RC, n) ? RC[n](t, n, i) : Up(t, 'unknown document directive "' + n + '"');
  }
  if (vn(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, vn(t, !0, -1)) : a && Pt(t, "directives end mark is expected"), cu(t, t.lineIndent - 1, sy, !1, !0), vn(t, !0, -1), t.checkLineBreaks && kre.test(t.input.slice(e, t.position)) && Up(t, "non-ASCII line breaks are interpreted as content"), t.documents.push(t.result), t.position === t.lineStart && Dg(t)) {
    t.input.charCodeAt(t.position) === 46 && (t.position += 3, vn(t, !0, -1));
    return;
  }
  if (t.position < t.length - 1)
    Pt(t, "end of the stream or a document separator is expected");
  else
    return;
}
x(sO, "readDocument");
function EE(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 r = new KI(t, e), n = t.indexOf("\0");
  for (n !== -1 && (r.position = n, Pt(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; )
    r.lineIndent += 1, r.position += 1;
  for (; r.position < r.length - 1; )
    sO(r);
  return r.documents;
}
x(EE, "loadDocuments");
function Cre(t, e, r) {
  e !== null && typeof e == "object" && typeof r > "u" && (r = e, e = null);
  var n = EE(t, r);
  if (typeof e != "function")
    return n;
  for (var i = 0, a = n.length; i < a; i += 1)
    e(n[i]);
}
x(Cre, "loadAll$1");
function oO(t, e) {
  var r = EE(t, e);
  if (r.length !== 0) {
    if (r.length === 1)
      return r[0];
    throw new oa("expected a single document in the stream, but found more");
  }
}
x(oO, "load$1");
var Are = oO, _re = {
  load: Are
}, lO = Object.prototype.toString, cO = Object.prototype.hasOwnProperty, kE = 65279, Lre = 9, Wp = 10, Rre = 13, Nre = 32, Mre = 33, Dre = 34, yw = 35, Ire = 37, Ore = 38, Pre = 39, Bre = 42, uO = 44, Fre = 45, oy = 58, $re = 61, zre = 62, Vre = 63, Gre = 64, hO = 91, dO = 93, Ure = 96, fO = 123, Wre = 124, pO = 125, Ri = {};
Ri[0] = "\\0";
Ri[7] = "\\a";
Ri[8] = "\\b";
Ri[9] = "\\t";
Ri[10] = "\\n";
Ri[11] = "\\v";
Ri[12] = "\\f";
Ri[13] = "\\r";
Ri[27] = "\\e";
Ri[34] = '\\"';
Ri[92] = "\\\\";
Ri[133] = "\\N";
Ri[160] = "\\_";
Ri[8232] = "\\L";
Ri[8233] = "\\P";
var Hre = [
  "y",
  "Y",
  "yes",
  "Yes",
  "YES",
  "on",
  "On",
  "ON",
  "n",
  "N",
  "no",
  "No",
  "NO",
  "off",
  "Off",
  "OFF"
], qre = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
function gO(t, e) {
  var r, n, i, a, s, o, l;
  if (e === null) return {};
  for (r = {}, n = Object.keys(e), i = 0, a = n.length; i < a; i += 1)
    s = n[i], o = String(e[s]), s.slice(0, 2) === "!!" && (s = "tag:yaml.org,2002:" + s.slice(2)), l = t.compiledTypeMap.fallback[s], l && cO.call(l.styleAliases, o) && (o = l.styleAliases[o]), r[s] = o;
  return r;
}
x(gO, "compileStyleMap");
function mO(t) {
  var e, r, n;
  if (e = t.toString(16).toUpperCase(), t <= 255)
    r = "x", n = 2;
  else if (t <= 65535)
    r = "u", n = 4;
  else if (t <= 4294967295)
    r = "U", n = 8;
  else
    throw new oa("code point within a string may not be greater than 0xFFFFFFFF");
  return "\\" + r + Pn.repeat("0", n - e.length) + e;
}
x(mO, "encodeHex");
var Yre = 1, Hp = 2;
function vO(t) {
  this.schema = t.schema || $I, this.indent = Math.max(1, t.indent || 2), this.noArrayIndent = t.noArrayIndent || !1, this.skipInvalid = t.skipInvalid || !1, this.flowLevel = Pn.isNothing(t.flowLevel) ? -1 : t.flowLevel, this.styleMap = gO(this.schema, t.styles || null), this.sortKeys = t.sortKeys || !1, this.lineWidth = t.lineWidth || 80, this.noRefs = t.noRefs || !1, this.noCompatMode = t.noCompatMode || !1, this.condenseFlow = t.condenseFlow || !1, this.quotingType = t.quotingType === '"' ? Hp : Yre, this.forceQuotes = t.forceQuotes || !1, this.replacer = typeof t.replacer == "function" ? t.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
}
x(vO, "State");
function xw(t, e) {
  for (var r = Pn.repeat(" ", e), n = 0, i = -1, a = "", s, o = t.length; n < o; )
    i = t.indexOf(`
`, n), i === -1 ? (s = t.slice(n), n = o) : (s = t.slice(n, i + 1), n = i + 1), s.length && s !== `
` && (a += r), a += s;
  return a;
}
x(xw, "indentString");
function ly(t, e) {
  return `
` + Pn.repeat(" ", t.indent * e);
}
x(ly, "generateNextLine");
function yO(t, e) {
  var r, n, i;
  for (r = 0, n = t.implicitTypes.length; r < n; r += 1)
    if (i = t.implicitTypes[r], i.resolve(e))
      return !0;
  return !1;
}
x(yO, "testImplicitResolving");
function qp(t) {
  return t === Nre || t === Lre;
}
x(qp, "isWhitespace");
function Zd(t) {
  return 32 <= t && t <= 126 || 161 <= t && t <= 55295 && t !== 8232 && t !== 8233 || 57344 <= t && t <= 65533 && t !== kE || 65536 <= t && t <= 1114111;
}
x(Zd, "isPrintable");
function bw(t) {
  return Zd(t) && t !== kE && t !== Rre && t !== Wp;
}
x(bw, "isNsCharOrWhitespace");
function ww(t, e, r) {
  var n = bw(t), i = n && !qp(t);
  return (
    // ns-plain-safe
    (r ? (
      // c = flow-in
      n
    ) : n && t !== uO && t !== hO && t !== dO && t !== fO && t !== pO) && t !== yw && !(e === oy && !i) || bw(e) && !qp(e) && t === yw || e === oy && i
  );
}
x(ww, "isPlainSafe");
function xO(t) {
  return Zd(t) && t !== kE && !qp(t) && t !== Fre && t !== Vre && t !== oy && t !== uO && t !== hO && t !== dO && t !== fO && t !== pO && t !== yw && t !== Ore && t !== Bre && t !== Mre && t !== Wre && t !== $re && t !== zre && t !== Pre && t !== Dre && t !== Ire && t !== Gre && t !== Ure;
}
x(xO, "isPlainSafeFirst");
function bO(t) {
  return !qp(t) && t !== oy;
}
x(bO, "isPlainSafeLast");
function bh(t, e) {
  var r = t.charCodeAt(e), n;
  return r >= 55296 && r <= 56319 && e + 1 < t.length && (n = t.charCodeAt(e + 1), n >= 56320 && n <= 57343) ? (r - 55296) * 1024 + n - 56320 + 65536 : r;
}
x(bh, "codePointAt");
function SE(t) {
  var e = /^\n* /;
  return e.test(t);
}
x(SE, "needIndentIndicator");
var wO = 1, Tw = 2, TO = 3, EO = 4, hh = 5;
function kO(t, e, r, n, i, a, s, o) {
  var l, u = 0, h = null, d = !1, f = !1, p = n !== -1, g = -1, m = xO(bh(t, 0)) && bO(bh(t, t.length - 1));
  if (e || s)
    for (l = 0; l < t.length; u >= 65536 ? l += 2 : l++) {
      if (u = bh(t, l), !Zd(u))
        return hh;
      m = m && ww(u, h, o), h = u;
    }
  else {
    for (l = 0; l < t.length; u >= 65536 ? l += 2 : l++) {
      if (u = bh(t, l), u === Wp)
        d = !0, p && (f = f || // Foldable line = too long, and not more-indented.
        l - g - 1 > n && t[g + 1] !== " ", g = l);
      else if (!Zd(u))
        return hh;
      m = m && ww(u, h, o), h = u;
    }
    f = f || p && l - g - 1 > n && t[g + 1] !== " ";
  }
  return !d && !f ? m && !s && !i(t) ? wO : a === Hp ? hh : Tw : r > 9 && SE(t) ? hh : s ? a === Hp ? hh : Tw : f ? EO : TO;
}
x(kO, "chooseScalarStyle");
function SO(t, e, r, n, i) {
  t.dump = function() {
    if (e.length === 0)
      return t.quotingType === Hp ? '""' : "''";
    if (!t.noCompatMode && (Hre.indexOf(e) !== -1 || qre.test(e)))
      return t.quotingType === Hp ? '"' + e + '"' : "'" + e + "'";
    var a = t.indent * Math.max(1, r), s = t.lineWidth === -1 ? -1 : Math.max(Math.min(t.lineWidth, 40), t.lineWidth - a), o = n || t.flowLevel > -1 && r >= t.flowLevel;
    function l(u) {
      return yO(t, u);
    }
    switch (x(l, "testAmbiguity"), kO(
      e,
      o,
      t.indent,
      s,
      l,
      t.quotingType,
      t.forceQuotes && !n,
      i
    )) {
      case wO:
        return e;
      case Tw:
        return "'" + e.replace(/'/g, "''") + "'";
      case TO:
        return "|" + Ew(e, t.indent) + kw(xw(e, a));
      case EO:
        return ">" + Ew(e, t.indent) + kw(xw(CO(e, s), a));
      case hh:
        return '"' + AO(e) + '"';
      default:
        throw new oa("impossible error: invalid scalar style");
    }
  }();
}
x(SO, "writeScalar");
function Ew(t, e) {
  var r = SE(t) ? String(e) : "", n = t[t.length - 1] === `
`, i = n && (t[t.length - 2] === `
` || t === `
`), a = i ? "+" : n ? "" : "-";
  return r + a + `
`;
}
x(Ew, "blockHeader");
function kw(t) {
  return t[t.length - 1] === `
` ? t.slice(0, -1) : t;
}
x(kw, "dropEndingNewline");
function CO(t, e) {
  for (var r = /(\n+)([^\n]*)/g, n = function() {
    var u = t.indexOf(`
`);
    return u = u !== -1 ? u : t.length, r.lastIndex = u, Sw(t.slice(0, u), e);
  }(), i = t[0] === `
` || t[0] === " ", a, s; s = r.exec(t); ) {
    var o = s[1], l = s[2];
    a = l[0] === " ", n += o + (!i && !a && l !== "" ? `
` : "") + Sw(l, e), i = a;
  }
  return n;
}
x(CO, "foldString");
function Sw(t, e) {
  if (t === "" || t[0] === " ") return t;
  for (var r = / [^ ]/g, n, i = 0, a, s = 0, o = 0, l = ""; n = r.exec(t); )
    o = n.index, o - i > e && (a = s > i ? s : o, l += `
` + t.slice(i, a), i = a + 1), s = o;
  return l += `
`, t.length - i > e && s > i ? l += t.slice(i, s) + `
` + t.slice(s + 1) : l += t.slice(i), l.slice(1);
}
x(Sw, "foldLine");
function AO(t) {
  for (var e = "", r = 0, n, i = 0; i < t.length; r >= 65536 ? i += 2 : i++)
    r = bh(t, i), n = Ri[r], !n && Zd(r) ? (e += t[i], r >= 65536 && (e += t[i + 1])) : e += n || mO(r);
  return e;
}
x(AO, "escapeString");
function _O(t, e, r) {
  var n = "", i = t.tag, a, s, o;
  for (a = 0, s = r.length; a < s; a += 1)
    o = r[a], t.replacer && (o = t.replacer.call(r, String(a), o)), (Ks(t, e, o, !1, !1) || typeof o > "u" && Ks(t, e, null, !1, !1)) && (n !== "" && (n += "," + (t.condenseFlow ? "" : " ")), n += t.dump);
  t.tag = i, t.dump = "[" + n + "]";
}
x(_O, "writeFlowSequence");
function Cw(t, e, r, n) {
  var i = "", a = t.tag, s, o, l;
  for (s = 0, o = r.length; s < o; s += 1)
    l = r[s], t.replacer && (l = t.replacer.call(r, String(s), l)), (Ks(t, e + 1, l, !0, !0, !1, !0) || typeof l > "u" && Ks(t, e + 1, null, !0, !0, !1, !0)) && ((!n || i !== "") && (i += ly(t, e)), t.dump && Wp === t.dump.charCodeAt(0) ? i += "-" : i += "- ", i += t.dump);
  t.tag = a, t.dump = i || "[]";
}
x(Cw, "writeBlockSequence");
function LO(t, e, r) {
  var n = "", i = t.tag, a = Object.keys(r), s, o, l, u, h;
  for (s = 0, o = a.length; s < o; s += 1)
    h = "", n !== "" && (h += ", "), t.condenseFlow && (h += '"'), l = a[s], u = r[l], t.replacer && (u = t.replacer.call(r, l, u)), Ks(t, e, l, !1, !1) && (t.dump.length > 1024 && (h += "? "), h += t.dump + (t.condenseFlow ? '"' : "") + ":" + (t.condenseFlow ? "" : " "), Ks(t, e, u, !1, !1) && (h += t.dump, n += h));
  t.tag = i, t.dump = "{" + n + "}";
}
x(LO, "writeFlowMapping");
function RO(t, e, r, n) {
  var i = "", a = t.tag, s = Object.keys(r), o, l, u, h, d, f;
  if (t.sortKeys === !0)
    s.sort();
  else if (typeof t.sortKeys == "function")
    s.sort(t.sortKeys);
  else if (t.sortKeys)
    throw new oa("sortKeys must be a boolean or a function");
  for (o = 0, l = s.length; o < l; o += 1)
    f = "", (!n || i !== "") && (f += ly(t, e)), u = s[o], h = r[u], t.replacer && (h = t.replacer.call(r, u, h)), Ks(t, e + 1, u, !0, !0, !0) && (d = t.tag !== null && t.tag !== "?" || t.dump && t.dump.length > 1024, d && (t.dump && Wp === t.dump.charCodeAt(0) ? f += "?" : f += "? "), f += t.dump, d && (f += ly(t, e)), Ks(t, e + 1, h, !0, d) && (t.dump && Wp === t.dump.charCodeAt(0) ? f += ":" : f += ": ", f += t.dump, i += f));
  t.tag = a, t.dump = i || "{}";
}
x(RO, "writeBlockMapping");
function Aw(t, e, r) {
  var n, i, a, s, o, l;
  for (i = r ? t.explicitTypes : t.implicitTypes, a = 0, s = i.length; a < s; a += 1)
    if (o = i[a], (o.instanceOf || o.predicate) && (!o.instanceOf || typeof e == "object" && e instanceof o.instanceOf) && (!o.predicate || o.predicate(e))) {
      if (r ? o.multi && o.representName ? t.tag = o.representName(e) : t.tag = o.tag : t.tag = "?", o.represent) {
        if (l = t.styleMap[o.tag] || o.defaultStyle, lO.call(o.represent) === "[object Function]")
          n = o.represent(e, l);
        else if (cO.call(o.represent, l))
          n = o.represent[l](e, l);
        else
          throw new oa("!<" + o.tag + '> tag resolver accepts not "' + l + '" style');
        t.dump = n;
      }
      return !0;
    }
  return !1;
}
x(Aw, "detectType");
function Ks(t, e, r, n, i, a, s) {
  t.tag = null, t.dump = r, Aw(t, r, !1) || Aw(t, r, !0);
  var o = lO.call(t.dump), l = n, u;
  n && (n = t.flowLevel < 0 || t.flowLevel > e);
  var h = o === "[object Object]" || o === "[object Array]", d, f;
  if (h && (d = t.duplicates.indexOf(r), f = d !== -1), (t.tag !== null && t.tag !== "?" || f || t.indent !== 2 && e > 0) && (i = !1), f && t.usedDuplicates[d])
    t.dump = "*ref_" + d;
  else {
    if (h && f && !t.usedDuplicates[d] && (t.usedDuplicates[d] = !0), o === "[object Object]")
      n && Object.keys(t.dump).length !== 0 ? (RO(t, e, t.dump, i), f && (t.dump = "&ref_" + d + t.dump)) : (LO(t, e, t.dump), f && (t.dump = "&ref_" + d + " " + t.dump));
    else if (o === "[object Array]")
      n && t.dump.length !== 0 ? (t.noArrayIndent && !s && e > 0 ? Cw(t, e - 1, t.dump, i) : Cw(t, e, t.dump, i), f && (t.dump = "&ref_" + d + t.dump)) : (_O(t, e, t.dump), f && (t.dump = "&ref_" + d + " " + t.dump));
    else if (o === "[object String]")
      t.tag !== "?" && SO(t, t.dump, e, a, l);
    else {
      if (o === "[object Undefined]")
        return !1;
      if (t.skipInvalid) return !1;
      throw new oa("unacceptable kind of an object to dump " + o);
    }
    t.tag !== null && t.tag !== "?" && (u = encodeURI(
      t.tag[0] === "!" ? t.tag.slice(1) : t.tag
    ).replace(/!/g, "%21"), t.tag[0] === "!" ? u = "!" + u : u.slice(0, 18) === "tag:yaml.org,2002:" ? u = "!!" + u.slice(18) : u = "!<" + u + ">", t.dump = u + " " + t.dump);
  }
  return !0;
}
x(Ks, "writeNode");
function NO(t, e) {
  var r = [], n = [], i, a;
  for (cy(t, r, n), i = 0, a = n.length; i < a; i += 1)
    e.duplicates.push(r[n[i]]);
  e.usedDuplicates = new Array(a);
}
x(NO, "getDuplicateReferences");
function cy(t, e, r) {
  var n, i, a;
  if (t !== null && typeof t == "object")
    if (i = e.indexOf(t), i !== -1)
      r.indexOf(i) === -1 && r.push(i);
    else if (e.push(t), Array.isArray(t))
      for (i = 0, a = t.length; i < a; i += 1)
        cy(t[i], e, r);
    else
      for (n = Object.keys(t), i = 0, a = n.length; i < a; i += 1)
        cy(t[n[i]], e, r);
}
x(cy, "inspectNode");
function Xre(t, e) {
  e = e || {};
  var r = new vO(e);
  r.noRefs || NO(t, r);
  var n = t;
  return r.replacer && (n = r.replacer.call({ "": n }, "", n)), Ks(r, 0, n, !0, !0) ? r.dump + `
` : "";
}
x(Xre, "dump$1");
function jre(t, e) {
  return function() {
    throw new Error("Function yaml." + t + " is removed in js-yaml 4. Use yaml." + e + " instead, which is now safe by default.");
  };
}
x(jre, "renamed");
var Z2 = TI, Q2 = _re.load;
/*! Bundled license information:

js-yaml/dist/js-yaml.mjs:
  (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
*/
var xi = {
  aggregation: 17.25,
  extension: 17.25,
  composition: 17.25,
  dependency: 6,
  lollipop: 13.5,
  arrow_point: 4
  //arrow_cross: 24,
}, NC = {
  arrow_point: 9,
  arrow_cross: 12.5,
  arrow_circle: 12.5
};
function w0(t, e) {
  if (t === void 0 || e === void 0)
    return { angle: 0, deltaX: 0, deltaY: 0 };
  t = Xr(t), e = Xr(e);
  const [r, n] = [t.x, t.y], [i, a] = [e.x, e.y], s = i - r, o = a - n;
  return { angle: Math.atan(o / s), deltaX: s, deltaY: o };
}
x(w0, "calculateDeltaAndAngle");
var Xr = /* @__PURE__ */ x((t) => Array.isArray(t) ? { x: t[0], y: t[1] } : t, "pointTransformer"), MO = /* @__PURE__ */ x((t) => ({
  x: /* @__PURE__ */ x(function(e, r, n) {
    let i = 0;
    const a = Xr(n[0]).x < Xr(n[n.length - 1]).x ? "left" : "right";
    if (r === 0 && Object.hasOwn(xi, t.arrowTypeStart)) {
      const { angle: p, deltaX: g } = w0(n[0], n[1]);
      i = xi[t.arrowTypeStart] * Math.cos(p) * (g >= 0 ? 1 : -1);
    } else if (r === n.length - 1 && Object.hasOwn(xi, t.arrowTypeEnd)) {
      const { angle: p, deltaX: g } = w0(
        n[n.length - 1],
        n[n.length - 2]
      );
      i = xi[t.arrowTypeEnd] * Math.cos(p) * (g >= 0 ? 1 : -1);
    }
    const s = Math.abs(
      Xr(e).x - Xr(n[n.length - 1]).x
    ), o = Math.abs(
      Xr(e).y - Xr(n[n.length - 1]).y
    ), l = Math.abs(Xr(e).x - Xr(n[0]).x), u = Math.abs(Xr(e).y - Xr(n[0]).y), h = xi[t.arrowTypeStart], d = xi[t.arrowTypeEnd], f = 1;
    if (s < d && s > 0 && o < d) {
      let p = d + f - s;
      p *= a === "right" ? -1 : 1, i -= p;
    }
    if (l < h && l > 0 && u < h) {
      let p = h + f - l;
      p *= a === "right" ? -1 : 1, i += p;
    }
    return Xr(e).x + i;
  }, "x"),
  y: /* @__PURE__ */ x(function(e, r, n) {
    let i = 0;
    const a = Xr(n[0]).y < Xr(n[n.length - 1]).y ? "down" : "up";
    if (r === 0 && Object.hasOwn(xi, t.arrowTypeStart)) {
      const { angle: p, deltaY: g } = w0(n[0], n[1]);
      i = xi[t.arrowTypeStart] * Math.abs(Math.sin(p)) * (g >= 0 ? 1 : -1);
    } else if (r === n.length - 1 && Object.hasOwn(xi, t.arrowTypeEnd)) {
      const { angle: p, deltaY: g } = w0(
        n[n.length - 1],
        n[n.length - 2]
      );
      i = xi[t.arrowTypeEnd] * Math.abs(Math.sin(p)) * (g >= 0 ? 1 : -1);
    }
    const s = Math.abs(
      Xr(e).y - Xr(n[n.length - 1]).y
    ), o = Math.abs(
      Xr(e).x - Xr(n[n.length - 1]).x
    ), l = Math.abs(Xr(e).y - Xr(n[0]).y), u = Math.abs(Xr(e).x - Xr(n[0]).x), h = xi[t.arrowTypeStart], d = xi[t.arrowTypeEnd], f = 1;
    if (s < d && s > 0 && o < d) {
      let p = d + f - s;
      p *= a === "up" ? -1 : 1, i -= p;
    }
    if (l < h && l > 0 && u < h) {
      let p = h + f - l;
      p *= a === "up" ? -1 : 1, i += p;
    }
    return Xr(e).y + i;
  }, "y")
}), "getLineFunctionsWithOffset"), Ig = /* @__PURE__ */ x(({
  flowchart: t
}) => {
  var i, a;
  const e = ((i = t == null ? void 0 : t.subGraphTitleMargin) == null ? void 0 : i.top) ?? 0, r = ((a = t == null ? void 0 : t.subGraphTitleMargin) == null ? void 0 : a.bottom) ?? 0, n = e + r;
  return {
    subGraphTitleTopMargin: e,
    subGraphTitleBottomMargin: r,
    subGraphTitleTotalMargin: n
  };
}, "getSubGraphTitleMargins"), Kre = /* @__PURE__ */ x((t) => {
  const { handDrawnSeed: e } = we();
  return {
    fill: t,
    hachureAngle: 120,
    // angle of hachure,
    hachureGap: 4,
    fillWeight: 2,
    roughness: 0.7,
    stroke: t,
    seed: e
  };
}, "solidStateFill"), Tf = /* @__PURE__ */ x((t) => {
  const e = Zre([
    ...t.cssCompiledStyles || [],
    ...t.cssStyles || [],
    ...t.labelStyle || []
  ]);
  return { stylesMap: e, stylesArray: [...e] };
}, "compileStyles"), Zre = /* @__PURE__ */ x((t) => {
  const e = /* @__PURE__ */ new Map();
  return t.forEach((r) => {
    const [n, i] = r.split(":");
    e.set(n.trim(), i == null ? void 0 : i.trim());
  }), e;
}, "styles2Map"), CE = /* @__PURE__ */ x((t) => t === "color" || t === "font-size" || t === "font-family" || t === "font-weight" || t === "font-style" || t === "text-decoration" || t === "text-align" || t === "text-transform" || t === "line-height" || t === "letter-spacing" || t === "word-spacing" || t === "text-shadow" || t === "text-overflow" || t === "white-space" || t === "word-wrap" || t === "word-break" || t === "overflow-wrap" || t === "hyphens", "isLabelStyle"), Ct = /* @__PURE__ */ x((t) => {
  const { stylesArray: e } = Tf(t), r = [], n = [], i = [], a = [];
  return e.forEach((s) => {
    const o = s[0];
    CE(o) ? r.push(s.join(":") + " !important") : (n.push(s.join(":") + " !important"), o.includes("stroke") && i.push(s.join(":") + " !important"), o === "fill" && a.push(s.join(":") + " !important"));
  }), {
    labelStyles: r.join(";"),
    nodeStyles: n.join(";"),
    stylesArray: e,
    borderStyles: i,
    backgroundStyles: a
  };
}, "styles2String"), Nt = /* @__PURE__ */ x((t, e) => {
  var l;
  const { themeVariables: r, handDrawnSeed: n } = we(), { nodeBorder: i, mainBkg: a } = r, { stylesMap: s } = Tf(t);
  return Object.assign(
    {
      roughness: 0.7,
      fill: s.get("fill") || a,
      fillStyle: "hachure",
      // solid fill
      fillWeight: 4,
      hachureGap: 5.2,
      stroke: s.get("stroke") || i,
      seed: n,
      strokeWidth: ((l = s.get("stroke-width")) == null ? void 0 : l.replace("px", "")) || 1.3,
      fillLineDash: [0, 0],
      strokeLineDash: Qre(s.get("stroke-dasharray"))
    },
    e
  );
}, "userNodeOverrides"), Qre = /* @__PURE__ */ x((t) => {
  if (!t)
    return [0, 0];
  const e = t.trim().split(/\s+/).map(Number);
  if (e.length === 1) {
    const i = isNaN(e[0]) ? 0 : e[0];
    return [i, i];
  }
  const r = isNaN(e[0]) ? 0 : e[0], n = isNaN(e[1]) ? 0 : e[1];
  return [r, n];
}, "getStrokeDashArray"), AE = {}, Xn = {};
Object.defineProperty(Xn, "__esModule", { value: !0 });
Xn.BLANK_URL = Xn.relativeFirstCharacters = Xn.whitespaceEscapeCharsRegex = Xn.urlSchemeRegex = Xn.ctrlCharactersRegex = Xn.htmlCtrlEntityRegex = Xn.htmlEntitiesRegex = Xn.invalidProtocolRegex = void 0;
Xn.invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
Xn.htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
Xn.htmlCtrlEntityRegex = /&(newline|tab);/gi;
Xn.ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
Xn.urlSchemeRegex = /^.+(:|&colon;)/gim;
Xn.whitespaceEscapeCharsRegex = /(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;
Xn.relativeFirstCharacters = [".", "/"];
Xn.BLANK_URL = "about:blank";
Object.defineProperty(AE, "__esModule", { value: !0 });
var rc = AE.sanitizeUrl = void 0, yi = Xn;
function Jre(t) {
  return yi.relativeFirstCharacters.indexOf(t[0]) > -1;
}
function ene(t) {
  var e = t.replace(yi.ctrlCharactersRegex, "");
  return e.replace(yi.htmlEntitiesRegex, function(r, n) {
    return String.fromCharCode(n);
  });
}
function tne(t) {
  return URL.canParse(t);
}
function MC(t) {
  try {
    return decodeURIComponent(t);
  } catch {
    return t;
  }
}
function rne(t) {
  if (!t)
    return yi.BLANK_URL;
  var e, r = MC(t.trim());
  do
    r = ene(r).replace(yi.htmlCtrlEntityRegex, "").replace(yi.ctrlCharactersRegex, "").replace(yi.whitespaceEscapeCharsRegex, "").trim(), r = MC(r), e = r.match(yi.ctrlCharactersRegex) || r.match(yi.htmlEntitiesRegex) || r.match(yi.htmlCtrlEntityRegex) || r.match(yi.whitespaceEscapeCharsRegex);
  while (e && e.length > 0);
  var n = r;
  if (!n)
    return yi.BLANK_URL;
  if (Jre(n))
    return n;
  var i = n.trimStart(), a = i.match(yi.urlSchemeRegex);
  if (!a)
    return n;
  var s = a[0].toLowerCase().trim();
  if (yi.invalidProtocolRegex.test(s))
    return yi.BLANK_URL;
  var o = i.replace(/\\/g, "/");
  if (s === "mailto:" || s.includes("://"))
    return o;
  if (s === "http:" || s === "https:") {
    if (!tne(o))
      return yi.BLANK_URL;
    var l = new URL(o);
    return l.protocol = l.protocol.toLowerCase(), l.hostname = l.hostname.toLowerCase(), l.toString();
  }
  return o;
}
rc = AE.sanitizeUrl = rne;
var DO = typeof global == "object" && global && global.Object === Object && global, nne = typeof self == "object" && self && self.Object === Object && self, io = DO || nne || Function("return this")(), Qa = io.Symbol, IO = Object.prototype, ine = IO.hasOwnProperty, ane = IO.toString, e0 = Qa ? Qa.toStringTag : void 0;
function sne(t) {
  var e = ine.call(t, e0), r = t[e0];
  try {
    t[e0] = void 0;
    var n = !0;
  } catch {
  }
  var i = ane.call(t);
  return n && (e ? t[e0] = r : delete t[e0]), i;
}
var one = Object.prototype, lne = one.toString;
function cne(t) {
  return lne.call(t);
}
var une = "[object Null]", hne = "[object Undefined]", DC = Qa ? Qa.toStringTag : void 0;
function rl(t) {
  return t == null ? t === void 0 ? hne : une : DC && DC in Object(t) ? sne(t) : cne(t);
}
function da(t) {
  var e = typeof t;
  return t != null && (e == "object" || e == "function");
}
var dne = "[object AsyncFunction]", fne = "[object Function]", pne = "[object GeneratorFunction]", gne = "[object Proxy]";
function Ja(t) {
  if (!da(t))
    return !1;
  var e = rl(t);
  return e == fne || e == pne || e == dne || e == gne;
}
var Yb = io["__core-js_shared__"], IC = function() {
  var t = /[^.]+$/.exec(Yb && Yb.keys && Yb.keys.IE_PROTO || "");
  return t ? "Symbol(src)_1." + t : "";
}();
function mne(t) {
  return !!IC && IC in t;
}
var vne = Function.prototype, yne = vne.toString;
function Ru(t) {
  if (t != null) {
    try {
      return yne.call(t);
    } catch {
    }
    try {
      return t + "";
    } catch {
    }
  }
  return "";
}
var xne = /[\\^$.*+?()[\]{}|]/g, bne = /^\[object .+?Constructor\]$/, wne = Function.prototype, Tne = Object.prototype, Ene = wne.toString, kne = Tne.hasOwnProperty, Sne = RegExp(
  "^" + Ene.call(kne).replace(xne, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function Cne(t) {
  if (!da(t) || mne(t))
    return !1;
  var e = Ja(t) ? Sne : bne;
  return e.test(Ru(t));
}
function Ane(t, e) {
  return t == null ? void 0 : t[e];
}
function Nu(t, e) {
  var r = Ane(t, e);
  return Cne(r) ? r : void 0;
}
var Yp = Nu(Object, "create");
function _ne() {
  this.__data__ = Yp ? Yp(null) : {}, this.size = 0;
}
function Lne(t) {
  var e = this.has(t) && delete this.__data__[t];
  return this.size -= e ? 1 : 0, e;
}
var Rne = "__lodash_hash_undefined__", Nne = Object.prototype, Mne = Nne.hasOwnProperty;
function Dne(t) {
  var e = this.__data__;
  if (Yp) {
    var r = e[t];
    return r === Rne ? void 0 : r;
  }
  return Mne.call(e, t) ? e[t] : void 0;
}
var Ine = Object.prototype, One = Ine.hasOwnProperty;
function Pne(t) {
  var e = this.__data__;
  return Yp ? e[t] !== void 0 : One.call(e, t);
}
var Bne = "__lodash_hash_undefined__";
function Fne(t, e) {
  var r = this.__data__;
  return this.size += this.has(t) ? 0 : 1, r[t] = Yp && e === void 0 ? Bne : e, this;
}
function uu(t) {
  var e = -1, r = t == null ? 0 : t.length;
  for (this.clear(); ++e < r; ) {
    var n = t[e];
    this.set(n[0], n[1]);
  }
}
uu.prototype.clear = _ne;
uu.prototype.delete = Lne;
uu.prototype.get = Dne;
uu.prototype.has = Pne;
uu.prototype.set = Fne;
function $ne() {
  this.__data__ = [], this.size = 0;
}
function Ef(t, e) {
  return t === e || t !== t && e !== e;
}
function J2(t, e) {
  for (var r = t.length; r--; )
    if (Ef(t[r][0], e))
      return r;
  return -1;
}
var zne = Array.prototype, Vne = zne.splice;
function Gne(t) {
  var e = this.__data__, r = J2(e, t);
  if (r < 0)
    return !1;
  var n = e.length - 1;
  return r == n ? e.pop() : Vne.call(e, r, 1), --this.size, !0;
}
function Une(t) {
  var e = this.__data__, r = J2(e, t);
  return r < 0 ? void 0 : e[r][1];
}
function Wne(t) {
  return J2(this.__data__, t) > -1;
}
function Hne(t, e) {
  var r = this.__data__, n = J2(r, t);
  return n < 0 ? (++this.size, r.push([t, e])) : r[n][1] = e, this;
}
function nl(t) {
  var e = -1, r = t == null ? 0 : t.length;
  for (this.clear(); ++e < r; ) {
    var n = t[e];
    this.set(n[0], n[1]);
  }
}
nl.prototype.clear = $ne;
nl.prototype.delete = Gne;
nl.prototype.get = Une;
nl.prototype.has = Wne;
nl.prototype.set = Hne;
var Xp = Nu(io, "Map");
function qne() {
  this.size = 0, this.__data__ = {
    hash: new uu(),
    map: new (Xp || nl)(),
    string: new uu()
  };
}
function Yne(t) {
  var e = typeof t;
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
}
function ex(t, e) {
  var r = t.__data__;
  return Yne(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
}
function Xne(t) {
  var e = ex(this, t).delete(t);
  return this.size -= e ? 1 : 0, e;
}
function jne(t) {
  return ex(this, t).get(t);
}
function Kne(t) {
  return ex(this, t).has(t);
}
function Zne(t, e) {
  var r = ex(this, t), n = r.size;
  return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
}
function il(t) {
  var e = -1, r = t == null ? 0 : t.length;
  for (this.clear(); ++e < r; ) {
    var n = t[e];
    this.set(n[0], n[1]);
  }
}
il.prototype.clear = qne;
il.prototype.delete = Xne;
il.prototype.get = jne;
il.prototype.has = Kne;
il.prototype.set = Zne;
var Qne = "Expected a function";
function kf(t, e) {
  if (typeof t != "function" || e != null && typeof e != "function")
    throw new TypeError(Qne);
  var r = function() {
    var n = arguments, i = e ? e.apply(this, n) : n[0], a = r.cache;
    if (a.has(i))
      return a.get(i);
    var s = t.apply(this, n);
    return r.cache = a.set(i, s) || a, s;
  };
  return r.cache = new (kf.Cache || il)(), r;
}
kf.Cache = il;
function Jne() {
  this.__data__ = new nl(), this.size = 0;
}
function eie(t) {
  var e = this.__data__, r = e.delete(t);
  return this.size = e.size, r;
}
function tie(t) {
  return this.__data__.get(t);
}
function rie(t) {
  return this.__data__.has(t);
}
var nie = 200;
function iie(t, e) {
  var r = this.__data__;
  if (r instanceof nl) {
    var n = r.__data__;
    if (!Xp || n.length < nie - 1)
      return n.push([t, e]), this.size = ++r.size, this;
    r = this.__data__ = new il(n);
  }
  return r.set(t, e), this.size = r.size, this;
}
function ms(t) {
  var e = this.__data__ = new nl(t);
  this.size = e.size;
}
ms.prototype.clear = Jne;
ms.prototype.delete = eie;
ms.prototype.get = tie;
ms.prototype.has = rie;
ms.prototype.set = iie;
var uy = function() {
  try {
    var t = Nu(Object, "defineProperty");
    return t({}, "", {}), t;
  } catch {
  }
}();
function Og(t, e, r) {
  e == "__proto__" && uy ? uy(t, e, {
    configurable: !0,
    enumerable: !0,
    value: r,
    writable: !0
  }) : t[e] = r;
}
function _w(t, e, r) {
  (r !== void 0 && !Ef(t[e], r) || r === void 0 && !(e in t)) && Og(t, e, r);
}
function aie(t) {
  return function(e, r, n) {
    for (var i = -1, a = Object(e), s = n(e), o = s.length; o--; ) {
      var l = s[++i];
      if (r(a[l], l, a) === !1)
        break;
    }
    return e;
  };
}
var _E = aie(), OO = typeof exports == "object" && exports && !exports.nodeType && exports, OC = OO && typeof module == "object" && module && !module.nodeType && module, sie = OC && OC.exports === OO, PC = sie ? io.Buffer : void 0, BC = PC ? PC.allocUnsafe : void 0;
function PO(t, e) {
  if (e)
    return t.slice();
  var r = t.length, n = BC ? BC(r) : new t.constructor(r);
  return t.copy(n), n;
}
var hy = io.Uint8Array;
function LE(t) {
  var e = new t.constructor(t.byteLength);
  return new hy(e).set(new hy(t)), e;
}
function BO(t, e) {
  var r = e ? LE(t.buffer) : t.buffer;
  return new t.constructor(r, t.byteOffset, t.length);
}
function FO(t, e) {
  var r = -1, n = t.length;
  for (e || (e = Array(n)); ++r < n; )
    e[r] = t[r];
  return e;
}
var FC = Object.create, oie = /* @__PURE__ */ function() {
  function t() {
  }
  return function(e) {
    if (!da(e))
      return {};
    if (FC)
      return FC(e);
    t.prototype = e;
    var r = new t();
    return t.prototype = void 0, r;
  };
}();
function $O(t, e) {
  return function(r) {
    return t(e(r));
  };
}
var RE = $O(Object.getPrototypeOf, Object), lie = Object.prototype;
function Pg(t) {
  var e = t && t.constructor, r = typeof e == "function" && e.prototype || lie;
  return t === r;
}
function zO(t) {
  return typeof t.constructor == "function" && !Pg(t) ? oie(RE(t)) : {};
}
function es(t) {
  return t != null && typeof t == "object";
}
var cie = "[object Arguments]";
function $C(t) {
  return es(t) && rl(t) == cie;
}
var VO = Object.prototype, uie = VO.hasOwnProperty, hie = VO.propertyIsEnumerable, Qd = $C(/* @__PURE__ */ function() {
  return arguments;
}()) ? $C : function(t) {
  return es(t) && uie.call(t, "callee") && !hie.call(t, "callee");
}, ir = Array.isArray, die = 9007199254740991;
function NE(t) {
  return typeof t == "number" && t > -1 && t % 1 == 0 && t <= die;
}
function ao(t) {
  return t != null && NE(t.length) && !Ja(t);
}
function dy(t) {
  return es(t) && ao(t);
}
function fie() {
  return !1;
}
var GO = typeof exports == "object" && exports && !exports.nodeType && exports, zC = GO && typeof module == "object" && module && !module.nodeType && module, pie = zC && zC.exports === GO, VC = pie ? io.Buffer : void 0, gie = VC ? VC.isBuffer : void 0, Jd = gie || fie, mie = "[object Object]", vie = Function.prototype, yie = Object.prototype, UO = vie.toString, xie = yie.hasOwnProperty, bie = UO.call(Object);
function wie(t) {
  if (!es(t) || rl(t) != mie)
    return !1;
  var e = RE(t);
  if (e === null)
    return !0;
  var r = xie.call(e, "constructor") && e.constructor;
  return typeof r == "function" && r instanceof r && UO.call(r) == bie;
}
var Tie = "[object Arguments]", Eie = "[object Array]", kie = "[object Boolean]", Sie = "[object Date]", Cie = "[object Error]", Aie = "[object Function]", _ie = "[object Map]", Lie = "[object Number]", Rie = "[object Object]", Nie = "[object RegExp]", Mie = "[object Set]", Die = "[object String]", Iie = "[object WeakMap]", Oie = "[object ArrayBuffer]", Pie = "[object DataView]", Bie = "[object Float32Array]", Fie = "[object Float64Array]", $ie = "[object Int8Array]", zie = "[object Int16Array]", Vie = "[object Int32Array]", Gie = "[object Uint8Array]", Uie = "[object Uint8ClampedArray]", Wie = "[object Uint16Array]", Hie = "[object Uint32Array]", Wr = {};
Wr[Bie] = Wr[Fie] = Wr[$ie] = Wr[zie] = Wr[Vie] = Wr[Gie] = Wr[Uie] = Wr[Wie] = Wr[Hie] = !0;
Wr[Tie] = Wr[Eie] = Wr[Oie] = Wr[kie] = Wr[Pie] = Wr[Sie] = Wr[Cie] = Wr[Aie] = Wr[_ie] = Wr[Lie] = Wr[Rie] = Wr[Nie] = Wr[Mie] = Wr[Die] = Wr[Iie] = !1;
function qie(t) {
  return es(t) && NE(t.length) && !!Wr[rl(t)];
}
function Bg(t) {
  return function(e) {
    return t(e);
  };
}
var WO = typeof exports == "object" && exports && !exports.nodeType && exports, Ep = WO && typeof module == "object" && module && !module.nodeType && module, Yie = Ep && Ep.exports === WO, Xb = Yie && DO.process, Ol = function() {
  try {
    var t = Ep && Ep.require && Ep.require("util").types;
    return t || Xb && Xb.binding && Xb.binding("util");
  } catch {
  }
}(), GC = Ol && Ol.isTypedArray, tx = GC ? Bg(GC) : qie;
function Lw(t, e) {
  if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
    return t[e];
}
var Xie = Object.prototype, jie = Xie.hasOwnProperty;
function Fg(t, e, r) {
  var n = t[e];
  (!(jie.call(t, e) && Ef(n, r)) || r === void 0 && !(e in t)) && Og(t, e, r);
}
function Sf(t, e, r, n) {
  var i = !r;
  r || (r = {});
  for (var a = -1, s = e.length; ++a < s; ) {
    var o = e[a], l = void 0;
    l === void 0 && (l = t[o]), i ? Og(r, o, l) : Fg(r, o, l);
  }
  return r;
}
function Kie(t, e) {
  for (var r = -1, n = Array(t); ++r < t; )
    n[r] = e(r);
  return n;
}
var Zie = 9007199254740991, Qie = /^(?:0|[1-9]\d*)$/;
function rx(t, e) {
  var r = typeof t;
  return e = e ?? Zie, !!e && (r == "number" || r != "symbol" && Qie.test(t)) && t > -1 && t % 1 == 0 && t < e;
}
var Jie = Object.prototype, eae = Jie.hasOwnProperty;
function HO(t, e) {
  var r = ir(t), n = !r && Qd(t), i = !r && !n && Jd(t), a = !r && !n && !i && tx(t), s = r || n || i || a, o = s ? Kie(t.length, String) : [], l = o.length;
  for (var u in t)
    (e || eae.call(t, u)) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
    (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    i && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    a && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
    rx(u, l))) && o.push(u);
  return o;
}
function tae(t) {
  var e = [];
  if (t != null)
    for (var r in Object(t))
      e.push(r);
  return e;
}
var rae = Object.prototype, nae = rae.hasOwnProperty;
function iae(t) {
  if (!da(t))
    return tae(t);
  var e = Pg(t), r = [];
  for (var n in t)
    n == "constructor" && (e || !nae.call(t, n)) || r.push(n);
  return r;
}
function Mu(t) {
  return ao(t) ? HO(t, !0) : iae(t);
}
function aae(t) {
  return Sf(t, Mu(t));
}
function sae(t, e, r, n, i, a, s) {
  var o = Lw(t, r), l = Lw(e, r), u = s.get(l);
  if (u) {
    _w(t, r, u);
    return;
  }
  var h = a ? a(o, l, r + "", t, e, s) : void 0, d = h === void 0;
  if (d) {
    var f = ir(l), p = !f && Jd(l), g = !f && !p && tx(l);
    h = l, f || p || g ? ir(o) ? h = o : dy(o) ? h = FO(o) : p ? (d = !1, h = PO(l, !0)) : g ? (d = !1, h = BO(l, !0)) : h = [] : wie(l) || Qd(l) ? (h = o, Qd(o) ? h = aae(o) : (!da(o) || Ja(o)) && (h = zO(l))) : d = !1;
  }
  d && (s.set(l, h), i(h, l, n, a, s), s.delete(l)), _w(t, r, h);
}
function qO(t, e, r, n, i) {
  t !== e && _E(e, function(a, s) {
    if (i || (i = new ms()), da(a))
      sae(t, e, s, r, qO, n, i);
    else {
      var o = n ? n(Lw(t, s), a, s + "", t, e, i) : void 0;
      o === void 0 && (o = a), _w(t, s, o);
    }
  }, Mu);
}
function qo(t) {
  return t;
}
function oae(t, e, r) {
  switch (r.length) {
    case 0:
      return t.call(e);
    case 1:
      return t.call(e, r[0]);
    case 2:
      return t.call(e, r[0], r[1]);
    case 3:
      return t.call(e, r[0], r[1], r[2]);
  }
  return t.apply(e, r);
}
var UC = Math.max;
function YO(t, e, r) {
  return e = UC(e === void 0 ? t.length - 1 : e, 0), function() {
    for (var n = arguments, i = -1, a = UC(n.length - e, 0), s = Array(a); ++i < a; )
      s[i] = n[e + i];
    i = -1;
    for (var o = Array(e + 1); ++i < e; )
      o[i] = n[i];
    return o[e] = r(s), oae(t, this, o);
  };
}
function wh(t) {
  return function() {
    return t;
  };
}
var lae = uy ? function(t, e) {
  return uy(t, "toString", {
    configurable: !0,
    enumerable: !1,
    value: wh(e),
    writable: !0
  });
} : qo, cae = 800, uae = 16, hae = Date.now;
function dae(t) {
  var e = 0, r = 0;
  return function() {
    var n = hae(), i = uae - (n - r);
    if (r = n, i > 0) {
      if (++e >= cae)
        return arguments[0];
    } else
      e = 0;
    return t.apply(void 0, arguments);
  };
}
var XO = dae(lae);
function $g(t, e) {
  return XO(YO(t, e, qo), t + "");
}
function jp(t, e, r) {
  if (!da(r))
    return !1;
  var n = typeof e;
  return (n == "number" ? ao(r) && rx(e, r.length) : n == "string" && e in r) ? Ef(r[e], t) : !1;
}
function jO(t) {
  return $g(function(e, r) {
    var n = -1, i = r.length, a = i > 1 ? r[i - 1] : void 0, s = i > 2 ? r[2] : void 0;
    for (a = t.length > 3 && typeof a == "function" ? (i--, a) : void 0, s && jp(r[0], r[1], s) && (a = i < 3 ? void 0 : a, i = 1), e = Object(e); ++n < i; ) {
      var o = r[n];
      o && t(e, o, n, a);
    }
    return e;
  });
}
var fy = jO(function(t, e, r) {
  qO(t, e, r);
}), KO = "​", fae = {
  curveBasis: Rh,
  curveBasisClosed: Bte,
  curveBasisOpen: Fte,
  curveBumpX: ND,
  curveBumpY: MD,
  curveBundle: $te,
  curveCardinalClosed: zte,
  curveCardinalOpen: Vte,
  curveCardinal: PD,
  curveCatmullRomClosed: Gte,
  curveCatmullRomOpen: Ute,
  curveCatmullRom: FD,
  curveLinear: ey,
  curveLinearClosed: Wte,
  curveMonotoneX: WD,
  curveMonotoneY: HD,
  curveNatural: YD,
  curveStep: XD,
  curveStepAfter: KD,
  curveStepBefore: jD
}, pae = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, gae = /* @__PURE__ */ x(function(t, e) {
  const r = ZO(t, /(?:init\b)|(?:initialize\b)/);
  let n = {};
  if (Array.isArray(r)) {
    const s = r.map((o) => o.args);
    Iv(s), n = mn(n, [...s]);
  } else
    n = r.args;
  if (!n)
    return;
  let i = Z6(t, e);
  const a = "config";
  return n[a] !== void 0 && (i === "flowchart-v2" && (i = "flowchart"), n[i] = n[a], delete n[a]), n;
}, "detectInit"), ZO = /* @__PURE__ */ x(function(t, e = null) {
  var r, n;
  try {
    const i = new RegExp(
      `[%]{2}(?![{]${pae.source})(?=[}][%]{2}).*
`,
      "ig"
    );
    t = t.trim().replace(i, "").replace(/'/gm, '"'), ae.debug(
      `Detecting diagram directive${e !== null ? " type:" + e : ""} based on the text:${t}`
    );
    let a;
    const s = [];
    for (; (a = bp.exec(t)) !== null; )
      if (a.index === bp.lastIndex && bp.lastIndex++, a && !e || e && ((r = a[1]) != null && r.match(e)) || e && ((n = a[2]) != null && n.match(e))) {
        const o = a[1] ? a[1] : a[2], l = a[3] ? a[3].trim() : a[4] ? JSON.parse(a[4].trim()) : null;
        s.push({ type: o, args: l });
      }
    return s.length === 0 ? { type: t, args: null } : s.length === 1 ? s[0] : s;
  } catch (i) {
    return ae.error(
      `ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`
    ), { type: void 0, args: null };
  }
}, "detectDirective"), mae = /* @__PURE__ */ x(function(t) {
  return t.replace(bp, "");
}, "removeDirectives"), vae = /* @__PURE__ */ x(function(t, e) {
  for (const [r, n] of e.entries())
    if (n.match(t))
      return r;
  return -1;
}, "isSubstringInArray");
function ME(t, e) {
  if (!t)
    return e;
  const r = `curve${t.charAt(0).toUpperCase() + t.slice(1)}`;
  return fae[r] ?? e;
}
x(ME, "interpolateToCurve");
function QO(t, e) {
  const r = t.trim();
  if (r)
    return e.securityLevel !== "loose" ? rc(r) : r;
}
x(QO, "formatUrl");
var yae = /* @__PURE__ */ x((t, ...e) => {
  const r = t.split("."), n = r.length - 1, i = r[n];
  let a = window;
  for (let s = 0; s < n; s++)
    if (a = a[r[s]], !a) {
      ae.error(`Function name: ${t} not found in window`);
      return;
    }
  a[i](...e);
}, "runFunc");
function DE(t, e) {
  return !t || !e ? 0 : Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
}
x(DE, "distance");
function JO(t) {
  let e, r = 0;
  t.forEach((i) => {
    r += DE(i, e), e = i;
  });
  const n = r / 2;
  return IE(t, n);
}
x(JO, "traverseEdge");
function eP(t) {
  return t.length === 1 ? t[0] : JO(t);
}
x(eP, "calcLabelPosition");
var WC = /* @__PURE__ */ x((t, e = 2) => {
  const r = Math.pow(10, e);
  return Math.round(t * r) / r;
}, "roundNumber"), IE = /* @__PURE__ */ x((t, e) => {
  let r, n = e;
  for (const i of t) {
    if (r) {
      const a = DE(i, r);
      if (a === 0)
        return r;
      if (a < n)
        n -= a;
      else {
        const s = n / a;
        if (s <= 0)
          return r;
        if (s >= 1)
          return { x: i.x, y: i.y };
        if (s > 0 && s < 1)
          return {
            x: WC((1 - s) * r.x + s * i.x, 5),
            y: WC((1 - s) * r.y + s * i.y, 5)
          };
      }
    }
    r = i;
  }
  throw new Error("Could not find a suitable point for the given distance");
}, "calculatePoint"), xae = /* @__PURE__ */ x((t, e, r) => {
  ae.info(`our points ${JSON.stringify(e)}`), e[0] !== r && (e = e.reverse());
  const i = IE(e, 25), a = t ? 10 : 5, s = Math.atan2(e[0].y - i.y, e[0].x - i.x), o = { x: 0, y: 0 };
  return o.x = Math.sin(s) * a + (e[0].x + i.x) / 2, o.y = -Math.cos(s) * a + (e[0].y + i.y) / 2, o;
}, "calcCardinalityPosition");
function tP(t, e, r) {
  const n = structuredClone(r);
  ae.info("our points", n), e !== "start_left" && e !== "start_right" && n.reverse();
  const i = 25 + t, a = IE(n, i), s = 10 + t * 0.5, o = Math.atan2(n[0].y - a.y, n[0].x - a.x), l = { x: 0, y: 0 };
  return e === "start_left" ? (l.x = Math.sin(o + Math.PI) * s + (n[0].x + a.x) / 2, l.y = -Math.cos(o + Math.PI) * s + (n[0].y + a.y) / 2) : e === "end_right" ? (l.x = Math.sin(o - Math.PI) * s + (n[0].x + a.x) / 2 - 5, l.y = -Math.cos(o - Math.PI) * s + (n[0].y + a.y) / 2 - 5) : e === "end_left" ? (l.x = Math.sin(o) * s + (n[0].x + a.x) / 2 - 5, l.y = -Math.cos(o) * s + (n[0].y + a.y) / 2 - 5) : (l.x = Math.sin(o) * s + (n[0].x + a.x) / 2, l.y = -Math.cos(o) * s + (n[0].y + a.y) / 2), l;
}
x(tP, "calcTerminalLabelPosition");
function OE(t) {
  let e = "", r = "";
  for (const n of t)
    n !== void 0 && (n.startsWith("color:") || n.startsWith("text-align:") ? r = r + n + ";" : e = e + n + ";");
  return { style: e, labelStyle: r };
}
x(OE, "getStylesFromArray");
var HC = 0, rP = /* @__PURE__ */ x(() => (HC++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + HC), "generateId");
function nP(t) {
  let e = "";
  const r = "0123456789abcdef", n = r.length;
  for (let i = 0; i < t; i++)
    e += r.charAt(Math.floor(Math.random() * n));
  return e;
}
x(nP, "makeRandomHex");
var iP = /* @__PURE__ */ x((t) => nP(t.length), "random"), bae = /* @__PURE__ */ x(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: ""
  };
}, "getTextObj"), wae = /* @__PURE__ */ x(function(t, e) {
  const r = e.text.replace(at.lineBreakRegex, " "), [, n] = Du(e.fontSize), i = t.append("text");
  i.attr("x", e.x), i.attr("y", e.y), i.style("text-anchor", e.anchor), i.style("font-family", e.fontFamily), i.style("font-size", n), i.style("font-weight", e.fontWeight), i.attr("fill", e.fill), e.class !== void 0 && i.attr("class", e.class);
  const a = i.append("tspan");
  return a.attr("x", e.x + e.textMargin * 2), a.attr("fill", e.fill), a.text(r), i;
}, "drawSimpleText"), aP = kf(
  (t, e, r) => {
    if (!t || (r = Object.assign(
      { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
      r
    ), at.lineBreakRegex.test(t)))
      return t;
    const n = t.split(" ").filter(Boolean), i = [];
    let a = "";
    return n.forEach((s, o) => {
      const l = Gi(`${s} `, r), u = Gi(a, r);
      if (l > e) {
        const { hyphenatedStrings: f, remainingWord: p } = Tae(s, e, "-", r);
        i.push(a, ...f), a = p;
      } else u + l >= e ? (i.push(a), a = s) : a = [a, s].filter(Boolean).join(" ");
      o + 1 === n.length && i.push(a);
    }), i.filter((s) => s !== "").join(r.joinWith);
  },
  (t, e, r) => `${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`
), Tae = kf(
  (t, e, r = "-", n) => {
    n = Object.assign(
      { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
      n
    );
    const i = [...t], a = [];
    let s = "";
    return i.forEach((o, l) => {
      const u = `${s}${o}`;
      if (Gi(u, n) >= e) {
        const d = l + 1, f = i.length === d, p = `${u}${r}`;
        a.push(f ? u : p), s = "";
      } else
        s = u;
    }), { hyphenatedStrings: a, remainingWord: s };
  },
  (t, e, r = "-", n) => `${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`
);
function py(t, e) {
  return PE(t, e).height;
}
x(py, "calculateTextHeight");
function Gi(t, e) {
  return PE(t, e).width;
}
x(Gi, "calculateTextWidth");
var PE = kf(
  (t, e) => {
    const { fontSize: r = 12, fontFamily: n = "Arial", fontWeight: i = 400 } = e;
    if (!t)
      return { width: 0, height: 0 };
    const [, a] = Du(r), s = ["sans-serif", n], o = t.split(at.lineBreakRegex), l = [], u = Qe("body");
    if (!u.remove)
      return { width: 0, height: 0, lineHeight: 0 };
    const h = u.append("svg");
    for (const f of s) {
      let p = 0;
      const g = { width: 0, height: 0, lineHeight: 0 };
      for (const m of o) {
        const v = bae();
        v.text = m || KO;
        const y = wae(h, v).style("font-size", a).style("font-weight", i).style("font-family", f), b = (y._groups || y)[0][0].getBBox();
        if (b.width === 0 && b.height === 0)
          throw new Error("svg element not in render tree");
        g.width = Math.round(Math.max(g.width, b.width)), p = Math.round(b.height), g.height += p, g.lineHeight = Math.round(Math.max(g.lineHeight, p));
      }
      l.push(g);
    }
    h.remove();
    const d = 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[d];
  },
  (t, e) => `${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`
), Kh, Eae = (Kh = class {
  constructor(e = !1, r) {
    this.count = 0, this.count = r ? r.length : 0, this.next = e ? () => this.count++ : () => Date.now();
  }
}, x(Kh, "InitIDGenerator"), Kh), M1, kae = /* @__PURE__ */ x(function(t) {
  return M1 = M1 || document.createElement("div"), t = escape(t).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";"), M1.innerHTML = t, unescape(M1.textContent);
}, "entityDecode");
function BE(t) {
  return "str" in t;
}
x(BE, "isDetailedError");
var Sae = /* @__PURE__ */ x((t, e, r, n) => {
  var a;
  if (!n)
    return;
  const i = (a = t.node()) == null ? void 0 : a.getBBox();
  i && t.append("text").text(n).attr("text-anchor", "middle").attr("x", i.x + i.width / 2).attr("y", -r).attr("class", e);
}, "insertTitle"), Du = /* @__PURE__ */ x((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];
}, "parseFontSize");
function qi(t, e) {
  return fy({}, t, e);
}
x(qi, "cleanAndMerge");
var Kt = {
  assignWithDepth: mn,
  wrapLabel: aP,
  calculateTextHeight: py,
  calculateTextWidth: Gi,
  calculateTextDimensions: PE,
  cleanAndMerge: qi,
  detectInit: gae,
  detectDirective: ZO,
  isSubstringInArray: vae,
  interpolateToCurve: ME,
  calcLabelPosition: eP,
  calcCardinalityPosition: xae,
  calcTerminalLabelPosition: tP,
  formatUrl: QO,
  getStylesFromArray: OE,
  generateId: rP,
  random: iP,
  runFunc: yae,
  entityDecode: kae,
  insertTitle: Sae,
  isLabelCoordinateInPath: sP,
  parseFontSize: Du,
  InitIDGenerator: Eae
}, Cae = /* @__PURE__ */ x(function(t) {
  let e = t;
  return e = e.replace(/style.*:\S*#.*;/g, function(r) {
    return r.substring(0, r.length - 1);
  }), e = e.replace(/classDef.*:\S*#.*;/g, function(r) {
    return r.substring(0, r.length - 1);
  }), e = e.replace(/#\w+;/g, function(r) {
    const n = r.substring(1, r.length - 1);
    return /^\+?\d+$/.test(n) ? "ﬂ°°" + n + "¶ß" : "ﬂ°" + n + "¶ß";
  }), e;
}, "encodeEntities"), Zs = /* @__PURE__ */ x(function(t) {
  return t.replace(/ﬂ°°/g, "&#").replace(/ﬂ°/g, "&").replace(/¶ß/g, ";");
}, "decodeEntities"), Nh = /* @__PURE__ */ x((t, e, {
  counter: r = 0,
  prefix: n,
  suffix: i
}, a) => a || `${n ? `${n}_` : ""}${t}_${e}_${r}${i ? `_${i}` : ""}`, "getEdgeId");
function Ci(t) {
  return t ?? null;
}
x(Ci, "handleUndefinedAttr");
function sP(t, e) {
  const r = Math.round(t.x), n = Math.round(t.y), i = e.replace(
    /(\d+\.\d+)/g,
    (a) => Math.round(parseFloat(a)).toString()
  );
  return i.includes(r.toString()) || i.includes(n.toString());
}
x(sP, "isLabelCoordinateInPath");
const Aae = Object.freeze({
  left: 0,
  top: 0,
  width: 16,
  height: 16
}), gy = Object.freeze({
  rotate: 0,
  vFlip: !1,
  hFlip: !1
}), oP = Object.freeze({
  ...Aae,
  ...gy
}), _ae = Object.freeze({
  ...oP,
  body: "",
  hidden: !1
}), Lae = Object.freeze({
  width: null,
  height: null
}), Rae = Object.freeze({
  ...Lae,
  ...gy
}), Nae = (t, e, r, n = "") => {
  const i = t.split(":");
  if (t.slice(0, 1) === "@") {
    if (i.length < 2 || i.length > 3) return null;
    n = i.shift().slice(1);
  }
  if (i.length > 3 || !i.length) return null;
  if (i.length > 1) {
    const o = i.pop(), l = i.pop(), u = {
      provider: i.length > 0 ? i[0] : n,
      prefix: l,
      name: o
    };
    return jb(u) ? u : null;
  }
  const a = i[0], s = a.split("-");
  if (s.length > 1) {
    const o = {
      provider: n,
      prefix: s.shift(),
      name: s.join("-")
    };
    return jb(o) ? o : null;
  }
  if (r && n === "") {
    const o = {
      provider: n,
      prefix: "",
      name: a
    };
    return jb(o, r) ? o : null;
  }
  return null;
}, jb = (t, e) => t ? !!((e && t.prefix === "" || t.prefix) && t.name) : !1;
function Mae(t, e) {
  const r = {};
  !t.hFlip != !e.hFlip && (r.hFlip = !0), !t.vFlip != !e.vFlip && (r.vFlip = !0);
  const n = ((t.rotate || 0) + (e.rotate || 0)) % 4;
  return n && (r.rotate = n), r;
}
function qC(t, e) {
  const r = Mae(t, e);
  for (const n in _ae) n in gy ? n in t && !(n in r) && (r[n] = gy[n]) : n in e ? r[n] = e[n] : n in t && (r[n] = t[n]);
  return r;
}
function Dae(t, e) {
  const r = t.icons, n = t.aliases || /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ Object.create(null);
  function a(s) {
    if (r[s]) return i[s] = [];
    if (!(s in i)) {
      i[s] = null;
      const o = n[s] && n[s].parent, l = o && a(o);
      l && (i[s] = [o].concat(l));
    }
    return i[s];
  }
  return (e || Object.keys(r).concat(Object.keys(n))).forEach(a), i;
}
function YC(t, e, r) {
  const n = t.icons, i = t.aliases || /* @__PURE__ */ Object.create(null);
  let a = {};
  function s(o) {
    a = qC(n[o] || i[o], a);
  }
  return s(e), r.forEach(s), qC(t, a);
}
function Iae(t, e) {
  if (t.icons[e]) return YC(t, e, []);
  const r = Dae(t, [e])[e];
  return r ? YC(t, e, r) : null;
}
const Oae = /(-?[0-9.]*[0-9]+[0-9.]*)/g, Pae = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function XC(t, e, r) {
  if (e === 1) return t;
  if (r = r || 100, typeof t == "number") return Math.ceil(t * e * r) / r;
  if (typeof t != "string") return t;
  const n = t.split(Oae);
  if (n === null || !n.length) return t;
  const i = [];
  let a = n.shift(), s = Pae.test(a);
  for (; ; ) {
    if (s) {
      const o = parseFloat(a);
      isNaN(o) ? i.push(a) : i.push(Math.ceil(o * e * r) / r);
    } else i.push(a);
    if (a = n.shift(), a === void 0) return i.join("");
    s = !s;
  }
}
function Bae(t, e = "defs") {
  let r = "";
  const n = t.indexOf("<" + e);
  for (; n >= 0; ) {
    const i = t.indexOf(">", n), a = t.indexOf("</" + e);
    if (i === -1 || a === -1) break;
    const s = t.indexOf(">", a);
    if (s === -1) break;
    r += t.slice(i + 1, a).trim(), t = t.slice(0, n).trim() + t.slice(s + 1);
  }
  return {
    defs: r,
    content: t
  };
}
function Fae(t, e) {
  return t ? "<defs>" + t + "</defs>" + e : e;
}
function $ae(t, e, r) {
  const n = Bae(t);
  return Fae(n.defs, e + n.content + r);
}
const zae = (t) => t === "unset" || t === "undefined" || t === "none";
function Vae(t, e) {
  const r = {
    ...oP,
    ...t
  }, n = {
    ...Rae,
    ...e
  }, i = {
    left: r.left,
    top: r.top,
    width: r.width,
    height: r.height
  };
  let a = r.body;
  [r, n].forEach((m) => {
    const v = [], y = m.hFlip, b = m.vFlip;
    let w = m.rotate;
    y ? b ? w += 2 : (v.push("translate(" + (i.width + i.left).toString() + " " + (0 - i.top).toString() + ")"), v.push("scale(-1 1)"), i.top = i.left = 0) : b && (v.push("translate(" + (0 - i.left).toString() + " " + (i.height + i.top).toString() + ")"), v.push("scale(1 -1)"), i.top = i.left = 0);
    let T;
    switch (w < 0 && (w -= Math.floor(w / 4) * 4), w = w % 4, w) {
      case 1:
        T = i.height / 2 + i.top, v.unshift("rotate(90 " + T.toString() + " " + T.toString() + ")");
        break;
      case 2:
        v.unshift("rotate(180 " + (i.width / 2 + i.left).toString() + " " + (i.height / 2 + i.top).toString() + ")");
        break;
      case 3:
        T = i.width / 2 + i.left, v.unshift("rotate(-90 " + T.toString() + " " + T.toString() + ")");
        break;
    }
    w % 2 === 1 && (i.left !== i.top && (T = i.left, i.left = i.top, i.top = T), i.width !== i.height && (T = i.width, i.width = i.height, i.height = T)), v.length && (a = $ae(a, '<g transform="' + v.join(" ") + '">', "</g>"));
  });
  const s = n.width, o = n.height, l = i.width, u = i.height;
  let h, d;
  s === null ? (d = o === null ? "1em" : o === "auto" ? u : o, h = XC(d, l / u)) : (h = s === "auto" ? l : s, d = o === null ? XC(h, u / l) : o === "auto" ? u : o);
  const f = {}, p = (m, v) => {
    zae(v) || (f[m] = v.toString());
  };
  p("width", h), p("height", d);
  const g = [
    i.left,
    i.top,
    l,
    u
  ];
  return f.viewBox = g.join(" "), {
    attributes: f,
    viewBox: g,
    body: a
  };
}
const Gae = /\sid="(\S+)"/g, Uae = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
let Wae = 0;
function Hae(t, e = Uae) {
  const r = [];
  let n;
  for (; n = Gae.exec(t); ) r.push(n[1]);
  if (!r.length) return t;
  const i = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  return r.forEach((a) => {
    const s = typeof e == "function" ? e(a) : e + (Wae++).toString(), o = a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    t = t.replace(new RegExp('([#;"])(' + o + ')([")]|\\.[a-z])', "g"), "$1" + s + i + "$3");
  }), t = t.replace(new RegExp(i, "g"), ""), t;
}
function qae(t, e) {
  let r = t.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  for (const n in e) r += " " + n + '="' + e[n] + '"';
  return '<svg xmlns="http://www.w3.org/2000/svg"' + r + ">" + t + "</svg>";
}
function FE() {
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
}
var Iu = FE();
function lP(t) {
  Iu = t;
}
var kp = { exec: () => null };
function kr(t, e = "") {
  let r = typeof t == "string" ? t : t.source, n = { replace: (i, a) => {
    let s = typeof a == "string" ? a : a.source;
    return s = s.replace(zi.caret, "$1"), r = r.replace(i, s), n;
  }, getRegex: () => new RegExp(r, e) };
  return n;
}
var Yae = (() => {
  try {
    return !!new RegExp("(?<=1)(?<!1)");
  } catch {
    return !1;
  }
})(), zi = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i") }, Xae = /^(?:[ \t]*(?:\n|$))+/, jae = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Kae = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, zg = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Zae = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, $E = /(?:[*+-]|\d{1,9}[.)])/, cP = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, uP = kr(cP).replace(/bull/g, $E).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Qae = kr(cP).replace(/bull/g, $E).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), zE = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Jae = /^[^\n]+/, VE = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ese = kr(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", VE).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), tse = kr(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, $E).getRegex(), nx = "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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", GE = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, rse = kr("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))", "i").replace("comment", GE).replace("tag", nx).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), hP = kr(zE).replace("hr", zg).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", nx).getRegex(), nse = kr(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", hP).getRegex(), UE = { blockquote: nse, code: jae, def: ese, fences: Kae, heading: Zae, hr: zg, html: rse, lheading: uP, list: tse, newline: Xae, paragraph: hP, table: kp, text: Jae }, jC = kr("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", zg).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}	)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", nx).getRegex(), ise = { ...UE, lheading: Qae, table: jC, paragraph: kr(zE).replace("hr", zg).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", jC).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", nx).getRegex() }, ase = { ...UE, html: kr(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", GE).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: kp, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: kr(zE).replace("hr", zg).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", uP).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, sse = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ose = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, dP = /^( {2,}|\\)\n(?!\s*$)/, lse = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, ix = /[\p{P}\p{S}]/u, WE = /[\s\p{P}\p{S}]/u, fP = /[^\s\p{P}\p{S}]/u, cse = kr(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, WE).getRegex(), pP = /(?!~)[\p{P}\p{S}]/u, use = /(?!~)[\s\p{P}\p{S}]/u, hse = /(?:[^\s\p{P}\p{S}]|~)/u, dse = kr(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Yae ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), gP = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, fse = kr(gP, "u").replace(/punct/g, ix).getRegex(), pse = kr(gP, "u").replace(/punct/g, pP).getRegex(), mP = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", gse = kr(mP, "gu").replace(/notPunctSpace/g, fP).replace(/punctSpace/g, WE).replace(/punct/g, ix).getRegex(), mse = kr(mP, "gu").replace(/notPunctSpace/g, hse).replace(/punctSpace/g, use).replace(/punct/g, pP).getRegex(), vse = kr("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, fP).replace(/punctSpace/g, WE).replace(/punct/g, ix).getRegex(), yse = kr(/\\(punct)/, "gu").replace(/punct/g, ix).getRegex(), xse = kr(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), bse = kr(GE).replace("(?:-->|$)", "-->").getRegex(), wse = kr("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", bse).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), my = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Tse = kr(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", my).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), vP = kr(/^!?\[(label)\]\[(ref)\]/).replace("label", my).replace("ref", VE).getRegex(), yP = kr(/^!?\[(ref)\](?:\[\])?/).replace("ref", VE).getRegex(), Ese = kr("reflink|nolink(?!\\()", "g").replace("reflink", vP).replace("nolink", yP).getRegex(), KC = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, HE = { _backpedal: kp, anyPunctuation: yse, autolink: xse, blockSkip: dse, br: dP, code: ose, del: kp, emStrongLDelim: fse, emStrongRDelimAst: gse, emStrongRDelimUnd: vse, escape: sse, link: Tse, nolink: yP, punctuation: cse, reflink: vP, reflinkSearch: Ese, tag: wse, text: lse, url: kp }, kse = { ...HE, link: kr(/^!?\[(label)\]\((.*?)\)/).replace("label", my).getRegex(), reflink: kr(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", my).getRegex() }, Rw = { ...HE, emStrongRDelimAst: mse, emStrongLDelim: pse, url: kr(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", KC).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: kr(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", KC).getRegex() }, Sse = { ...Rw, br: kr(dP).replace("{2,}", "*").getRegex(), text: kr(Rw.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, D1 = { normal: UE, gfm: ise, pedantic: ase }, t0 = { normal: HE, gfm: Rw, breaks: Sse, pedantic: kse }, Cse = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ZC = (t) => Cse[t];
function Is(t, e) {
  if (e) {
    if (zi.escapeTest.test(t)) return t.replace(zi.escapeReplace, ZC);
  } else if (zi.escapeTestNoEncode.test(t)) return t.replace(zi.escapeReplaceNoEncode, ZC);
  return t;
}
function QC(t) {
  try {
    t = encodeURI(t).replace(zi.percentDecode, "%");
  } catch {
    return null;
  }
  return t;
}
function JC(t, e) {
  var a;
  let r = t.replace(zi.findPipe, (s, o, l) => {
    let u = !1, h = o;
    for (; --h >= 0 && l[h] === "\\"; ) u = !u;
    return u ? "|" : " |";
  }), n = r.split(zi.splitPipe), i = 0;
  if (n[0].trim() || n.shift(), n.length > 0 && !((a = n.at(-1)) != null && a.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
  else for (; n.length < e; ) n.push("");
  for (; i < n.length; i++) n[i] = n[i].trim().replace(zi.slashPipe, "|");
  return n;
}
function r0(t, e, r) {
  let n = t.length;
  if (n === 0) return "";
  let i = 0;
  for (; i < n && t.charAt(n - i - 1) === e; )
    i++;
  return t.slice(0, n - i);
}
function Ase(t, e) {
  if (t.indexOf(e[1]) === -1) return -1;
  let r = 0;
  for (let n = 0; n < t.length; n++) if (t[n] === "\\") n++;
  else if (t[n] === e[0]) r++;
  else if (t[n] === e[1] && (r--, r < 0)) return n;
  return r > 0 ? -2 : -1;
}
function e8(t, e, r, n, i) {
  let a = e.href, s = e.title || null, o = t[1].replace(i.other.outputLinkReplace, "$1");
  n.state.inLink = !0;
  let l = { type: t[0].charAt(0) === "!" ? "image" : "link", raw: r, href: a, title: s, text: o, tokens: n.inlineTokens(o) };
  return n.state.inLink = !1, l;
}
function _se(t, e, r) {
  let n = t.match(r.other.indentCodeCompensation);
  if (n === null) return e;
  let i = n[1];
  return e.split(`
`).map((a) => {
    let s = a.match(r.other.beginningSpace);
    if (s === null) return a;
    let [o] = s;
    return o.length >= i.length ? a.slice(i.length) : a;
  }).join(`
`);
}
var vy = class {
  constructor(e) {
    ur(this, "options");
    ur(this, "rules");
    ur(this, "lexer");
    this.options = e || Iu;
  }
  space(e) {
    let r = this.rules.block.newline.exec(e);
    if (r && r[0].length > 0) return { type: "space", raw: r[0] };
  }
  code(e) {
    let r = this.rules.block.code.exec(e);
    if (r) {
      let n = r[0].replace(this.rules.other.codeRemoveIndent, "");
      return { type: "code", raw: r[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : r0(n, `
`) };
    }
  }
  fences(e) {
    let r = this.rules.block.fences.exec(e);
    if (r) {
      let n = r[0], i = _se(n, r[3] || "", this.rules);
      return { type: "code", raw: n, lang: r[2] ? r[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : r[2], text: i };
    }
  }
  heading(e) {
    let r = this.rules.block.heading.exec(e);
    if (r) {
      let n = r[2].trim();
      if (this.rules.other.endingHash.test(n)) {
        let i = r0(n, "#");
        (this.options.pedantic || !i || this.rules.other.endingSpaceChar.test(i)) && (n = i.trim());
      }
      return { type: "heading", raw: r[0], depth: r[1].length, text: n, tokens: this.lexer.inline(n) };
    }
  }
  hr(e) {
    let r = this.rules.block.hr.exec(e);
    if (r) return { type: "hr", raw: r0(r[0], `
`) };
  }
  blockquote(e) {
    let r = this.rules.block.blockquote.exec(e);
    if (r) {
      let n = r0(r[0], `
`).split(`
`), i = "", a = "", s = [];
      for (; n.length > 0; ) {
        let o = !1, l = [], u;
        for (u = 0; u < n.length; u++) if (this.rules.other.blockquoteStart.test(n[u])) l.push(n[u]), o = !0;
        else if (!o) l.push(n[u]);
        else break;
        n = n.slice(u);
        let h = l.join(`
`), d = h.replace(this.rules.other.blockquoteSetextReplace, `
    $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
        i = i ? `${i}
${h}` : h, a = a ? `${a}
${d}` : d;
        let f = this.lexer.state.top;
        if (this.lexer.state.top = !0, this.lexer.blockTokens(d, s, !0), this.lexer.state.top = f, n.length === 0) break;
        let p = s.at(-1);
        if ((p == null ? void 0 : p.type) === "code") break;
        if ((p == null ? void 0 : p.type) === "blockquote") {
          let g = p, m = g.raw + `
` + n.join(`
`), v = this.blockquote(m);
          s[s.length - 1] = v, i = i.substring(0, i.length - g.raw.length) + v.raw, a = a.substring(0, a.length - g.text.length) + v.text;
          break;
        } else if ((p == null ? void 0 : p.type) === "list") {
          let g = p, m = g.raw + `
` + n.join(`
`), v = this.list(m);
          s[s.length - 1] = v, i = i.substring(0, i.length - p.raw.length) + v.raw, a = a.substring(0, a.length - g.raw.length) + v.raw, n = m.substring(s.at(-1).raw.length).split(`
`);
          continue;
        }
      }
      return { type: "blockquote", raw: i, tokens: s, text: a };
    }
  }
  list(e) {
    let r = this.rules.block.list.exec(e);
    if (r) {
      let n = r[1].trim(), i = n.length > 1, a = { type: "list", raw: "", ordered: i, start: i ? +n.slice(0, -1) : "", loose: !1, items: [] };
      n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
      let s = this.rules.other.listItemRegex(n), o = !1;
      for (; e; ) {
        let u = !1, h = "", d = "";
        if (!(r = s.exec(e)) || this.rules.block.hr.test(e)) break;
        h = r[0], e = e.substring(h.length);
        let f = r[2].split(`
`, 1)[0].replace(this.rules.other.listReplaceTabs, (b) => " ".repeat(3 * b.length)), p = e.split(`
`, 1)[0], g = !f.trim(), m = 0;
        if (this.options.pedantic ? (m = 2, d = f.trimStart()) : g ? m = r[1].length + 1 : (m = r[2].search(this.rules.other.nonSpaceChar), m = m > 4 ? 1 : m, d = f.slice(m), m += r[1].length), g && this.rules.other.blankLine.test(p) && (h += p + `
`, e = e.substring(p.length + 1), u = !0), !u) {
          let b = this.rules.other.nextBulletRegex(m), w = this.rules.other.hrRegex(m), T = this.rules.other.fencesBeginRegex(m), E = this.rules.other.headingBeginRegex(m), C = this.rules.other.htmlBeginRegex(m);
          for (; e; ) {
            let k = e.split(`
`, 1)[0], _;
            if (p = k, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, "  "), _ = p) : _ = p.replace(this.rules.other.tabCharGlobal, "    "), T.test(p) || E.test(p) || C.test(p) || b.test(p) || w.test(p)) break;
            if (_.search(this.rules.other.nonSpaceChar) >= m || !p.trim()) d += `
` + _.slice(m);
            else {
              if (g || f.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || T.test(f) || E.test(f) || w.test(f)) break;
              d += `
` + p;
            }
            !g && !p.trim() && (g = !0), h += k + `
`, e = e.substring(k.length + 1), f = _.slice(m);
          }
        }
        a.loose || (o ? a.loose = !0 : this.rules.other.doubleBlankLine.test(h) && (o = !0));
        let v = null, y;
        this.options.gfm && (v = this.rules.other.listIsTask.exec(d), v && (y = v[0] !== "[ ] ", d = d.replace(this.rules.other.listReplaceTask, ""))), a.items.push({ type: "list_item", raw: h, task: !!v, checked: y, loose: !1, text: d, tokens: [] }), a.raw += h;
      }
      let l = a.items.at(-1);
      if (l) l.raw = l.raw.trimEnd(), l.text = l.text.trimEnd();
      else return;
      a.raw = a.raw.trimEnd();
      for (let u = 0; u < a.items.length; u++) if (this.lexer.state.top = !1, a.items[u].tokens = this.lexer.blockTokens(a.items[u].text, []), !a.loose) {
        let h = a.items[u].tokens.filter((f) => f.type === "space"), d = h.length > 0 && h.some((f) => this.rules.other.anyLine.test(f.raw));
        a.loose = d;
      }
      if (a.loose) for (let u = 0; u < a.items.length; u++) a.items[u].loose = !0;
      return a;
    }
  }
  html(e) {
    let r = this.rules.block.html.exec(e);
    if (r) return { type: "html", block: !0, raw: r[0], pre: r[1] === "pre" || r[1] === "script" || r[1] === "style", text: r[0] };
  }
  def(e) {
    let r = this.rules.block.def.exec(e);
    if (r) {
      let n = r[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), i = r[2] ? r[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", a = r[3] ? r[3].substring(1, r[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : r[3];
      return { type: "def", tag: n, raw: r[0], href: i, title: a };
    }
  }
  table(e) {
    var o;
    let r = this.rules.block.table.exec(e);
    if (!r || !this.rules.other.tableDelimiter.test(r[2])) return;
    let n = JC(r[1]), i = r[2].replace(this.rules.other.tableAlignChars, "").split("|"), a = (o = r[3]) != null && o.trim() ? r[3].replace(this.rules.other.tableRowBlankLine, "").split(`
`) : [], s = { type: "table", raw: r[0], header: [], align: [], rows: [] };
    if (n.length === i.length) {
      for (let l of i) this.rules.other.tableAlignRight.test(l) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? s.align.push("left") : s.align.push(null);
      for (let l = 0; l < n.length; l++) s.header.push({ text: n[l], tokens: this.lexer.inline(n[l]), header: !0, align: s.align[l] });
      for (let l of a) s.rows.push(JC(l, s.header.length).map((u, h) => ({ text: u, tokens: this.lexer.inline(u), header: !1, align: s.align[h] })));
      return s;
    }
  }
  lheading(e) {
    let r = this.rules.block.lheading.exec(e);
    if (r) return { type: "heading", raw: r[0], depth: r[2].charAt(0) === "=" ? 1 : 2, text: r[1], tokens: this.lexer.inline(r[1]) };
  }
  paragraph(e) {
    let r = this.rules.block.paragraph.exec(e);
    if (r) {
      let n = r[1].charAt(r[1].length - 1) === `
` ? r[1].slice(0, -1) : r[1];
      return { type: "paragraph", raw: r[0], text: n, tokens: this.lexer.inline(n) };
    }
  }
  text(e) {
    let r = this.rules.block.text.exec(e);
    if (r) return { type: "text", raw: r[0], text: r[0], tokens: this.lexer.inline(r[0]) };
  }
  escape(e) {
    let r = this.rules.inline.escape.exec(e);
    if (r) return { type: "escape", raw: r[0], text: r[1] };
  }
  tag(e) {
    let r = this.rules.inline.tag.exec(e);
    if (r) return !this.lexer.state.inLink && this.rules.other.startATag.test(r[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(r[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(r[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(r[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: r[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: r[0] };
  }
  link(e) {
    let r = this.rules.inline.link.exec(e);
    if (r) {
      let n = r[2].trim();
      if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
        if (!this.rules.other.endAngleBracket.test(n)) return;
        let s = r0(n.slice(0, -1), "\\");
        if ((n.length - s.length) % 2 === 0) return;
      } else {
        let s = Ase(r[2], "()");
        if (s === -2) return;
        if (s > -1) {
          let o = (r[0].indexOf("!") === 0 ? 5 : 4) + r[1].length + s;
          r[2] = r[2].substring(0, s), r[0] = r[0].substring(0, o).trim(), r[3] = "";
        }
      }
      let i = r[2], a = "";
      if (this.options.pedantic) {
        let s = this.rules.other.pedanticHrefTitle.exec(i);
        s && (i = s[1], a = s[3]);
      } else a = r[3] ? r[3].slice(1, -1) : "";
      return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), e8(r, { href: i && i.replace(this.rules.inline.anyPunctuation, "$1"), title: a && a.replace(this.rules.inline.anyPunctuation, "$1") }, r[0], this.lexer, this.rules);
    }
  }
  reflink(e, r) {
    let n;
    if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
      let i = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), a = r[i.toLowerCase()];
      if (!a) {
        let s = n[0].charAt(0);
        return { type: "text", raw: s, text: s };
      }
      return e8(n, a, n[0], this.lexer, this.rules);
    }
  }
  emStrong(e, r, n = "") {
    let i = this.rules.inline.emStrongLDelim.exec(e);
    if (!(!i || i[3] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(i[1] || i[2]) || !n || this.rules.inline.punctuation.exec(n))) {
      let a = [...i[0]].length - 1, s, o, l = a, u = 0, h = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
      for (h.lastIndex = 0, r = r.slice(-1 * e.length + a); (i = h.exec(r)) != null; ) {
        if (s = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !s) continue;
        if (o = [...s].length, i[3] || i[4]) {
          l += o;
          continue;
        } else if ((i[5] || i[6]) && a % 3 && !((a + o) % 3)) {
          u += o;
          continue;
        }
        if (l -= o, l > 0) continue;
        o = Math.min(o, o + l + u);
        let d = [...i[0]][0].length, f = e.slice(0, a + i.index + d + o);
        if (Math.min(a, o) % 2) {
          let g = f.slice(1, -1);
          return { type: "em", raw: f, text: g, tokens: this.lexer.inlineTokens(g) };
        }
        let p = f.slice(2, -2);
        return { type: "strong", raw: f, text: p, tokens: this.lexer.inlineTokens(p) };
      }
    }
  }
  codespan(e) {
    let r = this.rules.inline.code.exec(e);
    if (r) {
      let n = r[2].replace(this.rules.other.newLineCharGlobal, " "), i = this.rules.other.nonSpaceChar.test(n), a = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
      return i && a && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: r[0], text: n };
    }
  }
  br(e) {
    let r = this.rules.inline.br.exec(e);
    if (r) return { type: "br", raw: r[0] };
  }
  del(e) {
    let r = this.rules.inline.del.exec(e);
    if (r) return { type: "del", raw: r[0], text: r[2], tokens: this.lexer.inlineTokens(r[2]) };
  }
  autolink(e) {
    let r = this.rules.inline.autolink.exec(e);
    if (r) {
      let n, i;
      return r[2] === "@" ? (n = r[1], i = "mailto:" + n) : (n = r[1], i = n), { type: "link", raw: r[0], text: n, href: i, tokens: [{ type: "text", raw: n, text: n }] };
    }
  }
  url(e) {
    var n;
    let r;
    if (r = this.rules.inline.url.exec(e)) {
      let i, a;
      if (r[2] === "@") i = r[0], a = "mailto:" + i;
      else {
        let s;
        do
          s = r[0], r[0] = ((n = this.rules.inline._backpedal.exec(r[0])) == null ? void 0 : n[0]) ?? "";
        while (s !== r[0]);
        i = r[0], r[1] === "www." ? a = "http://" + r[0] : a = r[0];
      }
      return { type: "link", raw: r[0], text: i, href: a, tokens: [{ type: "text", raw: i, text: i }] };
    }
  }
  inlineText(e) {
    let r = this.rules.inline.text.exec(e);
    if (r) {
      let n = this.lexer.state.inRawBlock;
      return { type: "text", raw: r[0], text: r[0], escaped: n };
    }
  }
}, hs = class Nw {
  constructor(e) {
    ur(this, "tokens");
    ur(this, "options");
    ur(this, "state");
    ur(this, "tokenizer");
    ur(this, "inlineQueue");
    this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || Iu, this.options.tokenizer = this.options.tokenizer || new vy(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
    let r = { other: zi, block: D1.normal, inline: t0.normal };
    this.options.pedantic ? (r.block = D1.pedantic, r.inline = t0.pedantic) : this.options.gfm && (r.block = D1.gfm, this.options.breaks ? r.inline = t0.breaks : r.inline = t0.gfm), this.tokenizer.rules = r;
  }
  static get rules() {
    return { block: D1, inline: t0 };
  }
  static lex(e, r) {
    return new Nw(r).lex(e);
  }
  static lexInline(e, r) {
    return new Nw(r).inlineTokens(e);
  }
  lex(e) {
    e = e.replace(zi.carriageReturn, `
`), this.blockTokens(e, this.tokens);
    for (let r = 0; r < this.inlineQueue.length; r++) {
      let n = this.inlineQueue[r];
      this.inlineTokens(n.src, n.tokens);
    }
    return this.inlineQueue = [], this.tokens;
  }
  blockTokens(e, r = [], n = !1) {
    var i, a, s;
    for (this.options.pedantic && (e = e.replace(zi.tabCharGlobal, "    ").replace(zi.spaceLine, "")); e; ) {
      let o;
      if ((a = (i = this.options.extensions) == null ? void 0 : i.block) != null && a.some((u) => (o = u.call({ lexer: this }, e, r)) ? (e = e.substring(o.raw.length), r.push(o), !0) : !1)) continue;
      if (o = this.tokenizer.space(e)) {
        e = e.substring(o.raw.length);
        let u = r.at(-1);
        o.raw.length === 1 && u !== void 0 ? u.raw += `
` : r.push(o);
        continue;
      }
      if (o = this.tokenizer.code(e)) {
        e = e.substring(o.raw.length);
        let u = r.at(-1);
        (u == null ? void 0 : u.type) === "paragraph" || (u == null ? void 0 : u.type) === "text" ? (u.raw += (u.raw.endsWith(`
`) ? "" : `
`) + o.raw, u.text += `
` + o.text, this.inlineQueue.at(-1).src = u.text) : r.push(o);
        continue;
      }
      if (o = this.tokenizer.fences(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.heading(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.hr(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.blockquote(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.list(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.html(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.def(e)) {
        e = e.substring(o.raw.length);
        let u = r.at(-1);
        (u == null ? void 0 : u.type) === "paragraph" || (u == null ? void 0 : u.type) === "text" ? (u.raw += (u.raw.endsWith(`
`) ? "" : `
`) + o.raw, u.text += `
` + o.raw, this.inlineQueue.at(-1).src = u.text) : this.tokens.links[o.tag] || (this.tokens.links[o.tag] = { href: o.href, title: o.title }, r.push(o));
        continue;
      }
      if (o = this.tokenizer.table(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.lheading(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      let l = e;
      if ((s = this.options.extensions) != null && s.startBlock) {
        let u = 1 / 0, h = e.slice(1), d;
        this.options.extensions.startBlock.forEach((f) => {
          d = f.call({ lexer: this }, h), typeof d == "number" && d >= 0 && (u = Math.min(u, d));
        }), u < 1 / 0 && u >= 0 && (l = e.substring(0, u + 1));
      }
      if (this.state.top && (o = this.tokenizer.paragraph(l))) {
        let u = r.at(-1);
        n && (u == null ? void 0 : u.type) === "paragraph" ? (u.raw += (u.raw.endsWith(`
`) ? "" : `
`) + o.raw, u.text += `
` + o.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = u.text) : r.push(o), n = l.length !== e.length, e = e.substring(o.raw.length);
        continue;
      }
      if (o = this.tokenizer.text(e)) {
        e = e.substring(o.raw.length);
        let u = r.at(-1);
        (u == null ? void 0 : u.type) === "text" ? (u.raw += (u.raw.endsWith(`
`) ? "" : `
`) + o.raw, u.text += `
` + o.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = u.text) : r.push(o);
        continue;
      }
      if (e) {
        let u = "Infinite loop on byte: " + e.charCodeAt(0);
        if (this.options.silent) {
          console.error(u);
          break;
        } else throw new Error(u);
      }
    }
    return this.state.top = !0, r;
  }
  inline(e, r = []) {
    return this.inlineQueue.push({ src: e, tokens: r }), r;
  }
  inlineTokens(e, r = []) {
    var l, u, h, d, f;
    let n = e, i = null;
    if (this.tokens.links) {
      let p = Object.keys(this.tokens.links);
      if (p.length > 0) for (; (i = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) p.includes(i[0].slice(i[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
    }
    for (; (i = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, i.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
    let a;
    for (; (i = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) a = i[2] ? i[2].length : 0, n = n.slice(0, i.index + a) + "[" + "a".repeat(i[0].length - a - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
    n = ((u = (l = this.options.hooks) == null ? void 0 : l.emStrongMask) == null ? void 0 : u.call({ lexer: this }, n)) ?? n;
    let s = !1, o = "";
    for (; e; ) {
      s || (o = ""), s = !1;
      let p;
      if ((d = (h = this.options.extensions) == null ? void 0 : h.inline) != null && d.some((m) => (p = m.call({ lexer: this }, e, r)) ? (e = e.substring(p.raw.length), r.push(p), !0) : !1)) continue;
      if (p = this.tokenizer.escape(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.tag(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.link(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.reflink(e, this.tokens.links)) {
        e = e.substring(p.raw.length);
        let m = r.at(-1);
        p.type === "text" && (m == null ? void 0 : m.type) === "text" ? (m.raw += p.raw, m.text += p.text) : r.push(p);
        continue;
      }
      if (p = this.tokenizer.emStrong(e, n, o)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.codespan(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.br(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.del(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (p = this.tokenizer.autolink(e)) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      if (!this.state.inLink && (p = this.tokenizer.url(e))) {
        e = e.substring(p.raw.length), r.push(p);
        continue;
      }
      let g = e;
      if ((f = this.options.extensions) != null && f.startInline) {
        let m = 1 / 0, v = e.slice(1), y;
        this.options.extensions.startInline.forEach((b) => {
          y = b.call({ lexer: this }, v), typeof y == "number" && y >= 0 && (m = Math.min(m, y));
        }), m < 1 / 0 && m >= 0 && (g = e.substring(0, m + 1));
      }
      if (p = this.tokenizer.inlineText(g)) {
        e = e.substring(p.raw.length), p.raw.slice(-1) !== "_" && (o = p.raw.slice(-1)), s = !0;
        let m = r.at(-1);
        (m == null ? void 0 : m.type) === "text" ? (m.raw += p.raw, m.text += p.text) : r.push(p);
        continue;
      }
      if (e) {
        let m = "Infinite loop on byte: " + e.charCodeAt(0);
        if (this.options.silent) {
          console.error(m);
          break;
        } else throw new Error(m);
      }
    }
    return r;
  }
}, yy = class {
  constructor(e) {
    ur(this, "options");
    ur(this, "parser");
    this.options = e || Iu;
  }
  space(e) {
    return "";
  }
  code({ text: e, lang: r, escaped: n }) {
    var s;
    let i = (s = (r || "").match(zi.notSpaceStart)) == null ? void 0 : s[0], a = e.replace(zi.endingNewline, "") + `
`;
    return i ? '<pre><code class="language-' + Is(i) + '">' + (n ? a : Is(a, !0)) + `</code></pre>
` : "<pre><code>" + (n ? a : Is(a, !0)) + `</code></pre>
`;
  }
  blockquote({ tokens: e }) {
    return `<blockquote>
${this.parser.parse(e)}</blockquote>
`;
  }
  html({ text: e }) {
    return e;
  }
  def(e) {
    return "";
  }
  heading({ tokens: e, depth: r }) {
    return `<h${r}>${this.parser.parseInline(e)}</h${r}>
`;
  }
  hr(e) {
    return `<hr>
`;
  }
  list(e) {
    let r = e.ordered, n = e.start, i = "";
    for (let o = 0; o < e.items.length; o++) {
      let l = e.items[o];
      i += this.listitem(l);
    }
    let a = r ? "ol" : "ul", s = r && n !== 1 ? ' start="' + n + '"' : "";
    return "<" + a + s + `>
` + i + "</" + a + `>
`;
  }
  listitem(e) {
    var n;
    let r = "";
    if (e.task) {
      let i = this.checkbox({ checked: !!e.checked });
      e.loose ? ((n = e.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (e.tokens[0].text = i + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = i + " " + Is(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({ type: "text", raw: i + " ", text: i + " ", escaped: !0 }) : r += i + " ";
    }
    return r += this.parser.parse(e.tokens, !!e.loose), `<li>${r}</li>
`;
  }
  checkbox({ checked: e }) {
    return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
  }
  paragraph({ tokens: e }) {
    return `<p>${this.parser.parseInline(e)}</p>
`;
  }
  table(e) {
    let r = "", n = "";
    for (let a = 0; a < e.header.length; a++) n += this.tablecell(e.header[a]);
    r += this.tablerow({ text: n });
    let i = "";
    for (let a = 0; a < e.rows.length; a++) {
      let s = e.rows[a];
      n = "";
      for (let o = 0; o < s.length; o++) n += this.tablecell(s[o]);
      i += this.tablerow({ text: n });
    }
    return i && (i = `<tbody>${i}</tbody>`), `<table>
<thead>
` + r + `</thead>
` + i + `</table>
`;
  }
  tablerow({ text: e }) {
    return `<tr>
${e}</tr>
`;
  }
  tablecell(e) {
    let r = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
    return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + r + `</${n}>
`;
  }
  strong({ tokens: e }) {
    return `<strong>${this.parser.parseInline(e)}</strong>`;
  }
  em({ tokens: e }) {
    return `<em>${this.parser.parseInline(e)}</em>`;
  }
  codespan({ text: e }) {
    return `<code>${Is(e, !0)}</code>`;
  }
  br(e) {
    return "<br>";
  }
  del({ tokens: e }) {
    return `<del>${this.parser.parseInline(e)}</del>`;
  }
  link({ href: e, title: r, tokens: n }) {
    let i = this.parser.parseInline(n), a = QC(e);
    if (a === null) return i;
    e = a;
    let s = '<a href="' + e + '"';
    return r && (s += ' title="' + Is(r) + '"'), s += ">" + i + "</a>", s;
  }
  image({ href: e, title: r, text: n, tokens: i }) {
    i && (n = this.parser.parseInline(i, this.parser.textRenderer));
    let a = QC(e);
    if (a === null) return Is(n);
    e = a;
    let s = `<img src="${e}" alt="${n}"`;
    return r && (s += ` title="${Is(r)}"`), s += ">", s;
  }
  text(e) {
    return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : Is(e.text);
  }
}, qE = class {
  strong({ text: e }) {
    return e;
  }
  em({ text: e }) {
    return e;
  }
  codespan({ text: e }) {
    return e;
  }
  del({ text: e }) {
    return e;
  }
  html({ text: e }) {
    return e;
  }
  text({ text: e }) {
    return e;
  }
  link({ text: e }) {
    return "" + e;
  }
  image({ text: e }) {
    return "" + e;
  }
  br() {
    return "";
  }
}, ds = class Mw {
  constructor(e) {
    ur(this, "options");
    ur(this, "renderer");
    ur(this, "textRenderer");
    this.options = e || Iu, this.options.renderer = this.options.renderer || new yy(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new qE();
  }
  static parse(e, r) {
    return new Mw(r).parse(e);
  }
  static parseInline(e, r) {
    return new Mw(r).parseInline(e);
  }
  parse(e, r = !0) {
    var i, a;
    let n = "";
    for (let s = 0; s < e.length; s++) {
      let o = e[s];
      if ((a = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && a[o.type]) {
        let u = o, h = this.options.extensions.renderers[u.type].call({ parser: this }, u);
        if (h !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(u.type)) {
          n += h || "";
          continue;
        }
      }
      let l = o;
      switch (l.type) {
        case "space": {
          n += this.renderer.space(l);
          continue;
        }
        case "hr": {
          n += this.renderer.hr(l);
          continue;
        }
        case "heading": {
          n += this.renderer.heading(l);
          continue;
        }
        case "code": {
          n += this.renderer.code(l);
          continue;
        }
        case "table": {
          n += this.renderer.table(l);
          continue;
        }
        case "blockquote": {
          n += this.renderer.blockquote(l);
          continue;
        }
        case "list": {
          n += this.renderer.list(l);
          continue;
        }
        case "html": {
          n += this.renderer.html(l);
          continue;
        }
        case "def": {
          n += this.renderer.def(l);
          continue;
        }
        case "paragraph": {
          n += this.renderer.paragraph(l);
          continue;
        }
        case "text": {
          let u = l, h = this.renderer.text(u);
          for (; s + 1 < e.length && e[s + 1].type === "text"; ) u = e[++s], h += `
` + this.renderer.text(u);
          r ? n += this.renderer.paragraph({ type: "paragraph", raw: h, text: h, tokens: [{ type: "text", raw: h, text: h, escaped: !0 }] }) : n += h;
          continue;
        }
        default: {
          let u = 'Token with "' + l.type + '" type was not found.';
          if (this.options.silent) return console.error(u), "";
          throw new Error(u);
        }
      }
    }
    return n;
  }
  parseInline(e, r = this.renderer) {
    var i, a;
    let n = "";
    for (let s = 0; s < e.length; s++) {
      let o = e[s];
      if ((a = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && a[o.type]) {
        let u = this.options.extensions.renderers[o.type].call({ parser: this }, o);
        if (u !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(o.type)) {
          n += u || "";
          continue;
        }
      }
      let l = o;
      switch (l.type) {
        case "escape": {
          n += r.text(l);
          break;
        }
        case "html": {
          n += r.html(l);
          break;
        }
        case "link": {
          n += r.link(l);
          break;
        }
        case "image": {
          n += r.image(l);
          break;
        }
        case "strong": {
          n += r.strong(l);
          break;
        }
        case "em": {
          n += r.em(l);
          break;
        }
        case "codespan": {
          n += r.codespan(l);
          break;
        }
        case "br": {
          n += r.br(l);
          break;
        }
        case "del": {
          n += r.del(l);
          break;
        }
        case "text": {
          n += r.text(l);
          break;
        }
        default: {
          let u = 'Token with "' + l.type + '" type was not found.';
          if (this.options.silent) return console.error(u), "";
          throw new Error(u);
        }
      }
    }
    return n;
  }
}, Pm, T0 = (Pm = class {
  constructor(e) {
    ur(this, "options");
    ur(this, "block");
    this.options = e || Iu;
  }
  preprocess(e) {
    return e;
  }
  postprocess(e) {
    return e;
  }
  processAllTokens(e) {
    return e;
  }
  emStrongMask(e) {
    return e;
  }
  provideLexer() {
    return this.block ? hs.lex : hs.lexInline;
  }
  provideParser() {
    return this.block ? ds.parse : ds.parseInline;
  }
}, ur(Pm, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), ur(Pm, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Pm), Lse = class {
  constructor(...e) {
    ur(this, "defaults", FE());
    ur(this, "options", this.setOptions);
    ur(this, "parse", this.parseMarkdown(!0));
    ur(this, "parseInline", this.parseMarkdown(!1));
    ur(this, "Parser", ds);
    ur(this, "Renderer", yy);
    ur(this, "TextRenderer", qE);
    ur(this, "Lexer", hs);
    ur(this, "Tokenizer", vy);
    ur(this, "Hooks", T0);
    this.use(...e);
  }
  walkTokens(e, r) {
    var i, a;
    let n = [];
    for (let s of e) switch (n = n.concat(r.call(this, s)), s.type) {
      case "table": {
        let o = s;
        for (let l of o.header) n = n.concat(this.walkTokens(l.tokens, r));
        for (let l of o.rows) for (let u of l) n = n.concat(this.walkTokens(u.tokens, r));
        break;
      }
      case "list": {
        let o = s;
        n = n.concat(this.walkTokens(o.items, r));
        break;
      }
      default: {
        let o = s;
        (a = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && a[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((l) => {
          let u = o[l].flat(1 / 0);
          n = n.concat(this.walkTokens(u, r));
        }) : o.tokens && (n = n.concat(this.walkTokens(o.tokens, r)));
      }
    }
    return n;
  }
  use(...e) {
    let r = this.defaults.extensions || { renderers: {}, childTokens: {} };
    return e.forEach((n) => {
      let i = { ...n };
      if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((a) => {
        if (!a.name) throw new Error("extension name required");
        if ("renderer" in a) {
          let s = r.renderers[a.name];
          s ? r.renderers[a.name] = function(...o) {
            let l = a.renderer.apply(this, o);
            return l === !1 && (l = s.apply(this, o)), l;
          } : r.renderers[a.name] = a.renderer;
        }
        if ("tokenizer" in a) {
          if (!a.level || a.level !== "block" && a.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
          let s = r[a.level];
          s ? s.unshift(a.tokenizer) : r[a.level] = [a.tokenizer], a.start && (a.level === "block" ? r.startBlock ? r.startBlock.push(a.start) : r.startBlock = [a.start] : a.level === "inline" && (r.startInline ? r.startInline.push(a.start) : r.startInline = [a.start]));
        }
        "childTokens" in a && a.childTokens && (r.childTokens[a.name] = a.childTokens);
      }), i.extensions = r), n.renderer) {
        let a = this.defaults.renderer || new yy(this.defaults);
        for (let s in n.renderer) {
          if (!(s in a)) throw new Error(`renderer '${s}' does not exist`);
          if (["options", "parser"].includes(s)) continue;
          let o = s, l = n.renderer[o], u = a[o];
          a[o] = (...h) => {
            let d = l.apply(a, h);
            return d === !1 && (d = u.apply(a, h)), d || "";
          };
        }
        i.renderer = a;
      }
      if (n.tokenizer) {
        let a = this.defaults.tokenizer || new vy(this.defaults);
        for (let s in n.tokenizer) {
          if (!(s in a)) throw new Error(`tokenizer '${s}' does not exist`);
          if (["options", "rules", "lexer"].includes(s)) continue;
          let o = s, l = n.tokenizer[o], u = a[o];
          a[o] = (...h) => {
            let d = l.apply(a, h);
            return d === !1 && (d = u.apply(a, h)), d;
          };
        }
        i.tokenizer = a;
      }
      if (n.hooks) {
        let a = this.defaults.hooks || new T0();
        for (let s in n.hooks) {
          if (!(s in a)) throw new Error(`hook '${s}' does not exist`);
          if (["options", "block"].includes(s)) continue;
          let o = s, l = n.hooks[o], u = a[o];
          T0.passThroughHooks.has(s) ? a[o] = (h) => {
            if (this.defaults.async && T0.passThroughHooksRespectAsync.has(s)) return (async () => {
              let f = await l.call(a, h);
              return u.call(a, f);
            })();
            let d = l.call(a, h);
            return u.call(a, d);
          } : a[o] = (...h) => {
            if (this.defaults.async) return (async () => {
              let f = await l.apply(a, h);
              return f === !1 && (f = await u.apply(a, h)), f;
            })();
            let d = l.apply(a, h);
            return d === !1 && (d = u.apply(a, h)), d;
          };
        }
        i.hooks = a;
      }
      if (n.walkTokens) {
        let a = this.defaults.walkTokens, s = n.walkTokens;
        i.walkTokens = function(o) {
          let l = [];
          return l.push(s.call(this, o)), a && (l = l.concat(a.call(this, o))), l;
        };
      }
      this.defaults = { ...this.defaults, ...i };
    }), this;
  }
  setOptions(e) {
    return this.defaults = { ...this.defaults, ...e }, this;
  }
  lexer(e, r) {
    return hs.lex(e, r ?? this.defaults);
  }
  parser(e, r) {
    return ds.parse(e, r ?? this.defaults);
  }
  parseMarkdown(e) {
    return (r, n) => {
      let i = { ...n }, a = { ...this.defaults, ...i }, s = this.onError(!!a.silent, !!a.async);
      if (this.defaults.async === !0 && i.async === !1) return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
      if (typeof r > "u" || r === null) return s(new Error("marked(): input parameter is undefined or null"));
      if (typeof r != "string") return s(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(r) + ", string expected"));
      if (a.hooks && (a.hooks.options = a, a.hooks.block = e), a.async) return (async () => {
        let o = a.hooks ? await a.hooks.preprocess(r) : r, l = await (a.hooks ? await a.hooks.provideLexer() : e ? hs.lex : hs.lexInline)(o, a), u = a.hooks ? await a.hooks.processAllTokens(l) : l;
        a.walkTokens && await Promise.all(this.walkTokens(u, a.walkTokens));
        let h = await (a.hooks ? await a.hooks.provideParser() : e ? ds.parse : ds.parseInline)(u, a);
        return a.hooks ? await a.hooks.postprocess(h) : h;
      })().catch(s);
      try {
        a.hooks && (r = a.hooks.preprocess(r));
        let o = (a.hooks ? a.hooks.provideLexer() : e ? hs.lex : hs.lexInline)(r, a);
        a.hooks && (o = a.hooks.processAllTokens(o)), a.walkTokens && this.walkTokens(o, a.walkTokens);
        let l = (a.hooks ? a.hooks.provideParser() : e ? ds.parse : ds.parseInline)(o, a);
        return a.hooks && (l = a.hooks.postprocess(l)), l;
      } catch (o) {
        return s(o);
      }
    };
  }
  onError(e, r) {
    return (n) => {
      if (n.message += `
Please report this to https://github.com/markedjs/marked.`, e) {
        let i = "<p>An error occurred:</p><pre>" + Is(n.message + "", !0) + "</pre>";
        return r ? Promise.resolve(i) : i;
      }
      if (r) return Promise.reject(n);
      throw n;
    };
  }
}, hu = new Lse();
function Lr(t, e) {
  return hu.parse(t, e);
}
Lr.options = Lr.setOptions = function(t) {
  return hu.setOptions(t), Lr.defaults = hu.defaults, lP(Lr.defaults), Lr;
};
Lr.getDefaults = FE;
Lr.defaults = Iu;
Lr.use = function(...t) {
  return hu.use(...t), Lr.defaults = hu.defaults, lP(Lr.defaults), Lr;
};
Lr.walkTokens = function(t, e) {
  return hu.walkTokens(t, e);
};
Lr.parseInline = hu.parseInline;
Lr.Parser = ds;
Lr.parser = ds.parse;
Lr.Renderer = yy;
Lr.TextRenderer = qE;
Lr.Lexer = hs;
Lr.lexer = hs.lex;
Lr.Tokenizer = vy;
Lr.Hooks = T0;
Lr.parse = Lr;
Lr.options;
Lr.setOptions;
Lr.use;
Lr.walkTokens;
Lr.parseInline;
ds.parse;
hs.lex;
function xP(t) {
  for (var e = [], r = 1; r < arguments.length; r++)
    e[r - 1] = arguments[r];
  var n = Array.from(typeof t == "string" ? [t] : t);
  n[n.length - 1] = n[n.length - 1].replace(/\r?\n([\t ]*)$/, "");
  var i = n.reduce(function(o, l) {
    var u = l.match(/\n([\t ]+|(?!\s).)/g);
    return u ? o.concat(u.map(function(h) {
      var d, f;
      return (f = (d = h.match(/[\t ]/g)) === null || d === void 0 ? void 0 : d.length) !== null && f !== void 0 ? f : 0;
    })) : o;
  }, []);
  if (i.length) {
    var a = new RegExp(`
[	 ]{` + Math.min.apply(Math, i) + "}", "g");
    n = n.map(function(o) {
      return o.replace(a, `
`);
    });
  }
  n[0] = n[0].replace(/^\r?\n/, "");
  var s = n[0];
  return e.forEach(function(o, l) {
    var u = s.match(/(?:^|\n)( *)$/), h = u ? u[1] : "", d = o;
    typeof o == "string" && o.includes(`
`) && (d = String(o).split(`
`).map(function(f, p) {
      return p === 0 ? f : "" + h + f;
    }).join(`
`)), s += d + n[l + 1];
  }), s;
}
var bP = {
  body: '<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',
  height: 80,
  width: 80
}, Dw = /* @__PURE__ */ new Map(), wP = /* @__PURE__ */ new Map(), TP = /* @__PURE__ */ x((t) => {
  for (const e of t) {
    if (!e.name)
      throw new Error(
        'Invalid icon loader. Must have a "name" property with non-empty string value.'
      );
    if (ae.debug("Registering icon pack:", e.name), "loader" in e)
      wP.set(e.name, e.loader);
    else if ("icons" in e)
      Dw.set(e.name, e.icons);
    else
      throw ae.error("Invalid icon loader:", e), new Error('Invalid icon loader. Must have either "icons" or "loader" property.');
  }
}, "registerIconPacks"), EP = /* @__PURE__ */ x(async (t, e) => {
  const r = Nae(t, !0, e !== void 0);
  if (!r)
    throw new Error(`Invalid icon name: ${t}`);
  const n = r.prefix || e;
  if (!n)
    throw new Error(`Icon name must contain a prefix: ${t}`);
  let i = Dw.get(n);
  if (!i) {
    const s = wP.get(n);
    if (!s)
      throw new Error(`Icon set not found: ${r.prefix}`);
    try {
      i = { ...await s(), prefix: n }, Dw.set(n, i);
    } catch (o) {
      throw ae.error(o), new Error(`Failed to load icon set: ${r.prefix}`);
    }
  }
  const a = Iae(i, r.name);
  if (!a)
    throw new Error(`Icon not found: ${t}`);
  return a;
}, "getRegisteredIconData"), Rse = /* @__PURE__ */ x(async (t) => {
  try {
    return await EP(t), !0;
  } catch {
    return !1;
  }
}, "isIconAvailable"), Pl = /* @__PURE__ */ x(async (t, e, r) => {
  let n;
  try {
    n = await EP(t, e == null ? void 0 : e.fallbackPrefix);
  } catch (s) {
    ae.error(s), n = bP;
  }
  const i = Vae(n, e), a = qae(Hae(i.body), {
    ...i.attributes,
    ...r
  });
  return fr(a, gr());
}, "getIconSVG");
function kP(t, { markdownAutoWrap: e }) {
  const n = t.replace(/<br\/>/g, `
`).replace(/\n{2,}/g, `
`), i = xP(n);
  return e === !1 ? i.replace(/ /g, "&nbsp;") : i;
}
x(kP, "preprocessMarkdown");
function SP(t, e = {}) {
  const r = kP(t, e), n = Lr.lexer(r), i = [[]];
  let a = 0;
  function s(o, l = "normal") {
    o.type === "text" ? o.text.split(`
`).forEach((h, d) => {
      d !== 0 && (a++, i.push([])), h.split(" ").forEach((f) => {
        f = f.replace(/&#39;/g, "'"), f && i[a].push({ content: f, type: l });
      });
    }) : o.type === "strong" || o.type === "em" ? o.tokens.forEach((u) => {
      s(u, o.type);
    }) : o.type === "html" && i[a].push({ content: o.text, type: "normal" });
  }
  return x(s, "processNode"), n.forEach((o) => {
    var l;
    o.type === "paragraph" ? (l = o.tokens) == null || l.forEach((u) => {
      s(u);
    }) : o.type === "html" ? i[a].push({ content: o.text, type: "normal" }) : i[a].push({ content: o.raw, type: "normal" });
  }), i;
}
x(SP, "markdownToLines");
function CP(t, { markdownAutoWrap: e } = {}) {
  const r = Lr.lexer(t);
  function n(i) {
    var a, s, o;
    return i.type === "text" ? e === !1 ? i.text.replace(/\n */g, "<br/>").replace(/ /g, "&nbsp;") : i.text.replace(/\n */g, "<br/>") : i.type === "strong" ? `<strong>${(a = i.tokens) == null ? void 0 : a.map(n).join("")}</strong>` : i.type === "em" ? `<em>${(s = i.tokens) == null ? void 0 : s.map(n).join("")}</em>` : i.type === "paragraph" ? `<p>${(o = i.tokens) == null ? void 0 : o.map(n).join("")}</p>` : i.type === "space" ? "" : i.type === "html" ? `${i.text}` : i.type === "escape" ? i.text : (ae.warn(`Unsupported markdown: ${i.type}`), i.raw);
  }
  return x(n, "output"), r.map(n).join("");
}
x(CP, "markdownToHTML");
function AP(t) {
  return Intl.Segmenter ? [...new Intl.Segmenter().segment(t)].map((e) => e.segment) : [...t];
}
x(AP, "splitTextToChars");
function _P(t, e) {
  const r = AP(e.content);
  return YE(t, [], r, e.type);
}
x(_P, "splitWordToFitWidth");
function YE(t, e, r, n) {
  if (r.length === 0)
    return [
      { content: e.join(""), type: n },
      { content: "", type: n }
    ];
  const [i, ...a] = r, s = [...e, i];
  return t([{ content: s.join(""), type: n }]) ? YE(t, s, a, n) : (e.length === 0 && i && (e.push(i), r.shift()), [
    { content: e.join(""), type: n },
    { content: r.join(""), type: n }
  ]);
}
x(YE, "splitWordToFitWidthRecursion");
function LP(t, e) {
  if (t.some(({ content: r }) => r.includes(`
`)))
    throw new Error("splitLineToFitWidth does not support newlines in the line");
  return xy(t, e);
}
x(LP, "splitLineToFitWidth");
function xy(t, e, r = [], n = []) {
  if (t.length === 0)
    return n.length > 0 && r.push(n), r.length > 0 ? r : [];
  let i = "";
  t[0].content === " " && (i = " ", t.shift());
  const a = t.shift() ?? { content: " ", type: "normal" }, s = [...n];
  if (i !== "" && s.push({ content: i, type: "normal" }), s.push(a), e(s))
    return xy(t, e, r, s);
  if (n.length > 0)
    r.push(n), t.unshift(a);
  else if (a.content) {
    const [o, l] = _P(e, a);
    r.push([o]), l.content && t.unshift(l);
  }
  return xy(t, e, r);
}
x(xy, "splitLineToFitWidthRecursion");
function Iw(t, e) {
  e && t.attr("style", e);
}
x(Iw, "applyStyle");
async function RP(t, e, r, n, i = !1, a = gr()) {
  const s = t.append("foreignObject");
  s.attr("width", `${10 * r}px`), s.attr("height", `${10 * r}px`);
  const o = s.append("xhtml:div"), l = un(e.label) ? await _g(e.label.replace(at.lineBreakRegex, `
`), a) : fr(e.label, a), u = e.isNode ? "nodeLabel" : "edgeLabel", h = o.append("span");
  h.html(l), Iw(h, e.labelStyle), h.attr("class", `${u} ${n}`), Iw(o, e.labelStyle), o.style("display", "table-cell"), o.style("white-space", "nowrap"), o.style("line-height", "1.5"), o.style("max-width", r + "px"), o.style("text-align", "center"), o.attr("xmlns", "http://www.w3.org/1999/xhtml"), i && o.attr("class", "labelBkg");
  let d = o.node().getBoundingClientRect();
  return d.width === r && (o.style("display", "table"), o.style("white-space", "break-spaces"), o.style("width", r + "px"), d = o.node().getBoundingClientRect()), s.node();
}
x(RP, "addHtmlSpan");
function ax(t, e, r) {
  return t.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", e * r - 0.1 + "em").attr("dy", r + "em");
}
x(ax, "createTspan");
function NP(t, e, r) {
  const n = t.append("text"), i = ax(n, 1, e);
  sx(i, r);
  const a = i.node().getComputedTextLength();
  return n.remove(), a;
}
x(NP, "computeWidthOfText");
function MP(t, e, r) {
  var s;
  const n = t.append("text"), i = ax(n, 1, e);
  sx(i, [{ content: r, type: "normal" }]);
  const a = (s = i.node()) == null ? void 0 : s.getBoundingClientRect();
  return a && n.remove(), a;
}
x(MP, "computeDimensionOfText");
function DP(t, e, r, n = !1) {
  const a = e.append("g"), s = a.insert("rect").attr("class", "background").attr("style", "stroke: none"), o = a.append("text").attr("y", "-10.1");
  let l = 0;
  for (const u of r) {
    const h = /* @__PURE__ */ x((f) => NP(a, 1.1, f) <= t, "checkWidth"), d = h(u) ? [u] : LP(u, h);
    for (const f of d) {
      const p = ax(o, l, 1.1);
      sx(p, f), l++;
    }
  }
  if (n) {
    const u = o.node().getBBox(), h = 2;
    return s.attr("x", u.x - h).attr("y", u.y - h).attr("width", u.width + 2 * h).attr("height", u.height + 2 * h), a.node();
  } else
    return o.node();
}
x(DP, "createFormattedText");
function sx(t, e) {
  t.text(""), e.forEach((r, n) => {
    const i = t.append("tspan").attr("font-style", r.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", r.type === "strong" ? "bold" : "normal");
    n === 0 ? i.text(r.content) : i.text(" " + r.content);
  });
}
x(sx, "updateTextContentAndStyles");
async function XE(t, e = {}) {
  const r = [];
  t.replace(/(fa[bklrs]?):fa-([\w-]+)/g, (i, a, s) => (r.push(
    (async () => {
      const o = `${a}:${s}`;
      return await Rse(o) ? await Pl(o, void 0, { class: "label-icon" }) : `<i class='${fr(i, e).replace(":", " ")}'></i>`;
    })()
  ), i));
  const n = await Promise.all(r);
  return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => n.shift() ?? "");
}
x(XE, "replaceIconSubstring");
var Ma = /* @__PURE__ */ x(async (t, e = "", {
  style: r = "",
  isTitle: n = !1,
  classes: i = "",
  useHtmlLabels: a = !0,
  isNode: s = !0,
  width: o = 200,
  addSvgBackground: l = !1
} = {}, u) => {
  if (ae.debug(
    "XYZ createText",
    e,
    r,
    n,
    i,
    a,
    s,
    "addSvgBackground: ",
    l
  ), a) {
    const h = CP(e, u), d = await XE(Zs(h), u), f = e.replace(/\\\\/g, "\\"), p = {
      isNode: s,
      label: un(e) ? f : d,
      labelStyle: r.replace("fill:", "color:")
    };
    return await RP(t, p, o, i, l, u);
  } else {
    const h = e.replace(/<br\s*\/?>/g, "<br/>"), d = SP(h.replace("<br>", "<br/>"), u), f = DP(
      o,
      t,
      d,
      e ? l : !1
    );
    if (s) {
      /stroke:/.exec(r) && (r = r.replace("stroke:", "lineColor:"));
      const p = r.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
      Qe(f).attr("style", p);
    } else {
      const p = r.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
      Qe(f).select("rect").attr("style", p.replace(/background:/g, "fill:"));
      const g = r.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
      Qe(f).select("text").attr("style", g);
    }
    return f;
  }
}, "createText");
function Kb(t, e, r) {
  if (t && t.length) {
    const [n, i] = e, a = Math.PI / 180 * r, s = Math.cos(a), o = Math.sin(a);
    for (const l of t) {
      const [u, h] = l;
      l[0] = (u - n) * s - (h - i) * o + n, l[1] = (u - n) * o + (h - i) * s + i;
    }
  }
}
function Nse(t, e) {
  return t[0] === e[0] && t[1] === e[1];
}
function Mse(t, e, r, n = 1) {
  const i = r, a = Math.max(e, 0.1), s = t[0] && t[0][0] && typeof t[0][0] == "number" ? [t] : t, o = [0, 0];
  if (i) for (const u of s) Kb(u, o, i);
  const l = function(u, h, d) {
    const f = [];
    for (const b of u) {
      const w = [...b];
      Nse(w[0], w[w.length - 1]) || w.push([w[0][0], w[0][1]]), w.length > 2 && f.push(w);
    }
    const p = [];
    h = Math.max(h, 0.1);
    const g = [];
    for (const b of f) for (let w = 0; w < b.length - 1; w++) {
      const T = b[w], E = b[w + 1];
      if (T[1] !== E[1]) {
        const C = Math.min(T[1], E[1]);
        g.push({ ymin: C, ymax: Math.max(T[1], E[1]), x: C === T[1] ? T[0] : E[0], islope: (E[0] - T[0]) / (E[1] - T[1]) });
      }
    }
    if (g.sort((b, w) => b.ymin < w.ymin ? -1 : b.ymin > w.ymin ? 1 : b.x < w.x ? -1 : b.x > w.x ? 1 : b.ymax === w.ymax ? 0 : (b.ymax - w.ymax) / Math.abs(b.ymax - w.ymax)), !g.length) return p;
    let m = [], v = g[0].ymin, y = 0;
    for (; m.length || g.length; ) {
      if (g.length) {
        let b = -1;
        for (let w = 0; w < g.length && !(g[w].ymin > v); w++) b = w;
        g.splice(0, b + 1).forEach((w) => {
          m.push({ s: v, edge: w });
        });
      }
      if (m = m.filter((b) => !(b.edge.ymax <= v)), m.sort((b, w) => b.edge.x === w.edge.x ? 0 : (b.edge.x - w.edge.x) / Math.abs(b.edge.x - w.edge.x)), (d !== 1 || y % h == 0) && m.length > 1) for (let b = 0; b < m.length; b += 2) {
        const w = b + 1;
        if (w >= m.length) break;
        const T = m[b].edge, E = m[w].edge;
        p.push([[Math.round(T.x), v], [Math.round(E.x), v]]);
      }
      v += d, m.forEach((b) => {
        b.edge.x = b.edge.x + d * b.edge.islope;
      }), y++;
    }
    return p;
  }(s, a, n);
  if (i) {
    for (const u of s) Kb(u, o, -i);
    (function(u, h, d) {
      const f = [];
      u.forEach((p) => f.push(...p)), Kb(f, h, d);
    })(l, o, -i);
  }
  return l;
}
function Vg(t, e) {
  var r;
  const n = e.hachureAngle + 90;
  let i = e.hachureGap;
  i < 0 && (i = 4 * e.strokeWidth), i = Math.round(Math.max(i, 0.1));
  let a = 1;
  return e.roughness >= 1 && (((r = e.randomizer) === null || r === void 0 ? void 0 : r.next()) || Math.random()) > 0.7 && (a = i), Mse(t, i, n, a || 1);
}
class jE {
  constructor(e) {
    this.helper = e;
  }
  fillPolygons(e, r) {
    return this._fillPolygons(e, r);
  }
  _fillPolygons(e, r) {
    const n = Vg(e, r);
    return { type: "fillSketch", ops: this.renderLines(n, r) };
  }
  renderLines(e, r) {
    const n = [];
    for (const i of e) n.push(...this.helper.doubleLineOps(i[0][0], i[0][1], i[1][0], i[1][1], r));
    return n;
  }
}
function ox(t) {
  const e = t[0], r = t[1];
  return Math.sqrt(Math.pow(e[0] - r[0], 2) + Math.pow(e[1] - r[1], 2));
}
class Dse extends jE {
  fillPolygons(e, r) {
    let n = r.hachureGap;
    n < 0 && (n = 4 * r.strokeWidth), n = Math.max(n, 0.1);
    const i = Vg(e, Object.assign({}, r, { hachureGap: n })), a = Math.PI / 180 * r.hachureAngle, s = [], o = 0.5 * n * Math.cos(a), l = 0.5 * n * Math.sin(a);
    for (const [u, h] of i) ox([u, h]) && s.push([[u[0] - o, u[1] + l], [...h]], [[u[0] + o, u[1] - l], [...h]]);
    return { type: "fillSketch", ops: this.renderLines(s, r) };
  }
}
class Ise extends jE {
  fillPolygons(e, r) {
    const n = this._fillPolygons(e, r), i = Object.assign({}, r, { hachureAngle: r.hachureAngle + 90 }), a = this._fillPolygons(e, i);
    return n.ops = n.ops.concat(a.ops), n;
  }
}
let Ose = class {
  constructor(e) {
    this.helper = e;
  }
  fillPolygons(e, r) {
    const n = Vg(e, r = Object.assign({}, r, { hachureAngle: 0 }));
    return this.dotsOnLines(n, r);
  }
  dotsOnLines(e, r) {
    const n = [];
    let i = r.hachureGap;
    i < 0 && (i = 4 * r.strokeWidth), i = Math.max(i, 0.1);
    let a = r.fillWeight;
    a < 0 && (a = r.strokeWidth / 2);
    const s = i / 4;
    for (const o of e) {
      const l = ox(o), u = l / i, h = Math.ceil(u) - 1, d = l - h * i, f = (o[0][0] + o[1][0]) / 2 - i / 4, p = Math.min(o[0][1], o[1][1]);
      for (let g = 0; g < h; g++) {
        const m = p + d + g * i, v = f - s + 2 * Math.random() * s, y = m - s + 2 * Math.random() * s, b = this.helper.ellipse(v, y, a, a, r);
        n.push(...b.ops);
      }
    }
    return { type: "fillSketch", ops: n };
  }
}, Pse = class {
  constructor(e) {
    this.helper = e;
  }
  fillPolygons(e, r) {
    const n = Vg(e, r);
    return { type: "fillSketch", ops: this.dashedLine(n, r) };
  }
  dashedLine(e, r) {
    const n = r.dashOffset < 0 ? r.hachureGap < 0 ? 4 * r.strokeWidth : r.hachureGap : r.dashOffset, i = r.dashGap < 0 ? r.hachureGap < 0 ? 4 * r.strokeWidth : r.hachureGap : r.dashGap, a = [];
    return e.forEach((s) => {
      const o = ox(s), l = Math.floor(o / (n + i)), u = (o + i - l * (n + i)) / 2;
      let h = s[0], d = s[1];
      h[0] > d[0] && (h = s[1], d = s[0]);
      const f = Math.atan((d[1] - h[1]) / (d[0] - h[0]));
      for (let p = 0; p < l; p++) {
        const g = p * (n + i), m = g + n, v = [h[0] + g * Math.cos(f) + u * Math.cos(f), h[1] + g * Math.sin(f) + u * Math.sin(f)], y = [h[0] + m * Math.cos(f) + u * Math.cos(f), h[1] + m * Math.sin(f) + u * Math.sin(f)];
        a.push(...this.helper.doubleLineOps(v[0], v[1], y[0], y[1], r));
      }
    }), a;
  }
};
class Bse {
  constructor(e) {
    this.helper = e;
  }
  fillPolygons(e, r) {
    const n = r.hachureGap < 0 ? 4 * r.strokeWidth : r.hachureGap, i = r.zigzagOffset < 0 ? n : r.zigzagOffset, a = Vg(e, r = Object.assign({}, r, { hachureGap: n + i }));
    return { type: "fillSketch", ops: this.zigzagLines(a, i, r) };
  }
  zigzagLines(e, r, n) {
    const i = [];
    return e.forEach((a) => {
      const s = ox(a), o = Math.round(s / (2 * r));
      let l = a[0], u = a[1];
      l[0] > u[0] && (l = a[1], u = a[0]);
      const h = Math.atan((u[1] - l[1]) / (u[0] - l[0]));
      for (let d = 0; d < o; d++) {
        const f = 2 * d * r, p = 2 * (d + 1) * r, g = Math.sqrt(2 * Math.pow(r, 2)), m = [l[0] + f * Math.cos(h), l[1] + f * Math.sin(h)], v = [l[0] + p * Math.cos(h), l[1] + p * Math.sin(h)], y = [m[0] + g * Math.cos(h + Math.PI / 4), m[1] + g * Math.sin(h + Math.PI / 4)];
        i.push(...this.helper.doubleLineOps(m[0], m[1], y[0], y[1], n), ...this.helper.doubleLineOps(y[0], y[1], v[0], v[1], n));
      }
    }), i;
  }
}
const ta = {};
let Fse = class {
  constructor(e) {
    this.seed = e;
  }
  next() {
    return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
  }
};
const $se = 0, Zb = 1, t8 = 2, I1 = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 };
function Qb(t, e) {
  return t.type === e;
}
function KE(t) {
  const e = [], r = function(s) {
    const o = new Array();
    for (; s !== ""; ) if (s.match(/^([ \t\r\n,]+)/)) s = s.substr(RegExp.$1.length);
    else if (s.match(/^([aAcChHlLmMqQsStTvVzZ])/)) o[o.length] = { type: $se, text: RegExp.$1 }, s = s.substr(RegExp.$1.length);
    else {
      if (!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
      o[o.length] = { type: Zb, text: `${parseFloat(RegExp.$1)}` }, s = s.substr(RegExp.$1.length);
    }
    return o[o.length] = { type: t8, text: "" }, o;
  }(t);
  let n = "BOD", i = 0, a = r[i];
  for (; !Qb(a, t8); ) {
    let s = 0;
    const o = [];
    if (n === "BOD") {
      if (a.text !== "M" && a.text !== "m") return KE("M0,0" + t);
      i++, s = I1[a.text], n = a.text;
    } else Qb(a, Zb) ? s = I1[n] : (i++, s = I1[a.text], n = a.text);
    if (!(i + s < r.length)) throw new Error("Path data ended short");
    for (let l = i; l < i + s; l++) {
      const u = r[l];
      if (!Qb(u, Zb)) throw new Error("Param not a number: " + n + "," + u.text);
      o[o.length] = +u.text;
    }
    if (typeof I1[n] != "number") throw new Error("Bad segment: " + n);
    {
      const l = { key: n, data: o };
      e.push(l), i += s, a = r[i], n === "M" && (n = "L"), n === "m" && (n = "l");
    }
  }
  return e;
}
function IP(t) {
  let e = 0, r = 0, n = 0, i = 0;
  const a = [];
  for (const { key: s, data: o } of t) switch (s) {
    case "M":
      a.push({ key: "M", data: [...o] }), [e, r] = o, [n, i] = o;
      break;
    case "m":
      e += o[0], r += o[1], a.push({ key: "M", data: [e, r] }), n = e, i = r;
      break;
    case "L":
      a.push({ key: "L", data: [...o] }), [e, r] = o;
      break;
    case "l":
      e += o[0], r += o[1], a.push({ key: "L", data: [e, r] });
      break;
    case "C":
      a.push({ key: "C", data: [...o] }), e = o[4], r = o[5];
      break;
    case "c": {
      const l = o.map((u, h) => h % 2 ? u + r : u + e);
      a.push({ key: "C", data: l }), e = l[4], r = l[5];
      break;
    }
    case "Q":
      a.push({ key: "Q", data: [...o] }), e = o[2], r = o[3];
      break;
    case "q": {
      const l = o.map((u, h) => h % 2 ? u + r : u + e);
      a.push({ key: "Q", data: l }), e = l[2], r = l[3];
      break;
    }
    case "A":
      a.push({ key: "A", data: [...o] }), e = o[5], r = o[6];
      break;
    case "a":
      e += o[5], r += o[6], a.push({ key: "A", data: [o[0], o[1], o[2], o[3], o[4], e, r] });
      break;
    case "H":
      a.push({ key: "H", data: [...o] }), e = o[0];
      break;
    case "h":
      e += o[0], a.push({ key: "H", data: [e] });
      break;
    case "V":
      a.push({ key: "V", data: [...o] }), r = o[0];
      break;
    case "v":
      r += o[0], a.push({ key: "V", data: [r] });
      break;
    case "S":
      a.push({ key: "S", data: [...o] }), e = o[2], r = o[3];
      break;
    case "s": {
      const l = o.map((u, h) => h % 2 ? u + r : u + e);
      a.push({ key: "S", data: l }), e = l[2], r = l[3];
      break;
    }
    case "T":
      a.push({ key: "T", data: [...o] }), e = o[0], r = o[1];
      break;
    case "t":
      e += o[0], r += o[1], a.push({ key: "T", data: [e, r] });
      break;
    case "Z":
    case "z":
      a.push({ key: "Z", data: [] }), e = n, r = i;
  }
  return a;
}
function OP(t) {
  const e = [];
  let r = "", n = 0, i = 0, a = 0, s = 0, o = 0, l = 0;
  for (const { key: u, data: h } of t) {
    switch (u) {
      case "M":
        e.push({ key: "M", data: [...h] }), [n, i] = h, [a, s] = h;
        break;
      case "C":
        e.push({ key: "C", data: [...h] }), n = h[4], i = h[5], o = h[2], l = h[3];
        break;
      case "L":
        e.push({ key: "L", data: [...h] }), [n, i] = h;
        break;
      case "H":
        n = h[0], e.push({ key: "L", data: [n, i] });
        break;
      case "V":
        i = h[0], e.push({ key: "L", data: [n, i] });
        break;
      case "S": {
        let d = 0, f = 0;
        r === "C" || r === "S" ? (d = n + (n - o), f = i + (i - l)) : (d = n, f = i), e.push({ key: "C", data: [d, f, ...h] }), o = h[0], l = h[1], n = h[2], i = h[3];
        break;
      }
      case "T": {
        const [d, f] = h;
        let p = 0, g = 0;
        r === "Q" || r === "T" ? (p = n + (n - o), g = i + (i - l)) : (p = n, g = i);
        const m = n + 2 * (p - n) / 3, v = i + 2 * (g - i) / 3, y = d + 2 * (p - d) / 3, b = f + 2 * (g - f) / 3;
        e.push({ key: "C", data: [m, v, y, b, d, f] }), o = p, l = g, n = d, i = f;
        break;
      }
      case "Q": {
        const [d, f, p, g] = h, m = n + 2 * (d - n) / 3, v = i + 2 * (f - i) / 3, y = p + 2 * (d - p) / 3, b = g + 2 * (f - g) / 3;
        e.push({ key: "C", data: [m, v, y, b, p, g] }), o = d, l = f, n = p, i = g;
        break;
      }
      case "A": {
        const d = Math.abs(h[0]), f = Math.abs(h[1]), p = h[2], g = h[3], m = h[4], v = h[5], y = h[6];
        d === 0 || f === 0 ? (e.push({ key: "C", data: [n, i, v, y, v, y] }), n = v, i = y) : (n !== v || i !== y) && (PP(n, i, v, y, d, f, p, g, m).forEach(function(b) {
          e.push({ key: "C", data: b });
        }), n = v, i = y);
        break;
      }
      case "Z":
        e.push({ key: "Z", data: [] }), n = a, i = s;
    }
    r = u;
  }
  return e;
}
function n0(t, e, r) {
  return [t * Math.cos(r) - e * Math.sin(r), t * Math.sin(r) + e * Math.cos(r)];
}
function PP(t, e, r, n, i, a, s, o, l, u) {
  const h = (d = s, Math.PI * d / 180);
  var d;
  let f = [], p = 0, g = 0, m = 0, v = 0;
  if (u) [p, g, m, v] = u;
  else {
    [t, e] = n0(t, e, -h), [r, n] = n0(r, n, -h);
    const P = (t - r) / 2, S = (e - n) / 2;
    let R = P * P / (i * i) + S * S / (a * a);
    R > 1 && (R = Math.sqrt(R), i *= R, a *= R);
    const I = i * i, D = a * a, M = I * D - I * S * S - D * P * P, B = I * S * S + D * P * P, $ = (o === l ? -1 : 1) * Math.sqrt(Math.abs(M / B));
    m = $ * i * S / a + (t + r) / 2, v = $ * -a * P / i + (e + n) / 2, p = Math.asin(parseFloat(((e - v) / a).toFixed(9))), g = Math.asin(parseFloat(((n - v) / a).toFixed(9))), t < m && (p = Math.PI - p), r < m && (g = Math.PI - g), p < 0 && (p = 2 * Math.PI + p), g < 0 && (g = 2 * Math.PI + g), l && p > g && (p -= 2 * Math.PI), !l && g > p && (g -= 2 * Math.PI);
  }
  let y = g - p;
  if (Math.abs(y) > 120 * Math.PI / 180) {
    const P = g, S = r, R = n;
    g = l && g > p ? p + 120 * Math.PI / 180 * 1 : p + 120 * Math.PI / 180 * -1, f = PP(r = m + i * Math.cos(g), n = v + a * Math.sin(g), S, R, i, a, s, 0, l, [g, P, m, v]);
  }
  y = g - p;
  const b = Math.cos(p), w = Math.sin(p), T = Math.cos(g), E = Math.sin(g), C = Math.tan(y / 4), k = 4 / 3 * i * C, _ = 4 / 3 * a * C, L = [t, e], N = [t + k * w, e - _ * b], A = [r + k * E, n - _ * T], O = [r, n];
  if (N[0] = 2 * L[0] - N[0], N[1] = 2 * L[1] - N[1], u) return [N, A, O].concat(f);
  {
    f = [N, A, O].concat(f);
    const P = [];
    for (let S = 0; S < f.length; S += 3) {
      const R = n0(f[S][0], f[S][1], h), I = n0(f[S + 1][0], f[S + 1][1], h), D = n0(f[S + 2][0], f[S + 2][1], h);
      P.push([R[0], R[1], I[0], I[1], D[0], D[1]]);
    }
    return P;
  }
}
const zse = { randOffset: function(t, e) {
  return Ht(t, e);
}, randOffsetWithRange: function(t, e, r) {
  return by(t, e, r);
}, ellipse: function(t, e, r, n, i) {
  const a = FP(r, n, i);
  return Ow(t, e, i, a).opset;
}, doubleLineOps: function(t, e, r, n, i) {
  return Bl(t, e, r, n, i, !0);
} };
function BP(t, e, r, n, i) {
  return { type: "path", ops: Bl(t, e, r, n, i) };
}
function Xm(t, e, r) {
  const n = (t || []).length;
  if (n > 2) {
    const i = [];
    for (let a = 0; a < n - 1; a++) i.push(...Bl(t[a][0], t[a][1], t[a + 1][0], t[a + 1][1], r));
    return e && i.push(...Bl(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], r)), { type: "path", ops: i };
  }
  return n === 2 ? BP(t[0][0], t[0][1], t[1][0], t[1][1], r) : { type: "path", ops: [] };
}
function Vse(t, e, r, n, i) {
  return function(a, s) {
    return Xm(a, !0, s);
  }([[t, e], [t + r, e], [t + r, e + n], [t, e + n]], i);
}
function r8(t, e) {
  if (t.length) {
    const r = typeof t[0][0] == "number" ? [t] : t, n = O1(r[0], 1 * (1 + 0.2 * e.roughness), e), i = e.disableMultiStroke ? [] : O1(r[0], 1.5 * (1 + 0.22 * e.roughness), a8(e));
    for (let a = 1; a < r.length; a++) {
      const s = r[a];
      if (s.length) {
        const o = O1(s, 1 * (1 + 0.2 * e.roughness), e), l = e.disableMultiStroke ? [] : O1(s, 1.5 * (1 + 0.22 * e.roughness), a8(e));
        for (const u of o) u.op !== "move" && n.push(u);
        for (const u of l) u.op !== "move" && i.push(u);
      }
    }
    return { type: "path", ops: n.concat(i) };
  }
  return { type: "path", ops: [] };
}
function FP(t, e, r) {
  const n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(e / 2, 2)) / 2)), i = Math.ceil(Math.max(r.curveStepCount, r.curveStepCount / Math.sqrt(200) * n)), a = 2 * Math.PI / i;
  let s = Math.abs(t / 2), o = Math.abs(e / 2);
  const l = 1 - r.curveFitting;
  return s += Ht(s * l, r), o += Ht(o * l, r), { increment: a, rx: s, ry: o };
}
function Ow(t, e, r, n) {
  const [i, a] = s8(n.increment, t, e, n.rx, n.ry, 1, n.increment * by(0.1, by(0.4, 1, r), r), r);
  let s = wy(i, null, r);
  if (!r.disableMultiStroke && r.roughness !== 0) {
    const [o] = s8(n.increment, t, e, n.rx, n.ry, 1.5, 0, r), l = wy(o, null, r);
    s = s.concat(l);
  }
  return { estimatedPoints: a, opset: { type: "path", ops: s } };
}
function n8(t, e, r, n, i, a, s, o, l) {
  const u = t, h = e;
  let d = Math.abs(r / 2), f = Math.abs(n / 2);
  d += Ht(0.01 * d, l), f += Ht(0.01 * f, l);
  let p = i, g = a;
  for (; p < 0; ) p += 2 * Math.PI, g += 2 * Math.PI;
  g - p > 2 * Math.PI && (p = 0, g = 2 * Math.PI);
  const m = 2 * Math.PI / l.curveStepCount, v = Math.min(m / 2, (g - p) / 2), y = o8(v, u, h, d, f, p, g, 1, l);
  if (!l.disableMultiStroke) {
    const b = o8(v, u, h, d, f, p, g, 1.5, l);
    y.push(...b);
  }
  return s && (o ? y.push(...Bl(u, h, u + d * Math.cos(p), h + f * Math.sin(p), l), ...Bl(u, h, u + d * Math.cos(g), h + f * Math.sin(g), l)) : y.push({ op: "lineTo", data: [u, h] }, { op: "lineTo", data: [u + d * Math.cos(p), h + f * Math.sin(p)] })), { type: "path", ops: y };
}
function i8(t, e) {
  const r = OP(IP(KE(t))), n = [];
  let i = [0, 0], a = [0, 0];
  for (const { key: s, data: o } of r) switch (s) {
    case "M":
      a = [o[0], o[1]], i = [o[0], o[1]];
      break;
    case "L":
      n.push(...Bl(a[0], a[1], o[0], o[1], e)), a = [o[0], o[1]];
      break;
    case "C": {
      const [l, u, h, d, f, p] = o;
      n.push(...Gse(l, u, h, d, f, p, a, e)), a = [f, p];
      break;
    }
    case "Z":
      n.push(...Bl(a[0], a[1], i[0], i[1], e)), a = [i[0], i[1]];
  }
  return { type: "path", ops: n };
}
function Jb(t, e) {
  const r = [];
  for (const n of t) if (n.length) {
    const i = e.maxRandomnessOffset || 0, a = n.length;
    if (a > 2) {
      r.push({ op: "move", data: [n[0][0] + Ht(i, e), n[0][1] + Ht(i, e)] });
      for (let s = 1; s < a; s++) r.push({ op: "lineTo", data: [n[s][0] + Ht(i, e), n[s][1] + Ht(i, e)] });
    }
  }
  return { type: "fillPath", ops: r };
}
function Zu(t, e) {
  return function(r, n) {
    let i = r.fillStyle || "hachure";
    if (!ta[i]) switch (i) {
      case "zigzag":
        ta[i] || (ta[i] = new Dse(n));
        break;
      case "cross-hatch":
        ta[i] || (ta[i] = new Ise(n));
        break;
      case "dots":
        ta[i] || (ta[i] = new Ose(n));
        break;
      case "dashed":
        ta[i] || (ta[i] = new Pse(n));
        break;
      case "zigzag-line":
        ta[i] || (ta[i] = new Bse(n));
        break;
      default:
        i = "hachure", ta[i] || (ta[i] = new jE(n));
    }
    return ta[i];
  }(e, zse).fillPolygons(t, e);
}
function a8(t) {
  const e = Object.assign({}, t);
  return e.randomizer = void 0, t.seed && (e.seed = t.seed + 1), e;
}
function $P(t) {
  return t.randomizer || (t.randomizer = new Fse(t.seed || 0)), t.randomizer.next();
}
function by(t, e, r, n = 1) {
  return r.roughness * n * ($P(r) * (e - t) + t);
}
function Ht(t, e, r = 1) {
  return by(-t, t, e, r);
}
function Bl(t, e, r, n, i, a = !1) {
  const s = a ? i.disableMultiStrokeFill : i.disableMultiStroke, o = Pw(t, e, r, n, i, !0, !1);
  if (s) return o;
  const l = Pw(t, e, r, n, i, !0, !0);
  return o.concat(l);
}
function Pw(t, e, r, n, i, a, s) {
  const o = Math.pow(t - r, 2) + Math.pow(e - n, 2), l = Math.sqrt(o);
  let u = 1;
  u = l < 200 ? 1 : l > 500 ? 0.4 : -16668e-7 * l + 1.233334;
  let h = i.maxRandomnessOffset || 0;
  h * h * 100 > o && (h = l / 10);
  const d = h / 2, f = 0.2 + 0.2 * $P(i);
  let p = i.bowing * i.maxRandomnessOffset * (n - e) / 200, g = i.bowing * i.maxRandomnessOffset * (t - r) / 200;
  p = Ht(p, i, u), g = Ht(g, i, u);
  const m = [], v = () => Ht(d, i, u), y = () => Ht(h, i, u), b = i.preserveVertices;
  return s ? m.push({ op: "move", data: [t + (b ? 0 : v()), e + (b ? 0 : v())] }) : m.push({ op: "move", data: [t + (b ? 0 : Ht(h, i, u)), e + (b ? 0 : Ht(h, i, u))] }), s ? m.push({ op: "bcurveTo", data: [p + t + (r - t) * f + v(), g + e + (n - e) * f + v(), p + t + 2 * (r - t) * f + v(), g + e + 2 * (n - e) * f + v(), r + (b ? 0 : v()), n + (b ? 0 : v())] }) : m.push({ op: "bcurveTo", data: [p + t + (r - t) * f + y(), g + e + (n - e) * f + y(), p + t + 2 * (r - t) * f + y(), g + e + 2 * (n - e) * f + y(), r + (b ? 0 : y()), n + (b ? 0 : y())] }), m;
}
function O1(t, e, r) {
  if (!t.length) return [];
  const n = [];
  n.push([t[0][0] + Ht(e, r), t[0][1] + Ht(e, r)]), n.push([t[0][0] + Ht(e, r), t[0][1] + Ht(e, r)]);
  for (let i = 1; i < t.length; i++) n.push([t[i][0] + Ht(e, r), t[i][1] + Ht(e, r)]), i === t.length - 1 && n.push([t[i][0] + Ht(e, r), t[i][1] + Ht(e, r)]);
  return wy(n, null, r);
}
function wy(t, e, r) {
  const n = t.length, i = [];
  if (n > 3) {
    const a = [], s = 1 - r.curveTightness;
    i.push({ op: "move", data: [t[1][0], t[1][1]] });
    for (let o = 1; o + 2 < n; o++) {
      const l = t[o];
      a[0] = [l[0], l[1]], a[1] = [l[0] + (s * t[o + 1][0] - s * t[o - 1][0]) / 6, l[1] + (s * t[o + 1][1] - s * t[o - 1][1]) / 6], a[2] = [t[o + 1][0] + (s * t[o][0] - s * t[o + 2][0]) / 6, t[o + 1][1] + (s * t[o][1] - s * t[o + 2][1]) / 6], a[3] = [t[o + 1][0], t[o + 1][1]], i.push({ op: "bcurveTo", data: [a[1][0], a[1][1], a[2][0], a[2][1], a[3][0], a[3][1]] });
    }
  } else n === 3 ? (i.push({ op: "move", data: [t[1][0], t[1][1]] }), i.push({ op: "bcurveTo", data: [t[1][0], t[1][1], t[2][0], t[2][1], t[2][0], t[2][1]] })) : n === 2 && i.push(...Pw(t[0][0], t[0][1], t[1][0], t[1][1], r, !0, !0));
  return i;
}
function s8(t, e, r, n, i, a, s, o) {
  const l = [], u = [];
  if (o.roughness === 0) {
    t /= 4, u.push([e + n * Math.cos(-t), r + i * Math.sin(-t)]);
    for (let h = 0; h <= 2 * Math.PI; h += t) {
      const d = [e + n * Math.cos(h), r + i * Math.sin(h)];
      l.push(d), u.push(d);
    }
    u.push([e + n * Math.cos(0), r + i * Math.sin(0)]), u.push([e + n * Math.cos(t), r + i * Math.sin(t)]);
  } else {
    const h = Ht(0.5, o) - Math.PI / 2;
    u.push([Ht(a, o) + e + 0.9 * n * Math.cos(h - t), Ht(a, o) + r + 0.9 * i * Math.sin(h - t)]);
    const d = 2 * Math.PI + h - 0.01;
    for (let f = h; f < d; f += t) {
      const p = [Ht(a, o) + e + n * Math.cos(f), Ht(a, o) + r + i * Math.sin(f)];
      l.push(p), u.push(p);
    }
    u.push([Ht(a, o) + e + n * Math.cos(h + 2 * Math.PI + 0.5 * s), Ht(a, o) + r + i * Math.sin(h + 2 * Math.PI + 0.5 * s)]), u.push([Ht(a, o) + e + 0.98 * n * Math.cos(h + s), Ht(a, o) + r + 0.98 * i * Math.sin(h + s)]), u.push([Ht(a, o) + e + 0.9 * n * Math.cos(h + 0.5 * s), Ht(a, o) + r + 0.9 * i * Math.sin(h + 0.5 * s)]);
  }
  return [u, l];
}
function o8(t, e, r, n, i, a, s, o, l) {
  const u = a + Ht(0.1, l), h = [];
  h.push([Ht(o, l) + e + 0.9 * n * Math.cos(u - t), Ht(o, l) + r + 0.9 * i * Math.sin(u - t)]);
  for (let d = u; d <= s; d += t) h.push([Ht(o, l) + e + n * Math.cos(d), Ht(o, l) + r + i * Math.sin(d)]);
  return h.push([e + n * Math.cos(s), r + i * Math.sin(s)]), h.push([e + n * Math.cos(s), r + i * Math.sin(s)]), wy(h, null, l);
}
function Gse(t, e, r, n, i, a, s, o) {
  const l = [], u = [o.maxRandomnessOffset || 1, (o.maxRandomnessOffset || 1) + 0.3];
  let h = [0, 0];
  const d = o.disableMultiStroke ? 1 : 2, f = o.preserveVertices;
  for (let p = 0; p < d; p++) p === 0 ? l.push({ op: "move", data: [s[0], s[1]] }) : l.push({ op: "move", data: [s[0] + (f ? 0 : Ht(u[0], o)), s[1] + (f ? 0 : Ht(u[0], o))] }), h = f ? [i, a] : [i + Ht(u[p], o), a + Ht(u[p], o)], l.push({ op: "bcurveTo", data: [t + Ht(u[p], o), e + Ht(u[p], o), r + Ht(u[p], o), n + Ht(u[p], o), h[0], h[1]] });
  return l;
}
function i0(t) {
  return [...t];
}
function l8(t, e = 0) {
  const r = t.length;
  if (r < 3) throw new Error("A curve must have at least three points.");
  const n = [];
  if (r === 3) n.push(i0(t[0]), i0(t[1]), i0(t[2]), i0(t[2]));
  else {
    const i = [];
    i.push(t[0], t[0]);
    for (let o = 1; o < t.length; o++) i.push(t[o]), o === t.length - 1 && i.push(t[o]);
    const a = [], s = 1 - e;
    n.push(i0(i[0]));
    for (let o = 1; o + 2 < i.length; o++) {
      const l = i[o];
      a[0] = [l[0], l[1]], a[1] = [l[0] + (s * i[o + 1][0] - s * i[o - 1][0]) / 6, l[1] + (s * i[o + 1][1] - s * i[o - 1][1]) / 6], a[2] = [i[o + 1][0] + (s * i[o][0] - s * i[o + 2][0]) / 6, i[o + 1][1] + (s * i[o][1] - s * i[o + 2][1]) / 6], a[3] = [i[o + 1][0], i[o + 1][1]], n.push(a[1], a[2], a[3]);
    }
  }
  return n;
}
function jm(t, e) {
  return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2);
}
function Use(t, e, r) {
  const n = jm(e, r);
  if (n === 0) return jm(t, e);
  let i = ((t[0] - e[0]) * (r[0] - e[0]) + (t[1] - e[1]) * (r[1] - e[1])) / n;
  return i = Math.max(0, Math.min(1, i)), jm(t, Mc(e, r, i));
}
function Mc(t, e, r) {
  return [t[0] + (e[0] - t[0]) * r, t[1] + (e[1] - t[1]) * r];
}
function Bw(t, e, r, n) {
  const i = n || [];
  if (function(o, l) {
    const u = o[l + 0], h = o[l + 1], d = o[l + 2], f = o[l + 3];
    let p = 3 * h[0] - 2 * u[0] - f[0];
    p *= p;
    let g = 3 * h[1] - 2 * u[1] - f[1];
    g *= g;
    let m = 3 * d[0] - 2 * f[0] - u[0];
    m *= m;
    let v = 3 * d[1] - 2 * f[1] - u[1];
    return v *= v, p < m && (p = m), g < v && (g = v), p + g;
  }(t, e) < r) {
    const o = t[e + 0];
    i.length ? (a = i[i.length - 1], s = o, Math.sqrt(jm(a, s)) > 1 && i.push(o)) : i.push(o), i.push(t[e + 3]);
  } else {
    const l = t[e + 0], u = t[e + 1], h = t[e + 2], d = t[e + 3], f = Mc(l, u, 0.5), p = Mc(u, h, 0.5), g = Mc(h, d, 0.5), m = Mc(f, p, 0.5), v = Mc(p, g, 0.5), y = Mc(m, v, 0.5);
    Bw([l, f, m, y], 0, r, i), Bw([y, v, g, d], 0, r, i);
  }
  var a, s;
  return i;
}
function Wse(t, e) {
  return Ty(t, 0, t.length, e);
}
function Ty(t, e, r, n, i) {
  const a = i || [], s = t[e], o = t[r - 1];
  let l = 0, u = 1;
  for (let h = e + 1; h < r - 1; ++h) {
    const d = Use(t[h], s, o);
    d > l && (l = d, u = h);
  }
  return Math.sqrt(l) > n ? (Ty(t, e, u + 1, n, a), Ty(t, u, r, n, a)) : (a.length || a.push(s), a.push(o)), a;
}
function e4(t, e = 0.15, r) {
  const n = [], i = (t.length - 1) / 3;
  for (let a = 0; a < i; a++)
    Bw(t, 3 * a, e, n);
  return r && r > 0 ? Ty(n, 0, n.length, r) : n;
}
const wa = "none";
class Ey {
  constructor(e) {
    this.defaultOptions = { maxRandomnessOffset: 2, roughness: 1, bowing: 1, stroke: "#000", strokeWidth: 1, curveTightness: 0, curveFitting: 0.95, curveStepCount: 9, fillStyle: "hachure", fillWeight: -1, hachureAngle: -41, hachureGap: -1, dashOffset: -1, dashGap: -1, zigzagOffset: -1, seed: 0, disableMultiStroke: !1, disableMultiStrokeFill: !1, preserveVertices: !1, fillShapeRoughnessGain: 0.8 }, this.config = e || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
  }
  static newSeed() {
    return Math.floor(Math.random() * 2 ** 31);
  }
  _o(e) {
    return e ? Object.assign({}, this.defaultOptions, e) : this.defaultOptions;
  }
  _d(e, r, n) {
    return { shape: e, sets: r || [], options: n || this.defaultOptions };
  }
  line(e, r, n, i, a) {
    const s = this._o(a);
    return this._d("line", [BP(e, r, n, i, s)], s);
  }
  rectangle(e, r, n, i, a) {
    const s = this._o(a), o = [], l = Vse(e, r, n, i, s);
    if (s.fill) {
      const u = [[e, r], [e + n, r], [e + n, r + i], [e, r + i]];
      s.fillStyle === "solid" ? o.push(Jb([u], s)) : o.push(Zu([u], s));
    }
    return s.stroke !== wa && o.push(l), this._d("rectangle", o, s);
  }
  ellipse(e, r, n, i, a) {
    const s = this._o(a), o = [], l = FP(n, i, s), u = Ow(e, r, s, l);
    if (s.fill) if (s.fillStyle === "solid") {
      const h = Ow(e, r, s, l).opset;
      h.type = "fillPath", o.push(h);
    } else o.push(Zu([u.estimatedPoints], s));
    return s.stroke !== wa && o.push(u.opset), this._d("ellipse", o, s);
  }
  circle(e, r, n, i) {
    const a = this.ellipse(e, r, n, n, i);
    return a.shape = "circle", a;
  }
  linearPath(e, r) {
    const n = this._o(r);
    return this._d("linearPath", [Xm(e, !1, n)], n);
  }
  arc(e, r, n, i, a, s, o = !1, l) {
    const u = this._o(l), h = [], d = n8(e, r, n, i, a, s, o, !0, u);
    if (o && u.fill) if (u.fillStyle === "solid") {
      const f = Object.assign({}, u);
      f.disableMultiStroke = !0;
      const p = n8(e, r, n, i, a, s, !0, !1, f);
      p.type = "fillPath", h.push(p);
    } else h.push(function(f, p, g, m, v, y, b) {
      const w = f, T = p;
      let E = Math.abs(g / 2), C = Math.abs(m / 2);
      E += Ht(0.01 * E, b), C += Ht(0.01 * C, b);
      let k = v, _ = y;
      for (; k < 0; ) k += 2 * Math.PI, _ += 2 * Math.PI;
      _ - k > 2 * Math.PI && (k = 0, _ = 2 * Math.PI);
      const L = (_ - k) / b.curveStepCount, N = [];
      for (let A = k; A <= _; A += L) N.push([w + E * Math.cos(A), T + C * Math.sin(A)]);
      return N.push([w + E * Math.cos(_), T + C * Math.sin(_)]), N.push([w, T]), Zu([N], b);
    }(e, r, n, i, a, s, u));
    return u.stroke !== wa && h.push(d), this._d("arc", h, u);
  }
  curve(e, r) {
    const n = this._o(r), i = [], a = r8(e, n);
    if (n.fill && n.fill !== wa) if (n.fillStyle === "solid") {
      const s = r8(e, Object.assign(Object.assign({}, n), { disableMultiStroke: !0, roughness: n.roughness ? n.roughness + n.fillShapeRoughnessGain : 0 }));
      i.push({ type: "fillPath", ops: this._mergedShape(s.ops) });
    } else {
      const s = [], o = e;
      if (o.length) {
        const l = typeof o[0][0] == "number" ? [o] : o;
        for (const u of l) u.length < 3 ? s.push(...u) : u.length === 3 ? s.push(...e4(l8([u[0], u[0], u[1], u[2]]), 10, (1 + n.roughness) / 2)) : s.push(...e4(l8(u), 10, (1 + n.roughness) / 2));
      }
      s.length && i.push(Zu([s], n));
    }
    return n.stroke !== wa && i.push(a), this._d("curve", i, n);
  }
  polygon(e, r) {
    const n = this._o(r), i = [], a = Xm(e, !0, n);
    return n.fill && (n.fillStyle === "solid" ? i.push(Jb([e], n)) : i.push(Zu([e], n))), n.stroke !== wa && i.push(a), this._d("polygon", i, n);
  }
  path(e, r) {
    const n = this._o(r), i = [];
    if (!e) return this._d("path", i, n);
    e = (e || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
    const a = n.fill && n.fill !== "transparent" && n.fill !== wa, s = n.stroke !== wa, o = !!(n.simplification && n.simplification < 1), l = function(h, d, f) {
      const p = OP(IP(KE(h))), g = [];
      let m = [], v = [0, 0], y = [];
      const b = () => {
        y.length >= 4 && m.push(...e4(y, d)), y = [];
      }, w = () => {
        b(), m.length && (g.push(m), m = []);
      };
      for (const { key: E, data: C } of p) switch (E) {
        case "M":
          w(), v = [C[0], C[1]], m.push(v);
          break;
        case "L":
          b(), m.push([C[0], C[1]]);
          break;
        case "C":
          if (!y.length) {
            const k = m.length ? m[m.length - 1] : v;
            y.push([k[0], k[1]]);
          }
          y.push([C[0], C[1]]), y.push([C[2], C[3]]), y.push([C[4], C[5]]);
          break;
        case "Z":
          b(), m.push([v[0], v[1]]);
      }
      if (w(), !f) return g;
      const T = [];
      for (const E of g) {
        const C = Wse(E, f);
        C.length && T.push(C);
      }
      return T;
    }(e, 1, o ? 4 - 4 * (n.simplification || 1) : (1 + n.roughness) / 2), u = i8(e, n);
    if (a) if (n.fillStyle === "solid") if (l.length === 1) {
      const h = i8(e, Object.assign(Object.assign({}, n), { disableMultiStroke: !0, roughness: n.roughness ? n.roughness + n.fillShapeRoughnessGain : 0 }));
      i.push({ type: "fillPath", ops: this._mergedShape(h.ops) });
    } else i.push(Jb(l, n));
    else i.push(Zu(l, n));
    return s && (o ? l.forEach((h) => {
      i.push(Xm(h, !1, n));
    }) : i.push(u)), this._d("path", i, n);
  }
  opsToPath(e, r) {
    let n = "";
    for (const i of e.ops) {
      const a = typeof r == "number" && r >= 0 ? i.data.map((s) => +s.toFixed(r)) : i.data;
      switch (i.op) {
        case "move":
          n += `M${a[0]} ${a[1]} `;
          break;
        case "bcurveTo":
          n += `C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;
          break;
        case "lineTo":
          n += `L${a[0]} ${a[1]} `;
      }
    }
    return n.trim();
  }
  toPaths(e) {
    const r = e.sets || [], n = e.options || this.defaultOptions, i = [];
    for (const a of r) {
      let s = null;
      switch (a.type) {
        case "path":
          s = { d: this.opsToPath(a), stroke: n.stroke, strokeWidth: n.strokeWidth, fill: wa };
          break;
        case "fillPath":
          s = { d: this.opsToPath(a), stroke: wa, strokeWidth: 0, fill: n.fill || wa };
          break;
        case "fillSketch":
          s = this.fillSketch(a, n);
      }
      s && i.push(s);
    }
    return i;
  }
  fillSketch(e, r) {
    let n = r.fillWeight;
    return n < 0 && (n = r.strokeWidth / 2), { d: this.opsToPath(e), stroke: r.fill || wa, strokeWidth: n, fill: wa };
  }
  _mergedShape(e) {
    return e.filter((r, n) => n === 0 || r.op !== "move");
  }
}
class Hse {
  constructor(e, r) {
    this.canvas = e, this.ctx = this.canvas.getContext("2d"), this.gen = new Ey(r);
  }
  draw(e) {
    const r = e.sets || [], n = e.options || this.getDefaultOptions(), i = this.ctx, a = e.options.fixedDecimalPlaceDigits;
    for (const s of r) switch (s.type) {
      case "path":
        i.save(), i.strokeStyle = n.stroke === "none" ? "transparent" : n.stroke, i.lineWidth = n.strokeWidth, n.strokeLineDash && i.setLineDash(n.strokeLineDash), n.strokeLineDashOffset && (i.lineDashOffset = n.strokeLineDashOffset), this._drawToContext(i, s, a), i.restore();
        break;
      case "fillPath": {
        i.save(), i.fillStyle = n.fill || "";
        const o = e.shape === "curve" || e.shape === "polygon" || e.shape === "path" ? "evenodd" : "nonzero";
        this._drawToContext(i, s, a, o), i.restore();
        break;
      }
      case "fillSketch":
        this.fillSketch(i, s, n);
    }
  }
  fillSketch(e, r, n) {
    let i = n.fillWeight;
    i < 0 && (i = n.strokeWidth / 2), e.save(), n.fillLineDash && e.setLineDash(n.fillLineDash), n.fillLineDashOffset && (e.lineDashOffset = n.fillLineDashOffset), e.strokeStyle = n.fill || "", e.lineWidth = i, this._drawToContext(e, r, n.fixedDecimalPlaceDigits), e.restore();
  }
  _drawToContext(e, r, n, i = "nonzero") {
    e.beginPath();
    for (const a of r.ops) {
      const s = typeof n == "number" && n >= 0 ? a.data.map((o) => +o.toFixed(n)) : a.data;
      switch (a.op) {
        case "move":
          e.moveTo(s[0], s[1]);
          break;
        case "bcurveTo":
          e.bezierCurveTo(s[0], s[1], s[2], s[3], s[4], s[5]);
          break;
        case "lineTo":
          e.lineTo(s[0], s[1]);
      }
    }
    r.type === "fillPath" ? e.fill(i) : e.stroke();
  }
  get generator() {
    return this.gen;
  }
  getDefaultOptions() {
    return this.gen.defaultOptions;
  }
  line(e, r, n, i, a) {
    const s = this.gen.line(e, r, n, i, a);
    return this.draw(s), s;
  }
  rectangle(e, r, n, i, a) {
    const s = this.gen.rectangle(e, r, n, i, a);
    return this.draw(s), s;
  }
  ellipse(e, r, n, i, a) {
    const s = this.gen.ellipse(e, r, n, i, a);
    return this.draw(s), s;
  }
  circle(e, r, n, i) {
    const a = this.gen.circle(e, r, n, i);
    return this.draw(a), a;
  }
  linearPath(e, r) {
    const n = this.gen.linearPath(e, r);
    return this.draw(n), n;
  }
  polygon(e, r) {
    const n = this.gen.polygon(e, r);
    return this.draw(n), n;
  }
  arc(e, r, n, i, a, s, o = !1, l) {
    const u = this.gen.arc(e, r, n, i, a, s, o, l);
    return this.draw(u), u;
  }
  curve(e, r) {
    const n = this.gen.curve(e, r);
    return this.draw(n), n;
  }
  path(e, r) {
    const n = this.gen.path(e, r);
    return this.draw(n), n;
  }
}
const P1 = "http://www.w3.org/2000/svg";
class qse {
  constructor(e, r) {
    this.svg = e, this.gen = new Ey(r);
  }
  draw(e) {
    const r = e.sets || [], n = e.options || this.getDefaultOptions(), i = this.svg.ownerDocument || window.document, a = i.createElementNS(P1, "g"), s = e.options.fixedDecimalPlaceDigits;
    for (const o of r) {
      let l = null;
      switch (o.type) {
        case "path":
          l = i.createElementNS(P1, "path"), l.setAttribute("d", this.opsToPath(o, s)), l.setAttribute("stroke", n.stroke), l.setAttribute("stroke-width", n.strokeWidth + ""), l.setAttribute("fill", "none"), n.strokeLineDash && l.setAttribute("stroke-dasharray", n.strokeLineDash.join(" ").trim()), n.strokeLineDashOffset && l.setAttribute("stroke-dashoffset", `${n.strokeLineDashOffset}`);
          break;
        case "fillPath":
          l = i.createElementNS(P1, "path"), l.setAttribute("d", this.opsToPath(o, s)), l.setAttribute("stroke", "none"), l.setAttribute("stroke-width", "0"), l.setAttribute("fill", n.fill || ""), e.shape !== "curve" && e.shape !== "polygon" || l.setAttribute("fill-rule", "evenodd");
          break;
        case "fillSketch":
          l = this.fillSketch(i, o, n);
      }
      l && a.appendChild(l);
    }
    return a;
  }
  fillSketch(e, r, n) {
    let i = n.fillWeight;
    i < 0 && (i = n.strokeWidth / 2);
    const a = e.createElementNS(P1, "path");
    return a.setAttribute("d", this.opsToPath(r, n.fixedDecimalPlaceDigits)), a.setAttribute("stroke", n.fill || ""), a.setAttribute("stroke-width", i + ""), a.setAttribute("fill", "none"), n.fillLineDash && a.setAttribute("stroke-dasharray", n.fillLineDash.join(" ").trim()), n.fillLineDashOffset && a.setAttribute("stroke-dashoffset", `${n.fillLineDashOffset}`), a;
  }
  get generator() {
    return this.gen;
  }
  getDefaultOptions() {
    return this.gen.defaultOptions;
  }
  opsToPath(e, r) {
    return this.gen.opsToPath(e, r);
  }
  line(e, r, n, i, a) {
    const s = this.gen.line(e, r, n, i, a);
    return this.draw(s);
  }
  rectangle(e, r, n, i, a) {
    const s = this.gen.rectangle(e, r, n, i, a);
    return this.draw(s);
  }
  ellipse(e, r, n, i, a) {
    const s = this.gen.ellipse(e, r, n, i, a);
    return this.draw(s);
  }
  circle(e, r, n, i) {
    const a = this.gen.circle(e, r, n, i);
    return this.draw(a);
  }
  linearPath(e, r) {
    const n = this.gen.linearPath(e, r);
    return this.draw(n);
  }
  polygon(e, r) {
    const n = this.gen.polygon(e, r);
    return this.draw(n);
  }
  arc(e, r, n, i, a, s, o = !1, l) {
    const u = this.gen.arc(e, r, n, i, a, s, o, l);
    return this.draw(u);
  }
  curve(e, r) {
    const n = this.gen.curve(e, r);
    return this.draw(n);
  }
  path(e, r) {
    const n = this.gen.path(e, r);
    return this.draw(n);
  }
}
var Rt = { canvas: (t, e) => new Hse(t, e), svg: (t, e) => new qse(t, e), generator: (t) => new Ey(t), newSeed: () => Ey.newSeed() }, Ut = /* @__PURE__ */ x(async (t, e, r) => {
  var d, f;
  let n;
  const i = e.useHtmlLabels || Ir((d = we()) == null ? void 0 : d.htmlLabels);
  r ? n = r : n = "node default";
  const a = t.insert("g").attr("class", n).attr("id", e.domId || e.id), s = a.insert("g").attr("class", "label").attr("style", Ci(e.labelStyle));
  let o;
  e.label === void 0 ? o = "" : o = typeof e.label == "string" ? e.label : e.label[0];
  const l = await Ma(s, fr(Zs(o), we()), {
    useHtmlLabels: i,
    width: e.width || ((f = we().flowchart) == null ? void 0 : f.wrappingWidth),
    // @ts-expect-error -- This is currently not used. Should this be `classes` instead?
    cssClasses: "markdown-node-label",
    style: e.labelStyle,
    addSvgBackground: !!e.icon || !!e.img
  });
  let u = l.getBBox();
  const h = ((e == null ? void 0 : e.padding) ?? 0) / 2;
  if (i) {
    const p = l.children[0], g = Qe(l), m = p.getElementsByTagName("img");
    if (m) {
      const v = o.replace(/<img[^>]*>/g, "").trim() === "";
      await Promise.all(
        [...m].map(
          (y) => new Promise((b) => {
            function w() {
              if (y.style.display = "flex", y.style.flexDirection = "column", v) {
                const T = we().fontSize ? we().fontSize : window.getComputedStyle(document.body).fontSize, E = 5, [C = hr.fontSize] = Du(T), k = C * E + "px";
                y.style.minWidth = k, y.style.maxWidth = k;
              } else
                y.style.width = "100%";
              b(y);
            }
            x(w, "setupImage"), setTimeout(() => {
              y.complete && w();
            }), y.addEventListener("error", w), y.addEventListener("load", w);
          })
        )
      );
    }
    u = p.getBoundingClientRect(), g.attr("width", u.width), g.attr("height", u.height);
  }
  return i ? s.attr("transform", "translate(" + -u.width / 2 + ", " + -u.height / 2 + ")") : s.attr("transform", "translate(0, " + -u.height / 2 + ")"), e.centerLabel && s.attr("transform", "translate(" + -u.width / 2 + ", " + -u.height / 2 + ")"), s.insert("rect", ":first-child"), { shapeSvg: a, bbox: u, halfPadding: h, label: s };
}, "labelHelper"), t4 = /* @__PURE__ */ x(async (t, e, r) => {
  var l, u, h, d, f, p;
  const n = r.useHtmlLabels || Ir((u = (l = we()) == null ? void 0 : l.flowchart) == null ? void 0 : u.htmlLabels), i = t.insert("g").attr("class", "label").attr("style", r.labelStyle || ""), a = await Ma(i, fr(Zs(e), we()), {
    useHtmlLabels: n,
    width: r.width || ((d = (h = we()) == null ? void 0 : h.flowchart) == null ? void 0 : d.wrappingWidth),
    style: r.labelStyle,
    addSvgBackground: !!r.icon || !!r.img
  });
  let s = a.getBBox();
  const o = r.padding / 2;
  if (Ir((p = (f = we()) == null ? void 0 : f.flowchart) == null ? void 0 : p.htmlLabels)) {
    const g = a.children[0], m = Qe(a);
    s = g.getBoundingClientRect(), m.attr("width", s.width), m.attr("height", s.height);
  }
  return n ? i.attr("transform", "translate(" + -s.width / 2 + ", " + -s.height / 2 + ")") : i.attr("transform", "translate(0, " + -s.height / 2 + ")"), r.centerLabel && i.attr("transform", "translate(" + -s.width / 2 + ", " + -s.height / 2 + ")"), i.insert("rect", ":first-child"), { shapeSvg: t, bbox: s, halfPadding: o, label: i };
}, "insertLabel"), Mt = /* @__PURE__ */ x((t, e) => {
  const r = e.node().getBBox();
  t.width = r.width, t.height = r.height;
}, "updateNodeBounds"), $t = /* @__PURE__ */ x((t, e) => (t.look === "handDrawn" ? "rough-node" : "node") + " " + t.cssClasses + " " + (e || ""), "getNodeClasses");
function ar(t) {
  const e = t.map((r, n) => `${n === 0 ? "M" : "L"}${r.x},${r.y}`);
  return e.push("Z"), e.join(" ");
}
x(ar, "createPathFromPoints");
function Fl(t, e, r, n, i, a) {
  const s = [], l = r - t, u = n - e, h = l / a, d = 2 * Math.PI / h, f = e + u / 2;
  for (let p = 0; p <= 50; p++) {
    const g = p / 50, m = t + g * l, v = f + i * Math.sin(d * (m - t));
    s.push({ x: m, y: v });
  }
  return s;
}
x(Fl, "generateFullSineWavePoints");
function Kp(t, e, r, n, i, a) {
  const s = [], o = i * Math.PI / 180, h = (a * Math.PI / 180 - o) / (n - 1);
  for (let d = 0; d < n; d++) {
    const f = o + d * h, p = t + r * Math.cos(f), g = e + r * Math.sin(f);
    s.push({ x: -p, y: -g });
  }
  return s;
}
x(Kp, "generateCirclePoints");
var Yse = /* @__PURE__ */ x((t, e) => {
  var r = t.x, n = t.y, i = e.x - r, a = e.y - n, s = t.width / 2, o = t.height / 2, l, u;
  return Math.abs(a) * s > Math.abs(i) * o ? (a < 0 && (o = -o), l = a === 0 ? 0 : o * i / a, u = o) : (i < 0 && (s = -s), l = s, u = i === 0 ? 0 : s * a / i), { x: r + l, y: n + u };
}, "intersectRect"), Cf = Yse;
function zP(t, e) {
  e && t.attr("style", e);
}
x(zP, "applyStyle");
async function VP(t) {
  const e = Qe(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), r = e.append("xhtml:div"), n = we();
  let i = t.label;
  t.label && un(t.label) && (i = await _g(t.label.replace(at.lineBreakRegex, `
`), n));
  const s = '<span class="' + (t.isNode ? "nodeLabel" : "edgeLabel") + '" ' + (t.labelStyle ? 'style="' + t.labelStyle + '"' : "") + // codeql [js/html-constructed-from-input] : false positive
  ">" + i + "</span>";
  return r.html(fr(s, n)), zP(r, t.labelStyle), r.style("display", "inline-block"), r.style("padding-right", "1px"), r.style("white-space", "nowrap"), r.attr("xmlns", "http://www.w3.org/1999/xhtml"), e.node();
}
x(VP, "addHtmlLabel");
var Xse = /* @__PURE__ */ x(async (t, e, r, n) => {
  let i = t || "";
  if (typeof i == "object" && (i = i[0]), Ir(we().flowchart.htmlLabels)) {
    i = i.replace(/\\n|\n/g, "<br />"), ae.info("vertexText" + i);
    const a = {
      isNode: n,
      label: Zs(i).replace(
        /fa[blrs]?:fa-[\w-]+/g,
        (o) => `<i class='${o.replace(":", " ")}'></i>`
      ),
      labelStyle: e && e.replace("fill:", "color:")
    };
    return await VP(a);
  } else {
    const a = document.createElementNS("http://www.w3.org/2000/svg", "text");
    a.setAttribute("style", e.replace("color:", "fill:"));
    let s = [];
    typeof i == "string" ? s = i.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(i) ? s = i : s = [];
    for (const o of s) {
      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"), r ? l.setAttribute("class", "title-row") : l.setAttribute("class", "row"), l.textContent = o.trim(), a.appendChild(l);
    }
    return a;
  }
}, "createLabel"), qc = Xse, nc = /* @__PURE__ */ x((t, e, r, n, i) => [
  "M",
  t + i,
  e,
  // Move to the first point
  "H",
  t + r - i,
  // Draw horizontal line to the beginning of the right corner
  "A",
  i,
  i,
  0,
  0,
  1,
  t + r,
  e + i,
  // Draw arc to the right top corner
  "V",
  e + n - i,
  // Draw vertical line down to the beginning of the right bottom corner
  "A",
  i,
  i,
  0,
  0,
  1,
  t + r - i,
  e + n,
  // Draw arc to the right bottom corner
  "H",
  t + i,
  // Draw horizontal line to the beginning of the left bottom corner
  "A",
  i,
  i,
  0,
  0,
  1,
  t,
  e + n - i,
  // Draw arc to the left bottom corner
  "V",
  e + i,
  // Draw vertical line up to the beginning of the left top corner
  "A",
  i,
  i,
  0,
  0,
  1,
  t + i,
  e,
  // Draw arc to the left top corner
  "Z"
  // Close the path
].join(" "), "createRoundedRectPathD"), GP = /* @__PURE__ */ x(async (t, e) => {
  ae.info("Creating subgraph rect for ", e.id, e);
  const r = we(), { themeVariables: n, handDrawnSeed: i } = r, { clusterBkg: a, clusterBorder: s } = n, { labelStyles: o, nodeStyles: l, borderStyles: u, backgroundStyles: h } = Ct(e), d = t.insert("g").attr("class", "cluster " + e.cssClasses).attr("id", e.id).attr("data-look", e.look), f = Ir(r.flowchart.htmlLabels), p = d.insert("g").attr("class", "cluster-label "), g = await Ma(p, e.label, {
    style: e.labelStyle,
    useHtmlLabels: f,
    isNode: !0
  });
  let m = g.getBBox();
  if (Ir(r.flowchart.htmlLabels)) {
    const k = g.children[0], _ = Qe(g);
    m = k.getBoundingClientRect(), _.attr("width", m.width), _.attr("height", m.height);
  }
  const v = e.width <= m.width + e.padding ? m.width + e.padding : e.width;
  e.width <= m.width + e.padding ? e.diff = (v - e.width) / 2 - e.padding : e.diff = -e.padding;
  const y = e.height, b = e.x - v / 2, w = e.y - y / 2;
  ae.trace("Data ", e, JSON.stringify(e));
  let T;
  if (e.look === "handDrawn") {
    const k = Rt.svg(d), _ = Nt(e, {
      roughness: 0.7,
      fill: a,
      // fill: 'red',
      stroke: s,
      fillWeight: 3,
      seed: i
    }), L = k.path(nc(b, w, v, y, 0), _);
    T = d.insert(() => (ae.debug("Rough node insert CXC", L), L), ":first-child"), T.select("path:nth-child(2)").attr("style", u.join(";")), T.select("path").attr("style", h.join(";").replace("fill", "stroke"));
  } else
    T = d.insert("rect", ":first-child"), T.attr("style", l).attr("rx", e.rx).attr("ry", e.ry).attr("x", b).attr("y", w).attr("width", v).attr("height", y);
  const { subGraphTitleTopMargin: E } = Ig(r);
  if (p.attr(
    "transform",
    // This puts the label on top of the box instead of inside it
    `translate(${e.x - m.width / 2}, ${e.y - e.height / 2 + E})`
  ), o) {
    const k = p.select("span");
    k && k.attr("style", o);
  }
  const C = T.node().getBBox();
  return e.offsetX = 0, e.width = C.width, e.height = C.height, e.offsetY = m.height - e.padding / 2, e.intersect = function(k) {
    return Cf(e, k);
  }, { cluster: d, labelBBox: m };
}, "rect"), jse = /* @__PURE__ */ x((t, e) => {
  const r = t.insert("g").attr("class", "note-cluster").attr("id", e.id), n = r.insert("rect", ":first-child"), i = 0 * e.padding, a = i / 2;
  n.attr("rx", e.rx).attr("ry", e.ry).attr("x", e.x - e.width / 2 - a).attr("y", e.y - e.height / 2 - a).attr("width", e.width + i).attr("height", e.height + i).attr("fill", "none");
  const s = n.node().getBBox();
  return e.width = s.width, e.height = s.height, e.intersect = function(o) {
    return Cf(e, o);
  }, { cluster: r, labelBBox: { width: 0, height: 0 } };
}, "noteGroup"), Kse = /* @__PURE__ */ x(async (t, e) => {
  const r = we(), { themeVariables: n, handDrawnSeed: i } = r, { altBackground: a, compositeBackground: s, compositeTitleBackground: o, nodeBorder: l } = n, u = t.insert("g").attr("class", e.cssClasses).attr("id", e.id).attr("data-id", e.id).attr("data-look", e.look), h = u.insert("g", ":first-child"), d = u.insert("g").attr("class", "cluster-label");
  let f = u.append("rect");
  const p = d.node().appendChild(await qc(e.label, e.labelStyle, void 0, !0));
  let g = p.getBBox();
  if (Ir(r.flowchart.htmlLabels)) {
    const L = p.children[0], N = Qe(p);
    g = L.getBoundingClientRect(), N.attr("width", g.width), N.attr("height", g.height);
  }
  const m = 0 * e.padding, v = m / 2, y = (e.width <= g.width + e.padding ? g.width + e.padding : e.width) + m;
  e.width <= g.width + e.padding ? e.diff = (y - e.width) / 2 - e.padding : e.diff = -e.padding;
  const b = e.height + m, w = e.height + m - g.height - 6, T = e.x - y / 2, E = e.y - b / 2;
  e.width = y;
  const C = e.y - e.height / 2 - v + g.height + 2;
  let k;
  if (e.look === "handDrawn") {
    const L = e.cssClasses.includes("statediagram-cluster-alt"), N = Rt.svg(u), A = e.rx || e.ry ? N.path(nc(T, E, y, b, 10), {
      roughness: 0.7,
      fill: o,
      fillStyle: "solid",
      stroke: l,
      seed: i
    }) : N.rectangle(T, E, y, b, { seed: i });
    k = u.insert(() => A, ":first-child");
    const O = N.rectangle(T, C, y, w, {
      fill: L ? a : s,
      fillStyle: L ? "hachure" : "solid",
      stroke: l,
      seed: i
    });
    k = u.insert(() => A, ":first-child"), f = u.insert(() => O);
  } else
    k = h.insert("rect", ":first-child"), k.attr("class", "outer").attr("x", T).attr("y", E).attr("width", y).attr("height", b).attr("data-look", e.look), f.attr("class", "inner").attr("x", T).attr("y", C).attr("width", y).attr("height", w);
  d.attr(
    "transform",
    `translate(${e.x - g.width / 2}, ${E + 1 - (Ir(r.flowchart.htmlLabels) ? 0 : 3)})`
  );
  const _ = k.node().getBBox();
  return e.height = _.height, e.offsetX = 0, e.offsetY = g.height - e.padding / 2, e.labelBBox = g, e.intersect = function(L) {
    return Cf(e, L);
  }, { cluster: u, labelBBox: g };
}, "roundedWithTitle"), Zse = /* @__PURE__ */ x(async (t, e) => {
  ae.info("Creating subgraph rect for ", e.id, e);
  const r = we(), { themeVariables: n, handDrawnSeed: i } = r, { clusterBkg: a, clusterBorder: s } = n, { labelStyles: o, nodeStyles: l, borderStyles: u, backgroundStyles: h } = Ct(e), d = t.insert("g").attr("class", "cluster " + e.cssClasses).attr("id", e.id).attr("data-look", e.look), f = Ir(r.flowchart.htmlLabels), p = d.insert("g").attr("class", "cluster-label "), g = await Ma(p, e.label, {
    style: e.labelStyle,
    useHtmlLabels: f,
    isNode: !0,
    width: e.width
  });
  let m = g.getBBox();
  if (Ir(r.flowchart.htmlLabels)) {
    const k = g.children[0], _ = Qe(g);
    m = k.getBoundingClientRect(), _.attr("width", m.width), _.attr("height", m.height);
  }
  const v = e.width <= m.width + e.padding ? m.width + e.padding : e.width;
  e.width <= m.width + e.padding ? e.diff = (v - e.width) / 2 - e.padding : e.diff = -e.padding;
  const y = e.height, b = e.x - v / 2, w = e.y - y / 2;
  ae.trace("Data ", e, JSON.stringify(e));
  let T;
  if (e.look === "handDrawn") {
    const k = Rt.svg(d), _ = Nt(e, {
      roughness: 0.7,
      fill: a,
      // fill: 'red',
      stroke: s,
      fillWeight: 4,
      seed: i
    }), L = k.path(nc(b, w, v, y, e.rx), _);
    T = d.insert(() => (ae.debug("Rough node insert CXC", L), L), ":first-child"), T.select("path:nth-child(2)").attr("style", u.join(";")), T.select("path").attr("style", h.join(";").replace("fill", "stroke"));
  } else
    T = d.insert("rect", ":first-child"), T.attr("style", l).attr("rx", e.rx).attr("ry", e.ry).attr("x", b).attr("y", w).attr("width", v).attr("height", y);
  const { subGraphTitleTopMargin: E } = Ig(r);
  if (p.attr(
    "transform",
    // This puts the label on top of the box instead of inside it
    `translate(${e.x - m.width / 2}, ${e.y - e.height / 2 + E})`
  ), o) {
    const k = p.select("span");
    k && k.attr("style", o);
  }
  const C = T.node().getBBox();
  return e.offsetX = 0, e.width = C.width, e.height = C.height, e.offsetY = m.height - e.padding / 2, e.intersect = function(k) {
    return Cf(e, k);
  }, { cluster: d, labelBBox: m };
}, "kanbanSection"), Qse = /* @__PURE__ */ x((t, e) => {
  const r = we(), { themeVariables: n, handDrawnSeed: i } = r, { nodeBorder: a } = n, s = t.insert("g").attr("class", e.cssClasses).attr("id", e.id).attr("data-look", e.look), o = s.insert("g", ":first-child"), l = 0 * e.padding, u = e.width + l;
  e.diff = -e.padding;
  const h = e.height + l, d = e.x - u / 2, f = e.y - h / 2;
  e.width = u;
  let p;
  if (e.look === "handDrawn") {
    const v = Rt.svg(s).rectangle(d, f, u, h, {
      fill: "lightgrey",
      roughness: 0.5,
      strokeLineDash: [5],
      stroke: a,
      seed: i
    });
    p = s.insert(() => v, ":first-child");
  } else
    p = o.insert("rect", ":first-child"), p.attr("class", "divider").attr("x", d).attr("y", f).attr("width", u).attr("height", h).attr("data-look", e.look);
  const g = p.node().getBBox();
  return e.height = g.height, e.offsetX = 0, e.offsetY = 0, e.intersect = function(m) {
    return Cf(e, m);
  }, { cluster: s, labelBBox: {} };
}, "divider"), Jse = GP, eoe = {
  rect: GP,
  squareRect: Jse,
  roundedWithTitle: Kse,
  noteGroup: jse,
  divider: Qse,
  kanbanSection: Zse
}, UP = /* @__PURE__ */ new Map(), ZE = /* @__PURE__ */ x(async (t, e) => {
  const r = e.shape || "rect", n = await eoe[r](t, e);
  return UP.set(e.id, n), n;
}, "insertCluster"), toe = /* @__PURE__ */ x(() => {
  UP = /* @__PURE__ */ new Map();
}, "clear");
function WP(t, e) {
  return t.intersect(e);
}
x(WP, "intersectNode");
var roe = WP;
function HP(t, e, r, n) {
  var i = t.x, a = t.y, s = i - n.x, o = a - n.y, l = Math.sqrt(e * e * o * o + r * r * s * s), u = Math.abs(e * r * s / l);
  n.x < i && (u = -u);
  var h = Math.abs(e * r * o / l);
  return n.y < a && (h = -h), { x: i + u, y: a + h };
}
x(HP, "intersectEllipse");
var qP = HP;
function YP(t, e, r) {
  return qP(t, e, e, r);
}
x(YP, "intersectCircle");
var noe = YP;
function XP(t, e, r, n) {
  {
    const i = e.y - t.y, a = t.x - e.x, s = e.x * t.y - t.x * e.y, o = i * r.x + a * r.y + s, l = i * n.x + a * n.y + s, u = 1e-6;
    if (o !== 0 && l !== 0 && Fw(o, l))
      return;
    const h = n.y - r.y, d = r.x - n.x, f = n.x * r.y - r.x * n.y, p = h * t.x + d * t.y + f, g = h * e.x + d * e.y + f;
    if (Math.abs(p) < u && Math.abs(g) < u && Fw(p, g))
      return;
    const m = i * d - h * a;
    if (m === 0)
      return;
    const v = Math.abs(m / 2);
    let y = a * f - d * s;
    const b = y < 0 ? (y - v) / m : (y + v) / m;
    y = h * s - i * f;
    const w = y < 0 ? (y - v) / m : (y + v) / m;
    return { x: b, y: w };
  }
}
x(XP, "intersectLine");
function Fw(t, e) {
  return t * e > 0;
}
x(Fw, "sameSign");
var ioe = XP;
function jP(t, e, r) {
  let n = t.x, i = t.y, a = [], s = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY;
  typeof e.forEach == "function" ? e.forEach(function(h) {
    s = Math.min(s, h.x), o = Math.min(o, h.y);
  }) : (s = Math.min(s, e.x), o = Math.min(o, e.y));
  let l = n - t.width / 2 - s, u = i - t.height / 2 - o;
  for (let h = 0; h < e.length; h++) {
    let d = e[h], f = e[h < e.length - 1 ? h + 1 : 0], p = ioe(
      t,
      r,
      { x: l + d.x, y: u + d.y },
      { x: l + f.x, y: u + f.y }
    );
    p && a.push(p);
  }
  return a.length ? (a.length > 1 && a.sort(function(h, d) {
    let f = h.x - r.x, p = h.y - r.y, g = Math.sqrt(f * f + p * p), m = d.x - r.x, v = d.y - r.y, y = Math.sqrt(m * m + v * v);
    return g < y ? -1 : g === y ? 0 : 1;
  }), a[0]) : t;
}
x(jP, "intersectPolygon");
var aoe = jP, St = {
  node: roe,
  circle: noe,
  ellipse: qP,
  polygon: aoe,
  rect: Cf
};
function KP(t, e) {
  const { labelStyles: r } = Ct(e);
  e.labelStyle = r;
  const n = $t(e);
  let i = n;
  n || (i = "anchor");
  const a = t.insert("g").attr("class", i).attr("id", e.domId || e.id), s = 1, { cssStyles: o } = e, l = Rt.svg(a), u = Nt(e, { fill: "black", stroke: "none", fillStyle: "solid" });
  e.look !== "handDrawn" && (u.roughness = 0);
  const h = l.circle(0, 0, s * 2, u), d = a.insert(() => h, ":first-child");
  return d.attr("class", "anchor").attr("style", Ci(o)), Mt(e, d), e.intersect = function(f) {
    return ae.info("Circle intersect", e, s, f), St.circle(e, s, f);
  }, a;
}
x(KP, "anchor");
function $w(t, e, r, n, i, a, s) {
  const l = (t + r) / 2, u = (e + n) / 2, h = Math.atan2(n - e, r - t), d = (r - t) / 2, f = (n - e) / 2, p = d / i, g = f / a, m = Math.sqrt(p ** 2 + g ** 2);
  if (m > 1)
    throw new Error("The given radii are too small to create an arc between the points.");
  const v = Math.sqrt(1 - m ** 2), y = l + v * a * Math.sin(h) * (s ? -1 : 1), b = u - v * i * Math.cos(h) * (s ? -1 : 1), w = Math.atan2((e - b) / a, (t - y) / i);
  let E = Math.atan2((n - b) / a, (r - y) / i) - w;
  s && E < 0 && (E += 2 * Math.PI), !s && E > 0 && (E -= 2 * Math.PI);
  const C = [];
  for (let k = 0; k < 20; k++) {
    const _ = k / 19, L = w + _ * E, N = y + i * Math.cos(L), A = b + a * Math.sin(L);
    C.push({ x: N, y: A });
  }
  return C;
}
x($w, "generateArcPoints");
async function ZP(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = a.width + e.padding + 20, o = a.height + e.padding, l = o / 2, u = l / (2.5 + o / 50), { cssStyles: h } = e, d = [
    { x: s / 2, y: -o / 2 },
    { x: -s / 2, y: -o / 2 },
    ...$w(-s / 2, -o / 2, -s / 2, o / 2, u, l, !1),
    { x: s / 2, y: o / 2 },
    ...$w(s / 2, o / 2, s / 2, -o / 2, u, l, !0)
  ], f = Rt.svg(i), p = Nt(e, {});
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = ar(d), m = f.path(g, p), v = i.insert(() => m, ":first-child");
  return v.attr("class", "basic label-container"), h && e.look !== "handDrawn" && v.selectAll("path").attr("style", h), n && e.look !== "handDrawn" && v.selectAll("path").attr("style", n), v.attr("transform", `translate(${u / 2}, 0)`), Mt(e, v), e.intersect = function(y) {
    return St.polygon(e, d, y);
  }, i;
}
x(ZP, "bowTieRect");
function ic(t, e, r, n) {
  return t.insert("polygon", ":first-child").attr(
    "points",
    n.map(function(i) {
      return i.x + "," + i.y;
    }).join(" ")
  ).attr("class", "label-container").attr("transform", "translate(" + -e / 2 + "," + r / 2 + ")");
}
x(ic, "insertPolygonShape");
async function QP(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = a.height + e.padding, o = 12, l = a.width + e.padding + o, u = 0, h = l, d = -s, f = 0, p = [
    { x: u + o, y: d },
    { x: h, y: d },
    { x: h, y: f },
    { x: u, y: f },
    { x: u, y: d + o },
    { x: u + o, y: d }
  ];
  let g;
  const { cssStyles: m } = e;
  if (e.look === "handDrawn") {
    const v = Rt.svg(i), y = Nt(e, {}), b = ar(p), w = v.path(b, y);
    g = i.insert(() => w, ":first-child").attr("transform", `translate(${-l / 2}, ${s / 2})`), m && g.attr("style", m);
  } else
    g = ic(i, l, s, p);
  return n && g.attr("style", n), Mt(e, g), e.intersect = function(v) {
    return St.polygon(e, p, v);
  }, i;
}
x(QP, "card");
function JP(t, e) {
  const { nodeStyles: r } = Ct(e);
  e.label = "";
  const n = t.insert("g").attr("class", $t(e)).attr("id", e.domId ?? e.id), { cssStyles: i } = e, a = Math.max(28, e.width ?? 0), s = [
    { x: 0, y: a / 2 },
    { x: a / 2, y: 0 },
    { x: 0, y: -a / 2 },
    { x: -a / 2, y: 0 }
  ], o = Rt.svg(n), l = Nt(e, {});
  e.look !== "handDrawn" && (l.roughness = 0, l.fillStyle = "solid");
  const u = ar(s), h = o.path(u, l), d = n.insert(() => h, ":first-child");
  return i && e.look !== "handDrawn" && d.selectAll("path").attr("style", i), r && e.look !== "handDrawn" && d.selectAll("path").attr("style", r), e.width = 28, e.height = 28, e.intersect = function(f) {
    return St.polygon(e, s, f);
  }, n;
}
x(JP, "choice");
async function QE(t, e, r) {
  const { labelStyles: n, nodeStyles: i } = Ct(e);
  e.labelStyle = n;
  const { shapeSvg: a, bbox: s, halfPadding: o } = await Ut(t, e, $t(e)), l = (r == null ? void 0 : r.padding) ?? o, u = s.width / 2 + l;
  let h;
  const { cssStyles: d } = e;
  if (e.look === "handDrawn") {
    const f = Rt.svg(a), p = Nt(e, {}), g = f.circle(0, 0, u * 2, p);
    h = a.insert(() => g, ":first-child"), h.attr("class", "basic label-container").attr("style", Ci(d));
  } else
    h = a.insert("circle", ":first-child").attr("class", "basic label-container").attr("style", i).attr("r", u).attr("cx", 0).attr("cy", 0);
  return Mt(e, h), e.calcIntersect = function(f, p) {
    const g = f.width / 2;
    return St.circle(f, g, p);
  }, e.intersect = function(f) {
    return ae.info("Circle intersect", e, u, f), St.circle(e, u, f);
  }, a;
}
x(QE, "circle");
function eB(t) {
  const e = Math.cos(Math.PI / 4), r = Math.sin(Math.PI / 4), n = t * 2, i = { x: n / 2 * e, y: n / 2 * r }, a = { x: -(n / 2) * e, y: n / 2 * r }, s = { x: -(n / 2) * e, y: -(n / 2) * r }, o = { x: n / 2 * e, y: -(n / 2) * r };
  return `M ${a.x},${a.y} L ${o.x},${o.y}
                   M ${i.x},${i.y} L ${s.x},${s.y}`;
}
x(eB, "createLine");
function tB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r, e.label = "";
  const i = t.insert("g").attr("class", $t(e)).attr("id", e.domId ?? e.id), a = Math.max(30, (e == null ? void 0 : e.width) ?? 0), { cssStyles: s } = e, o = Rt.svg(i), l = Nt(e, {});
  e.look !== "handDrawn" && (l.roughness = 0, l.fillStyle = "solid");
  const u = o.circle(0, 0, a * 2, l), h = eB(a), d = o.path(h, l), f = i.insert(() => u, ":first-child");
  return f.insert(() => d), s && e.look !== "handDrawn" && f.selectAll("path").attr("style", s), n && e.look !== "handDrawn" && f.selectAll("path").attr("style", n), Mt(e, f), e.intersect = function(p) {
    return ae.info("crossedCircle intersect", e, { radius: a, point: p }), St.circle(e, a, p);
  }, i;
}
x(tB, "crossedCircle");
function To(t, e, r, n = 100, i = 0, a = 180) {
  const s = [], o = i * Math.PI / 180, h = (a * Math.PI / 180 - o) / (n - 1);
  for (let d = 0; d < n; d++) {
    const f = o + d * h, p = t + r * Math.cos(f), g = e + r * Math.sin(f);
    s.push({ x: -p, y: -g });
  }
  return s;
}
x(To, "generateCirclePoints");
async function rB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = a.width + (e.padding ?? 0), l = a.height + (e.padding ?? 0), u = Math.max(5, l * 0.1), { cssStyles: h } = e, d = [
    ...To(o / 2, -l / 2, u, 30, -90, 0),
    { x: -o / 2 - u, y: u },
    ...To(o / 2 + u * 2, -u, u, 20, -180, -270),
    ...To(o / 2 + u * 2, u, u, 20, -90, -180),
    { x: -o / 2 - u, y: -l / 2 },
    ...To(o / 2, l / 2, u, 20, 0, 90)
  ], f = [
    { x: o / 2, y: -l / 2 - u },
    { x: -o / 2, y: -l / 2 - u },
    ...To(o / 2, -l / 2, u, 20, -90, 0),
    { x: -o / 2 - u, y: -u },
    ...To(o / 2 + o * 0.1, -u, u, 20, -180, -270),
    ...To(o / 2 + o * 0.1, u, u, 20, -90, -180),
    { x: -o / 2 - u, y: l / 2 },
    ...To(o / 2, l / 2, u, 20, 0, 90),
    { x: -o / 2, y: l / 2 + u },
    { x: o / 2, y: l / 2 + u }
  ], p = Rt.svg(i), g = Nt(e, { fill: "none" });
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const v = ar(d).replace("Z", ""), y = p.path(v, g), b = ar(f), w = p.path(b, { ...g }), T = i.insert("g", ":first-child");
  return T.insert(() => w, ":first-child").attr("stroke-opacity", 0), T.insert(() => y, ":first-child"), T.attr("class", "text"), h && e.look !== "handDrawn" && T.selectAll("path").attr("style", h), n && e.look !== "handDrawn" && T.selectAll("path").attr("style", n), T.attr("transform", `translate(${u}, 0)`), s.attr(
    "transform",
    `translate(${-o / 2 + u - (a.x - (a.left ?? 0))},${-l / 2 + (e.padding ?? 0) / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, T), e.intersect = function(E) {
    return St.polygon(e, f, E);
  }, i;
}
x(rB, "curlyBraceLeft");
function Eo(t, e, r, n = 100, i = 0, a = 180) {
  const s = [], o = i * Math.PI / 180, h = (a * Math.PI / 180 - o) / (n - 1);
  for (let d = 0; d < n; d++) {
    const f = o + d * h, p = t + r * Math.cos(f), g = e + r * Math.sin(f);
    s.push({ x: p, y: g });
  }
  return s;
}
x(Eo, "generateCirclePoints");
async function nB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = a.width + (e.padding ?? 0), l = a.height + (e.padding ?? 0), u = Math.max(5, l * 0.1), { cssStyles: h } = e, d = [
    ...Eo(o / 2, -l / 2, u, 20, -90, 0),
    { x: o / 2 + u, y: -u },
    ...Eo(o / 2 + u * 2, -u, u, 20, -180, -270),
    ...Eo(o / 2 + u * 2, u, u, 20, -90, -180),
    { x: o / 2 + u, y: l / 2 },
    ...Eo(o / 2, l / 2, u, 20, 0, 90)
  ], f = [
    { x: -o / 2, y: -l / 2 - u },
    { x: o / 2, y: -l / 2 - u },
    ...Eo(o / 2, -l / 2, u, 20, -90, 0),
    { x: o / 2 + u, y: -u },
    ...Eo(o / 2 + u * 2, -u, u, 20, -180, -270),
    ...Eo(o / 2 + u * 2, u, u, 20, -90, -180),
    { x: o / 2 + u, y: l / 2 },
    ...Eo(o / 2, l / 2, u, 20, 0, 90),
    { x: o / 2, y: l / 2 + u },
    { x: -o / 2, y: l / 2 + u }
  ], p = Rt.svg(i), g = Nt(e, { fill: "none" });
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const v = ar(d).replace("Z", ""), y = p.path(v, g), b = ar(f), w = p.path(b, { ...g }), T = i.insert("g", ":first-child");
  return T.insert(() => w, ":first-child").attr("stroke-opacity", 0), T.insert(() => y, ":first-child"), T.attr("class", "text"), h && e.look !== "handDrawn" && T.selectAll("path").attr("style", h), n && e.look !== "handDrawn" && T.selectAll("path").attr("style", n), T.attr("transform", `translate(${-u}, 0)`), s.attr(
    "transform",
    `translate(${-o / 2 + (e.padding ?? 0) / 2 - (a.x - (a.left ?? 0))},${-l / 2 + (e.padding ?? 0) / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, T), e.intersect = function(E) {
    return St.polygon(e, f, E);
  }, i;
}
x(nB, "curlyBraceRight");
function ri(t, e, r, n = 100, i = 0, a = 180) {
  const s = [], o = i * Math.PI / 180, h = (a * Math.PI / 180 - o) / (n - 1);
  for (let d = 0; d < n; d++) {
    const f = o + d * h, p = t + r * Math.cos(f), g = e + r * Math.sin(f);
    s.push({ x: -p, y: -g });
  }
  return s;
}
x(ri, "generateCirclePoints");
async function iB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = a.width + (e.padding ?? 0), l = a.height + (e.padding ?? 0), u = Math.max(5, l * 0.1), { cssStyles: h } = e, d = [
    ...ri(o / 2, -l / 2, u, 30, -90, 0),
    { x: -o / 2 - u, y: u },
    ...ri(o / 2 + u * 2, -u, u, 20, -180, -270),
    ...ri(o / 2 + u * 2, u, u, 20, -90, -180),
    { x: -o / 2 - u, y: -l / 2 },
    ...ri(o / 2, l / 2, u, 20, 0, 90)
  ], f = [
    ...ri(-o / 2 + u + u / 2, -l / 2, u, 20, -90, -180),
    { x: o / 2 - u / 2, y: u },
    ...ri(-o / 2 - u / 2, -u, u, 20, 0, 90),
    ...ri(-o / 2 - u / 2, u, u, 20, -90, 0),
    { x: o / 2 - u / 2, y: -u },
    ...ri(-o / 2 + u + u / 2, l / 2, u, 30, -180, -270)
  ], p = [
    { x: o / 2, y: -l / 2 - u },
    { x: -o / 2, y: -l / 2 - u },
    ...ri(o / 2, -l / 2, u, 20, -90, 0),
    { x: -o / 2 - u, y: -u },
    ...ri(o / 2 + u * 2, -u, u, 20, -180, -270),
    ...ri(o / 2 + u * 2, u, u, 20, -90, -180),
    { x: -o / 2 - u, y: l / 2 },
    ...ri(o / 2, l / 2, u, 20, 0, 90),
    { x: -o / 2, y: l / 2 + u },
    { x: o / 2 - u - u / 2, y: l / 2 + u },
    ...ri(-o / 2 + u + u / 2, -l / 2, u, 20, -90, -180),
    { x: o / 2 - u / 2, y: u },
    ...ri(-o / 2 - u / 2, -u, u, 20, 0, 90),
    ...ri(-o / 2 - u / 2, u, u, 20, -90, 0),
    { x: o / 2 - u / 2, y: -u },
    ...ri(-o / 2 + u + u / 2, l / 2, u, 30, -180, -270)
  ], g = Rt.svg(i), m = Nt(e, { fill: "none" });
  e.look !== "handDrawn" && (m.roughness = 0, m.fillStyle = "solid");
  const y = ar(d).replace("Z", ""), b = g.path(y, m), T = ar(f).replace("Z", ""), E = g.path(T, m), C = ar(p), k = g.path(C, { ...m }), _ = i.insert("g", ":first-child");
  return _.insert(() => k, ":first-child").attr("stroke-opacity", 0), _.insert(() => b, ":first-child"), _.insert(() => E, ":first-child"), _.attr("class", "text"), h && e.look !== "handDrawn" && _.selectAll("path").attr("style", h), n && e.look !== "handDrawn" && _.selectAll("path").attr("style", n), _.attr("transform", `translate(${u - u / 4}, 0)`), s.attr(
    "transform",
    `translate(${-o / 2 + (e.padding ?? 0) / 2 - (a.x - (a.left ?? 0))},${-l / 2 + (e.padding ?? 0) / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, _), e.intersect = function(L) {
    return St.polygon(e, p, L);
  }, i;
}
x(iB, "curlyBraces");
async function aB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = 80, o = 20, l = Math.max(s, (a.width + (e.padding ?? 0) * 2) * 1.25, (e == null ? void 0 : e.width) ?? 0), u = Math.max(o, a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), h = u / 2, { cssStyles: d } = e, f = Rt.svg(i), p = Nt(e, {});
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = l, m = u, v = g - h, y = m / 4, b = [
    { x: v, y: 0 },
    { x: y, y: 0 },
    { x: 0, y: m / 2 },
    { x: y, y: m },
    { x: v, y: m },
    ...Kp(-v, -m / 2, h, 50, 270, 90)
  ], w = ar(b), T = f.path(w, p), E = i.insert(() => T, ":first-child");
  return E.attr("class", "basic label-container"), d && e.look !== "handDrawn" && E.selectChildren("path").attr("style", d), n && e.look !== "handDrawn" && E.selectChildren("path").attr("style", n), E.attr("transform", `translate(${-l / 2}, ${-u / 2})`), Mt(e, E), e.intersect = function(C) {
    return St.polygon(e, b, C);
  }, i;
}
x(aB, "curvedTrapezoid");
var soe = /* @__PURE__ */ x((t, e, r, n, i, a) => [
  `M${t},${e + a}`,
  `a${i},${a} 0,0,0 ${r},0`,
  `a${i},${a} 0,0,0 ${-r},0`,
  `l0,${n}`,
  `a${i},${a} 0,0,0 ${r},0`,
  `l0,${-n}`
].join(" "), "createCylinderPathD"), ooe = /* @__PURE__ */ x((t, e, r, n, i, a) => [
  `M${t},${e + a}`,
  `M${t + r},${e + a}`,
  `a${i},${a} 0,0,0 ${-r},0`,
  `l0,${n}`,
  `a${i},${a} 0,0,0 ${r},0`,
  `l0,${-n}`
].join(" "), "createOuterCylinderPathD"), loe = /* @__PURE__ */ x((t, e, r, n, i, a) => [`M${t - r / 2},${-n / 2}`, `a${i},${a} 0,0,0 ${r},0`].join(" "), "createInnerCylinderPathD");
async function sB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + e.padding, e.width ?? 0), l = o / 2, u = l / (2.5 + o / 50), h = Math.max(a.height + u + e.padding, e.height ?? 0);
  let d;
  const { cssStyles: f } = e;
  if (e.look === "handDrawn") {
    const p = Rt.svg(i), g = ooe(0, 0, o, h, l, u), m = loe(0, u, o, h, l, u), v = p.path(g, Nt(e, {})), y = p.path(m, Nt(e, { fill: "none" }));
    d = i.insert(() => y, ":first-child"), d = i.insert(() => v, ":first-child"), d.attr("class", "basic label-container"), f && d.attr("style", f);
  } else {
    const p = soe(0, 0, o, h, l, u);
    d = i.insert("path", ":first-child").attr("d", p).attr("class", "basic label-container").attr("style", Ci(f)).attr("style", n);
  }
  return d.attr("label-offset-y", u), d.attr("transform", `translate(${-o / 2}, ${-(h / 2 + u)})`), Mt(e, d), s.attr(
    "transform",
    `translate(${-(a.width / 2) - (a.x - (a.left ?? 0))}, ${-(a.height / 2) + (e.padding ?? 0) / 1.5 - (a.y - (a.top ?? 0))})`
  ), e.intersect = function(p) {
    const g = St.rect(e, p), m = g.x - (e.x ?? 0);
    if (l != 0 && (Math.abs(m) < (e.width ?? 0) / 2 || Math.abs(m) == (e.width ?? 0) / 2 && Math.abs(g.y - (e.y ?? 0)) > (e.height ?? 0) / 2 - u)) {
      let v = u * u * (1 - m * m / (l * l));
      v > 0 && (v = Math.sqrt(v)), v = u - v, p.y - (e.y ?? 0) > 0 && (v = -v), g.y += v;
    }
    return g;
  }, i;
}
x(sB, "cylinder");
async function oB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = a.width + e.padding, l = a.height + e.padding, u = l * 0.2, h = -o / 2, d = -l / 2 - u / 2, { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {});
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const m = [
    { x: h, y: d + u },
    { x: -h, y: d + u },
    { x: -h, y: -d },
    { x: h, y: -d },
    { x: h, y: d },
    { x: -h, y: d },
    { x: -h, y: d + u }
  ], v = p.polygon(
    m.map((b) => [b.x, b.y]),
    g
  ), y = i.insert(() => v, ":first-child");
  return y.attr("class", "basic label-container"), f && e.look !== "handDrawn" && y.selectAll("path").attr("style", f), n && e.look !== "handDrawn" && y.selectAll("path").attr("style", n), s.attr(
    "transform",
    `translate(${h + (e.padding ?? 0) / 2 - (a.x - (a.left ?? 0))}, ${d + u + (e.padding ?? 0) / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, y), e.intersect = function(b) {
    return St.rect(e, b);
  }, i;
}
x(oB, "dividedRectangle");
async function lB(t, e) {
  var f, p;
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, halfPadding: s } = await Ut(t, e, $t(e)), l = a.width / 2 + s + 5, u = a.width / 2 + s;
  let h;
  const { cssStyles: d } = e;
  if (e.look === "handDrawn") {
    const g = Rt.svg(i), m = Nt(e, { roughness: 0.2, strokeWidth: 2.5 }), v = Nt(e, { roughness: 0.2, strokeWidth: 1.5 }), y = g.circle(0, 0, l * 2, m), b = g.circle(0, 0, u * 2, v);
    h = i.insert("g", ":first-child"), h.attr("class", Ci(e.cssClasses)).attr("style", Ci(d)), (f = h.node()) == null || f.appendChild(y), (p = h.node()) == null || p.appendChild(b);
  } else {
    h = i.insert("g", ":first-child");
    const g = h.insert("circle", ":first-child"), m = h.insert("circle");
    h.attr("class", "basic label-container").attr("style", n), g.attr("class", "outer-circle").attr("style", n).attr("r", l).attr("cx", 0).attr("cy", 0), m.attr("class", "inner-circle").attr("style", n).attr("r", u).attr("cx", 0).attr("cy", 0);
  }
  return Mt(e, h), e.intersect = function(g) {
    return ae.info("DoubleCircle intersect", e, l, g), St.circle(e, l, g);
  }, i;
}
x(lB, "doublecircle");
function cB(t, e, { config: { themeVariables: r } }) {
  const { labelStyles: n, nodeStyles: i } = Ct(e);
  e.label = "", e.labelStyle = n;
  const a = t.insert("g").attr("class", $t(e)).attr("id", e.domId ?? e.id), s = 7, { cssStyles: o } = e, l = Rt.svg(a), { nodeBorder: u } = r, h = Nt(e, { fillStyle: "solid" });
  e.look !== "handDrawn" && (h.roughness = 0);
  const d = l.circle(0, 0, s * 2, h), f = a.insert(() => d, ":first-child");
  return f.selectAll("path").attr("style", `fill: ${u} !important;`), o && o.length > 0 && e.look !== "handDrawn" && f.selectAll("path").attr("style", o), i && e.look !== "handDrawn" && f.selectAll("path").attr("style", i), Mt(e, f), e.intersect = function(p) {
    return ae.info("filledCircle intersect", e, { radius: s, point: p }), St.circle(e, s, p);
  }, a;
}
x(cB, "filledCircle");
async function uB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = a.width + (e.padding ?? 0), l = o + a.height, u = o + a.height, h = [
    { x: 0, y: -l },
    { x: u, y: -l },
    { x: u / 2, y: 0 }
  ], { cssStyles: d } = e, f = Rt.svg(i), p = Nt(e, {});
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = ar(h), m = f.path(g, p), v = i.insert(() => m, ":first-child").attr("transform", `translate(${-l / 2}, ${l / 2})`);
  return d && e.look !== "handDrawn" && v.selectChildren("path").attr("style", d), n && e.look !== "handDrawn" && v.selectChildren("path").attr("style", n), e.width = o, e.height = l, Mt(e, v), s.attr(
    "transform",
    `translate(${-a.width / 2 - (a.x - (a.left ?? 0))}, ${-l / 2 + (e.padding ?? 0) / 2 + (a.y - (a.top ?? 0))})`
  ), e.intersect = function(y) {
    return ae.info("Triangle intersect", e, h, y), St.polygon(e, h, y);
  }, i;
}
x(uB, "flippedTriangle");
function hB(t, e, { dir: r, config: { state: n, themeVariables: i } }) {
  const { nodeStyles: a } = Ct(e);
  e.label = "";
  const s = t.insert("g").attr("class", $t(e)).attr("id", e.domId ?? e.id), { cssStyles: o } = e;
  let l = Math.max(70, (e == null ? void 0 : e.width) ?? 0), u = Math.max(10, (e == null ? void 0 : e.height) ?? 0);
  r === "LR" && (l = Math.max(10, (e == null ? void 0 : e.width) ?? 0), u = Math.max(70, (e == null ? void 0 : e.height) ?? 0));
  const h = -1 * l / 2, d = -1 * u / 2, f = Rt.svg(s), p = Nt(e, {
    stroke: i.lineColor,
    fill: i.lineColor
  });
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = f.rectangle(h, d, l, u, p), m = s.insert(() => g, ":first-child");
  o && e.look !== "handDrawn" && m.selectAll("path").attr("style", o), a && e.look !== "handDrawn" && m.selectAll("path").attr("style", a), Mt(e, m);
  const v = (n == null ? void 0 : n.padding) ?? 0;
  return e.width && e.height && (e.width += v / 2 || 0, e.height += v / 2 || 0), e.intersect = function(y) {
    return St.rect(e, y);
  }, s;
}
x(hB, "forkJoin");
async function dB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const i = 80, a = 50, { shapeSvg: s, bbox: o } = await Ut(t, e, $t(e)), l = Math.max(i, o.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), u = Math.max(a, o.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), h = u / 2, { cssStyles: d } = e, f = Rt.svg(s), p = Nt(e, {});
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = [
    { x: -l / 2, y: -u / 2 },
    { x: l / 2 - h, y: -u / 2 },
    ...Kp(-l / 2 + h, 0, h, 50, 90, 270),
    { x: l / 2 - h, y: u / 2 },
    { x: -l / 2, y: u / 2 }
  ], m = ar(g), v = f.path(m, p), y = s.insert(() => v, ":first-child");
  return y.attr("class", "basic label-container"), d && e.look !== "handDrawn" && y.selectChildren("path").attr("style", d), n && e.look !== "handDrawn" && y.selectChildren("path").attr("style", n), Mt(e, y), e.intersect = function(b) {
    return ae.info("Pill intersect", e, { radius: h, point: b }), St.polygon(e, g, b);
  }, s;
}
x(dB, "halfRoundedRectangle");
async function fB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = a.height + (e.padding ?? 0), o = a.width + (e.padding ?? 0) * 2.5, { cssStyles: l } = e, u = Rt.svg(i), h = Nt(e, {});
  e.look !== "handDrawn" && (h.roughness = 0, h.fillStyle = "solid");
  let d = o / 2;
  const f = d / 6;
  d = d + f;
  const p = s / 2, g = p / 2, m = d - g, v = [
    { x: -m, y: -p },
    { x: 0, y: -p },
    { x: m, y: -p },
    { x: d, y: 0 },
    { x: m, y: p },
    { x: 0, y: p },
    { x: -m, y: p },
    { x: -d, y: 0 }
  ], y = ar(v), b = u.path(y, h), w = i.insert(() => b, ":first-child");
  return w.attr("class", "basic label-container"), l && e.look !== "handDrawn" && w.selectChildren("path").attr("style", l), n && e.look !== "handDrawn" && w.selectChildren("path").attr("style", n), e.width = o, e.height = s, Mt(e, w), e.intersect = function(T) {
    return St.polygon(e, v, T);
  }, i;
}
x(fB, "hexagon");
async function pB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.label = "", e.labelStyle = r;
  const { shapeSvg: i } = await Ut(t, e, $t(e)), a = Math.max(30, (e == null ? void 0 : e.width) ?? 0), s = Math.max(30, (e == null ? void 0 : e.height) ?? 0), { cssStyles: o } = e, l = Rt.svg(i), u = Nt(e, {});
  e.look !== "handDrawn" && (u.roughness = 0, u.fillStyle = "solid");
  const h = [
    { x: 0, y: 0 },
    { x: a, y: 0 },
    { x: 0, y: s },
    { x: a, y: s }
  ], d = ar(h), f = l.path(d, u), p = i.insert(() => f, ":first-child");
  return p.attr("class", "basic label-container"), o && e.look !== "handDrawn" && p.selectChildren("path").attr("style", o), n && e.look !== "handDrawn" && p.selectChildren("path").attr("style", n), p.attr("transform", `translate(${-a / 2}, ${-s / 2})`), Mt(e, p), e.intersect = function(g) {
    return ae.info("Pill intersect", e, { points: h }), St.polygon(e, h, g);
  }, i;
}
x(pB, "hourglass");
async function gB(t, e, { config: { themeVariables: r, flowchart: n } }) {
  const { labelStyles: i } = Ct(e);
  e.labelStyle = i;
  const a = e.assetHeight ?? 48, s = e.assetWidth ?? 48, o = Math.max(a, s), l = n == null ? void 0 : n.wrappingWidth;
  e.width = Math.max(o, l ?? 0);
  const { shapeSvg: u, bbox: h, label: d } = await Ut(t, e, "icon-shape default"), f = e.pos === "t", p = o, g = o, { nodeBorder: m } = r, { stylesMap: v } = Tf(e), y = -g / 2, b = -p / 2, w = e.label ? 8 : 0, T = Rt.svg(u), E = Nt(e, { stroke: "none", fill: "none" });
  e.look !== "handDrawn" && (E.roughness = 0, E.fillStyle = "solid");
  const C = T.rectangle(y, b, g, p, E), k = Math.max(g, h.width), _ = p + h.height + w, L = T.rectangle(-k / 2, -_ / 2, k, _, {
    ...E,
    fill: "transparent",
    stroke: "none"
  }), N = u.insert(() => C, ":first-child"), A = u.insert(() => L);
  if (e.icon) {
    const O = u.append("g");
    O.html(
      `<g>${await Pl(e.icon, {
        height: o,
        width: o,
        fallbackPrefix: ""
      })}</g>`
    );
    const P = O.node().getBBox(), S = P.width, R = P.height, I = P.x, D = P.y;
    O.attr(
      "transform",
      `translate(${-S / 2 - I},${f ? h.height / 2 + w / 2 - R / 2 - D : -h.height / 2 - w / 2 - R / 2 - D})`
    ), O.attr("style", `color: ${v.get("stroke") ?? m};`);
  }
  return d.attr(
    "transform",
    `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${f ? -_ / 2 : _ / 2 - h.height})`
  ), N.attr(
    "transform",
    `translate(0,${f ? h.height / 2 + w / 2 : -h.height / 2 - w / 2})`
  ), Mt(e, A), e.intersect = function(O) {
    if (ae.info("iconSquare intersect", e, O), !e.label)
      return St.rect(e, O);
    const P = e.x ?? 0, S = e.y ?? 0, R = e.height ?? 0;
    let I = [];
    return f ? I = [
      { x: P - h.width / 2, y: S - R / 2 },
      { x: P + h.width / 2, y: S - R / 2 },
      { x: P + h.width / 2, y: S - R / 2 + h.height + w },
      { x: P + g / 2, y: S - R / 2 + h.height + w },
      { x: P + g / 2, y: S + R / 2 },
      { x: P - g / 2, y: S + R / 2 },
      { x: P - g / 2, y: S - R / 2 + h.height + w },
      { x: P - h.width / 2, y: S - R / 2 + h.height + w }
    ] : I = [
      { x: P - g / 2, y: S - R / 2 },
      { x: P + g / 2, y: S - R / 2 },
      { x: P + g / 2, y: S - R / 2 + p },
      { x: P + h.width / 2, y: S - R / 2 + p },
      { x: P + h.width / 2 / 2, y: S + R / 2 },
      { x: P - h.width / 2, y: S + R / 2 },
      { x: P - h.width / 2, y: S - R / 2 + p },
      { x: P - g / 2, y: S - R / 2 + p }
    ], St.polygon(e, I, O);
  }, u;
}
x(gB, "icon");
async function mB(t, e, { config: { themeVariables: r, flowchart: n } }) {
  const { labelStyles: i } = Ct(e);
  e.labelStyle = i;
  const a = e.assetHeight ?? 48, s = e.assetWidth ?? 48, o = Math.max(a, s), l = n == null ? void 0 : n.wrappingWidth;
  e.width = Math.max(o, l ?? 0);
  const { shapeSvg: u, bbox: h, label: d } = await Ut(t, e, "icon-shape default"), f = 20, p = e.label ? 8 : 0, g = e.pos === "t", { nodeBorder: m, mainBkg: v } = r, { stylesMap: y } = Tf(e), b = Rt.svg(u), w = Nt(e, {});
  e.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
  const T = y.get("fill");
  w.stroke = T ?? v;
  const E = u.append("g");
  e.icon && E.html(
    `<g>${await Pl(e.icon, {
      height: o,
      width: o,
      fallbackPrefix: ""
    })}</g>`
  );
  const C = E.node().getBBox(), k = C.width, _ = C.height, L = C.x, N = C.y, A = Math.max(k, _) * Math.SQRT2 + f * 2, O = b.circle(0, 0, A, w), P = Math.max(A, h.width), S = A + h.height + p, R = b.rectangle(-P / 2, -S / 2, P, S, {
    ...w,
    fill: "transparent",
    stroke: "none"
  }), I = u.insert(() => O, ":first-child"), D = u.insert(() => R);
  return E.attr(
    "transform",
    `translate(${-k / 2 - L},${g ? h.height / 2 + p / 2 - _ / 2 - N : -h.height / 2 - p / 2 - _ / 2 - N})`
  ), E.attr("style", `color: ${y.get("stroke") ?? m};`), d.attr(
    "transform",
    `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${g ? -S / 2 : S / 2 - h.height})`
  ), I.attr(
    "transform",
    `translate(0,${g ? h.height / 2 + p / 2 : -h.height / 2 - p / 2})`
  ), Mt(e, D), e.intersect = function(M) {
    return ae.info("iconSquare intersect", e, M), St.rect(e, M);
  }, u;
}
x(mB, "iconCircle");
async function vB(t, e, { config: { themeVariables: r, flowchart: n } }) {
  const { labelStyles: i } = Ct(e);
  e.labelStyle = i;
  const a = e.assetHeight ?? 48, s = e.assetWidth ?? 48, o = Math.max(a, s), l = n == null ? void 0 : n.wrappingWidth;
  e.width = Math.max(o, l ?? 0);
  const { shapeSvg: u, bbox: h, halfPadding: d, label: f } = await Ut(
    t,
    e,
    "icon-shape default"
  ), p = e.pos === "t", g = o + d * 2, m = o + d * 2, { nodeBorder: v, mainBkg: y } = r, { stylesMap: b } = Tf(e), w = -m / 2, T = -g / 2, E = e.label ? 8 : 0, C = Rt.svg(u), k = Nt(e, {});
  e.look !== "handDrawn" && (k.roughness = 0, k.fillStyle = "solid");
  const _ = b.get("fill");
  k.stroke = _ ?? y;
  const L = C.path(nc(w, T, m, g, 5), k), N = Math.max(m, h.width), A = g + h.height + E, O = C.rectangle(-N / 2, -A / 2, N, A, {
    ...k,
    fill: "transparent",
    stroke: "none"
  }), P = u.insert(() => L, ":first-child").attr("class", "icon-shape2"), S = u.insert(() => O);
  if (e.icon) {
    const R = u.append("g");
    R.html(
      `<g>${await Pl(e.icon, {
        height: o,
        width: o,
        fallbackPrefix: ""
      })}</g>`
    );
    const I = R.node().getBBox(), D = I.width, M = I.height, B = I.x, $ = I.y;
    R.attr(
      "transform",
      `translate(${-D / 2 - B},${p ? h.height / 2 + E / 2 - M / 2 - $ : -h.height / 2 - E / 2 - M / 2 - $})`
    ), R.attr("style", `color: ${b.get("stroke") ?? v};`);
  }
  return f.attr(
    "transform",
    `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${p ? -A / 2 : A / 2 - h.height})`
  ), P.attr(
    "transform",
    `translate(0,${p ? h.height / 2 + E / 2 : -h.height / 2 - E / 2})`
  ), Mt(e, S), e.intersect = function(R) {
    if (ae.info("iconSquare intersect", e, R), !e.label)
      return St.rect(e, R);
    const I = e.x ?? 0, D = e.y ?? 0, M = e.height ?? 0;
    let B = [];
    return p ? B = [
      { x: I - h.width / 2, y: D - M / 2 },
      { x: I + h.width / 2, y: D - M / 2 },
      { x: I + h.width / 2, y: D - M / 2 + h.height + E },
      { x: I + m / 2, y: D - M / 2 + h.height + E },
      { x: I + m / 2, y: D + M / 2 },
      { x: I - m / 2, y: D + M / 2 },
      { x: I - m / 2, y: D - M / 2 + h.height + E },
      { x: I - h.width / 2, y: D - M / 2 + h.height + E }
    ] : B = [
      { x: I - m / 2, y: D - M / 2 },
      { x: I + m / 2, y: D - M / 2 },
      { x: I + m / 2, y: D - M / 2 + g },
      { x: I + h.width / 2, y: D - M / 2 + g },
      { x: I + h.width / 2 / 2, y: D + M / 2 },
      { x: I - h.width / 2, y: D + M / 2 },
      { x: I - h.width / 2, y: D - M / 2 + g },
      { x: I - m / 2, y: D - M / 2 + g }
    ], St.polygon(e, B, R);
  }, u;
}
x(vB, "iconRounded");
async function yB(t, e, { config: { themeVariables: r, flowchart: n } }) {
  const { labelStyles: i } = Ct(e);
  e.labelStyle = i;
  const a = e.assetHeight ?? 48, s = e.assetWidth ?? 48, o = Math.max(a, s), l = n == null ? void 0 : n.wrappingWidth;
  e.width = Math.max(o, l ?? 0);
  const { shapeSvg: u, bbox: h, halfPadding: d, label: f } = await Ut(
    t,
    e,
    "icon-shape default"
  ), p = e.pos === "t", g = o + d * 2, m = o + d * 2, { nodeBorder: v, mainBkg: y } = r, { stylesMap: b } = Tf(e), w = -m / 2, T = -g / 2, E = e.label ? 8 : 0, C = Rt.svg(u), k = Nt(e, {});
  e.look !== "handDrawn" && (k.roughness = 0, k.fillStyle = "solid");
  const _ = b.get("fill");
  k.stroke = _ ?? y;
  const L = C.path(nc(w, T, m, g, 0.1), k), N = Math.max(m, h.width), A = g + h.height + E, O = C.rectangle(-N / 2, -A / 2, N, A, {
    ...k,
    fill: "transparent",
    stroke: "none"
  }), P = u.insert(() => L, ":first-child"), S = u.insert(() => O);
  if (e.icon) {
    const R = u.append("g");
    R.html(
      `<g>${await Pl(e.icon, {
        height: o,
        width: o,
        fallbackPrefix: ""
      })}</g>`
    );
    const I = R.node().getBBox(), D = I.width, M = I.height, B = I.x, $ = I.y;
    R.attr(
      "transform",
      `translate(${-D / 2 - B},${p ? h.height / 2 + E / 2 - M / 2 - $ : -h.height / 2 - E / 2 - M / 2 - $})`
    ), R.attr("style", `color: ${b.get("stroke") ?? v};`);
  }
  return f.attr(
    "transform",
    `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${p ? -A / 2 : A / 2 - h.height})`
  ), P.attr(
    "transform",
    `translate(0,${p ? h.height / 2 + E / 2 : -h.height / 2 - E / 2})`
  ), Mt(e, S), e.intersect = function(R) {
    if (ae.info("iconSquare intersect", e, R), !e.label)
      return St.rect(e, R);
    const I = e.x ?? 0, D = e.y ?? 0, M = e.height ?? 0;
    let B = [];
    return p ? B = [
      { x: I - h.width / 2, y: D - M / 2 },
      { x: I + h.width / 2, y: D - M / 2 },
      { x: I + h.width / 2, y: D - M / 2 + h.height + E },
      { x: I + m / 2, y: D - M / 2 + h.height + E },
      { x: I + m / 2, y: D + M / 2 },
      { x: I - m / 2, y: D + M / 2 },
      { x: I - m / 2, y: D - M / 2 + h.height + E },
      { x: I - h.width / 2, y: D - M / 2 + h.height + E }
    ] : B = [
      { x: I - m / 2, y: D - M / 2 },
      { x: I + m / 2, y: D - M / 2 },
      { x: I + m / 2, y: D - M / 2 + g },
      { x: I + h.width / 2, y: D - M / 2 + g },
      { x: I + h.width / 2 / 2, y: D + M / 2 },
      { x: I - h.width / 2, y: D + M / 2 },
      { x: I - h.width / 2, y: D - M / 2 + g },
      { x: I - m / 2, y: D - M / 2 + g }
    ], St.polygon(e, B, R);
  }, u;
}
x(yB, "iconSquare");
async function xB(t, e, { config: { flowchart: r } }) {
  const n = new Image();
  n.src = (e == null ? void 0 : e.img) ?? "", await n.decode();
  const i = Number(n.naturalWidth.toString().replace("px", "")), a = Number(n.naturalHeight.toString().replace("px", ""));
  e.imageAspectRatio = i / a;
  const { labelStyles: s } = Ct(e);
  e.labelStyle = s;
  const o = r == null ? void 0 : r.wrappingWidth;
  e.defaultWidth = r == null ? void 0 : r.wrappingWidth;
  const l = Math.max(
    e.label ? o ?? 0 : 0,
    (e == null ? void 0 : e.assetWidth) ?? i
  ), u = e.constraint === "on" && e != null && e.assetHeight ? e.assetHeight * e.imageAspectRatio : l, h = e.constraint === "on" ? u / e.imageAspectRatio : (e == null ? void 0 : e.assetHeight) ?? a;
  e.width = Math.max(u, o ?? 0);
  const { shapeSvg: d, bbox: f, label: p } = await Ut(t, e, "image-shape default"), g = e.pos === "t", m = -u / 2, v = -h / 2, y = e.label ? 8 : 0, b = Rt.svg(d), w = Nt(e, {});
  e.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
  const T = b.rectangle(m, v, u, h, w), E = Math.max(u, f.width), C = h + f.height + y, k = b.rectangle(-E / 2, -C / 2, E, C, {
    ...w,
    fill: "none",
    stroke: "none"
  }), _ = d.insert(() => T, ":first-child"), L = d.insert(() => k);
  if (e.img) {
    const N = d.append("image");
    N.attr("href", e.img), N.attr("width", u), N.attr("height", h), N.attr("preserveAspectRatio", "none"), N.attr(
      "transform",
      `translate(${-u / 2},${g ? C / 2 - h : -C / 2})`
    );
  }
  return p.attr(
    "transform",
    `translate(${-f.width / 2 - (f.x - (f.left ?? 0))},${g ? -h / 2 - f.height / 2 - y / 2 : h / 2 - f.height / 2 + y / 2})`
  ), _.attr(
    "transform",
    `translate(0,${g ? f.height / 2 + y / 2 : -f.height / 2 - y / 2})`
  ), Mt(e, L), e.intersect = function(N) {
    if (ae.info("iconSquare intersect", e, N), !e.label)
      return St.rect(e, N);
    const A = e.x ?? 0, O = e.y ?? 0, P = e.height ?? 0;
    let S = [];
    return g ? S = [
      { x: A - f.width / 2, y: O - P / 2 },
      { x: A + f.width / 2, y: O - P / 2 },
      { x: A + f.width / 2, y: O - P / 2 + f.height + y },
      { x: A + u / 2, y: O - P / 2 + f.height + y },
      { x: A + u / 2, y: O + P / 2 },
      { x: A - u / 2, y: O + P / 2 },
      { x: A - u / 2, y: O - P / 2 + f.height + y },
      { x: A - f.width / 2, y: O - P / 2 + f.height + y }
    ] : S = [
      { x: A - u / 2, y: O - P / 2 },
      { x: A + u / 2, y: O - P / 2 },
      { x: A + u / 2, y: O - P / 2 + h },
      { x: A + f.width / 2, y: O - P / 2 + h },
      { x: A + f.width / 2 / 2, y: O + P / 2 },
      { x: A - f.width / 2, y: O + P / 2 },
      { x: A - f.width / 2, y: O - P / 2 + h },
      { x: A - u / 2, y: O - P / 2 + h }
    ], St.polygon(e, S, N);
  }, d;
}
x(xB, "imageSquare");
async function bB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), o = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), l = [
    { x: 0, y: 0 },
    { x: s, y: 0 },
    { x: s + 3 * o / 6, y: -o },
    { x: -3 * o / 6, y: -o }
  ];
  let u;
  const { cssStyles: h } = e;
  if (e.look === "handDrawn") {
    const d = Rt.svg(i), f = Nt(e, {}), p = ar(l), g = d.path(p, f);
    u = i.insert(() => g, ":first-child").attr("transform", `translate(${-s / 2}, ${o / 2})`), h && u.attr("style", h);
  } else
    u = ic(i, s, o, l);
  return n && u.attr("style", n), e.width = s, e.height = o, Mt(e, u), e.intersect = function(d) {
    return St.polygon(e, l, d);
  }, i;
}
x(bB, "inv_trapezoid");
async function lx(t, e, r) {
  const { labelStyles: n, nodeStyles: i } = Ct(e);
  e.labelStyle = n;
  const { shapeSvg: a, bbox: s } = await Ut(t, e, $t(e)), o = Math.max(s.width + r.labelPaddingX * 2, (e == null ? void 0 : e.width) || 0), l = Math.max(s.height + r.labelPaddingY * 2, (e == null ? void 0 : e.height) || 0), u = -o / 2, h = -l / 2;
  let d, { rx: f, ry: p } = e;
  const { cssStyles: g } = e;
  if (r != null && r.rx && r.ry && (f = r.rx, p = r.ry), e.look === "handDrawn") {
    const m = Rt.svg(a), v = Nt(e, {}), y = f || p ? m.path(nc(u, h, o, l, f || 0), v) : m.rectangle(u, h, o, l, v);
    d = a.insert(() => y, ":first-child"), d.attr("class", "basic label-container").attr("style", Ci(g));
  } else
    d = a.insert("rect", ":first-child"), d.attr("class", "basic label-container").attr("style", i).attr("rx", Ci(f)).attr("ry", Ci(p)).attr("x", u).attr("y", h).attr("width", o).attr("height", l);
  return Mt(e, d), e.calcIntersect = function(m, v) {
    return St.rect(m, v);
  }, e.intersect = function(m) {
    return St.rect(e, m);
  }, a;
}
x(lx, "drawRect");
async function wB(t, e) {
  const { shapeSvg: r, bbox: n, label: i } = await Ut(t, e, "label"), a = r.insert("rect", ":first-child");
  return a.attr("width", 0.1).attr("height", 0.1), r.attr("class", "label edgeLabel"), i.attr(
    "transform",
    `translate(${-(n.width / 2) - (n.x - (n.left ?? 0))}, ${-(n.height / 2) - (n.y - (n.top ?? 0))})`
  ), Mt(e, a), e.intersect = function(l) {
    return St.rect(e, l);
  }, r;
}
x(wB, "labelRect");
async function TB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = Math.max(a.width + (e.padding ?? 0), (e == null ? void 0 : e.width) ?? 0), o = Math.max(a.height + (e.padding ?? 0), (e == null ? void 0 : e.height) ?? 0), l = [
    { x: 0, y: 0 },
    { x: s + 3 * o / 6, y: 0 },
    { x: s, y: -o },
    { x: -(3 * o) / 6, y: -o }
  ];
  let u;
  const { cssStyles: h } = e;
  if (e.look === "handDrawn") {
    const d = Rt.svg(i), f = Nt(e, {}), p = ar(l), g = d.path(p, f);
    u = i.insert(() => g, ":first-child").attr("transform", `translate(${-s / 2}, ${o / 2})`), h && u.attr("style", h);
  } else
    u = ic(i, s, o, l);
  return n && u.attr("style", n), e.width = s, e.height = o, Mt(e, u), e.intersect = function(d) {
    return St.polygon(e, l, d);
  }, i;
}
x(TB, "lean_left");
async function EB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = Math.max(a.width + (e.padding ?? 0), (e == null ? void 0 : e.width) ?? 0), o = Math.max(a.height + (e.padding ?? 0), (e == null ? void 0 : e.height) ?? 0), l = [
    { x: -3 * o / 6, y: 0 },
    { x: s, y: 0 },
    { x: s + 3 * o / 6, y: -o },
    { x: 0, y: -o }
  ];
  let u;
  const { cssStyles: h } = e;
  if (e.look === "handDrawn") {
    const d = Rt.svg(i), f = Nt(e, {}), p = ar(l), g = d.path(p, f);
    u = i.insert(() => g, ":first-child").attr("transform", `translate(${-s / 2}, ${o / 2})`), h && u.attr("style", h);
  } else
    u = ic(i, s, o, l);
  return n && u.attr("style", n), e.width = s, e.height = o, Mt(e, u), e.intersect = function(d) {
    return St.polygon(e, l, d);
  }, i;
}
x(EB, "lean_right");
function kB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.label = "", e.labelStyle = r;
  const i = t.insert("g").attr("class", $t(e)).attr("id", e.domId ?? e.id), { cssStyles: a } = e, s = Math.max(35, (e == null ? void 0 : e.width) ?? 0), o = Math.max(35, (e == null ? void 0 : e.height) ?? 0), l = 7, u = [
    { x: s, y: 0 },
    { x: 0, y: o + l / 2 },
    { x: s - 2 * l, y: o + l / 2 },
    { x: 0, y: 2 * o },
    { x: s, y: o - l / 2 },
    { x: 2 * l, y: o - l / 2 }
  ], h = Rt.svg(i), d = Nt(e, {});
  e.look !== "handDrawn" && (d.roughness = 0, d.fillStyle = "solid");
  const f = ar(u), p = h.path(f, d), g = i.insert(() => p, ":first-child");
  return a && e.look !== "handDrawn" && g.selectAll("path").attr("style", a), n && e.look !== "handDrawn" && g.selectAll("path").attr("style", n), g.attr("transform", `translate(-${s / 2},${-o})`), Mt(e, g), e.intersect = function(m) {
    return ae.info("lightningBolt intersect", e, m), St.polygon(e, u, m);
  }, i;
}
x(kB, "lightningBolt");
var coe = /* @__PURE__ */ x((t, e, r, n, i, a, s) => [
  `M${t},${e + a}`,
  `a${i},${a} 0,0,0 ${r},0`,
  `a${i},${a} 0,0,0 ${-r},0`,
  `l0,${n}`,
  `a${i},${a} 0,0,0 ${r},0`,
  `l0,${-n}`,
  `M${t},${e + a + s}`,
  `a${i},${a} 0,0,0 ${r},0`
].join(" "), "createCylinderPathD"), uoe = /* @__PURE__ */ x((t, e, r, n, i, a, s) => [
  `M${t},${e + a}`,
  `M${t + r},${e + a}`,
  `a${i},${a} 0,0,0 ${-r},0`,
  `l0,${n}`,
  `a${i},${a} 0,0,0 ${r},0`,
  `l0,${-n}`,
  `M${t},${e + a + s}`,
  `a${i},${a} 0,0,0 ${r},0`
].join(" "), "createOuterCylinderPathD"), hoe = /* @__PURE__ */ x((t, e, r, n, i, a) => [`M${t - r / 2},${-n / 2}`, `a${i},${a} 0,0,0 ${r},0`].join(" "), "createInnerCylinderPathD");
async function SB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0), e.width ?? 0), l = o / 2, u = l / (2.5 + o / 50), h = Math.max(a.height + u + (e.padding ?? 0), e.height ?? 0), d = h * 0.1;
  let f;
  const { cssStyles: p } = e;
  if (e.look === "handDrawn") {
    const g = Rt.svg(i), m = uoe(0, 0, o, h, l, u, d), v = hoe(0, u, o, h, l, u), y = Nt(e, {}), b = g.path(m, y), w = g.path(v, y);
    i.insert(() => w, ":first-child").attr("class", "line"), f = i.insert(() => b, ":first-child"), f.attr("class", "basic label-container"), p && f.attr("style", p);
  } else {
    const g = coe(0, 0, o, h, l, u, d);
    f = i.insert("path", ":first-child").attr("d", g).attr("class", "basic label-container").attr("style", Ci(p)).attr("style", n);
  }
  return f.attr("label-offset-y", u), f.attr("transform", `translate(${-o / 2}, ${-(h / 2 + u)})`), Mt(e, f), s.attr(
    "transform",
    `translate(${-(a.width / 2) - (a.x - (a.left ?? 0))}, ${-(a.height / 2) + u - (a.y - (a.top ?? 0))})`
  ), e.intersect = function(g) {
    const m = St.rect(e, g), v = m.x - (e.x ?? 0);
    if (l != 0 && (Math.abs(v) < (e.width ?? 0) / 2 || Math.abs(v) == (e.width ?? 0) / 2 && Math.abs(m.y - (e.y ?? 0)) > (e.height ?? 0) / 2 - u)) {
      let y = u * u * (1 - v * v / (l * l));
      y > 0 && (y = Math.sqrt(y)), y = u - y, g.y - (e.y ?? 0) > 0 && (y = -y), m.y += y;
    }
    return m;
  }, i;
}
x(SB, "linedCylinder");
async function CB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = l / 4, h = l + u, { cssStyles: d } = e, f = Rt.svg(i), p = Nt(e, {});
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = [
    { x: -o / 2 - o / 2 * 0.1, y: -h / 2 },
    { x: -o / 2 - o / 2 * 0.1, y: h / 2 },
    ...Fl(
      -o / 2 - o / 2 * 0.1,
      h / 2,
      o / 2 + o / 2 * 0.1,
      h / 2,
      u,
      0.8
    ),
    { x: o / 2 + o / 2 * 0.1, y: -h / 2 },
    { x: -o / 2 - o / 2 * 0.1, y: -h / 2 },
    { x: -o / 2, y: -h / 2 },
    { x: -o / 2, y: h / 2 * 1.1 },
    { x: -o / 2, y: -h / 2 }
  ], m = f.polygon(
    g.map((y) => [y.x, y.y]),
    p
  ), v = i.insert(() => m, ":first-child");
  return v.attr("class", "basic label-container"), d && e.look !== "handDrawn" && v.selectAll("path").attr("style", d), n && e.look !== "handDrawn" && v.selectAll("path").attr("style", n), v.attr("transform", `translate(0,${-u / 2})`), s.attr(
    "transform",
    `translate(${-o / 2 + (e.padding ?? 0) + o / 2 * 0.1 / 2 - (a.x - (a.left ?? 0))},${-l / 2 + (e.padding ?? 0) - u / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, v), e.intersect = function(y) {
    return St.polygon(e, g, y);
  }, i;
}
x(CB, "linedWaveEdgedRect");
async function AB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = 5, h = -o / 2, d = -l / 2, { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {}), m = [
    { x: h - u, y: d + u },
    { x: h - u, y: d + l + u },
    { x: h + o - u, y: d + l + u },
    { x: h + o - u, y: d + l },
    { x: h + o, y: d + l },
    { x: h + o, y: d + l - u },
    { x: h + o + u, y: d + l - u },
    { x: h + o + u, y: d - u },
    { x: h + u, y: d - u },
    { x: h + u, y: d },
    { x: h, y: d },
    { x: h, y: d + u }
  ], v = [
    { x: h, y: d + u },
    { x: h + o - u, y: d + u },
    { x: h + o - u, y: d + l },
    { x: h + o, y: d + l },
    { x: h + o, y: d },
    { x: h, y: d }
  ];
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const y = ar(m), b = p.path(y, g), w = ar(v), T = p.path(w, { ...g, fill: "none" }), E = i.insert(() => T, ":first-child");
  return E.insert(() => b, ":first-child"), E.attr("class", "basic label-container"), f && e.look !== "handDrawn" && E.selectAll("path").attr("style", f), n && e.look !== "handDrawn" && E.selectAll("path").attr("style", n), s.attr(
    "transform",
    `translate(${-(a.width / 2) - u - (a.x - (a.left ?? 0))}, ${-(a.height / 2) + u - (a.y - (a.top ?? 0))})`
  ), Mt(e, E), e.intersect = function(C) {
    return St.polygon(e, m, C);
  }, i;
}
x(AB, "multiRect");
async function _B(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = l / 4, h = l + u, d = -o / 2, f = -h / 2, p = 5, { cssStyles: g } = e, m = Fl(
    d - p,
    f + h + p,
    d + o - p,
    f + h + p,
    u,
    0.8
  ), v = m == null ? void 0 : m[m.length - 1], y = [
    { x: d - p, y: f + p },
    { x: d - p, y: f + h + p },
    ...m,
    { x: d + o - p, y: v.y - p },
    { x: d + o, y: v.y - p },
    { x: d + o, y: v.y - 2 * p },
    { x: d + o + p, y: v.y - 2 * p },
    { x: d + o + p, y: f - p },
    { x: d + p, y: f - p },
    { x: d + p, y: f },
    { x: d, y: f },
    { x: d, y: f + p }
  ], b = [
    { x: d, y: f + p },
    { x: d + o - p, y: f + p },
    { x: d + o - p, y: v.y - p },
    { x: d + o, y: v.y - p },
    { x: d + o, y: f },
    { x: d, y: f }
  ], w = Rt.svg(i), T = Nt(e, {});
  e.look !== "handDrawn" && (T.roughness = 0, T.fillStyle = "solid");
  const E = ar(y), C = w.path(E, T), k = ar(b), _ = w.path(k, T), L = i.insert(() => C, ":first-child");
  return L.insert(() => _), L.attr("class", "basic label-container"), g && e.look !== "handDrawn" && L.selectAll("path").attr("style", g), n && e.look !== "handDrawn" && L.selectAll("path").attr("style", n), L.attr("transform", `translate(0,${-u / 2})`), s.attr(
    "transform",
    `translate(${-(a.width / 2) - p - (a.x - (a.left ?? 0))}, ${-(a.height / 2) + p - u / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, L), e.intersect = function(N) {
    return St.polygon(e, y, N);
  }, i;
}
x(_B, "multiWaveEdgedRectangle");
async function LB(t, e, { config: { themeVariables: r } }) {
  var b;
  const { labelStyles: n, nodeStyles: i } = Ct(e);
  e.labelStyle = n, e.useHtmlLabels || ((b = gr().flowchart) == null ? void 0 : b.htmlLabels) !== !1 || (e.centerLabel = !0);
  const { shapeSvg: s, bbox: o, label: l } = await Ut(t, e, $t(e)), u = Math.max(o.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), h = Math.max(o.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), d = -u / 2, f = -h / 2, { cssStyles: p } = e, g = Rt.svg(s), m = Nt(e, {
    fill: r.noteBkgColor,
    stroke: r.noteBorderColor
  });
  e.look !== "handDrawn" && (m.roughness = 0, m.fillStyle = "solid");
  const v = g.rectangle(d, f, u, h, m), y = s.insert(() => v, ":first-child");
  return y.attr("class", "basic label-container"), p && e.look !== "handDrawn" && y.selectAll("path").attr("style", p), i && e.look !== "handDrawn" && y.selectAll("path").attr("style", i), l.attr(
    "transform",
    `translate(${-o.width / 2 - (o.x - (o.left ?? 0))}, ${-(o.height / 2) - (o.y - (o.top ?? 0))})`
  ), Mt(e, y), e.intersect = function(w) {
    return St.rect(e, w);
  }, s;
}
x(LB, "note");
var doe = /* @__PURE__ */ x((t, e, r) => [
  `M${t + r / 2},${e}`,
  `L${t + r},${e - r / 2}`,
  `L${t + r / 2},${e - r}`,
  `L${t},${e - r / 2}`,
  "Z"
].join(" "), "createDecisionBoxPathD");
async function RB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = a.width + e.padding, o = a.height + e.padding, l = s + o, u = 0.5, h = [
    { x: l / 2, y: 0 },
    { x: l, y: -l / 2 },
    { x: l / 2, y: -l },
    { x: 0, y: -l / 2 }
  ];
  let d;
  const { cssStyles: f } = e;
  if (e.look === "handDrawn") {
    const p = Rt.svg(i), g = Nt(e, {}), m = doe(0, 0, l), v = p.path(m, g);
    d = i.insert(() => v, ":first-child").attr("transform", `translate(${-l / 2 + u}, ${l / 2})`), f && d.attr("style", f);
  } else
    d = ic(i, l, l, h), d.attr("transform", `translate(${-l / 2 + u}, ${l / 2})`);
  return n && d.attr("style", n), Mt(e, d), e.calcIntersect = function(p, g) {
    const m = p.width, v = [
      { x: m / 2, y: 0 },
      { x: m, y: -m / 2 },
      { x: m / 2, y: -m },
      { x: 0, y: -m / 2 }
    ], y = St.polygon(p, v, g);
    return { x: y.x - 0.5, y: y.y - 0.5 };
  }, e.intersect = function(p) {
    return this.calcIntersect(e, p);
  }, i;
}
x(RB, "question");
async function NB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0), (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0), (e == null ? void 0 : e.height) ?? 0), u = -o / 2, h = -l / 2, d = h / 2, f = [
    { x: u + d, y: h },
    { x: u, y: 0 },
    { x: u + d, y: -h },
    { x: -u, y: -h },
    { x: -u, y: h }
  ], { cssStyles: p } = e, g = Rt.svg(i), m = Nt(e, {});
  e.look !== "handDrawn" && (m.roughness = 0, m.fillStyle = "solid");
  const v = ar(f), y = g.path(v, m), b = i.insert(() => y, ":first-child");
  return b.attr("class", "basic label-container"), p && e.look !== "handDrawn" && b.selectAll("path").attr("style", p), n && e.look !== "handDrawn" && b.selectAll("path").attr("style", n), b.attr("transform", `translate(${-d / 2},0)`), s.attr(
    "transform",
    `translate(${-d / 2 - a.width / 2 - (a.x - (a.left ?? 0))}, ${-(a.height / 2) - (a.y - (a.top ?? 0))})`
  ), Mt(e, b), e.intersect = function(w) {
    return St.polygon(e, f, w);
  }, i;
}
x(NB, "rect_left_inv_arrow");
async function MB(t, e) {
  var _, L;
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  let i;
  e.cssClasses ? i = "node " + e.cssClasses : i = "node default";
  const a = t.insert("g").attr("class", i).attr("id", e.domId || e.id), s = a.insert("g"), o = a.insert("g").attr("class", "label").attr("style", n), l = e.description, u = e.label, h = o.node().appendChild(await qc(u, e.labelStyle, !0, !0));
  let d = { width: 0, height: 0 };
  if (Ir((L = (_ = we()) == null ? void 0 : _.flowchart) == null ? void 0 : L.htmlLabels)) {
    const N = h.children[0], A = Qe(h);
    d = N.getBoundingClientRect(), A.attr("width", d.width), A.attr("height", d.height);
  }
  ae.info("Text 2", l);
  const f = l || [], p = h.getBBox(), g = o.node().appendChild(
    await qc(
      f.join ? f.join("<br/>") : f,
      e.labelStyle,
      !0,
      !0
    )
  ), m = g.children[0], v = Qe(g);
  d = m.getBoundingClientRect(), v.attr("width", d.width), v.attr("height", d.height);
  const y = (e.padding || 0) / 2;
  Qe(g).attr(
    "transform",
    "translate( " + (d.width > p.width ? 0 : (p.width - d.width) / 2) + ", " + (p.height + y + 5) + ")"
  ), Qe(h).attr(
    "transform",
    "translate( " + (d.width < p.width ? 0 : -(p.width - d.width) / 2) + ", 0)"
  ), d = o.node().getBBox(), o.attr(
    "transform",
    "translate(" + -d.width / 2 + ", " + (-d.height / 2 - y + 3) + ")"
  );
  const b = d.width + (e.padding || 0), w = d.height + (e.padding || 0), T = -d.width / 2 - y, E = -d.height / 2 - y;
  let C, k;
  if (e.look === "handDrawn") {
    const N = Rt.svg(a), A = Nt(e, {}), O = N.path(
      nc(T, E, b, w, e.rx || 0),
      A
    ), P = N.line(
      -d.width / 2 - y,
      -d.height / 2 - y + p.height + y,
      d.width / 2 + y,
      -d.height / 2 - y + p.height + y,
      A
    );
    k = a.insert(() => (ae.debug("Rough node insert CXC", O), P), ":first-child"), C = a.insert(() => (ae.debug("Rough node insert CXC", O), O), ":first-child");
  } else
    C = s.insert("rect", ":first-child"), k = s.insert("line"), C.attr("class", "outer title-state").attr("style", n).attr("x", -d.width / 2 - y).attr("y", -d.height / 2 - y).attr("width", d.width + (e.padding || 0)).attr("height", d.height + (e.padding || 0)), k.attr("class", "divider").attr("x1", -d.width / 2 - y).attr("x2", d.width / 2 + y).attr("y1", -d.height / 2 - y + p.height + y).attr("y2", -d.height / 2 - y + p.height + y);
  return Mt(e, C), e.intersect = function(N) {
    return St.rect(e, N);
  }, a;
}
x(MB, "rectWithTitle");
function E0(t, e, r, n, i, a, s) {
  const l = (t + r) / 2, u = (e + n) / 2, h = Math.atan2(n - e, r - t), d = (r - t) / 2, f = (n - e) / 2, p = d / i, g = f / a, m = Math.sqrt(p ** 2 + g ** 2);
  if (m > 1)
    throw new Error("The given radii are too small to create an arc between the points.");
  const v = Math.sqrt(1 - m ** 2), y = l + v * a * Math.sin(h) * (s ? -1 : 1), b = u - v * i * Math.cos(h) * (s ? -1 : 1), w = Math.atan2((e - b) / a, (t - y) / i);
  let E = Math.atan2((n - b) / a, (r - y) / i) - w;
  s && E < 0 && (E += 2 * Math.PI), !s && E > 0 && (E -= 2 * Math.PI);
  const C = [];
  for (let k = 0; k < 20; k++) {
    const _ = k / 19, L = w + _ * E, N = y + i * Math.cos(L), A = b + a * Math.sin(L);
    C.push({ x: N, y: A });
  }
  return C;
}
x(E0, "generateArcPoints");
async function DB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = (e == null ? void 0 : e.padding) ?? 0, o = (e == null ? void 0 : e.padding) ?? 0, l = (e != null && e.width ? e == null ? void 0 : e.width : a.width) + s * 2, u = (e != null && e.height ? e == null ? void 0 : e.height : a.height) + o * 2, h = e.radius || 5, d = e.taper || 5, { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {});
  e.stroke && (g.stroke = e.stroke), e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const m = [
    // Top edge (left to right)
    { x: -l / 2 + d, y: -u / 2 },
    // Top-left corner start (1)
    { x: l / 2 - d, y: -u / 2 },
    // Top-right corner start (2)
    ...E0(l / 2 - d, -u / 2, l / 2, -u / 2 + d, h, h, !0),
    // Top-left arc (2 to 3)
    // Right edge (top to bottom)
    { x: l / 2, y: -u / 2 + d },
    // Top-right taper point (3)
    { x: l / 2, y: u / 2 - d },
    // Bottom-right taper point (4)
    ...E0(l / 2, u / 2 - d, l / 2 - d, u / 2, h, h, !0),
    // Top-left arc (4 to 5)
    // Bottom edge (right to left)
    { x: l / 2 - d, y: u / 2 },
    // Bottom-right corner start (5)
    { x: -l / 2 + d, y: u / 2 },
    // Bottom-left corner start (6)
    ...E0(-l / 2 + d, u / 2, -l / 2, u / 2 - d, h, h, !0),
    // Top-left arc (4 to 5)
    // Left edge (bottom to top)
    { x: -l / 2, y: u / 2 - d },
    // Bottom-left taper point (7)
    { x: -l / 2, y: -u / 2 + d },
    // Top-left taper point (8)
    ...E0(-l / 2, -u / 2 + d, -l / 2 + d, -u / 2, h, h, !0)
    // Top-left arc (4 to 5)
  ], v = ar(m), y = p.path(v, g), b = i.insert(() => y, ":first-child");
  return b.attr("class", "basic label-container outer-path"), f && e.look !== "handDrawn" && b.selectChildren("path").attr("style", f), n && e.look !== "handDrawn" && b.selectChildren("path").attr("style", n), Mt(e, b), e.intersect = function(w) {
    return St.polygon(e, m, w);
  }, i;
}
x(DB, "roundedRect");
async function IB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = (e == null ? void 0 : e.padding) ?? 0, l = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), u = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), h = -a.width / 2 - o, d = -a.height / 2 - o, { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {});
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const m = [
    { x: h, y: d },
    { x: h + l + 8, y: d },
    { x: h + l + 8, y: d + u },
    { x: h - 8, y: d + u },
    { x: h - 8, y: d },
    { x: h, y: d },
    { x: h, y: d + u }
  ], v = p.polygon(
    m.map((b) => [b.x, b.y]),
    g
  ), y = i.insert(() => v, ":first-child");
  return y.attr("class", "basic label-container").attr("style", Ci(f)), n && e.look !== "handDrawn" && y.selectAll("path").attr("style", n), f && e.look !== "handDrawn" && y.selectAll("path").attr("style", n), s.attr(
    "transform",
    `translate(${-l / 2 + 4 + (e.padding ?? 0) - (a.x - (a.left ?? 0))},${-u / 2 + (e.padding ?? 0) - (a.y - (a.top ?? 0))})`
  ), Mt(e, y), e.intersect = function(b) {
    return St.rect(e, b);
  }, i;
}
x(IB, "shadedProcess");
async function OB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = -o / 2, h = -l / 2, { cssStyles: d } = e, f = Rt.svg(i), p = Nt(e, {});
  e.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
  const g = [
    { x: u, y: h },
    { x: u, y: h + l },
    { x: u + o, y: h + l },
    { x: u + o, y: h - l / 2 }
  ], m = ar(g), v = f.path(m, p), y = i.insert(() => v, ":first-child");
  return y.attr("class", "basic label-container"), d && e.look !== "handDrawn" && y.selectChildren("path").attr("style", d), n && e.look !== "handDrawn" && y.selectChildren("path").attr("style", n), y.attr("transform", `translate(0, ${l / 4})`), s.attr(
    "transform",
    `translate(${-o / 2 + (e.padding ?? 0) - (a.x - (a.left ?? 0))}, ${-l / 4 + (e.padding ?? 0) - (a.y - (a.top ?? 0))})`
  ), Mt(e, y), e.intersect = function(b) {
    return St.polygon(e, g, b);
  }, i;
}
x(OB, "slopedRect");
async function PB(t, e) {
  const r = {
    rx: 0,
    ry: 0,
    labelPaddingX: e.labelPaddingX ?? ((e == null ? void 0 : e.padding) || 0) * 2,
    labelPaddingY: ((e == null ? void 0 : e.padding) || 0) * 1
  };
  return lx(t, e, r);
}
x(PB, "squareRect");
async function BB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = a.height + e.padding, o = a.width + s / 4 + e.padding, l = s / 2, { cssStyles: u } = e, h = Rt.svg(i), d = Nt(e, {});
  e.look !== "handDrawn" && (d.roughness = 0, d.fillStyle = "solid");
  const f = [
    { x: -o / 2 + l, y: -s / 2 },
    { x: o / 2 - l, y: -s / 2 },
    ...Kp(-o / 2 + l, 0, l, 50, 90, 270),
    { x: o / 2 - l, y: s / 2 },
    ...Kp(o / 2 - l, 0, l, 50, 270, 450)
  ], p = ar(f), g = h.path(p, d), m = i.insert(() => g, ":first-child");
  return m.attr("class", "basic label-container outer-path"), u && e.look !== "handDrawn" && m.selectChildren("path").attr("style", u), n && e.look !== "handDrawn" && m.selectChildren("path").attr("style", n), Mt(e, m), e.intersect = function(v) {
    return St.polygon(e, f, v);
  }, i;
}
x(BB, "stadium");
async function FB(t, e) {
  return lx(t, e, {
    rx: 5,
    ry: 5
  });
}
x(FB, "state");
function $B(t, e, { config: { themeVariables: r } }) {
  const { labelStyles: n, nodeStyles: i } = Ct(e);
  e.labelStyle = n;
  const { cssStyles: a } = e, { lineColor: s, stateBorder: o, nodeBorder: l } = r, u = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), h = Rt.svg(u), d = Nt(e, {});
  e.look !== "handDrawn" && (d.roughness = 0, d.fillStyle = "solid");
  const f = h.circle(0, 0, 14, {
    ...d,
    stroke: s,
    strokeWidth: 2
  }), p = o ?? l, g = h.circle(0, 0, 5, {
    ...d,
    fill: p,
    stroke: p,
    strokeWidth: 2,
    fillStyle: "solid"
  }), m = u.insert(() => f, ":first-child");
  return m.insert(() => g), a && m.selectAll("path").attr("style", a), i && m.selectAll("path").attr("style", i), Mt(e, m), e.intersect = function(v) {
    return St.circle(e, 7, v);
  }, u;
}
x($B, "stateEnd");
function zB(t, e, { config: { themeVariables: r } }) {
  const { lineColor: n } = r, i = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id);
  let a;
  if (e.look === "handDrawn") {
    const o = Rt.svg(i).circle(0, 0, 14, Kre(n));
    a = i.insert(() => o), a.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
  } else
    a = i.insert("circle", ":first-child"), a.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
  return Mt(e, a), e.intersect = function(s) {
    return St.circle(e, 7, s);
  }, i;
}
x(zB, "stateStart");
async function VB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = ((e == null ? void 0 : e.padding) || 0) / 2, o = a.width + e.padding, l = a.height + e.padding, u = -a.width / 2 - s, h = -a.height / 2 - s, d = [
    { x: 0, y: 0 },
    { x: o, y: 0 },
    { x: o, y: -l },
    { x: 0, y: -l },
    { x: 0, y: 0 },
    { x: -8, y: 0 },
    { x: o + 8, y: 0 },
    { x: o + 8, y: -l },
    { x: -8, y: -l },
    { x: -8, y: 0 }
  ];
  if (e.look === "handDrawn") {
    const f = Rt.svg(i), p = Nt(e, {}), g = f.rectangle(u - 8, h, o + 16, l, p), m = f.line(u, h, u, h + l, p), v = f.line(u + o, h, u + o, h + l, p);
    i.insert(() => m, ":first-child"), i.insert(() => v, ":first-child");
    const y = i.insert(() => g, ":first-child"), { cssStyles: b } = e;
    y.attr("class", "basic label-container").attr("style", Ci(b)), Mt(e, y);
  } else {
    const f = ic(i, o, l, d);
    n && f.attr("style", n), Mt(e, f);
  }
  return e.intersect = function(f) {
    return St.polygon(e, d, f);
  }, i;
}
x(VB, "subroutine");
async function GB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), o = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), l = -s / 2, u = -o / 2, h = 0.2 * o, d = 0.2 * o, { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {}), m = [
    { x: l - h / 2, y: u },
    { x: l + s + h / 2, y: u },
    { x: l + s + h / 2, y: u + o },
    { x: l - h / 2, y: u + o }
  ], v = [
    { x: l + s - h / 2, y: u + o },
    { x: l + s + h / 2, y: u + o },
    { x: l + s + h / 2, y: u + o - d }
  ];
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const y = ar(m), b = p.path(y, g), w = ar(v), T = p.path(w, { ...g, fillStyle: "solid" }), E = i.insert(() => T, ":first-child");
  return E.insert(() => b, ":first-child"), E.attr("class", "basic label-container"), f && e.look !== "handDrawn" && E.selectAll("path").attr("style", f), n && e.look !== "handDrawn" && E.selectAll("path").attr("style", n), Mt(e, E), e.intersect = function(C) {
    return St.polygon(e, m, C);
  }, i;
}
x(GB, "taggedRect");
async function UB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = l / 4, h = 0.2 * o, d = 0.2 * l, f = l + u, { cssStyles: p } = e, g = Rt.svg(i), m = Nt(e, {});
  e.look !== "handDrawn" && (m.roughness = 0, m.fillStyle = "solid");
  const v = [
    { x: -o / 2 - o / 2 * 0.1, y: f / 2 },
    ...Fl(
      -o / 2 - o / 2 * 0.1,
      f / 2,
      o / 2 + o / 2 * 0.1,
      f / 2,
      u,
      0.8
    ),
    { x: o / 2 + o / 2 * 0.1, y: -f / 2 },
    { x: -o / 2 - o / 2 * 0.1, y: -f / 2 }
  ], y = -o / 2 + o / 2 * 0.1, b = -f / 2 - d * 0.4, w = [
    { x: y + o - h, y: (b + l) * 1.4 },
    { x: y + o, y: b + l - d },
    { x: y + o, y: (b + l) * 0.9 },
    ...Fl(
      y + o,
      (b + l) * 1.3,
      y + o - h,
      (b + l) * 1.5,
      -l * 0.03,
      0.5
    )
  ], T = ar(v), E = g.path(T, m), C = ar(w), k = g.path(C, {
    ...m,
    fillStyle: "solid"
  }), _ = i.insert(() => k, ":first-child");
  return _.insert(() => E, ":first-child"), _.attr("class", "basic label-container"), p && e.look !== "handDrawn" && _.selectAll("path").attr("style", p), n && e.look !== "handDrawn" && _.selectAll("path").attr("style", n), _.attr("transform", `translate(0,${-u / 2})`), s.attr(
    "transform",
    `translate(${-o / 2 + (e.padding ?? 0) - (a.x - (a.left ?? 0))},${-l / 2 + (e.padding ?? 0) - u / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, _), e.intersect = function(L) {
    return St.polygon(e, v, L);
  }, i;
}
x(UB, "taggedWaveEdgedRectangle");
async function WB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = Math.max(a.width + e.padding, (e == null ? void 0 : e.width) || 0), o = Math.max(a.height + e.padding, (e == null ? void 0 : e.height) || 0), l = -s / 2, u = -o / 2, h = i.insert("rect", ":first-child");
  return h.attr("class", "text").attr("style", n).attr("rx", 0).attr("ry", 0).attr("x", l).attr("y", u).attr("width", s).attr("height", o), Mt(e, h), e.intersect = function(d) {
    return St.rect(e, d);
  }, i;
}
x(WB, "text");
var foe = /* @__PURE__ */ x((t, e, r, n, i, a) => `M${t},${e}
    a${i},${a} 0,0,1 0,${-n}
    l${r},0
    a${i},${a} 0,0,1 0,${n}
    M${r},${-n}
    a${i},${a} 0,0,0 0,${n}
    l${-r},0`, "createCylinderPathD"), poe = /* @__PURE__ */ x((t, e, r, n, i, a) => [
  `M${t},${e}`,
  `M${t + r},${e}`,
  `a${i},${a} 0,0,0 0,${-n}`,
  `l${-r},0`,
  `a${i},${a} 0,0,0 0,${n}`,
  `l${r},0`
].join(" "), "createOuterCylinderPathD"), goe = /* @__PURE__ */ x((t, e, r, n, i, a) => [`M${t + r / 2},${-n / 2}`, `a${i},${a} 0,0,0 0,${n}`].join(" "), "createInnerCylinderPathD");
async function HB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s, halfPadding: o } = await Ut(
    t,
    e,
    $t(e)
  ), l = e.look === "neo" ? o * 2 : o, u = a.height + l, h = u / 2, d = h / (2.5 + u / 50), f = a.width + d + l, { cssStyles: p } = e;
  let g;
  if (e.look === "handDrawn") {
    const m = Rt.svg(i), v = poe(0, 0, f, u, d, h), y = goe(0, 0, f, u, d, h), b = m.path(v, Nt(e, {})), w = m.path(y, Nt(e, { fill: "none" }));
    g = i.insert(() => w, ":first-child"), g = i.insert(() => b, ":first-child"), g.attr("class", "basic label-container"), p && g.attr("style", p);
  } else {
    const m = foe(0, 0, f, u, d, h);
    g = i.insert("path", ":first-child").attr("d", m).attr("class", "basic label-container").attr("style", Ci(p)).attr("style", n), g.attr("class", "basic label-container"), p && g.selectAll("path").attr("style", p), n && g.selectAll("path").attr("style", n);
  }
  return g.attr("label-offset-x", d), g.attr("transform", `translate(${-f / 2}, ${u / 2} )`), s.attr(
    "transform",
    `translate(${-(a.width / 2) - d - (a.x - (a.left ?? 0))}, ${-(a.height / 2) - (a.y - (a.top ?? 0))})`
  ), Mt(e, g), e.intersect = function(m) {
    const v = St.rect(e, m), y = v.y - (e.y ?? 0);
    if (h != 0 && (Math.abs(y) < (e.height ?? 0) / 2 || Math.abs(y) == (e.height ?? 0) / 2 && Math.abs(v.x - (e.x ?? 0)) > (e.width ?? 0) / 2 - d)) {
      let b = d * d * (1 - y * y / (h * h));
      b != 0 && (b = Math.sqrt(Math.abs(b))), b = d - b, m.x - (e.x ?? 0) > 0 && (b = -b), v.x += b;
    }
    return v;
  }, i;
}
x(HB, "tiltedCylinder");
async function qB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = a.width + e.padding, o = a.height + e.padding, l = [
    { x: -3 * o / 6, y: 0 },
    { x: s + 3 * o / 6, y: 0 },
    { x: s, y: -o },
    { x: 0, y: -o }
  ];
  let u;
  const { cssStyles: h } = e;
  if (e.look === "handDrawn") {
    const d = Rt.svg(i), f = Nt(e, {}), p = ar(l), g = d.path(p, f);
    u = i.insert(() => g, ":first-child").attr("transform", `translate(${-s / 2}, ${o / 2})`), h && u.attr("style", h);
  } else
    u = ic(i, s, o, l);
  return n && u.attr("style", n), e.width = s, e.height = o, Mt(e, u), e.intersect = function(d) {
    return St.polygon(e, l, d);
  }, i;
}
x(qB, "trapezoid");
async function YB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = 60, o = 20, l = Math.max(s, a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), u = Math.max(o, a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), { cssStyles: h } = e, d = Rt.svg(i), f = Nt(e, {});
  e.look !== "handDrawn" && (f.roughness = 0, f.fillStyle = "solid");
  const p = [
    { x: -l / 2 * 0.8, y: -u / 2 },
    { x: l / 2 * 0.8, y: -u / 2 },
    { x: l / 2, y: -u / 2 * 0.6 },
    { x: l / 2, y: u / 2 },
    { x: -l / 2, y: u / 2 },
    { x: -l / 2, y: -u / 2 * 0.6 }
  ], g = ar(p), m = d.path(g, f), v = i.insert(() => m, ":first-child");
  return v.attr("class", "basic label-container"), h && e.look !== "handDrawn" && v.selectChildren("path").attr("style", h), n && e.look !== "handDrawn" && v.selectChildren("path").attr("style", n), Mt(e, v), e.intersect = function(y) {
    return St.polygon(e, p, y);
  }, i;
}
x(YB, "trapezoidalPentagon");
async function XB(t, e) {
  var b;
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Ir((b = we().flowchart) == null ? void 0 : b.htmlLabels), l = a.width + (e.padding ?? 0), u = l + a.height, h = l + a.height, d = [
    { x: 0, y: 0 },
    { x: h, y: 0 },
    { x: h / 2, y: -u }
  ], { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {});
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const m = ar(d), v = p.path(m, g), y = i.insert(() => v, ":first-child").attr("transform", `translate(${-u / 2}, ${u / 2})`);
  return f && e.look !== "handDrawn" && y.selectChildren("path").attr("style", f), n && e.look !== "handDrawn" && y.selectChildren("path").attr("style", n), e.width = l, e.height = u, Mt(e, y), s.attr(
    "transform",
    `translate(${-a.width / 2 - (a.x - (a.left ?? 0))}, ${u / 2 - (a.height + (e.padding ?? 0) / (o ? 2 : 1) - (a.y - (a.top ?? 0)))})`
  ), e.intersect = function(w) {
    return ae.info("Triangle intersect", e, d, w), St.polygon(e, d, w);
  }, i;
}
x(XB, "triangle");
async function jB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = l / 8, h = l + u, { cssStyles: d } = e, p = 70 - o, g = p > 0 ? p / 2 : 0, m = Rt.svg(i), v = Nt(e, {});
  e.look !== "handDrawn" && (v.roughness = 0, v.fillStyle = "solid");
  const y = [
    { x: -o / 2 - g, y: h / 2 },
    ...Fl(
      -o / 2 - g,
      h / 2,
      o / 2 + g,
      h / 2,
      u,
      0.8
    ),
    { x: o / 2 + g, y: -h / 2 },
    { x: -o / 2 - g, y: -h / 2 }
  ], b = ar(y), w = m.path(b, v), T = i.insert(() => w, ":first-child");
  return T.attr("class", "basic label-container"), d && e.look !== "handDrawn" && T.selectAll("path").attr("style", d), n && e.look !== "handDrawn" && T.selectAll("path").attr("style", n), T.attr("transform", `translate(0,${-u / 2})`), s.attr(
    "transform",
    `translate(${-o / 2 + (e.padding ?? 0) - (a.x - (a.left ?? 0))},${-l / 2 + (e.padding ?? 0) - u - (a.y - (a.top ?? 0))})`
  ), Mt(e, T), e.intersect = function(E) {
    return St.polygon(e, y, E);
  }, i;
}
x(jB, "waveEdgedRectangle");
async function KB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a } = await Ut(t, e, $t(e)), s = 100, o = 50, l = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), u = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), h = l / u;
  let d = l, f = u;
  d > f * h ? f = d / h : d = f * h, d = Math.max(d, s), f = Math.max(f, o);
  const p = Math.min(f * 0.2, f / 4), g = f + p * 2, { cssStyles: m } = e, v = Rt.svg(i), y = Nt(e, {});
  e.look !== "handDrawn" && (y.roughness = 0, y.fillStyle = "solid");
  const b = [
    { x: -d / 2, y: g / 2 },
    ...Fl(-d / 2, g / 2, d / 2, g / 2, p, 1),
    { x: d / 2, y: -g / 2 },
    ...Fl(d / 2, -g / 2, -d / 2, -g / 2, p, -1)
  ], w = ar(b), T = v.path(w, y), E = i.insert(() => T, ":first-child");
  return E.attr("class", "basic label-container"), m && e.look !== "handDrawn" && E.selectAll("path").attr("style", m), n && e.look !== "handDrawn" && E.selectAll("path").attr("style", n), Mt(e, E), e.intersect = function(C) {
    return St.polygon(e, b, C);
  }, i;
}
x(KB, "waveRectangle");
async function ZB(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, label: s } = await Ut(t, e, $t(e)), o = Math.max(a.width + (e.padding ?? 0) * 2, (e == null ? void 0 : e.width) ?? 0), l = Math.max(a.height + (e.padding ?? 0) * 2, (e == null ? void 0 : e.height) ?? 0), u = 5, h = -o / 2, d = -l / 2, { cssStyles: f } = e, p = Rt.svg(i), g = Nt(e, {}), m = [
    { x: h - u, y: d - u },
    { x: h - u, y: d + l },
    { x: h + o, y: d + l },
    { x: h + o, y: d - u }
  ], v = `M${h - u},${d - u} L${h + o},${d - u} L${h + o},${d + l} L${h - u},${d + l} L${h - u},${d - u}
                M${h - u},${d} L${h + o},${d}
                M${h},${d - u} L${h},${d + l}`;
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const y = p.path(v, g), b = i.insert(() => y, ":first-child");
  return b.attr("transform", `translate(${u / 2}, ${u / 2})`), b.attr("class", "basic label-container"), f && e.look !== "handDrawn" && b.selectAll("path").attr("style", f), n && e.look !== "handDrawn" && b.selectAll("path").attr("style", n), s.attr(
    "transform",
    `translate(${-(a.width / 2) + u / 2 - (a.x - (a.left ?? 0))}, ${-(a.height / 2) + u / 2 - (a.y - (a.top ?? 0))})`
  ), Mt(e, b), e.intersect = function(w) {
    return St.polygon(e, m, w);
  }, i;
}
x(ZB, "windowPane");
async function JE(t, e) {
  var G, H, ee, Y;
  const r = e;
  if (r.alias && (e.label = r.alias), e.look === "handDrawn") {
    const { themeVariables: re } = gr(), { background: ne } = re, he = {
      ...e,
      id: e.id + "-background",
      look: "default",
      cssStyles: ["stroke: none", `fill: ${ne}`]
    };
    await JE(t, he);
  }
  const n = gr();
  e.useHtmlLabels = n.htmlLabels;
  let i = ((G = n.er) == null ? void 0 : G.diagramPadding) ?? 10, a = ((H = n.er) == null ? void 0 : H.entityPadding) ?? 6;
  const { cssStyles: s } = e, { labelStyles: o, nodeStyles: l } = Ct(e);
  if (r.attributes.length === 0 && e.label) {
    const re = {
      rx: 0,
      ry: 0,
      labelPaddingX: i,
      labelPaddingY: i * 1.5
    };
    Gi(e.label, n) + re.labelPaddingX * 2 < n.er.minEntityWidth && (e.width = n.er.minEntityWidth);
    const ne = await lx(t, e, re);
    if (!Ir(n.htmlLabels)) {
      const he = ne.select("text"), K = (ee = he.node()) == null ? void 0 : ee.getBBox();
      he.attr("transform", `translate(${-K.width / 2}, 0)`);
    }
    return ne;
  }
  n.htmlLabels || (i *= 1.25, a *= 1.25);
  let u = $t(e);
  u || (u = "node default");
  const h = t.insert("g").attr("class", u).attr("id", e.domId || e.id), d = await dh(h, e.label ?? "", n, 0, 0, ["name"], o);
  d.height += a;
  let f = 0;
  const p = [], g = [];
  let m = 0, v = 0, y = 0, b = 0, w = !0, T = !0;
  for (const re of r.attributes) {
    const ne = await dh(
      h,
      re.type,
      n,
      0,
      f,
      ["attribute-type"],
      o
    );
    m = Math.max(m, ne.width + i);
    const he = await dh(
      h,
      re.name,
      n,
      0,
      f,
      ["attribute-name"],
      o
    );
    v = Math.max(v, he.width + i);
    const K = await dh(
      h,
      re.keys.join(),
      n,
      0,
      f,
      ["attribute-keys"],
      o
    );
    y = Math.max(y, K.width + i);
    const Z = await dh(
      h,
      re.comment,
      n,
      0,
      f,
      ["attribute-comment"],
      o
    );
    b = Math.max(b, Z.width + i);
    const X = Math.max(ne.height, he.height, K.height, Z.height) + a;
    g.push({ yOffset: f, rowHeight: X }), f += X;
  }
  let E = 4;
  y <= i && (w = !1, y = 0, E--), b <= i && (T = !1, b = 0, E--);
  const C = h.node().getBBox();
  if (d.width + i * 2 - (m + v + y + b) > 0) {
    const re = d.width + i * 2 - (m + v + y + b);
    m += re / E, v += re / E, y > 0 && (y += re / E), b > 0 && (b += re / E);
  }
  const k = m + v + y + b, _ = Rt.svg(h), L = Nt(e, {});
  e.look !== "handDrawn" && (L.roughness = 0, L.fillStyle = "solid");
  let N = 0;
  g.length > 0 && (N = g.reduce((re, ne) => re + ((ne == null ? void 0 : ne.rowHeight) ?? 0), 0));
  const A = Math.max(C.width + i * 2, (e == null ? void 0 : e.width) || 0, k), O = Math.max((N ?? 0) + d.height, (e == null ? void 0 : e.height) || 0), P = -A / 2, S = -O / 2;
  h.selectAll("g:not(:first-child)").each((re, ne, he) => {
    const K = Qe(he[ne]), Z = K.attr("transform");
    let X = 0, q = 0;
    if (Z) {
      const j = RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Z);
      j && (X = parseFloat(j[1]), q = parseFloat(j[2]), K.attr("class").includes("attribute-name") ? X += m : K.attr("class").includes("attribute-keys") ? X += m + v : K.attr("class").includes("attribute-comment") && (X += m + v + y));
    }
    K.attr(
      "transform",
      `translate(${P + i / 2 + X}, ${q + S + d.height + a / 2})`
    );
  }), h.select(".name").attr("transform", "translate(" + -d.width / 2 + ", " + (S + a / 2) + ")");
  const R = _.rectangle(P, S, A, O, L), I = h.insert(() => R, ":first-child").attr("style", s.join("")), { themeVariables: D } = gr(), { rowEven: M, rowOdd: B, nodeBorder: $ } = D;
  p.push(0);
  for (const [re, ne] of g.entries()) {
    const K = (re + 1) % 2 === 0 && ne.yOffset !== 0, Z = _.rectangle(P, d.height + S + (ne == null ? void 0 : ne.yOffset), A, ne == null ? void 0 : ne.rowHeight, {
      ...L,
      fill: K ? M : B,
      stroke: $
    });
    h.insert(() => Z, "g.label").attr("style", s.join("")).attr("class", `row-rect-${K ? "even" : "odd"}`);
  }
  let F = _.line(P, d.height + S, A + P, d.height + S, L);
  h.insert(() => F).attr("class", "divider"), F = _.line(m + P, d.height + S, m + P, O + S, L), h.insert(() => F).attr("class", "divider"), w && (F = _.line(
    m + v + P,
    d.height + S,
    m + v + P,
    O + S,
    L
  ), h.insert(() => F).attr("class", "divider")), T && (F = _.line(
    m + v + y + P,
    d.height + S,
    m + v + y + P,
    O + S,
    L
  ), h.insert(() => F).attr("class", "divider"));
  for (const re of p)
    F = _.line(
      P,
      d.height + S + re,
      A + P,
      d.height + S + re,
      L
    ), h.insert(() => F).attr("class", "divider");
  if (Mt(e, I), l && e.look !== "handDrawn") {
    const re = l.split(";"), ne = (Y = re == null ? void 0 : re.filter((he) => he.includes("stroke"))) == null ? void 0 : Y.map((he) => `${he}`).join("; ");
    h.selectAll("path").attr("style", ne ?? ""), h.selectAll(".row-rect-even path").attr("style", l);
  }
  return e.intersect = function(re) {
    return St.rect(e, re);
  }, h;
}
x(JE, "erBox");
async function dh(t, e, r, n = 0, i = 0, a = [], s = "") {
  const o = t.insert("g").attr("class", `label ${a.join(" ")}`).attr("transform", `translate(${n}, ${i})`).attr("style", s);
  e !== gl(e) && (e = gl(e), e = e.replaceAll("<", "&lt;").replaceAll(">", "&gt;"));
  const l = o.node().appendChild(
    await Ma(
      o,
      e,
      {
        width: Gi(e, r) + 100,
        style: s,
        useHtmlLabels: r.htmlLabels
      },
      r
    )
  );
  if (e.includes("&lt;") || e.includes("&gt;")) {
    let h = l.children[0];
    for (h.textContent = h.textContent.replaceAll("&lt;", "<").replaceAll("&gt;", ">"); h.childNodes[0]; )
      h = h.childNodes[0], h.textContent = h.textContent.replaceAll("&lt;", "<").replaceAll("&gt;", ">");
  }
  let u = l.getBBox();
  if (Ir(r.htmlLabels)) {
    const h = l.children[0];
    h.style.textAlign = "start";
    const d = Qe(l);
    u = h.getBoundingClientRect(), d.attr("width", u.width), d.attr("height", u.height);
  }
  return u;
}
x(dh, "addText");
async function QB(t, e, r, n, i = r.class.padding ?? 12) {
  const a = n ? 0 : 3, s = t.insert("g").attr("class", $t(e)).attr("id", e.domId || e.id);
  let o = null, l = null, u = null, h = null, d = 0, f = 0, p = 0;
  if (o = s.insert("g").attr("class", "annotation-group text"), e.annotations.length > 0) {
    const b = e.annotations[0];
    await k0(o, { text: `«${b}»` }, 0), d = o.node().getBBox().height;
  }
  l = s.insert("g").attr("class", "label-group text"), await k0(l, e, 0, ["font-weight: bolder"]);
  const g = l.node().getBBox();
  f = g.height, u = s.insert("g").attr("class", "members-group text");
  let m = 0;
  for (const b of e.members) {
    const w = await k0(u, b, m, [b.parseClassifier()]);
    m += w + a;
  }
  p = u.node().getBBox().height, p <= 0 && (p = i / 2), h = s.insert("g").attr("class", "methods-group text");
  let v = 0;
  for (const b of e.methods) {
    const w = await k0(h, b, v, [b.parseClassifier()]);
    v += w + a;
  }
  let y = s.node().getBBox();
  if (o !== null) {
    const b = o.node().getBBox();
    o.attr("transform", `translate(${-b.width / 2})`);
  }
  return l.attr("transform", `translate(${-g.width / 2}, ${d})`), y = s.node().getBBox(), u.attr(
    "transform",
    `translate(0, ${d + f + i * 2})`
  ), y = s.node().getBBox(), h.attr(
    "transform",
    `translate(0, ${d + f + (p ? p + i * 4 : i * 2)})`
  ), y = s.node().getBBox(), { shapeSvg: s, bbox: y };
}
x(QB, "textHelper");
async function k0(t, e, r, n = []) {
  const i = t.insert("g").attr("class", "label").attr("style", n.join("; ")), a = gr();
  let s = "useHtmlLabels" in e ? e.useHtmlLabels : Ir(a.htmlLabels) ?? !0, o = "";
  "text" in e ? o = e.text : o = e.label, !s && o.startsWith("\\") && (o = o.substring(1)), un(o) && (s = !0);
  const l = await Ma(
    i,
    nE(Zs(o)),
    {
      width: Gi(o, a) + 50,
      // Add room for error when splitting text into multiple lines
      classes: "markdown-node-label",
      useHtmlLabels: s
    },
    a
  );
  let u, h = 1;
  if (s) {
    const d = l.children[0], f = Qe(l);
    h = d.innerHTML.split("<br>").length, d.innerHTML.includes("</math>") && (h += d.innerHTML.split("<mrow>").length - 1);
    const p = d.getElementsByTagName("img");
    if (p) {
      const g = o.replace(/<img[^>]*>/g, "").trim() === "";
      await Promise.all(
        [...p].map(
          (m) => new Promise((v) => {
            function y() {
              var b;
              if (m.style.display = "flex", m.style.flexDirection = "column", g) {
                const w = ((b = a.fontSize) == null ? void 0 : b.toString()) ?? window.getComputedStyle(document.body).fontSize, E = parseInt(w, 10) * 5 + "px";
                m.style.minWidth = E, m.style.maxWidth = E;
              } else
                m.style.width = "100%";
              v(m);
            }
            x(y, "setupImage"), setTimeout(() => {
              m.complete && y();
            }), m.addEventListener("error", y), m.addEventListener("load", y);
          })
        )
      );
    }
    u = d.getBoundingClientRect(), f.attr("width", u.width), f.attr("height", u.height);
  } else {
    n.includes("font-weight: bolder") && Qe(l).selectAll("tspan").attr("font-weight", ""), h = l.children.length;
    const d = l.children[0];
    (l.textContent === "" || l.textContent.includes("&gt")) && (d.textContent = o[0] + o.substring(1).replaceAll("&gt;", ">").replaceAll("&lt;", "<").trim(), o[1] === " " && (d.textContent = d.textContent[0] + " " + d.textContent.substring(1))), d.textContent === "undefined" && (d.textContent = ""), u = l.getBBox();
  }
  return i.attr("transform", "translate(0," + (-u.height / (2 * h) + r) + ")"), u.height;
}
x(k0, "addText");
async function JB(t, e) {
  var L, N;
  const r = we(), n = r.class.padding ?? 12, i = n, a = e.useHtmlLabels ?? Ir(r.htmlLabels) ?? !0, s = e;
  s.annotations = s.annotations ?? [], s.members = s.members ?? [], s.methods = s.methods ?? [];
  const { shapeSvg: o, bbox: l } = await QB(t, e, r, a, i), { labelStyles: u, nodeStyles: h } = Ct(e);
  e.labelStyle = u, e.cssStyles = s.styles || "";
  const d = ((L = s.styles) == null ? void 0 : L.join(";")) || h || "";
  e.cssStyles || (e.cssStyles = d.replaceAll("!important", "").split(";"));
  const f = s.members.length === 0 && s.methods.length === 0 && !((N = r.class) != null && N.hideEmptyMembersBox), p = Rt.svg(o), g = Nt(e, {});
  e.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
  const m = l.width;
  let v = l.height;
  s.members.length === 0 && s.methods.length === 0 ? v += i : s.members.length > 0 && s.methods.length === 0 && (v += i * 2);
  const y = -m / 2, b = -v / 2, w = p.rectangle(
    y - n,
    b - n - (f ? n : s.members.length === 0 && s.methods.length === 0 ? -n / 2 : 0),
    m + 2 * n,
    v + 2 * n + (f ? n * 2 : s.members.length === 0 && s.methods.length === 0 ? -n : 0),
    g
  ), T = o.insert(() => w, ":first-child");
  T.attr("class", "basic label-container");
  const E = T.node().getBBox();
  o.selectAll(".text").each((A, O, P) => {
    var B;
    const S = Qe(P[O]), R = S.attr("transform");
    let I = 0;
    if (R) {
      const F = RegExp(/translate\(([^,]+),([^)]+)\)/).exec(R);
      F && (I = parseFloat(F[2]));
    }
    let D = I + b + n - (f ? n : s.members.length === 0 && s.methods.length === 0 ? -n / 2 : 0);
    a || (D -= 4);
    let M = y;
    (S.attr("class").includes("label-group") || S.attr("class").includes("annotation-group")) && (M = -((B = S.node()) == null ? void 0 : B.getBBox().width) / 2 || 0, o.selectAll("text").each(function($, F, G) {
      window.getComputedStyle(G[F]).textAnchor === "middle" && (M = 0);
    })), S.attr("transform", `translate(${M}, ${D})`);
  });
  const C = o.select(".annotation-group").node().getBBox().height - (f ? n / 2 : 0) || 0, k = o.select(".label-group").node().getBBox().height - (f ? n / 2 : 0) || 0, _ = o.select(".members-group").node().getBBox().height - (f ? n / 2 : 0) || 0;
  if (s.members.length > 0 || s.methods.length > 0 || f) {
    const A = p.line(
      E.x,
      C + k + b + n,
      E.x + E.width,
      C + k + b + n,
      g
    );
    o.insert(() => A).attr("class", "divider").attr("style", d);
  }
  if (f || s.members.length > 0 || s.methods.length > 0) {
    const A = p.line(
      E.x,
      C + k + _ + b + i * 2 + n,
      E.x + E.width,
      C + k + _ + b + n + i * 2,
      g
    );
    o.insert(() => A).attr("class", "divider").attr("style", d);
  }
  if (s.look !== "handDrawn" && o.selectAll("path").attr("style", d), T.select(":nth-child(2)").attr("style", d), o.selectAll(".divider").select("path").attr("style", d), e.labelStyle ? o.selectAll("span").attr("style", e.labelStyle) : o.selectAll("span").attr("style", d), !a) {
    const A = RegExp(/color\s*:\s*([^;]*)/), O = A.exec(d);
    if (O) {
      const P = O[0].replace("color", "fill");
      o.selectAll("tspan").attr("style", P);
    } else if (u) {
      const P = A.exec(u);
      if (P) {
        const S = P[0].replace("color", "fill");
        o.selectAll("tspan").attr("style", S);
      }
    }
  }
  return Mt(e, T), e.intersect = function(A) {
    return St.rect(e, A);
  }, o;
}
x(JB, "classBox");
async function eF(t, e) {
  var C, k;
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const i = e, a = e, s = 20, o = 20, l = "verifyMethod" in e, u = $t(e), h = t.insert("g").attr("class", u).attr("id", e.domId ?? e.id);
  let d;
  l ? d = await Os(
    h,
    `&lt;&lt;${i.type}&gt;&gt;`,
    0,
    e.labelStyle
  ) : d = await Os(h, "&lt;&lt;Element&gt;&gt;", 0, e.labelStyle);
  let f = d;
  const p = await Os(
    h,
    i.name,
    f,
    e.labelStyle + "; font-weight: bold;"
  );
  if (f += p + o, l) {
    const _ = await Os(
      h,
      `${i.requirementId ? `ID: ${i.requirementId}` : ""}`,
      f,
      e.labelStyle
    );
    f += _;
    const L = await Os(
      h,
      `${i.text ? `Text: ${i.text}` : ""}`,
      f,
      e.labelStyle
    );
    f += L;
    const N = await Os(
      h,
      `${i.risk ? `Risk: ${i.risk}` : ""}`,
      f,
      e.labelStyle
    );
    f += N, await Os(
      h,
      `${i.verifyMethod ? `Verification: ${i.verifyMethod}` : ""}`,
      f,
      e.labelStyle
    );
  } else {
    const _ = await Os(
      h,
      `${a.type ? `Type: ${a.type}` : ""}`,
      f,
      e.labelStyle
    );
    f += _, await Os(
      h,
      `${a.docRef ? `Doc Ref: ${a.docRef}` : ""}`,
      f,
      e.labelStyle
    );
  }
  const g = (((C = h.node()) == null ? void 0 : C.getBBox().width) ?? 200) + s, m = (((k = h.node()) == null ? void 0 : k.getBBox().height) ?? 200) + s, v = -g / 2, y = -m / 2, b = Rt.svg(h), w = Nt(e, {});
  e.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
  const T = b.rectangle(v, y, g, m, w), E = h.insert(() => T, ":first-child");
  if (E.attr("class", "basic label-container").attr("style", n), h.selectAll(".label").each((_, L, N) => {
    const A = Qe(N[L]), O = A.attr("transform");
    let P = 0, S = 0;
    if (O) {
      const M = RegExp(/translate\(([^,]+),([^)]+)\)/).exec(O);
      M && (P = parseFloat(M[1]), S = parseFloat(M[2]));
    }
    const R = S - m / 2;
    let I = v + s / 2;
    (L === 0 || L === 1) && (I = P), A.attr("transform", `translate(${I}, ${R + s})`);
  }), f > d + p + o) {
    const _ = b.line(
      v,
      y + d + p + o,
      v + g,
      y + d + p + o,
      w
    );
    h.insert(() => _).attr("style", n);
  }
  return Mt(e, E), e.intersect = function(_) {
    return St.rect(e, _);
  }, h;
}
x(eF, "requirementBox");
async function Os(t, e, r, n = "") {
  if (e === "")
    return 0;
  const i = t.insert("g").attr("class", "label").attr("style", n), a = we(), s = a.htmlLabels ?? !0, o = await Ma(
    i,
    nE(Zs(e)),
    {
      width: Gi(e, a) + 50,
      // Add room for error when splitting text into multiple lines
      classes: "markdown-node-label",
      useHtmlLabels: s,
      style: n
    },
    a
  );
  let l;
  if (s) {
    const u = o.children[0], h = Qe(o);
    l = u.getBoundingClientRect(), h.attr("width", l.width), h.attr("height", l.height);
  } else {
    const u = o.children[0];
    for (const h of u.children)
      h.textContent = h.textContent.replaceAll("&gt;", ">").replaceAll("&lt;", "<"), n && h.setAttribute("style", n);
    l = o.getBBox(), l.height += 6;
  }
  return i.attr("transform", `translate(${-l.width / 2},${-l.height / 2 + r})`), l.height;
}
x(Os, "addText");
var moe = /* @__PURE__ */ x((t) => {
  switch (t) {
    case "Very High":
      return "red";
    case "High":
      return "orange";
    case "Medium":
      return null;
    case "Low":
      return "blue";
    case "Very Low":
      return "lightblue";
  }
}, "colorFromPriority");
async function tF(t, e, { config: r }) {
  var O, P;
  const { labelStyles: n, nodeStyles: i } = Ct(e);
  e.labelStyle = n || "";
  const a = 10, s = e.width;
  e.width = (e.width ?? 200) - 10;
  const {
    shapeSvg: o,
    bbox: l,
    label: u
  } = await Ut(t, e, $t(e)), h = e.padding || 10;
  let d = "", f;
  "ticket" in e && e.ticket && ((O = r == null ? void 0 : r.kanban) != null && O.ticketBaseUrl) && (d = (P = r == null ? void 0 : r.kanban) == null ? void 0 : P.ticketBaseUrl.replace("#TICKET#", e.ticket), f = o.insert("svg:a", ":first-child").attr("class", "kanban-ticket-link").attr("xlink:href", d).attr("target", "_blank"));
  const p = {
    useHtmlLabels: e.useHtmlLabels,
    labelStyle: e.labelStyle || "",
    width: e.width,
    img: e.img,
    padding: e.padding || 8,
    centerLabel: !1
  };
  let g, m;
  f ? { label: g, bbox: m } = await t4(
    f,
    "ticket" in e && e.ticket || "",
    p
  ) : { label: g, bbox: m } = await t4(
    o,
    "ticket" in e && e.ticket || "",
    p
  );
  const { label: v, bbox: y } = await t4(
    o,
    "assigned" in e && e.assigned || "",
    p
  );
  e.width = s;
  const b = 10, w = (e == null ? void 0 : e.width) || 0, T = Math.max(m.height, y.height) / 2, E = Math.max(l.height + b * 2, (e == null ? void 0 : e.height) || 0) + T, C = -w / 2, k = -E / 2;
  u.attr(
    "transform",
    "translate(" + (h - w / 2) + ", " + (-T - l.height / 2) + ")"
  ), g.attr(
    "transform",
    "translate(" + (h - w / 2) + ", " + (-T + l.height / 2) + ")"
  ), v.attr(
    "transform",
    "translate(" + (h + w / 2 - y.width - 2 * a) + ", " + (-T + l.height / 2) + ")"
  );
  let _;
  const { rx: L, ry: N } = e, { cssStyles: A } = e;
  if (e.look === "handDrawn") {
    const S = Rt.svg(o), R = Nt(e, {}), I = L || N ? S.path(nc(C, k, w, E, L || 0), R) : S.rectangle(C, k, w, E, R);
    _ = o.insert(() => I, ":first-child"), _.attr("class", "basic label-container").attr("style", A || null);
  } else {
    _ = o.insert("rect", ":first-child"), _.attr("class", "basic label-container __APA__").attr("style", i).attr("rx", L ?? 5).attr("ry", N ?? 5).attr("x", C).attr("y", k).attr("width", w).attr("height", E);
    const S = "priority" in e && e.priority;
    if (S) {
      const R = o.append("line"), I = C + 2, D = k + Math.floor((L ?? 0) / 2), M = k + E - Math.floor((L ?? 0) / 2);
      R.attr("x1", I).attr("y1", D).attr("x2", I).attr("y2", M).attr("stroke-width", "4").attr("stroke", moe(S));
    }
  }
  return Mt(e, _), e.height = E, e.intersect = function(S) {
    return St.rect(e, S);
  }, o;
}
x(tF, "kanbanItem");
async function rF(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, halfPadding: s, label: o } = await Ut(
    t,
    e,
    $t(e)
  ), l = a.width + 10 * s, u = a.height + 8 * s, h = 0.15 * l, { cssStyles: d } = e, f = a.width + 20, p = a.height + 20, g = Math.max(l, f), m = Math.max(u, p);
  o.attr("transform", `translate(${-a.width / 2}, ${-a.height / 2})`);
  let v;
  const y = `M0 0 
    a${h},${h} 1 0,0 ${g * 0.25},${-1 * m * 0.1}
    a${h},${h} 1 0,0 ${g * 0.25},0
    a${h},${h} 1 0,0 ${g * 0.25},0
    a${h},${h} 1 0,0 ${g * 0.25},${m * 0.1}

    a${h},${h} 1 0,0 ${g * 0.15},${m * 0.33}
    a${h * 0.8},${h * 0.8} 1 0,0 0,${m * 0.34}
    a${h},${h} 1 0,0 ${-1 * g * 0.15},${m * 0.33}

    a${h},${h} 1 0,0 ${-1 * g * 0.25},${m * 0.15}
    a${h},${h} 1 0,0 ${-1 * g * 0.25},0
    a${h},${h} 1 0,0 ${-1 * g * 0.25},0
    a${h},${h} 1 0,0 ${-1 * g * 0.25},${-1 * m * 0.15}

    a${h},${h} 1 0,0 ${-1 * g * 0.1},${-1 * m * 0.33}
    a${h * 0.8},${h * 0.8} 1 0,0 0,${-1 * m * 0.34}
    a${h},${h} 1 0,0 ${g * 0.1},${-1 * m * 0.33}
  H0 V0 Z`;
  if (e.look === "handDrawn") {
    const b = Rt.svg(i), w = Nt(e, {}), T = b.path(y, w);
    v = i.insert(() => T, ":first-child"), v.attr("class", "basic label-container").attr("style", Ci(d));
  } else
    v = i.insert("path", ":first-child").attr("class", "basic label-container").attr("style", n).attr("d", y);
  return v.attr("transform", `translate(${-g / 2}, ${-m / 2})`), Mt(e, v), e.calcIntersect = function(b, w) {
    return St.rect(b, w);
  }, e.intersect = function(b) {
    return ae.info("Bang intersect", e, b), St.rect(e, b);
  }, i;
}
x(rF, "bang");
async function nF(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, halfPadding: s, label: o } = await Ut(
    t,
    e,
    $t(e)
  ), l = a.width + 2 * s, u = a.height + 2 * s, h = 0.15 * l, d = 0.25 * l, f = 0.35 * l, p = 0.2 * l, { cssStyles: g } = e;
  let m;
  const v = `M0 0 
    a${h},${h} 0 0,1 ${l * 0.25},${-1 * l * 0.1}
    a${f},${f} 1 0,1 ${l * 0.4},${-1 * l * 0.1}
    a${d},${d} 1 0,1 ${l * 0.35},${l * 0.2}

    a${h},${h} 1 0,1 ${l * 0.15},${u * 0.35}
    a${p},${p} 1 0,1 ${-1 * l * 0.15},${u * 0.65}

    a${d},${h} 1 0,1 ${-1 * l * 0.25},${l * 0.15}
    a${f},${f} 1 0,1 ${-1 * l * 0.5},0
    a${h},${h} 1 0,1 ${-1 * l * 0.25},${-1 * l * 0.15}

    a${h},${h} 1 0,1 ${-1 * l * 0.1},${-1 * u * 0.35}
    a${p},${p} 1 0,1 ${l * 0.1},${-1 * u * 0.65}
  H0 V0 Z`;
  if (e.look === "handDrawn") {
    const y = Rt.svg(i), b = Nt(e, {}), w = y.path(v, b);
    m = i.insert(() => w, ":first-child"), m.attr("class", "basic label-container").attr("style", Ci(g));
  } else
    m = i.insert("path", ":first-child").attr("class", "basic label-container").attr("style", n).attr("d", v);
  return o.attr("transform", `translate(${-a.width / 2}, ${-a.height / 2})`), m.attr("transform", `translate(${-l / 2}, ${-u / 2})`), Mt(e, m), e.calcIntersect = function(y, b) {
    return St.rect(y, b);
  }, e.intersect = function(y) {
    return ae.info("Cloud intersect", e, y), St.rect(e, y);
  }, i;
}
x(nF, "cloud");
async function iF(t, e) {
  const { labelStyles: r, nodeStyles: n } = Ct(e);
  e.labelStyle = r;
  const { shapeSvg: i, bbox: a, halfPadding: s, label: o } = await Ut(
    t,
    e,
    $t(e)
  ), l = a.width + 8 * s, u = a.height + 2 * s, h = 5, d = `
    M${-l / 2} ${u / 2 - h}
    v${-u + 2 * h}
    q0,-${h} ${h},-${h}
    h${l - 2 * h}
    q${h},0 ${h},${h}
    v${u - 2 * h}
    q0,${h} -${h},${h}
    h${-l + 2 * h}
    q-${h},0 -${h},-${h}
    Z
  `, f = i.append("path").attr("id", "node-" + e.id).attr("class", "node-bkg node-" + e.type).attr("style", n).attr("d", d);
  return i.append("line").attr("class", "node-line-").attr("x1", -l / 2).attr("y1", u / 2).attr("x2", l / 2).attr("y2", u / 2), o.attr("transform", `translate(${-a.width / 2}, ${-a.height / 2})`), i.append(() => o.node()), Mt(e, f), e.calcIntersect = function(p, g) {
    return St.rect(p, g);
  }, e.intersect = function(p) {
    return St.rect(e, p);
  }, i;
}
x(iF, "defaultMindmapNode");
async function aF(t, e) {
  const r = {
    padding: e.padding ?? 0
  };
  return QE(t, e, r);
}
x(aF, "mindmapCircle");
var voe = [
  {
    semanticName: "Process",
    name: "Rectangle",
    shortName: "rect",
    description: "Standard process shape",
    aliases: ["proc", "process", "rectangle"],
    internalAliases: ["squareRect"],
    handler: PB
  },
  {
    semanticName: "Event",
    name: "Rounded Rectangle",
    shortName: "rounded",
    description: "Represents an event",
    aliases: ["event"],
    internalAliases: ["roundedRect"],
    handler: DB
  },
  {
    semanticName: "Terminal Point",
    name: "Stadium",
    shortName: "stadium",
    description: "Terminal point",
    aliases: ["terminal", "pill"],
    handler: BB
  },
  {
    semanticName: "Subprocess",
    name: "Framed Rectangle",
    shortName: "fr-rect",
    description: "Subprocess",
    aliases: ["subprocess", "subproc", "framed-rectangle", "subroutine"],
    handler: VB
  },
  {
    semanticName: "Database",
    name: "Cylinder",
    shortName: "cyl",
    description: "Database storage",
    aliases: ["db", "database", "cylinder"],
    handler: sB
  },
  {
    semanticName: "Start",
    name: "Circle",
    shortName: "circle",
    description: "Starting point",
    aliases: ["circ"],
    handler: QE
  },
  {
    semanticName: "Bang",
    name: "Bang",
    shortName: "bang",
    description: "Bang",
    aliases: ["bang"],
    handler: rF
  },
  {
    semanticName: "Cloud",
    name: "Cloud",
    shortName: "cloud",
    description: "cloud",
    aliases: ["cloud"],
    handler: nF
  },
  {
    semanticName: "Decision",
    name: "Diamond",
    shortName: "diam",
    description: "Decision-making step",
    aliases: ["decision", "diamond", "question"],
    handler: RB
  },
  {
    semanticName: "Prepare Conditional",
    name: "Hexagon",
    shortName: "hex",
    description: "Preparation or condition step",
    aliases: ["hexagon", "prepare"],
    handler: fB
  },
  {
    semanticName: "Data Input/Output",
    name: "Lean Right",
    shortName: "lean-r",
    description: "Represents input or output",
    aliases: ["lean-right", "in-out"],
    internalAliases: ["lean_right"],
    handler: EB
  },
  {
    semanticName: "Data Input/Output",
    name: "Lean Left",
    shortName: "lean-l",
    description: "Represents output or input",
    aliases: ["lean-left", "out-in"],
    internalAliases: ["lean_left"],
    handler: TB
  },
  {
    semanticName: "Priority Action",
    name: "Trapezoid Base Bottom",
    shortName: "trap-b",
    description: "Priority action",
    aliases: ["priority", "trapezoid-bottom", "trapezoid"],
    handler: qB
  },
  {
    semanticName: "Manual Operation",
    name: "Trapezoid Base Top",
    shortName: "trap-t",
    description: "Represents a manual task",
    aliases: ["manual", "trapezoid-top", "inv-trapezoid"],
    internalAliases: ["inv_trapezoid"],
    handler: bB
  },
  {
    semanticName: "Stop",
    name: "Double Circle",
    shortName: "dbl-circ",
    description: "Represents a stop point",
    aliases: ["double-circle"],
    internalAliases: ["doublecircle"],
    handler: lB
  },
  {
    semanticName: "Text Block",
    name: "Text Block",
    shortName: "text",
    description: "Text block",
    handler: WB
  },
  {
    semanticName: "Card",
    name: "Notched Rectangle",
    shortName: "notch-rect",
    description: "Represents a card",
    aliases: ["card", "notched-rectangle"],
    handler: QP
  },
  {
    semanticName: "Lined/Shaded Process",
    name: "Lined Rectangle",
    shortName: "lin-rect",
    description: "Lined process shape",
    aliases: ["lined-rectangle", "lined-process", "lin-proc", "shaded-process"],
    handler: IB
  },
  {
    semanticName: "Start",
    name: "Small Circle",
    shortName: "sm-circ",
    description: "Small starting point",
    aliases: ["start", "small-circle"],
    internalAliases: ["stateStart"],
    handler: zB
  },
  {
    semanticName: "Stop",
    name: "Framed Circle",
    shortName: "fr-circ",
    description: "Stop point",
    aliases: ["stop", "framed-circle"],
    internalAliases: ["stateEnd"],
    handler: $B
  },
  {
    semanticName: "Fork/Join",
    name: "Filled Rectangle",
    shortName: "fork",
    description: "Fork or join in process flow",
    aliases: ["join"],
    internalAliases: ["forkJoin"],
    handler: hB
  },
  {
    semanticName: "Collate",
    name: "Hourglass",
    shortName: "hourglass",
    description: "Represents a collate operation",
    aliases: ["hourglass", "collate"],
    handler: pB
  },
  {
    semanticName: "Comment",
    name: "Curly Brace",
    shortName: "brace",
    description: "Adds a comment",
    aliases: ["comment", "brace-l"],
    handler: rB
  },
  {
    semanticName: "Comment Right",
    name: "Curly Brace",
    shortName: "brace-r",
    description: "Adds a comment",
    handler: nB
  },
  {
    semanticName: "Comment with braces on both sides",
    name: "Curly Braces",
    shortName: "braces",
    description: "Adds a comment",
    handler: iB
  },
  {
    semanticName: "Com Link",
    name: "Lightning Bolt",
    shortName: "bolt",
    description: "Communication link",
    aliases: ["com-link", "lightning-bolt"],
    handler: kB
  },
  {
    semanticName: "Document",
    name: "Document",
    shortName: "doc",
    description: "Represents a document",
    aliases: ["doc", "document"],
    handler: jB
  },
  {
    semanticName: "Delay",
    name: "Half-Rounded Rectangle",
    shortName: "delay",
    description: "Represents a delay",
    aliases: ["half-rounded-rectangle"],
    handler: dB
  },
  {
    semanticName: "Direct Access Storage",
    name: "Horizontal Cylinder",
    shortName: "h-cyl",
    description: "Direct access storage",
    aliases: ["das", "horizontal-cylinder"],
    handler: HB
  },
  {
    semanticName: "Disk Storage",
    name: "Lined Cylinder",
    shortName: "lin-cyl",
    description: "Disk storage",
    aliases: ["disk", "lined-cylinder"],
    handler: SB
  },
  {
    semanticName: "Display",
    name: "Curved Trapezoid",
    shortName: "curv-trap",
    description: "Represents a display",
    aliases: ["curved-trapezoid", "display"],
    handler: aB
  },
  {
    semanticName: "Divided Process",
    name: "Divided Rectangle",
    shortName: "div-rect",
    description: "Divided process shape",
    aliases: ["div-proc", "divided-rectangle", "divided-process"],
    handler: oB
  },
  {
    semanticName: "Extract",
    name: "Triangle",
    shortName: "tri",
    description: "Extraction process",
    aliases: ["extract", "triangle"],
    handler: XB
  },
  {
    semanticName: "Internal Storage",
    name: "Window Pane",
    shortName: "win-pane",
    description: "Internal storage",
    aliases: ["internal-storage", "window-pane"],
    handler: ZB
  },
  {
    semanticName: "Junction",
    name: "Filled Circle",
    shortName: "f-circ",
    description: "Junction point",
    aliases: ["junction", "filled-circle"],
    handler: cB
  },
  {
    semanticName: "Loop Limit",
    name: "Trapezoidal Pentagon",
    shortName: "notch-pent",
    description: "Loop limit step",
    aliases: ["loop-limit", "notched-pentagon"],
    handler: YB
  },
  {
    semanticName: "Manual File",
    name: "Flipped Triangle",
    shortName: "flip-tri",
    description: "Manual file operation",
    aliases: ["manual-file", "flipped-triangle"],
    handler: uB
  },
  {
    semanticName: "Manual Input",
    name: "Sloped Rectangle",
    shortName: "sl-rect",
    description: "Manual input step",
    aliases: ["manual-input", "sloped-rectangle"],
    handler: OB
  },
  {
    semanticName: "Multi-Document",
    name: "Stacked Document",
    shortName: "docs",
    description: "Multiple documents",
    aliases: ["documents", "st-doc", "stacked-document"],
    handler: _B
  },
  {
    semanticName: "Multi-Process",
    name: "Stacked Rectangle",
    shortName: "st-rect",
    description: "Multiple processes",
    aliases: ["procs", "processes", "stacked-rectangle"],
    handler: AB
  },
  {
    semanticName: "Stored Data",
    name: "Bow Tie Rectangle",
    shortName: "bow-rect",
    description: "Stored data",
    aliases: ["stored-data", "bow-tie-rectangle"],
    handler: ZP
  },
  {
    semanticName: "Summary",
    name: "Crossed Circle",
    shortName: "cross-circ",
    description: "Summary",
    aliases: ["summary", "crossed-circle"],
    handler: tB
  },
  {
    semanticName: "Tagged Document",
    name: "Tagged Document",
    shortName: "tag-doc",
    description: "Tagged document",
    aliases: ["tag-doc", "tagged-document"],
    handler: UB
  },
  {
    semanticName: "Tagged Process",
    name: "Tagged Rectangle",
    shortName: "tag-rect",
    description: "Tagged process",
    aliases: ["tagged-rectangle", "tag-proc", "tagged-process"],
    handler: GB
  },
  {
    semanticName: "Paper Tape",
    name: "Flag",
    shortName: "flag",
    description: "Paper tape",
    aliases: ["paper-tape"],
    handler: KB
  },
  {
    semanticName: "Odd",
    name: "Odd",
    shortName: "odd",
    description: "Odd shape",
    internalAliases: ["rect_left_inv_arrow"],
    handler: NB
  },
  {
    semanticName: "Lined Document",
    name: "Lined Document",
    shortName: "lin-doc",
    description: "Lined document",
    aliases: ["lined-document"],
    handler: CB
  }
], yoe = /* @__PURE__ */ x(() => {
  const e = [
    ...Object.entries({
      // States
      state: FB,
      choice: JP,
      note: LB,
      // Rectangles
      rectWithTitle: MB,
      labelRect: wB,
      // Icons
      iconSquare: yB,
      iconCircle: mB,
      icon: gB,
      iconRounded: vB,
      imageSquare: xB,
      anchor: KP,
      // Kanban diagram
      kanbanItem: tF,
      //Mindmap diagram
      mindmapCircle: aF,
      defaultMindmapNode: iF,
      // class diagram
      classBox: JB,
      // er diagram
      erBox: JE,
      // Requirement diagram
      requirementBox: eF
    }),
    ...voe.flatMap((r) => [
      r.shortName,
      ..."aliases" in r ? r.aliases : [],
      ..."internalAliases" in r ? r.internalAliases : []
    ].map((i) => [i, r.handler]))
  ];
  return Object.fromEntries(e);
}, "generateShapeMap"), sF = yoe();
function oF(t) {
  return t in sF;
}
x(oF, "isValidShape");
var cx = /* @__PURE__ */ new Map();
async function ux(t, e, r) {
  let n, i;
  e.shape === "rect" && (e.rx && e.ry ? e.shape = "roundedRect" : e.shape = "squareRect");
  const a = e.shape ? sF[e.shape] : void 0;
  if (!a)
    throw new Error(`No such shape: ${e.shape}. Please check your syntax.`);
  if (e.link) {
    let s;
    r.config.securityLevel === "sandbox" ? s = "_top" : e.linkTarget && (s = e.linkTarget || "_blank"), n = t.insert("svg:a").attr("xlink:href", e.link).attr("target", s ?? null), i = await a(n, e, r);
  } else
    i = await a(t, e, r), n = i;
  return e.tooltip && i.attr("title", e.tooltip), cx.set(e.id, n), e.haveCallback && n.attr("class", n.attr("class") + " clickable"), n;
}
x(ux, "insertNode");
var xoe = /* @__PURE__ */ x((t, e) => {
  cx.set(e.id, t);
}, "setNodeElem"), boe = /* @__PURE__ */ x(() => {
  cx.clear();
}, "clear"), zw = /* @__PURE__ */ x((t) => {
  const e = cx.get(t.id);
  ae.trace(
    "Transforming node",
    t.diff,
    t,
    "translate(" + (t.x - t.width / 2 - 5) + ", " + t.width / 2 + ")"
  );
  const r = 8, n = t.diff || 0;
  return t.clusterNode ? e.attr(
    "transform",
    "translate(" + (t.x + n - t.width / 2) + ", " + (t.y - t.height / 2 - r) + ")"
  ) : e.attr("transform", "translate(" + t.x + ", " + t.y + ")"), n;
}, "positionNode"), woe = /* @__PURE__ */ x((t, e, r, n, i, a) => {
  e.arrowTypeStart && c8(t, "start", e.arrowTypeStart, r, n, i, a), e.arrowTypeEnd && c8(t, "end", e.arrowTypeEnd, r, n, i, a);
}, "addEdgeMarkers"), Toe = {
  arrow_cross: { type: "cross", fill: !1 },
  arrow_point: { type: "point", fill: !0 },
  arrow_barb: { type: "barb", fill: !0 },
  arrow_circle: { type: "circle", fill: !1 },
  aggregation: { type: "aggregation", fill: !1 },
  extension: { type: "extension", fill: !1 },
  composition: { type: "composition", fill: !0 },
  dependency: { type: "dependency", fill: !0 },
  lollipop: { type: "lollipop", fill: !1 },
  only_one: { type: "onlyOne", fill: !1 },
  zero_or_one: { type: "zeroOrOne", fill: !1 },
  one_or_more: { type: "oneOrMore", fill: !1 },
  zero_or_more: { type: "zeroOrMore", fill: !1 },
  requirement_arrow: { type: "requirement_arrow", fill: !1 },
  requirement_contains: { type: "requirement_contains", fill: !1 }
}, c8 = /* @__PURE__ */ x((t, e, r, n, i, a, s) => {
  var d;
  const o = Toe[r];
  if (!o) {
    ae.warn(`Unknown arrow type: ${r}`);
    return;
  }
  const l = o.type, h = `${i}_${a}-${l}${e === "start" ? "Start" : "End"}`;
  if (s && s.trim() !== "") {
    const f = s.replace(/[^\dA-Za-z]/g, "_"), p = `${h}_${f}`;
    if (!document.getElementById(p)) {
      const g = document.getElementById(h);
      if (g) {
        const m = g.cloneNode(!0);
        m.id = p, m.querySelectorAll("path, circle, line").forEach((y) => {
          y.setAttribute("stroke", s), o.fill && y.setAttribute("fill", s);
        }), (d = g.parentNode) == null || d.appendChild(m);
      }
    }
    t.attr(`marker-${e}`, `url(${n}#${p})`);
  } else
    t.attr(`marker-${e}`, `url(${n}#${h})`);
}, "addEdgeMarker"), ky = /* @__PURE__ */ new Map(), ai = /* @__PURE__ */ new Map(), Eoe = /* @__PURE__ */ x(() => {
  ky.clear(), ai.clear();
}, "clear"), B1 = /* @__PURE__ */ x((t) => t ? t.reduce((r, n) => r + ";" + n, "") : "", "getLabelStyles"), lF = /* @__PURE__ */ x(async (t, e) => {
  let r = Ir(we().flowchart.htmlLabels);
  const { labelStyles: n } = Ct(e);
  e.labelStyle = n;
  const i = await Ma(t, e.label, {
    style: e.labelStyle,
    useHtmlLabels: r,
    addSvgBackground: !0,
    isNode: !1
  });
  ae.info("abc82", e, e.labelType);
  const a = t.insert("g").attr("class", "edgeLabel"), s = a.insert("g").attr("class", "label").attr("data-id", e.id);
  s.node().appendChild(i);
  let o = i.getBBox();
  if (r) {
    const u = i.children[0], h = Qe(i);
    o = u.getBoundingClientRect(), h.attr("width", o.width), h.attr("height", o.height);
  }
  s.attr("transform", "translate(" + -o.width / 2 + ", " + -o.height / 2 + ")"), ky.set(e.id, a), e.width = o.width, e.height = o.height;
  let l;
  if (e.startLabelLeft) {
    const u = await qc(
      e.startLabelLeft,
      B1(e.labelStyle)
    ), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), ai.get(e.id) || ai.set(e.id, {}), ai.get(e.id).startLeft = h, S0(l, e.startLabelLeft);
  }
  if (e.startLabelRight) {
    const u = await qc(
      e.startLabelRight,
      B1(e.labelStyle)
    ), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = h.node().appendChild(u), d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), ai.get(e.id) || ai.set(e.id, {}), ai.get(e.id).startRight = h, S0(l, e.startLabelRight);
  }
  if (e.endLabelLeft) {
    const u = await qc(e.endLabelLeft, B1(e.labelStyle)), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), h.node().appendChild(u), ai.get(e.id) || ai.set(e.id, {}), ai.get(e.id).endLeft = h, S0(l, e.endLabelLeft);
  }
  if (e.endLabelRight) {
    const u = await qc(e.endLabelRight, B1(e.labelStyle)), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), h.node().appendChild(u), ai.get(e.id) || ai.set(e.id, {}), ai.get(e.id).endRight = h, S0(l, e.endLabelRight);
  }
  return i;
}, "insertEdgeLabel");
function S0(t, e) {
  we().flowchart.htmlLabels && t && (t.style.width = e.length * 9 + "px", t.style.height = "12px");
}
x(S0, "setTerminalWidth");
var cF = /* @__PURE__ */ x((t, e) => {
  ae.debug("Moving label abc88 ", t.id, t.label, ky.get(t.id), e);
  let r = e.updatedPath ? e.updatedPath : e.originalPath;
  const n = we(), { subGraphTitleTotalMargin: i } = Ig(n);
  if (t.label) {
    const a = ky.get(t.id);
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcLabelPosition(r);
      ae.debug(
        "Moving label " + t.label + " from (",
        s,
        ",",
        o,
        ") to (",
        l.x,
        ",",
        l.y,
        ") abc88"
      ), e.updatedPath && (s = l.x, o = l.y);
    }
    a.attr("transform", `translate(${s}, ${o + i / 2})`);
  }
  if (t.startLabelLeft) {
    const a = ai.get(t.id).startLeft;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(t.arrowTypeStart ? 10 : 0, "start_left", r);
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
  if (t.startLabelRight) {
    const a = ai.get(t.id).startRight;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(
        t.arrowTypeStart ? 10 : 0,
        "start_right",
        r
      );
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
  if (t.endLabelLeft) {
    const a = ai.get(t.id).endLeft;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(t.arrowTypeEnd ? 10 : 0, "end_left", r);
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
  if (t.endLabelRight) {
    const a = ai.get(t.id).endRight;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(t.arrowTypeEnd ? 10 : 0, "end_right", r);
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
}, "positionEdgeLabel"), koe = /* @__PURE__ */ x((t, e) => {
  const r = t.x, n = t.y, i = Math.abs(e.x - r), a = Math.abs(e.y - n), s = t.width / 2, o = t.height / 2;
  return i >= s || a >= o;
}, "outsideNode"), Soe = /* @__PURE__ */ x((t, e, r) => {
  ae.debug(`intersection calc abc89:
  outsidePoint: ${JSON.stringify(e)}
  insidePoint : ${JSON.stringify(r)}
  node        : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);
  const n = t.x, i = t.y, a = Math.abs(n - r.x), s = t.width / 2;
  let o = r.x < e.x ? s - a : s + a;
  const l = t.height / 2, u = Math.abs(e.y - r.y), h = Math.abs(e.x - r.x);
  if (Math.abs(i - e.y) * s > Math.abs(n - e.x) * l) {
    let d = r.y < e.y ? e.y - l - i : i - l - e.y;
    o = h * d / u;
    const f = {
      x: r.x < e.x ? r.x + o : r.x - h + o,
      y: r.y < e.y ? r.y + u - d : r.y - u + d
    };
    return o === 0 && (f.x = e.x, f.y = e.y), h === 0 && (f.x = e.x), u === 0 && (f.y = e.y), ae.debug(`abc89 top/bottom calc, Q ${u}, q ${d}, R ${h}, r ${o}`, f), f;
  } else {
    r.x < e.x ? o = e.x - s - n : o = n - s - e.x;
    let d = u * o / h, f = r.x < e.x ? r.x + h - o : r.x - h + o, p = r.y < e.y ? r.y + d : r.y - d;
    return ae.debug(`sides calc abc89, Q ${u}, q ${d}, R ${h}, r ${o}`, { _x: f, _y: p }), o === 0 && (f = e.x, p = e.y), h === 0 && (f = e.x), u === 0 && (p = e.y), { x: f, y: p };
  }
}, "intersection"), u8 = /* @__PURE__ */ x((t, e) => {
  ae.warn("abc88 cutPathAtIntersect", t, e);
  let r = [], n = t[0], i = !1;
  return t.forEach((a) => {
    if (ae.info("abc88 checking point", a, e), !koe(e, a) && !i) {
      const s = Soe(e, n, a);
      ae.debug("abc88 inside", a, n, s), ae.debug("abc88 intersection", s, e);
      let o = !1;
      r.forEach((l) => {
        o = o || l.x === s.x && l.y === s.y;
      }), r.some((l) => l.x === s.x && l.y === s.y) ? ae.warn("abc88 no intersect", s, r) : r.push(s), i = !0;
    } else
      ae.warn("abc88 outside", a, n), n = a, i || r.push(a);
  }), ae.debug("returning points", r), r;
}, "cutPathAtIntersect");
function uF(t) {
  const e = [], r = [];
  for (let n = 1; n < t.length - 1; n++) {
    const i = t[n - 1], a = t[n], s = t[n + 1];
    (i.x === a.x && a.y === s.y && Math.abs(a.x - s.x) > 5 && Math.abs(a.y - i.y) > 5 || i.y === a.y && a.x === s.x && Math.abs(a.x - i.x) > 5 && Math.abs(a.y - s.y) > 5) && (e.push(a), r.push(n));
  }
  return { cornerPoints: e, cornerPointPositions: r };
}
x(uF, "extractCornerPoints");
var h8 = /* @__PURE__ */ x(function(t, e, r) {
  const n = e.x - t.x, i = e.y - t.y, a = Math.sqrt(n * n + i * i), s = r / a;
  return { x: e.x - s * n, y: e.y - s * i };
}, "findAdjacentPoint"), Coe = /* @__PURE__ */ x(function(t) {
  const { cornerPointPositions: e } = uF(t), r = [];
  for (let n = 0; n < t.length; n++)
    if (e.includes(n)) {
      const i = t[n - 1], a = t[n + 1], s = t[n], o = h8(i, s, 5), l = h8(a, s, 5), u = l.x - o.x, h = l.y - o.y;
      r.push(o);
      const d = Math.sqrt(2) * 2;
      let f = { x: s.x, y: s.y };
      if (Math.abs(a.x - i.x) > 10 && Math.abs(a.y - i.y) >= 10) {
        ae.debug(
          "Corner point fixing",
          Math.abs(a.x - i.x),
          Math.abs(a.y - i.y)
        );
        const p = 5;
        s.x === o.x ? f = {
          x: u < 0 ? o.x - p + d : o.x + p - d,
          y: h < 0 ? o.y - d : o.y + d
        } : f = {
          x: u < 0 ? o.x - d : o.x + d,
          y: h < 0 ? o.y - p + d : o.y + p - d
        };
      } else
        ae.debug(
          "Corner point skipping fixing",
          Math.abs(a.x - i.x),
          Math.abs(a.y - i.y)
        );
      r.push(f, l);
    } else
      r.push(t[n]);
  return r;
}, "fixCorners"), Aoe = /* @__PURE__ */ x((t, e, r) => {
  const n = t - e - r, i = 2, a = 2, s = i + a, o = Math.floor(n / s), l = Array(o).fill(`${i} ${a}`).join(" ");
  return `0 ${e} ${l} ${r}`;
}, "generateDashArray"), hF = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o = !1) {
  var S;
  const { handDrawnSeed: l } = we();
  let u = e.points, h = !1;
  const d = i;
  var f = a;
  const p = [];
  for (const R in e.cssCompiledStyles)
    CE(R) || p.push(e.cssCompiledStyles[R]);
  ae.debug("UIO intersect check", e.points, f.x, d.x), f.intersect && d.intersect && !o && (u = u.slice(1, e.points.length - 1), u.unshift(d.intersect(u[0])), ae.debug(
    "Last point UIO",
    e.start,
    "-->",
    e.end,
    u[u.length - 1],
    f,
    f.intersect(u[u.length - 1])
  ), u.push(f.intersect(u[u.length - 1])));
  const g = btoa(JSON.stringify(u));
  e.toCluster && (ae.info("to cluster abc88", r.get(e.toCluster)), u = u8(e.points, r.get(e.toCluster).node), h = !0), e.fromCluster && (ae.debug(
    "from cluster abc88",
    r.get(e.fromCluster),
    JSON.stringify(u, null, 2)
  ), u = u8(u.reverse(), r.get(e.fromCluster).node).reverse(), h = !0);
  let m = u.filter((R) => !Number.isNaN(R.y));
  m = Coe(m);
  let v = Rh;
  switch (v = ey, e.curve) {
    case "linear":
      v = ey;
      break;
    case "basis":
      v = Rh;
      break;
    case "cardinal":
      v = PD;
      break;
    case "bumpX":
      v = ND;
      break;
    case "bumpY":
      v = MD;
      break;
    case "catmullRom":
      v = FD;
      break;
    case "monotoneX":
      v = WD;
      break;
    case "monotoneY":
      v = HD;
      break;
    case "natural":
      v = YD;
      break;
    case "step":
      v = XD;
      break;
    case "stepAfter":
      v = KD;
      break;
    case "stepBefore":
      v = jD;
      break;
    default:
      v = Rh;
  }
  const { x: y, y: b } = MO(e), w = Gp().x(y).y(b).curve(v);
  let T;
  switch (e.thickness) {
    case "normal":
      T = "edge-thickness-normal";
      break;
    case "thick":
      T = "edge-thickness-thick";
      break;
    case "invisible":
      T = "edge-thickness-invisible";
      break;
    default:
      T = "edge-thickness-normal";
  }
  switch (e.pattern) {
    case "solid":
      T += " edge-pattern-solid";
      break;
    case "dotted":
      T += " edge-pattern-dotted";
      break;
    case "dashed":
      T += " edge-pattern-dashed";
      break;
    default:
      T += " edge-pattern-solid";
  }
  let E, C = e.curve === "rounded" ? dF(fF(m, e), 5) : w(m);
  const k = Array.isArray(e.style) ? e.style : [e.style];
  let _ = k.find((R) => R == null ? void 0 : R.startsWith("stroke:")), L = !1;
  if (e.look === "handDrawn") {
    const R = Rt.svg(t);
    Object.assign([], m);
    const I = R.path(C, {
      roughness: 0.3,
      seed: l
    });
    T += " transition", E = Qe(I).select("path").attr("id", e.id).attr("class", " " + T + (e.classes ? " " + e.classes : "")).attr("style", k ? k.reduce((M, B) => M + ";" + B, "") : "");
    let D = E.attr("d");
    E.attr("d", D), t.node().appendChild(E.node());
  } else {
    const R = p.join(";"), I = k ? k.reduce((H, ee) => H + ee + ";", "") : "";
    let D = "";
    e.animate && (D = " edge-animation-fast"), e.animation && (D = " edge-animation-" + e.animation);
    const M = (R ? R + ";" + I + ";" : I) + ";" + (k ? k.reduce((H, ee) => H + ";" + ee, "") : "");
    E = t.append("path").attr("d", C).attr("id", e.id).attr(
      "class",
      " " + T + (e.classes ? " " + e.classes : "") + (D ?? "")
    ).attr("style", M), _ = (S = M.match(/stroke:([^;]+)/)) == null ? void 0 : S[1], L = e.animate === !0 || !!e.animation || R.includes("animation");
    const B = E.node(), $ = typeof B.getTotalLength == "function" ? B.getTotalLength() : 0, F = NC[e.arrowTypeStart] || 0, G = NC[e.arrowTypeEnd] || 0;
    if (e.look === "neo" && !L) {
      const ee = `stroke-dasharray: ${e.pattern === "dotted" || e.pattern === "dashed" ? Aoe($, F, G) : `0 ${F} ${$ - F - G} ${G}`}; stroke-dashoffset: 0;`;
      E.attr("style", ee + E.attr("style"));
    }
  }
  E.attr("data-edge", !0), E.attr("data-et", "edge"), E.attr("data-id", e.id), E.attr("data-points", g), e.showPoints && m.forEach((R) => {
    t.append("circle").style("stroke", "red").style("fill", "red").attr("r", 1).attr("cx", R.x).attr("cy", R.y);
  });
  let N = "";
  (we().flowchart.arrowMarkerAbsolute || we().state.arrowMarkerAbsolute) && (N = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, N = N.replace(/\(/g, "\\(").replace(/\)/g, "\\)")), ae.info("arrowTypeStart", e.arrowTypeStart), ae.info("arrowTypeEnd", e.arrowTypeEnd), woe(E, e, N, s, n, _);
  const A = Math.floor(u.length / 2), O = u[A];
  Kt.isLabelCoordinateInPath(O, E.attr("d")) || (h = !0);
  let P = {};
  return h && (P.updatedPath = u), P.originalPath = e.points, P;
}, "insertEdge");
function dF(t, e) {
  if (t.length < 2)
    return "";
  let r = "";
  const n = t.length, i = 1e-5;
  for (let a = 0; a < n; a++) {
    const s = t[a], o = t[a - 1], l = t[a + 1];
    if (a === 0)
      r += `M${s.x},${s.y}`;
    else if (a === n - 1)
      r += `L${s.x},${s.y}`;
    else {
      const u = s.x - o.x, h = s.y - o.y, d = l.x - s.x, f = l.y - s.y, p = Math.hypot(u, h), g = Math.hypot(d, f);
      if (p < i || g < i) {
        r += `L${s.x},${s.y}`;
        continue;
      }
      const m = u / p, v = h / p, y = d / g, b = f / g, w = m * y + v * b, T = Math.max(-1, Math.min(1, w)), E = Math.acos(T);
      if (E < i || Math.abs(Math.PI - E) < i) {
        r += `L${s.x},${s.y}`;
        continue;
      }
      const C = Math.min(e / Math.sin(E / 2), p / 2, g / 2), k = s.x - m * C, _ = s.y - v * C, L = s.x + y * C, N = s.y + b * C;
      r += `L${k},${_}`, r += `Q${s.x},${s.y} ${L},${N}`;
    }
  }
  return r;
}
x(dF, "generateRoundedPath");
function Vw(t, e) {
  if (!t || !e)
    return { angle: 0, deltaX: 0, deltaY: 0 };
  const r = e.x - t.x, n = e.y - t.y;
  return { angle: Math.atan2(n, r), deltaX: r, deltaY: n };
}
x(Vw, "calculateDeltaAndAngle");
function fF(t, e) {
  const r = t.map((i) => ({ ...i }));
  if (t.length >= 2 && xi[e.arrowTypeStart]) {
    const i = xi[e.arrowTypeStart], a = t[0], s = t[1], { angle: o } = Vw(a, s), l = i * Math.cos(o), u = i * Math.sin(o);
    r[0].x = a.x + l, r[0].y = a.y + u;
  }
  const n = t.length;
  if (n >= 2 && xi[e.arrowTypeEnd]) {
    const i = xi[e.arrowTypeEnd], a = t[n - 1], s = t[n - 2], { angle: o } = Vw(s, a), l = i * Math.cos(o), u = i * Math.sin(o);
    r[n - 1].x = a.x - l, r[n - 1].y = a.y - u;
  }
  return r;
}
x(fF, "applyMarkerOffsetsToPoints");
var _oe = /* @__PURE__ */ x((t, e, r, n) => {
  e.forEach((i) => {
    Woe[i](t, r, n);
  });
}, "insertMarkers"), Loe = /* @__PURE__ */ x((t, e, r) => {
  ae.trace("Making markers for ", r), t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "extension"), Roe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "composition"), Noe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "aggregation"), Moe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "dependency"), Doe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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);
}, "lollipop"), Ioe = /* @__PURE__ */ x((t, e, r) => {
  t.append("marker").attr("id", r + "_" + e + "-pointEnd").attr("class", "marker " + e).attr("viewBox", "0 0 10 10").attr("refX", 5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).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", r + "_" + e + "-pointStart").attr("class", "marker " + e).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).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");
}, "point"), Ooe = /* @__PURE__ */ x((t, e, r) => {
  t.append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "circle"), Poe = /* @__PURE__ */ x((t, e, r) => {
  t.append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "cross"), Boe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + e + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
}, "barb"), Foe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + e + "-onlyOneStart").attr("class", "marker onlyOne " + e).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", r + "_" + e + "-onlyOneEnd").attr("class", "marker onlyOne " + e).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M3,0 L3,18 M9,0 L9,18");
}, "only_one"), $oe = /* @__PURE__ */ x((t, e, r) => {
  const n = t.append("defs").append("marker").attr("id", r + "_" + e + "-zeroOrOneStart").attr("class", "marker zeroOrOne " + e).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
  n.append("circle").attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), n.append("path").attr("d", "M9,0 L9,18");
  const i = t.append("defs").append("marker").attr("id", r + "_" + e + "-zeroOrOneEnd").attr("class", "marker zeroOrOne " + e).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
  i.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), i.append("path").attr("d", "M21,0 L21,18");
}, "zero_or_one"), zoe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + e + "-oneOrMoreStart").attr("class", "marker oneOrMore " + e).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").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", r + "_" + e + "-oneOrMoreEnd").attr("class", "marker oneOrMore " + e).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18");
}, "one_or_more"), Voe = /* @__PURE__ */ x((t, e, r) => {
  const n = t.append("defs").append("marker").attr("id", r + "_" + e + "-zeroOrMoreStart").attr("class", "marker zeroOrMore " + e).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
  n.append("circle").attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), n.append("path").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18");
  const i = t.append("defs").append("marker").attr("id", r + "_" + e + "-zeroOrMoreEnd").attr("class", "marker zeroOrMore " + e).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
  i.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), i.append("path").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
}, "zero_or_more"), Goe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + e + "-requirement_arrowEnd").attr("refX", 20).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("path").attr(
    "d",
    `M0,0
      L20,10
      M20,10
      L0,20`
  );
}, "requirement_arrow"), Uoe = /* @__PURE__ */ x((t, e, r) => {
  const n = t.append("defs").append("marker").attr("id", r + "_" + e + "-requirement_containsStart").attr("refX", 0).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("g");
  n.append("circle").attr("cx", 10).attr("cy", 10).attr("r", 9).attr("fill", "none"), n.append("line").attr("x1", 1).attr("x2", 19).attr("y1", 10).attr("y2", 10), n.append("line").attr("y1", 1).attr("y2", 19).attr("x1", 10).attr("x2", 10);
}, "requirement_contains"), Woe = {
  extension: Loe,
  composition: Roe,
  aggregation: Noe,
  dependency: Moe,
  lollipop: Doe,
  point: Ioe,
  circle: Ooe,
  cross: Poe,
  barb: Boe,
  only_one: Foe,
  zero_or_one: $oe,
  one_or_more: zoe,
  zero_or_more: Voe,
  requirement_arrow: Goe,
  requirement_contains: Uoe
}, pF = _oe, Hoe = {
  common: at,
  getConfig: gr,
  insertCluster: ZE,
  insertEdge: hF,
  insertEdgeLabel: lF,
  insertMarkers: pF,
  insertNode: ux,
  interpolateToCurve: ME,
  labelHelper: Ut,
  log: ae,
  positionEdgeLabel: cF
}, Zp = {}, gF = /* @__PURE__ */ x((t) => {
  for (const e of t)
    Zp[e.name] = e;
}, "registerLayoutLoaders"), qoe = /* @__PURE__ */ x(() => {
  gF([
    {
      name: "dagre",
      loader: /* @__PURE__ */ x(async () => await Promise.resolve().then(() => mme), "loader")
    },
    {
      name: "cose-bilkent",
      loader: /* @__PURE__ */ x(async () => await Promise.resolve().then(() => J4e), "loader")
    }
  ]);
}, "registerDefaultLayoutLoaders");
qoe();
var Af = /* @__PURE__ */ x(async (t, e) => {
  if (!(t.layoutAlgorithm in Zp))
    throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);
  const r = Zp[t.layoutAlgorithm];
  return (await r.loader()).render(t, e, Hoe, {
    algorithm: r.algorithm
  });
}, "render"), Gg = /* @__PURE__ */ x((t = "", { fallback: e = "dagre" } = {}) => {
  if (t in Zp)
    return t;
  if (e in Zp)
    return ae.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`), e;
  throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`);
}, "getRegisteredLayoutAlgorithm"), mF = "comm", vF = "rule", yF = "decl", Yoe = "@import", Xoe = "@namespace", joe = "@keyframes", Koe = "@layer", xF = Math.abs, ek = String.fromCharCode;
function bF(t) {
  return t.trim();
}
function Km(t, e, r) {
  return t.replace(e, r);
}
function Zoe(t, e, r) {
  return t.indexOf(e, r);
}
function Mh(t, e) {
  return t.charCodeAt(e) | 0;
}
function ef(t, e, r) {
  return t.slice(e, r);
}
function Fs(t) {
  return t.length;
}
function Qoe(t) {
  return t.length;
}
function F1(t, e) {
  return e.push(t), t;
}
var hx = 1, tf = 1, wF = 0, ts = 0, kn = 0, _f = "";
function tk(t, e, r, n, i, a, s, o) {
  return { value: t, root: e, parent: r, type: n, props: i, children: a, line: hx, column: tf, length: s, return: "", siblings: o };
}
function Joe() {
  return kn;
}
function ele() {
  return kn = ts > 0 ? Mh(_f, --ts) : 0, tf--, kn === 10 && (tf = 1, hx--), kn;
}
function vs() {
  return kn = ts < wF ? Mh(_f, ts++) : 0, tf++, kn === 10 && (tf = 1, hx++), kn;
}
function wl() {
  return Mh(_f, ts);
}
function Zm() {
  return ts;
}
function dx(t, e) {
  return ef(_f, t, e);
}
function Qp(t) {
  switch (t) {
    case 0:
    case 9:
    case 10:
    case 13:
    case 32:
      return 5;
    case 33:
    case 43:
    case 44:
    case 47:
    case 62:
    case 64:
    case 126:
    case 59:
    case 123:
    case 125:
      return 4;
    case 58:
      return 3;
    case 34:
    case 39:
    case 40:
    case 91:
      return 2;
    case 41:
    case 93:
      return 1;
  }
  return 0;
}
function tle(t) {
  return hx = tf = 1, wF = Fs(_f = t), ts = 0, [];
}
function rle(t) {
  return _f = "", t;
}
function r4(t) {
  return bF(dx(ts - 1, Gw(t === 91 ? t + 2 : t === 40 ? t + 1 : t)));
}
function nle(t) {
  for (; (kn = wl()) && kn < 33; )
    vs();
  return Qp(t) > 2 || Qp(kn) > 3 ? "" : " ";
}
function ile(t, e) {
  for (; --e && vs() && !(kn < 48 || kn > 102 || kn > 57 && kn < 65 || kn > 70 && kn < 97); )
    ;
  return dx(t, Zm() + (e < 6 && wl() == 32 && vs() == 32));
}
function Gw(t) {
  for (; vs(); )
    switch (kn) {
      case t:
        return ts;
      case 34:
      case 39:
        t !== 34 && t !== 39 && Gw(kn);
        break;
      case 40:
        t === 41 && Gw(t);
        break;
      case 92:
        vs();
        break;
    }
  return ts;
}
function ale(t, e) {
  for (; vs() && t + kn !== 57; )
    if (t + kn === 84 && wl() === 47)
      break;
  return "/*" + dx(e, ts - 1) + "*" + ek(t === 47 ? t : vs());
}
function sle(t) {
  for (; !Qp(wl()); )
    vs();
  return dx(t, ts);
}
function ole(t) {
  return rle(Qm("", null, null, null, [""], t = tle(t), 0, [0], t));
}
function Qm(t, e, r, n, i, a, s, o, l) {
  for (var u = 0, h = 0, d = s, f = 0, p = 0, g = 0, m = 1, v = 1, y = 1, b = 0, w = "", T = i, E = a, C = n, k = w; v; )
    switch (g = b, b = vs()) {
      case 40:
        if (g != 108 && Mh(k, d - 1) == 58) {
          Zoe(k += Km(r4(b), "&", "&\f"), "&\f", xF(u ? o[u - 1] : 0)) != -1 && (y = -1);
          break;
        }
      case 34:
      case 39:
      case 91:
        k += r4(b);
        break;
      case 9:
      case 10:
      case 13:
      case 32:
        k += nle(g);
        break;
      case 92:
        k += ile(Zm() - 1, 7);
        continue;
      case 47:
        switch (wl()) {
          case 42:
          case 47:
            F1(lle(ale(vs(), Zm()), e, r, l), l), (Qp(g || 1) == 5 || Qp(wl() || 1) == 5) && Fs(k) && ef(k, -1, void 0) !== " " && (k += " ");
            break;
          default:
            k += "/";
        }
        break;
      case 123 * m:
        o[u++] = Fs(k) * y;
      case 125 * m:
      case 59:
      case 0:
        switch (b) {
          case 0:
          case 125:
            v = 0;
          case 59 + h:
            y == -1 && (k = Km(k, /\f/g, "")), p > 0 && (Fs(k) - d || m === 0 && g === 47) && F1(p > 32 ? f8(k + ";", n, r, d - 1, l) : f8(Km(k, " ", "") + ";", n, r, d - 2, l), l);
            break;
          case 59:
            k += ";";
          default:
            if (F1(C = d8(k, e, r, u, h, i, o, w, T = [], E = [], d, a), a), b === 123)
              if (h === 0)
                Qm(k, e, C, C, T, a, d, o, E);
              else {
                switch (f) {
                  case 99:
                    if (Mh(k, 3) === 110) break;
                  case 108:
                    if (Mh(k, 2) === 97) break;
                  default:
                    h = 0;
                  case 100:
                  case 109:
                  case 115:
                }
                h ? Qm(t, C, C, n && F1(d8(t, C, C, 0, 0, i, o, w, i, T = [], d, E), E), i, E, d, o, n ? T : E) : Qm(k, C, C, C, [""], E, 0, o, E);
              }
        }
        u = h = p = 0, m = y = 1, w = k = "", d = s;
        break;
      case 58:
        d = 1 + Fs(k), p = g;
      default:
        if (m < 1) {
          if (b == 123)
            --m;
          else if (b == 125 && m++ == 0 && ele() == 125)
            continue;
        }
        switch (k += ek(b), b * m) {
          case 38:
            y = h > 0 ? 1 : (k += "\f", -1);
            break;
          case 44:
            o[u++] = (Fs(k) - 1) * y, y = 1;
            break;
          case 64:
            wl() === 45 && (k += r4(vs())), f = wl(), h = d = Fs(w = k += sle(Zm())), b++;
            break;
          case 45:
            g === 45 && Fs(k) == 2 && (m = 0);
        }
    }
  return a;
}
function d8(t, e, r, n, i, a, s, o, l, u, h, d) {
  for (var f = i - 1, p = i === 0 ? a : [""], g = Qoe(p), m = 0, v = 0, y = 0; m < n; ++m)
    for (var b = 0, w = ef(t, f + 1, f = xF(v = s[m])), T = t; b < g; ++b)
      (T = bF(v > 0 ? p[b] + " " + w : Km(w, /&\f/g, p[b]))) && (l[y++] = T);
  return tk(t, e, r, i === 0 ? vF : o, l, u, h, d);
}
function lle(t, e, r, n) {
  return tk(t, e, r, mF, ek(Joe()), ef(t, 2, -2), 0, n);
}
function f8(t, e, r, n, i) {
  return tk(t, e, r, yF, ef(t, 0, n), ef(t, n + 1, -1), n, i);
}
function Uw(t, e) {
  for (var r = "", n = 0; n < t.length; n++)
    r += e(t[n], n, t, e) || "";
  return r;
}
function cle(t, e, r, n) {
  switch (t.type) {
    case Koe:
      if (t.children.length) break;
    case Yoe:
    case Xoe:
    case yF:
      return t.return = t.return || t.value;
    case mF:
      return "";
    case joe:
      return t.return = t.value + "{" + Uw(t.children, n) + "}";
    case vF:
      if (!Fs(t.value = t.props.join(","))) return "";
  }
  return Fs(r = Uw(t.children, n)) ? t.return = t.value + "{" + r + "}" : "";
}
var ule = $O(Object.keys, Object), hle = Object.prototype, dle = hle.hasOwnProperty;
function TF(t) {
  if (!Pg(t))
    return ule(t);
  var e = [];
  for (var r in Object(t))
    dle.call(t, r) && r != "constructor" && e.push(r);
  return e;
}
var Ww = Nu(io, "DataView"), Hw = Nu(io, "Promise"), Dh = Nu(io, "Set"), qw = Nu(io, "WeakMap"), p8 = "[object Map]", fle = "[object Object]", g8 = "[object Promise]", m8 = "[object Set]", v8 = "[object WeakMap]", y8 = "[object DataView]", ple = Ru(Ww), gle = Ru(Xp), mle = Ru(Hw), vle = Ru(Dh), yle = Ru(qw), Wa = rl;
(Ww && Wa(new Ww(new ArrayBuffer(1))) != y8 || Xp && Wa(new Xp()) != p8 || Hw && Wa(Hw.resolve()) != g8 || Dh && Wa(new Dh()) != m8 || qw && Wa(new qw()) != v8) && (Wa = function(t) {
  var e = rl(t), r = e == fle ? t.constructor : void 0, n = r ? Ru(r) : "";
  if (n)
    switch (n) {
      case ple:
        return y8;
      case gle:
        return p8;
      case mle:
        return g8;
      case vle:
        return m8;
      case yle:
        return v8;
    }
  return e;
});
var xle = "[object Map]", ble = "[object Set]", wle = Object.prototype, Tle = wle.hasOwnProperty;
function Sr(t) {
  if (t == null)
    return !0;
  if (ao(t) && (ir(t) || typeof t == "string" || typeof t.splice == "function" || Jd(t) || tx(t) || Qd(t)))
    return !t.length;
  var e = Wa(t);
  if (e == xle || e == ble)
    return !t.size;
  if (Pg(t))
    return !TF(t).length;
  for (var r in t)
    if (Tle.call(t, r))
      return !1;
  return !0;
}
var EF = "c4", Ele = /* @__PURE__ */ x((t) => /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t), "detector"), kle = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => j3e);
  return { id: EF, diagram: t };
}, "loader"), Sle = {
  id: EF,
  detector: Ele,
  loader: kle
}, Cle = Sle, kF = "flowchart", Ale = /* @__PURE__ */ x((t, e) => {
  var r, n;
  return ((r = e == null ? void 0 : e.flowchart) == null ? void 0 : r.defaultRenderer) === "dagre-wrapper" || ((n = e == null ? void 0 : e.flowchart) == null ? void 0 : n.defaultRenderer) === "elk" ? !1 : /^\s*graph/.test(t);
}, "detector"), _le = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => bS);
  return { id: kF, diagram: t };
}, "loader"), Lle = {
  id: kF,
  detector: Ale,
  loader: _le
}, Rle = Lle, SF = "flowchart-v2", Nle = /* @__PURE__ */ x((t, e) => {
  var r, n, i;
  return ((r = e == null ? void 0 : e.flowchart) == null ? void 0 : r.defaultRenderer) === "dagre-d3" ? !1 : (((n = e == null ? void 0 : e.flowchart) == null ? void 0 : n.defaultRenderer) === "elk" && (e.layout = "elk"), /^\s*graph/.test(t) && ((i = e == null ? void 0 : e.flowchart) == null ? void 0 : i.defaultRenderer) === "dagre-wrapper" ? !0 : /^\s*flowchart/.test(t));
}, "detector"), Mle = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => bS);
  return { id: SF, diagram: t };
}, "loader"), Dle = {
  id: SF,
  detector: Nle,
  loader: Mle
}, Ile = Dle, CF = "er", Ole = /* @__PURE__ */ x((t) => /^\s*erDiagram/.test(t), "detector"), Ple = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => g5e);
  return { id: CF, diagram: t };
}, "loader"), Ble = {
  id: CF,
  detector: Ole,
  loader: Ple
}, Fle = Ble, AF = "gitGraph", $le = /* @__PURE__ */ x((t) => /^\s*gitGraph/.test(t), "detector"), zle = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => R7e);
  return { id: AF, diagram: t };
}, "loader"), Vle = {
  id: AF,
  detector: $le,
  loader: zle
}, Gle = Vle, _F = "gantt", Ule = /* @__PURE__ */ x((t) => /^\s*gantt/.test(t), "detector"), Wle = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => ACe);
  return { id: _F, diagram: t };
}, "loader"), Hle = {
  id: _F,
  detector: Ule,
  loader: Wle
}, qle = Hle, LF = "info", Yle = /* @__PURE__ */ x((t) => /^\s*info/.test(t), "detector"), Xle = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => OCe);
  return { id: LF, diagram: t };
}, "loader"), jle = {
  id: LF,
  detector: Yle,
  loader: Xle
}, RF = "pie", Kle = /* @__PURE__ */ x((t) => /^\s*pie/.test(t), "detector"), Zle = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => QCe);
  return { id: RF, diagram: t };
}, "loader"), Qle = {
  id: RF,
  detector: Kle,
  loader: Zle
}, NF = "quadrantChart", Jle = /* @__PURE__ */ x((t) => /^\s*quadrantChart/.test(t), "detector"), ece = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => o8e);
  return { id: NF, diagram: t };
}, "loader"), tce = {
  id: NF,
  detector: Jle,
  loader: ece
}, rce = tce, MF = "xychart", nce = /* @__PURE__ */ x((t) => /^\s*xychart(-beta)?/.test(t), "detector"), ice = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => T8e);
  return { id: MF, diagram: t };
}, "loader"), ace = {
  id: MF,
  detector: nce,
  loader: ice
}, sce = ace, DF = "requirement", oce = /* @__PURE__ */ x((t) => /^\s*requirement(Diagram)?/.test(t), "detector"), lce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => L8e);
  return { id: DF, diagram: t };
}, "loader"), cce = {
  id: DF,
  detector: oce,
  loader: lce
}, uce = cce, IF = "sequence", hce = /* @__PURE__ */ x((t) => /^\s*sequenceDiagram/.test(t), "detector"), dce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => mAe);
  return { id: IF, diagram: t };
}, "loader"), fce = {
  id: IF,
  detector: hce,
  loader: dce
}, pce = fce, OF = "class", gce = /* @__PURE__ */ x((t, e) => {
  var r;
  return ((r = e == null ? void 0 : e.class) == null ? void 0 : r.defaultRenderer) === "dagre-wrapper" ? !1 : /^\s*classDiagram/.test(t);
}, "detector"), mce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => TAe);
  return { id: OF, diagram: t };
}, "loader"), vce = {
  id: OF,
  detector: gce,
  loader: mce
}, yce = vce, PF = "classDiagram", xce = /* @__PURE__ */ x((t, e) => {
  var r;
  return /^\s*classDiagram/.test(t) && ((r = e == null ? void 0 : e.class) == null ? void 0 : r.defaultRenderer) === "dagre-wrapper" ? !0 : /^\s*classDiagram-v2/.test(t);
}, "detector"), bce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => kAe);
  return { id: PF, diagram: t };
}, "loader"), wce = {
  id: PF,
  detector: xce,
  loader: bce
}, Tce = wce, BF = "state", Ece = /* @__PURE__ */ x((t, e) => {
  var r;
  return ((r = e == null ? void 0 : e.state) == null ? void 0 : r.defaultRenderer) === "dagre-wrapper" ? !1 : /^\s*stateDiagram/.test(t);
}, "detector"), kce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => f_e);
  return { id: BF, diagram: t };
}, "loader"), Sce = {
  id: BF,
  detector: Ece,
  loader: kce
}, Cce = Sce, FF = "stateDiagram", Ace = /* @__PURE__ */ x((t, e) => {
  var r;
  return !!(/^\s*stateDiagram-v2/.test(t) || /^\s*stateDiagram/.test(t) && ((r = e == null ? void 0 : e.state) == null ? void 0 : r.defaultRenderer) === "dagre-wrapper");
}, "detector"), _ce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => g_e);
  return { id: FF, diagram: t };
}, "loader"), Lce = {
  id: FF,
  detector: Ace,
  loader: _ce
}, Rce = Lce, $F = "journey", Nce = /* @__PURE__ */ x((t) => /^\s*journey/.test(t), "detector"), Mce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => B_e);
  return { id: $F, diagram: t };
}, "loader"), Dce = {
  id: $F,
  detector: Nce,
  loader: Mce
}, Ice = Dce, Oce = /* @__PURE__ */ x((t, e, r) => {
  ae.debug(`rendering svg for syntax error
`);
  const n = tl(e), i = n.append("g");
  n.attr("viewBox", "0 0 2412 512"), Ki(n, 100, 512, !0), i.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"
  ), i.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"
  ), i.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"
  ), i.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"
  ), i.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"
  ), i.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"
  ), i.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"), i.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${r}`);
}, "draw"), zF = { draw: Oce }, Pce = zF, Bce = {
  db: {},
  renderer: zF,
  parser: {
    parse: /* @__PURE__ */ x(() => {
    }, "parse")
  }
}, Fce = Bce, VF = "flowchart-elk", $ce = /* @__PURE__ */ x((t, e = {}) => {
  var r;
  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) && ((r = e == null ? void 0 : e.flowchart) == null ? void 0 : r.defaultRenderer) === "elk" ? (e.layout = "elk", !0) : !1
  );
}, "detector"), zce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => bS);
  return { id: VF, diagram: t };
}, "loader"), Vce = {
  id: VF,
  detector: $ce,
  loader: zce
}, Gce = Vce, GF = "timeline", Uce = /* @__PURE__ */ x((t) => /^\s*timeline/.test(t), "detector"), Wce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => a9e);
  return { id: GF, diagram: t };
}, "loader"), Hce = {
  id: GF,
  detector: Uce,
  loader: Wce
}, qce = Hce, UF = "mindmap", Yce = /* @__PURE__ */ x((t) => /^\s*mindmap/.test(t), "detector"), Xce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => x9e);
  return { id: UF, diagram: t };
}, "loader"), jce = {
  id: UF,
  detector: Yce,
  loader: Xce
}, Kce = jce, WF = "kanban", Zce = /* @__PURE__ */ x((t) => /^\s*kanban/.test(t), "detector"), Qce = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => $9e);
  return { id: WF, diagram: t };
}, "loader"), Jce = {
  id: WF,
  detector: Zce,
  loader: Qce
}, eue = Jce, HF = "sankey", tue = /* @__PURE__ */ x((t) => /^\s*sankey(-beta)?/.test(t), "detector"), rue = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => ELe);
  return { id: HF, diagram: t };
}, "loader"), nue = {
  id: HF,
  detector: tue,
  loader: rue
}, iue = nue, qF = "packet", aue = /* @__PURE__ */ x((t) => /^\s*packet(-beta)?/.test(t), "detector"), sue = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => ILe);
  return { id: qF, diagram: t };
}, "loader"), oue = {
  id: qF,
  detector: aue,
  loader: sue
}, YF = "radar", lue = /* @__PURE__ */ x((t) => /^\s*radar-beta/.test(t), "detector"), cue = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => tRe);
  return { id: YF, diagram: t };
}, "loader"), uue = {
  id: YF,
  detector: lue,
  loader: cue
}, XF = "block", hue = /* @__PURE__ */ x((t) => /^\s*block(-beta)?/.test(t), "detector"), due = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => ANe);
  return { id: XF, diagram: t };
}, "loader"), fue = {
  id: XF,
  detector: hue,
  loader: due
}, pue = fue, jF = "architecture", gue = /* @__PURE__ */ x((t) => /^\s*architecture/.test(t), "detector"), mue = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => ZNe);
  return { id: jF, diagram: t };
}, "loader"), vue = {
  id: jF,
  detector: gue,
  loader: mue
}, yue = vue, KF = "treemap", xue = /* @__PURE__ */ x((t) => /^\s*treemap/.test(t), "detector"), bue = /* @__PURE__ */ x(async () => {
  const { diagram: t } = await Promise.resolve().then(() => lMe);
  return { id: KF, diagram: t };
}, "loader"), wue = {
  id: KF,
  detector: xue,
  loader: bue
}, x8 = !1, fx = /* @__PURE__ */ x(() => {
  x8 || (x8 = !0, Fv("error", Fce, (t) => t.toLowerCase().trim() === "error"), Fv(
    "---",
    // --- diagram type may appear if YAML front-matter is not parsed correctly
    {
      db: {
        clear: /* @__PURE__ */ x(() => {
        }, "clear")
      },
      styles: {},
      // should never be used
      renderer: {
        draw: /* @__PURE__ */ x(() => {
        }, "draw")
      },
      parser: {
        parse: /* @__PURE__ */ x(() => {
          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"
          );
        }, "parse")
      },
      init: /* @__PURE__ */ x(() => null, "init")
      // no op
    },
    (t) => t.toLowerCase().trimStart().startsWith("---")
  ), q5(Gce, Kce, yue), q5(
    Cle,
    eue,
    Tce,
    yce,
    Fle,
    qle,
    jle,
    Qle,
    uce,
    pce,
    Ile,
    Rle,
    qce,
    Gle,
    Rce,
    Cce,
    Ice,
    rce,
    iue,
    oue,
    sce,
    pue,
    uue,
    wue
  ));
}, "addDiagrams"), Tue = /* @__PURE__ */ x(async () => {
  ae.debug("Loading registered diagrams");
  const e = (await Promise.allSettled(
    Object.entries(ru).map(async ([r, { detector: n, loader: i }]) => {
      if (i)
        try {
          Z5(r);
        } catch {
          try {
            const { diagram: a, id: s } = await i();
            Fv(s, a, n);
          } catch (a) {
            throw ae.error(`Failed to load external diagram with key ${r}. Removing from detectors.`), delete ru[r], a;
          }
        }
    })
  )).filter((r) => r.status === "rejected");
  if (e.length > 0) {
    ae.error(`Failed to load ${e.length} external diagrams`);
    for (const r of e)
      ae.error(r);
    throw new Error(`Failed to load ${e.length} external diagrams`);
  }
}, "loadRegisteredDiagrams"), Eue = "graphics-document document";
function ZF(t, e) {
  t.attr("role", Eue), e !== "" && t.attr("aria-roledescription", e);
}
x(ZF, "setA11yDiagramInfo");
function QF(t, e, r, n) {
  if (t.insert !== void 0) {
    if (r) {
      const i = `chart-desc-${n}`;
      t.attr("aria-describedby", i), t.insert("desc", ":first-child").attr("id", i).text(r);
    }
    if (e) {
      const i = `chart-title-${n}`;
      t.attr("aria-labelledby", i), t.insert("title", ":first-child").attr("id", i).text(e);
    }
  }
}
x(QF, "addSVGa11yTitleDescription");
var eu, Yw = (eu = class {
  constructor(e, r, n, i, a) {
    this.type = e, this.text = r, this.db = n, this.parser = i, this.renderer = a;
  }
  static async fromText(e, r = {}) {
    var u, h;
    const n = gr(), i = Z6(e, n);
    e = Cae(e) + `
`;
    try {
      Z5(i);
    } catch {
      const d = NX(i);
      if (!d)
        throw new xM(`Diagram ${i} not found.`);
      const { id: f, diagram: p } = await d();
      Fv(f, p);
    }
    const { db: a, parser: s, renderer: o, init: l } = Z5(i);
    return s.parser && (s.parser.yy = a), (u = a.clear) == null || u.call(a), l == null || l(n), r.title && ((h = a.setDiagramTitle) == null || h.call(a, r.title)), await s.parse(e), new eu(i, e, a, s, o);
  }
  async render(e, r) {
    await this.renderer.draw(this.text, e, r, this);
  }
  getParser() {
    return this.parser;
  }
  getType() {
    return this.type;
  }
}, x(eu, "Diagram"), eu), b8 = [], kue = /* @__PURE__ */ x(() => {
  b8.forEach((t) => {
    t();
  }), b8 = [];
}, "attachFunctions"), Sue = /* @__PURE__ */ x((t) => t.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart(), "cleanupComments");
function JF(t) {
  const e = t.match(yM);
  if (!e)
    return {
      text: t,
      metadata: {}
    };
  let r = Q2(e[1], {
    // To support config, we need JSON schema.
    // https://www.yaml.org/spec/1.2/spec.html#id2803231
    schema: Z2
  }) ?? {};
  r = typeof r == "object" && !Array.isArray(r) ? r : {};
  const n = {};
  return r.displayMode && (n.displayMode = r.displayMode.toString()), r.title && (n.title = r.title.toString()), r.config && (n.config = r.config), {
    text: t.slice(e[0].length),
    metadata: n
  };
}
x(JF, "extractFrontMatter");
var Cue = /* @__PURE__ */ x((t) => t.replace(/\r\n?/g, `
`).replace(
  /<(\w+)([^>]*)>/g,
  (e, r, n) => "<" + r + n.replace(/="([^"]*)"/g, "='$1'") + ">"
), "cleanupText"), Aue = /* @__PURE__ */ x((t) => {
  const { text: e, metadata: r } = JF(t), { displayMode: n, title: i, config: a = {} } = r;
  return n && (a.gantt || (a.gantt = {}), a.gantt.displayMode = n), { title: i, config: a, text: e };
}, "processFrontmatter"), _ue = /* @__PURE__ */ x((t) => {
  const e = Kt.detectInit(t) ?? {}, r = Kt.detectDirective(t, "wrap");
  return Array.isArray(r) ? e.wrap = r.some(({ type: n }) => n === "wrap") : (r == null ? void 0 : r.type) === "wrap" && (e.wrap = !0), {
    text: mae(t),
    directive: e
  };
}, "processDirectives");
function rk(t) {
  const e = Cue(t), r = Aue(e), n = _ue(r.text), i = qi(r.config, n.directive);
  return t = Sue(n.text), {
    code: t,
    title: r.title,
    config: i
  };
}
x(rk, "preprocessDiagram");
function e$(t) {
  const e = new TextEncoder().encode(t), r = Array.from(e, (n) => String.fromCodePoint(n)).join("");
  return btoa(r);
}
x(e$, "toBase64");
var Lue = 5e4, Rue = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa", Nue = "sandbox", Mue = "loose", Due = "http://www.w3.org/2000/svg", Iue = "http://www.w3.org/1999/xlink", Oue = "http://www.w3.org/1999/xhtml", Pue = "100%", Bue = "100%", Fue = "border:0;margin:0;", $ue = "margin:0", zue = "allow-top-navigation-by-user-activation allow-popups", Vue = 'The "iframe" tag is not supported by your browser.', Gue = ["foreignobject"], Uue = ["dominant-baseline"];
function nk(t) {
  const e = rk(t);
  return Pv(), qX(e.config ?? {}), e;
}
x(nk, "processAndSetConfigs");
async function t$(t, e) {
  fx();
  try {
    const { code: r, config: n } = nk(t);
    return { diagramType: (await n$(r)).type, config: n };
  } catch (r) {
    if (e != null && e.suppressErrors)
      return !1;
    throw r;
  }
}
x(t$, "parse");
var w8 = /* @__PURE__ */ x((t, e, r = []) => `
.${t} ${e} { ${r.join(" !important; ")} !important; }`, "cssImportantStyles"), Wue = /* @__PURE__ */ x((t, e = /* @__PURE__ */ new Map()) => {
  var n;
  let r = "";
  if (t.themeCSS !== void 0 && (r += `
${t.themeCSS}`), t.fontFamily !== void 0 && (r += `
:root { --mermaid-font-family: ${t.fontFamily}}`), t.altFontFamily !== void 0 && (r += `
:root { --mermaid-alt-font-family: ${t.altFontFamily}}`), e instanceof Map) {
    const o = t.htmlLabels ?? ((n = t.flowchart) == null ? void 0 : n.htmlLabels) ? ["> *", "span"] : ["rect", "polygon", "ellipse", "circle", "path"];
    e.forEach((l) => {
      Sr(l.styles) || o.forEach((u) => {
        r += w8(l.id, u, l.styles);
      }), Sr(l.textStyles) || (r += w8(
        l.id,
        "tspan",
        ((l == null ? void 0 : l.textStyles) || []).map((u) => u.replace("color", "fill"))
      ));
    });
  }
  return r;
}, "createCssStyles"), Hue = /* @__PURE__ */ x((t, e, r, n) => {
  const i = Wue(t, r), a = hj(e, i, t.themeVariables);
  return Uw(ole(`${n}{${a}}`), cle);
}, "createUserStyles"), que = /* @__PURE__ */ x((t = "", e, r) => {
  let n = t;
  return !r && !e && (n = n.replace(
    /marker-end="url\([\d+./:=?A-Za-z-]*?#/g,
    'marker-end="url(#'
  )), n = Zs(n), n = n.replace(/<br>/g, "<br/>"), n;
}, "cleanUpSvgCode"), Yue = /* @__PURE__ */ x((t = "", e) => {
  var i, a;
  const r = (a = (i = e == null ? void 0 : e.viewBox) == null ? void 0 : i.baseVal) != null && a.height ? e.viewBox.baseVal.height + "px" : Bue, n = e$(`<body style="${$ue}">${t}</body>`);
  return `<iframe style="width:${Pue};height:${r};${Fue}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${zue}">
  ${Vue}
</iframe>`;
}, "putIntoIFrame"), T8 = /* @__PURE__ */ x((t, e, r, n, i) => {
  const a = t.append("div");
  a.attr("id", r), n && a.attr("style", n);
  const s = a.append("svg").attr("id", e).attr("width", "100%").attr("xmlns", Due);
  return i && s.attr("xmlns:xlink", i), s.append("g"), t;
}, "appendDivSvgG");
function Xw(t, e) {
  return t.append("iframe").attr("id", e).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
}
x(Xw, "sandboxedIframe");
var Xue = /* @__PURE__ */ x((t, e, r, n) => {
  var i, a, s;
  (i = t.getElementById(e)) == null || i.remove(), (a = t.getElementById(r)) == null || a.remove(), (s = t.getElementById(n)) == null || s.remove();
}, "removeExistingElements"), jue = /* @__PURE__ */ x(async function(t, e, r) {
  var O, P, S, R, I, D;
  fx();
  const n = nk(e);
  e = n.code;
  const i = gr();
  ae.debug(i), e.length > ((i == null ? void 0 : i.maxTextSize) ?? Lue) && (e = Rue);
  const a = "#" + t, s = "i" + t, o = "#" + s, l = "d" + t, u = "#" + l, h = /* @__PURE__ */ x(() => {
    const B = Qe(f ? o : u).node();
    B && "remove" in B && B.remove();
  }, "removeTempElements");
  let d = Qe("body");
  const f = i.securityLevel === Nue, p = i.securityLevel === Mue, g = i.fontFamily;
  if (r !== void 0) {
    if (r && (r.innerHTML = ""), f) {
      const M = Xw(Qe(r), s);
      d = Qe(M.nodes()[0].contentDocument.body), d.node().style.margin = 0;
    } else
      d = Qe(r);
    T8(d, t, l, `font-family: ${g}`, Iue);
  } else {
    if (Xue(document, t, l, s), f) {
      const M = Xw(Qe("body"), s);
      d = Qe(M.nodes()[0].contentDocument.body), d.node().style.margin = 0;
    } else
      d = Qe("body");
    T8(d, t, l);
  }
  let m, v;
  try {
    m = await Yw.fromText(e, { title: n.title });
  } catch (M) {
    if (i.suppressErrorRendering)
      throw h(), M;
    m = await Yw.fromText("error"), v = M;
  }
  const y = d.select(u).node(), b = m.type, w = y.firstChild, T = w.firstChild, E = (P = (O = m.renderer).getClasses) == null ? void 0 : P.call(O, e, m), C = Hue(i, b, E, a), k = document.createElement("style");
  k.innerHTML = C, w.insertBefore(k, T);
  try {
    await m.renderer.draw(e, t, G5.version, m);
  } catch (M) {
    throw i.suppressErrorRendering ? h() : Pce.draw(e, t, G5.version), M;
  }
  const _ = d.select(`${u} svg`), L = (R = (S = m.db).getAccTitle) == null ? void 0 : R.call(S), N = (D = (I = m.db).getAccDescription) == null ? void 0 : D.call(I);
  i$(b, _, L, N), d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns", Oue);
  let A = d.select(u).node().innerHTML;
  if (ae.debug("config.arrowMarkerAbsolute", i.arrowMarkerAbsolute), A = que(A, f, Ir(i.arrowMarkerAbsolute)), f) {
    const M = d.select(u + " svg").node();
    A = Yue(A, M);
  } else p || (A = Vd.sanitize(A, {
    ADD_TAGS: Gue,
    ADD_ATTR: Uue,
    HTML_INTEGRATION_POINTS: { foreignobject: !0 }
  }));
  if (kue(), v)
    throw v;
  return h(), {
    diagramType: b,
    svg: A,
    bindFunctions: m.db.bindFunctions
  };
}, "render");
function r$(t = {}) {
  var n;
  const e = mn({}, t);
  e != null && e.fontFamily && !((n = e.themeVariables) != null && n.fontFamily) && (e.themeVariables || (e.themeVariables = {}), e.themeVariables.fontFamily = e.fontFamily), WX(e), e != null && e.theme && e.theme in Fo ? e.themeVariables = Fo[e.theme].getThemeVariables(
    e.themeVariables
  ) : e && (e.themeVariables = Fo.default.getThemeVariables(e.themeVariables));
  const r = typeof e == "object" ? UX(e) : EM();
  j6(r.logLevel), fx();
}
x(r$, "initialize");
var n$ = /* @__PURE__ */ x((t, e = {}) => {
  const { code: r } = rk(t);
  return Yw.fromText(r, e);
}, "getDiagramFromText");
function i$(t, e, r, n) {
  ZF(e, t), QF(e, r, n, e.attr("id"));
}
x(i$, "addA11yInfo");
var du = Object.freeze({
  render: jue,
  parse: t$,
  getDiagramFromText: n$,
  initialize: r$,
  getConfig: gr,
  setConfig: kM,
  getSiteConfig: EM,
  updateSiteConfig: HX,
  reset: /* @__PURE__ */ x(() => {
    Pv();
  }, "reset"),
  globalReset: /* @__PURE__ */ x(() => {
    Pv(Gd);
  }, "globalReset"),
  defaultConfig: Gd
});
j6(gr().logLevel);
Pv(gr());
var Kue = /* @__PURE__ */ x((t, e, r) => {
  ae.warn(t), BE(t) ? (r && r(t.str, t.hash), e.push({ ...t, message: t.str, error: t })) : (r && r(t), t instanceof Error && e.push({
    str: t.message,
    message: t.message,
    hash: t.name,
    error: t
  }));
}, "handleError"), a$ = /* @__PURE__ */ x(async function(t = {
  querySelector: ".mermaid"
}) {
  try {
    await Zue(t);
  } catch (e) {
    if (BE(e) && ae.error(e.str), Ca.parseError && Ca.parseError(e), !t.suppressErrors)
      throw ae.error("Use the suppressErrors option to suppress these errors"), e;
  }
}, "run"), Zue = /* @__PURE__ */ x(async function({ postRenderCallback: t, querySelector: e, nodes: r } = {
  querySelector: ".mermaid"
}) {
  const n = du.getConfig();
  ae.debug(`${t ? "" : "No "}Callback function found`);
  let i;
  if (r)
    i = r;
  else if (e)
    i = document.querySelectorAll(e);
  else
    throw new Error("Nodes and querySelector are both undefined");
  ae.debug(`Found ${i.length} diagrams`), (n == null ? void 0 : n.startOnLoad) !== void 0 && (ae.debug("Start On Load: " + (n == null ? void 0 : n.startOnLoad)), du.updateSiteConfig({ startOnLoad: n == null ? void 0 : n.startOnLoad }));
  const a = new Kt.InitIDGenerator(n.deterministicIds, n.deterministicIDSeed);
  let s;
  const o = [];
  for (const l of Array.from(i)) {
    if (ae.info("Rendering diagram: " + l.id), l.getAttribute("data-processed"))
      continue;
    l.setAttribute("data-processed", "true");
    const u = `mermaid-${a.next()}`;
    s = l.innerHTML, s = xP(Kt.entityDecode(s)).trim().replace(/<br\s*\/?>/gi, "<br/>");
    const h = Kt.detectInit(s);
    h && ae.debug("Detected early reinit: ", h);
    try {
      const { svg: d, bindFunctions: f } = await c$(u, s, l);
      l.innerHTML = d, t && await t(u), f && f(l);
    } catch (d) {
      Kue(d, o, Ca.parseError);
    }
  }
  if (o.length > 0)
    throw o[0];
}, "runThrowsErrors"), s$ = /* @__PURE__ */ x(function(t) {
  du.initialize(t);
}, "initialize"), Que = /* @__PURE__ */ x(async function(t, e, r) {
  ae.warn("mermaid.init is deprecated. Please use run instead."), t && s$(t);
  const n = { postRenderCallback: r, querySelector: ".mermaid" };
  typeof e == "string" ? n.querySelector = e : e && (e instanceof HTMLElement ? n.nodes = [e] : n.nodes = e), await a$(n);
}, "init"), Jue = /* @__PURE__ */ x(async (t, {
  lazyLoad: e = !0
} = {}) => {
  fx(), q5(...t), e === !1 && await Tue();
}, "registerExternalDiagrams"), o$ = /* @__PURE__ */ x(function() {
  if (Ca.startOnLoad) {
    const { startOnLoad: t } = du.getConfig();
    t && Ca.run().catch((e) => ae.error("Mermaid failed to initialize", e));
  }
}, "contentLoaded");
typeof document < "u" && window.addEventListener("load", o$, !1);
var ehe = /* @__PURE__ */ x(function(t) {
  Ca.parseError = t;
}, "setParseErrorHandler"), Sy = [], n4 = !1, l$ = /* @__PURE__ */ x(async () => {
  if (!n4) {
    for (n4 = !0; Sy.length > 0; ) {
      const t = Sy.shift();
      if (t)
        try {
          await t();
        } catch (e) {
          ae.error("Error executing queue", e);
        }
    }
    n4 = !1;
  }
}, "executeQueue"), the = /* @__PURE__ */ x(async (t, e) => new Promise((r, n) => {
  const i = /* @__PURE__ */ x(() => new Promise((a, s) => {
    du.parse(t, e).then(
      (o) => {
        a(o), r(o);
      },
      (o) => {
        var l;
        ae.error("Error parsing", o), (l = Ca.parseError) == null || l.call(Ca, o), s(o), n(o);
      }
    );
  }), "performCall");
  Sy.push(i), l$().catch(n);
}), "parse"), c$ = /* @__PURE__ */ x((t, e, r) => new Promise((n, i) => {
  const a = /* @__PURE__ */ x(() => new Promise((s, o) => {
    du.render(t, e, r).then(
      (l) => {
        s(l), n(l);
      },
      (l) => {
        var u;
        ae.error("Error parsing", l), (u = Ca.parseError) == null || u.call(Ca, l), o(l), i(l);
      }
    );
  }), "performCall");
  Sy.push(a), l$().catch(i);
}), "render"), rhe = /* @__PURE__ */ x(() => Object.keys(ru).map((t) => ({
  id: t
})), "getRegisteredDiagramsMetadata"), Ca = {
  startOnLoad: !0,
  mermaidAPI: du,
  parse: the,
  render: c$,
  init: Que,
  run: a$,
  registerExternalDiagrams: Jue,
  registerLayoutLoaders: gF,
  initialize: s$,
  parseError: void 0,
  contentLoaded: o$,
  setParseErrorHandler: ehe,
  detectType: Z6,
  registerIconPacks: TP,
  getRegisteredDiagramsMetadata: rhe
}, E8 = Ca;
/*! Check if previously processed */
/*!
 * Wait for document loaded before starting the execution
 */
function AMe(t) {
  const { data: e, setStateValue: r, setTriggerValue: n, parentElement: i } = t, a = i.querySelector("#mermaid-container");
  s();
  function s() {
    E8.initialize({ startOnLoad: !1, theme: e.theme || "neutral" });
    const o = "mermaid-" + Math.random().toString(36).substr(2, 9);
    E8.render(o, e.mermaid_code).then(({ svg: l }) => {
      a.innerHTML = l, setTimeout(() => {
        const u = a.querySelectorAll("g");
        console.log(u);
        const h = [];
        u.forEach((d) => {
          const f = d.id != "" || d.classList.contains("label") && d.classList.contains("name");
          console.log(f), f && h.push(d);
        }), h.forEach((d) => {
          let f = "";
          const p = d.querySelectorAll("text"), g = d.querySelectorAll(".nodeLabel"), m = d.querySelectorAll(".label");
          p.length > 0 ? f = p[0].textContent.trim() : g.length > 0 ? f = g[0].textContent.trim() : m.length > 0 && (f = m[0].textContent.trim()), !f && d.hasAttribute("data-id") && (f = d.getAttribute("data-id")), f && (d.style.cursor = "pointer", d.classList.add("mermaid-clickable"), d.addEventListener("click", (v) => {
            v.preventDefault(), v.stopPropagation();
            const y = e.entity_name_mapping && e.entity_name_mapping[f] || f;
            r("entity_clicked", y), n("clicked", y);
          }));
        });
      }, 500);
    }).catch((l) => {
      a.innerHTML = '<p style="color: red;">Error rendering diagram: ' + l.message + "</p>", console.error("Mermaid error:", l);
    });
  }
}
class na {
  // The + prefix indicates that these fields aren't writeable
  // Lexer holding the input string.
  // Start offset, zero-based inclusive.
  // End offset, zero-based exclusive.
  constructor(e, r, n) {
    this.lexer = void 0, this.start = void 0, this.end = void 0, this.lexer = e, this.start = r, this.end = n;
  }
  /**
   * Merges two `SourceLocation`s from location providers, given they are
   * provided in order of appearance.
   * - Returns the first one's location if only the first is provided.
   * - Returns a merged range of the first and the last if both are provided
   *   and their lexers match.
   * - Otherwise, returns null.
   */
  static range(e, r) {
    return r ? !e || !e.loc || !r.loc || e.loc.lexer !== r.loc.lexer ? null : new na(e.loc.lexer, e.loc.start, r.loc.end) : e && e.loc;
  }
}
class Aa {
  // don't expand the token
  // used in \noexpand
  constructor(e, r) {
    this.text = void 0, this.loc = void 0, this.noexpand = void 0, this.treatAsRelax = void 0, this.text = e, this.loc = r;
  }
  /**
   * Given a pair of tokens (this and endToken), compute a `Token` encompassing
   * the whole input range enclosed by these two.
   */
  range(e, r) {
    return new Aa(r, na.range(this, e));
  }
}
class ot {
  // Error start position based on passed-in Token or ParseNode.
  // Length of affected text based on passed-in Token or ParseNode.
  // The underlying error message without any context added.
  constructor(e, r) {
    this.name = void 0, this.position = void 0, this.length = void 0, this.rawMessage = void 0;
    var n = "KaTeX parse error: " + e, i, a, s = r && r.loc;
    if (s && s.start <= s.end) {
      var o = s.lexer.input;
      i = s.start, a = s.end, i === o.length ? n += " at end of input: " : n += " at position " + (i + 1) + ": ";
      var l = o.slice(i, a).replace(/[^]/g, "$&̲"), u;
      i > 15 ? u = "…" + o.slice(i - 15, i) : u = o.slice(0, i);
      var h;
      a + 15 < o.length ? h = o.slice(a, a + 15) + "…" : h = o.slice(a), n += u + l + h;
    }
    var d = new Error(n);
    return d.name = "ParseError", d.__proto__ = ot.prototype, d.position = i, i != null && a != null && (d.length = a - i), d.rawMessage = e, d;
  }
}
ot.prototype.__proto__ = Error.prototype;
var nhe = function(e, r) {
  return e === void 0 ? r : e;
}, ihe = /([A-Z])/g, ahe = function(e) {
  return e.replace(ihe, "-$1").toLowerCase();
}, she = {
  "&": "&amp;",
  ">": "&gt;",
  "<": "&lt;",
  '"': "&quot;",
  "'": "&#x27;"
}, ohe = /[&><"']/g;
function lhe(t) {
  return String(t).replace(ohe, (e) => she[e]);
}
var u$ = function t(e) {
  return e.type === "ordgroup" || e.type === "color" ? e.body.length === 1 ? t(e.body[0]) : e : e.type === "font" ? t(e.body) : e;
}, che = function(e) {
  var r = u$(e);
  return r.type === "mathord" || r.type === "textord" || r.type === "atom";
}, uhe = function(e) {
  if (!e)
    throw new Error("Expected non-null, but got " + String(e));
  return e;
}, hhe = function(e) {
  var r = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);
  return r ? r[2] !== ":" || !/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1]) ? null : r[1].toLowerCase() : "_relative";
}, Tr = {
  deflt: nhe,
  escape: lhe,
  hyphenate: ahe,
  getBaseElem: u$,
  isCharacterBox: che,
  protocolFromUrl: hhe
}, Sp = {
  displayMode: {
    type: "boolean",
    description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",
    cli: "-d, --display-mode"
  },
  output: {
    type: {
      enum: ["htmlAndMathml", "html", "mathml"]
    },
    description: "Determines the markup language of the output.",
    cli: "-F, --format <type>"
  },
  leqno: {
    type: "boolean",
    description: "Render display math in leqno style (left-justified tags)."
  },
  fleqn: {
    type: "boolean",
    description: "Render display math flush left."
  },
  throwOnError: {
    type: "boolean",
    default: !0,
    cli: "-t, --no-throw-on-error",
    cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."
  },
  errorColor: {
    type: "string",
    default: "#cc0000",
    cli: "-c, --error-color <color>",
    cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",
    cliProcessor: (t) => "#" + t
  },
  macros: {
    type: "object",
    cli: "-m, --macro <def>",
    cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",
    cliDefault: [],
    cliProcessor: (t, e) => (e.push(t), e)
  },
  minRuleThickness: {
    type: "number",
    description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",
    processor: (t) => Math.max(0, t),
    cli: "--min-rule-thickness <size>",
    cliProcessor: parseFloat
  },
  colorIsTextColor: {
    type: "boolean",
    description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",
    cli: "-b, --color-is-text-color"
  },
  strict: {
    type: [{
      enum: ["warn", "ignore", "error"]
    }, "boolean", "function"],
    description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",
    cli: "-S, --strict",
    cliDefault: !1
  },
  trust: {
    type: ["boolean", "function"],
    description: "Trust the input, enabling all HTML features such as \\url.",
    cli: "-T, --trust"
  },
  maxSize: {
    type: "number",
    default: 1 / 0,
    description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",
    processor: (t) => Math.max(0, t),
    cli: "-s, --max-size <n>",
    cliProcessor: parseInt
  },
  maxExpand: {
    type: "number",
    default: 1e3,
    description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",
    processor: (t) => Math.max(0, t),
    cli: "-e, --max-expand <n>",
    cliProcessor: (t) => t === "Infinity" ? 1 / 0 : parseInt(t)
  },
  globalGroup: {
    type: "boolean",
    cli: !1
  }
};
function dhe(t) {
  if (t.default)
    return t.default;
  var e = t.type, r = Array.isArray(e) ? e[0] : e;
  if (typeof r != "string")
    return r.enum[0];
  switch (r) {
    case "boolean":
      return !1;
    case "string":
      return "";
    case "number":
      return 0;
    case "object":
      return {};
  }
}
class ik {
  constructor(e) {
    this.displayMode = void 0, this.output = void 0, this.leqno = void 0, this.fleqn = void 0, this.throwOnError = void 0, this.errorColor = void 0, this.macros = void 0, this.minRuleThickness = void 0, this.colorIsTextColor = void 0, this.strict = void 0, this.trust = void 0, this.maxSize = void 0, this.maxExpand = void 0, this.globalGroup = void 0, e = e || {};
    for (var r in Sp)
      if (Sp.hasOwnProperty(r)) {
        var n = Sp[r];
        this[r] = e[r] !== void 0 ? n.processor ? n.processor(e[r]) : e[r] : dhe(n);
      }
  }
  /**
   * Report nonstrict (non-LaTeX-compatible) input.
   * Can safely not be called if `this.strict` is false in JavaScript.
   */
  reportNonstrict(e, r, n) {
    var i = this.strict;
    if (typeof i == "function" && (i = i(e, r, n)), !(!i || i === "ignore")) {
      if (i === !0 || i === "error")
        throw new ot("LaTeX-incompatible input and strict mode is set to 'error': " + (r + " [" + e + "]"), n);
      i === "warn" ? typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (r + " [" + e + "]")) : typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + i + "': " + r + " [" + e + "]"));
    }
  }
  /**
   * Check whether to apply strict (LaTeX-adhering) behavior for unusual
   * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
   * instead, "error" translates to a return value of `true`, while "ignore"
   * translates to a return value of `false`.  May still print a warning:
   * "warn" prints a warning and returns `false`.
   * This is for the second category of `errorCode`s listed in the README.
   */
  useStrictBehavior(e, r, n) {
    var i = this.strict;
    if (typeof i == "function")
      try {
        i = i(e, r, n);
      } catch {
        i = "error";
      }
    return !i || i === "ignore" ? !1 : i === !0 || i === "error" ? !0 : i === "warn" ? (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (r + " [" + e + "]")), !1) : (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + i + "': " + r + " [" + e + "]")), !1);
  }
  /**
   * Check whether to test potentially dangerous input, and return
   * `true` (trusted) or `false` (untrusted).  The sole argument `context`
   * should be an object with `command` field specifying the relevant LaTeX
   * command (as a string starting with `\`), and any other arguments, etc.
   * If `context` has a `url` field, a `protocol` field will automatically
   * get added by this function (changing the specified object).
   */
  isTrusted(e) {
    if (e.url && !e.protocol) {
      var r = Tr.protocolFromUrl(e.url);
      if (r == null)
        return !1;
      e.protocol = r;
    }
    var n = typeof this.trust == "function" ? this.trust(e) : this.trust;
    return !!n;
  }
}
class ul {
  constructor(e, r, n) {
    this.id = void 0, this.size = void 0, this.cramped = void 0, this.id = e, this.size = r, this.cramped = n;
  }
  /**
   * Get the style of a superscript given a base in the current style.
   */
  sup() {
    return zs[fhe[this.id]];
  }
  /**
   * Get the style of a subscript given a base in the current style.
   */
  sub() {
    return zs[phe[this.id]];
  }
  /**
   * Get the style of a fraction numerator given the fraction in the current
   * style.
   */
  fracNum() {
    return zs[ghe[this.id]];
  }
  /**
   * Get the style of a fraction denominator given the fraction in the current
   * style.
   */
  fracDen() {
    return zs[mhe[this.id]];
  }
  /**
   * Get the cramped version of a style (in particular, cramping a cramped style
   * doesn't change the style).
   */
  cramp() {
    return zs[vhe[this.id]];
  }
  /**
   * Get a text or display version of this style.
   */
  text() {
    return zs[yhe[this.id]];
  }
  /**
   * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
   */
  isTight() {
    return this.size >= 2;
  }
}
var ak = 0, Cy = 1, Ih = 2, zo = 3, Jp = 4, Xa = 5, rf = 6, Vi = 7, zs = [new ul(ak, 0, !1), new ul(Cy, 0, !0), new ul(Ih, 1, !1), new ul(zo, 1, !0), new ul(Jp, 2, !1), new ul(Xa, 2, !0), new ul(rf, 3, !1), new ul(Vi, 3, !0)], fhe = [Jp, Xa, Jp, Xa, rf, Vi, rf, Vi], phe = [Xa, Xa, Xa, Xa, Vi, Vi, Vi, Vi], ghe = [Ih, zo, Jp, Xa, rf, Vi, rf, Vi], mhe = [zo, zo, Xa, Xa, Vi, Vi, Vi, Vi], vhe = [Cy, Cy, zo, zo, Xa, Xa, Vi, Vi], yhe = [ak, Cy, Ih, zo, Ih, zo, Ih, zo], Vt = {
  DISPLAY: zs[ak],
  TEXT: zs[Ih],
  SCRIPT: zs[Jp],
  SCRIPTSCRIPT: zs[rf]
}, jw = [{
  // Latin characters beyond the Latin-1 characters we have metrics for.
  // Needed for Czech, Hungarian and Turkish text, for example.
  name: "latin",
  blocks: [
    [256, 591],
    // Latin Extended-A and Latin Extended-B
    [768, 879]
    // Combining Diacritical marks
  ]
}, {
  // The Cyrillic script used by Russian and related languages.
  // A Cyrillic subset used to be supported as explicitly defined
  // symbols in symbols.js
  name: "cyrillic",
  blocks: [[1024, 1279]]
}, {
  // Armenian
  name: "armenian",
  blocks: [[1328, 1423]]
}, {
  // The Brahmic scripts of South and Southeast Asia
  // Devanagari (0900–097F)
  // Bengali (0980–09FF)
  // Gurmukhi (0A00–0A7F)
  // Gujarati (0A80–0AFF)
  // Oriya (0B00–0B7F)
  // Tamil (0B80–0BFF)
  // Telugu (0C00–0C7F)
  // Kannada (0C80–0CFF)
  // Malayalam (0D00–0D7F)
  // Sinhala (0D80–0DFF)
  // Thai (0E00–0E7F)
  // Lao (0E80–0EFF)
  // Tibetan (0F00–0FFF)
  // Myanmar (1000–109F)
  name: "brahmic",
  blocks: [[2304, 4255]]
}, {
  name: "georgian",
  blocks: [[4256, 4351]]
}, {
  // Chinese and Japanese.
  // The "k" in cjk is for Korean, but we've separated Korean out
  name: "cjk",
  blocks: [
    [12288, 12543],
    // CJK symbols and punctuation, Hiragana, Katakana
    [19968, 40879],
    // CJK ideograms
    [65280, 65376]
    // Fullwidth punctuation
    // TODO: add halfwidth Katakana and Romanji glyphs
  ]
}, {
  // Korean
  name: "hangul",
  blocks: [[44032, 55215]]
}];
function xhe(t) {
  for (var e = 0; e < jw.length; e++)
    for (var r = jw[e], n = 0; n < r.blocks.length; n++) {
      var i = r.blocks[n];
      if (t >= i[0] && t <= i[1])
        return r.name;
    }
  return null;
}
var Jm = [];
jw.forEach((t) => t.blocks.forEach((e) => Jm.push(...e)));
function h$(t) {
  for (var e = 0; e < Jm.length; e += 2)
    if (t >= Jm[e] && t <= Jm[e + 1])
      return !0;
  return !1;
}
var Qu = 80, bhe = function(e, r) {
  return "M95," + (622 + e + r) + `
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l` + e / 2.075 + " -" + e + `
c5.3,-9.3,12,-14,20,-14
H400000v` + (40 + e) + `H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M` + (834 + e) + " " + r + "h400000v" + (40 + e) + "h-400000z";
}, whe = function(e, r) {
  return "M263," + (601 + e + r) + `c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l` + e / 2.084 + " -" + e + `
c4.7,-7.3,11,-11,19,-11
H40000v` + (40 + e) + `H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M` + (1001 + e) + " " + r + "h400000v" + (40 + e) + "h-400000z";
}, The = function(e, r) {
  return "M983 " + (10 + e + r) + `
l` + e / 3.13 + " -" + e + `
c4,-6.7,10,-10,18,-10 H400000v` + (40 + e) + `
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M` + (1001 + e) + " " + r + "h400000v" + (40 + e) + "h-400000z";
}, Ehe = function(e, r) {
  return "M424," + (2398 + e + r) + `
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l` + e / 4.223 + " -" + e + `c4,-6.7,10,-10,18,-10 H400000
v` + (40 + e) + `H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M` + (1001 + e) + " " + r + `
h400000v` + (40 + e) + "h-400000z";
}, khe = function(e, r) {
  return "M473," + (2713 + e + r) + `
c339.3,-1799.3,509.3,-2700,510,-2702 l` + e / 5.298 + " -" + e + `
c3.3,-7.3,9.3,-11,18,-11 H400000v` + (40 + e) + `H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM` + (1001 + e) + " " + r + "h400000v" + (40 + e) + "H1017.7z";
}, She = function(e) {
  var r = e / 2;
  return "M400000 " + e + " H0 L" + r + " 0 l65 45 L145 " + (e - 80) + " H400000z";
}, Che = function(e, r, n) {
  var i = n - 54 - r - e;
  return "M702 " + (e + r) + "H400000" + (40 + e) + `
H742v` + i + `l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 ` + r + "H400000v" + (40 + e) + "H742z";
}, Ahe = function(e, r, n) {
  r = 1e3 * r;
  var i = "";
  switch (e) {
    case "sqrtMain":
      i = bhe(r, Qu);
      break;
    case "sqrtSize1":
      i = whe(r, Qu);
      break;
    case "sqrtSize2":
      i = The(r, Qu);
      break;
    case "sqrtSize3":
      i = Ehe(r, Qu);
      break;
    case "sqrtSize4":
      i = khe(r, Qu);
      break;
    case "sqrtTall":
      i = Che(r, Qu, n);
  }
  return i;
}, _he = function(e, r) {
  switch (e) {
    case "⎜":
      return "M291 0 H417 V" + r + " H291z M291 0 H417 V" + r + " H291z";
    case "∣":
      return "M145 0 H188 V" + r + " H145z M145 0 H188 V" + r + " H145z";
    case "∥":
      return "M145 0 H188 V" + r + " H145z M145 0 H188 V" + r + " H145z" + ("M367 0 H410 V" + r + " H367z M367 0 H410 V" + r + " H367z");
    case "⎟":
      return "M457 0 H583 V" + r + " H457z M457 0 H583 V" + r + " H457z";
    case "⎢":
      return "M319 0 H403 V" + r + " H319z M319 0 H403 V" + r + " H319z";
    case "⎥":
      return "M263 0 H347 V" + r + " H263z M263 0 H347 V" + r + " H263z";
    case "⎪":
      return "M384 0 H504 V" + r + " H384z M384 0 H504 V" + r + " H384z";
    case "⏐":
      return "M312 0 H355 V" + r + " H312z M312 0 H355 V" + r + " H312z";
    case "‖":
      return "M257 0 H300 V" + r + " H257z M257 0 H300 V" + r + " H257z" + ("M478 0 H521 V" + r + " H478z M478 0 H521 V" + r + " H478z");
    default:
      return "";
  }
}, k8 = {
  // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
  doubleleftarrow: `M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,
  // doublerightarrow is from glyph U+21D2 in font KaTeX Main
  doublerightarrow: `M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,
  // leftarrow is from glyph U+2190 in font KaTeX Main
  leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120
 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
 l-3-3h399890zM100 241v40h399900v-40z`,
  // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
  leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,
  leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,
  // overgroup is from the MnSymbol package (public domain)
  leftgroup: `M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
 435 0h399565z`,
  leftgroupunder: `M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
 435 219h399565z`,
  // Harpoons are from glyph U+21BD in font KaTeX Main
  leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,
  leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,
  leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,
  leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,
  // hook is from glyph U+21A9 in font KaTeX Main
  lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
 71.5 23h399859zM103 281v-40h399897v40z`,
  leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,
  leftmapsto: `M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,
  // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
  leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,
  longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,
  midbrace: `M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,
  midbraceunder: `M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,
  oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,
  oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,
  oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,
  oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,
  rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
 151.7 139 205zm0 0v40h399900v-40z`,
  rightbrace: `M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,
  rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,
  rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
 3-1 3-3v-38c-76-158-257-219-435-219H0z`,
  rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,
  rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
 69.2 92 94.5zm0 0v40h399900v-40z`,
  rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,
  rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,
  rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,
  righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,
  rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,
  rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,
  // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
  twoheadleftarrow: `M0 167c68 40
 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,
  twoheadrightarrow: `M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,
  // tilde1 is a modified version of a glyph from the MnSymbol package
  tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,
  // ditto tilde2, tilde3, & tilde4
  tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,
  tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
 -338 0-409-156.573-744-156.573z`,
  tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
 -175.236-744-175.236z`,
  // vec is from glyph U+20D7 in font KaTeX Main
  vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,
  // widehat1 is a modified version of a glyph from the MnSymbol package
  widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,
  // ditto widehat2, widehat3, & widehat4
  widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
  widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
  widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,
  // widecheck paths are all inverted versions of widehat
  widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,
  widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
  widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
  widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,
  // The next ten paths support reaction arrows from the mhchem package.
  // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
  // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
  baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,
  // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
  rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,
  // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
  // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
  baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,
  rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,
  shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,
  shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`
}, Lhe = function(e, r) {
  switch (e) {
    case "lbrack":
      return "M403 1759 V84 H666 V0 H319 V1759 v" + r + ` v1759 h347 v-84
H403z M403 1759 V0 H319 V1759 v` + r + " v1759 h84z";
    case "rbrack":
      return "M347 1759 V0 H0 V84 H263 V1759 v" + r + ` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v` + r + " v1759 h84z";
    case "vert":
      return "M145 15 v585 v" + r + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -r + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + r + " v585 h43z";
    case "doublevert":
      return "M145 15 v585 v" + r + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -r + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + r + ` v585 h43z
M367 15 v585 v` + r + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -r + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v` + r + " v585 h43z";
    case "lfloor":
      return "M319 602 V0 H403 V602 v" + r + ` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v` + r + " v1715 H319z";
    case "rfloor":
      return "M319 602 V0 H403 V602 v" + r + ` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v` + r + " v1715 H319z";
    case "lceil":
      return "M403 1759 V84 H666 V0 H319 V1759 v" + r + ` v602 h84z
M403 1759 V0 H319 V1759 v` + r + " v602 h84z";
    case "rceil":
      return "M347 1759 V0 H0 V84 H263 V1759 v" + r + ` v602 h84z
M347 1759 V0 h-84 V1759 v` + r + " v602 h84z";
    case "lparen":
      return `M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,` + (r + 84) + `c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-` + (r + 92) + `c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;
    case "rparen":
      return `M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,` + (r + 9) + `
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-` + (r + 144) + `c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;
    default:
      throw new Error("Unknown stretchy delimiter.");
  }
};
class Ug {
  // Never used; needed for satisfying interface.
  constructor(e) {
    this.children = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.children = e, this.classes = [], this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = {};
  }
  hasClass(e) {
    return this.classes.includes(e);
  }
  /** Convert the fragment into a node. */
  toNode() {
    for (var e = document.createDocumentFragment(), r = 0; r < this.children.length; r++)
      e.appendChild(this.children[r].toNode());
    return e;
  }
  /** Convert the fragment into HTML markup. */
  toMarkup() {
    for (var e = "", r = 0; r < this.children.length; r++)
      e += this.children[r].toMarkup();
    return e;
  }
  /**
   * Converts the math node into a string, similar to innerText. Applies to
   * MathDomNode's only.
   */
  toText() {
    var e = (r) => r.toText();
    return this.children.map(e).join("");
  }
}
var Gs = {
  "AMS-Regular": {
    32: [0, 0, 0, 0, 0.25],
    65: [0, 0.68889, 0, 0, 0.72222],
    66: [0, 0.68889, 0, 0, 0.66667],
    67: [0, 0.68889, 0, 0, 0.72222],
    68: [0, 0.68889, 0, 0, 0.72222],
    69: [0, 0.68889, 0, 0, 0.66667],
    70: [0, 0.68889, 0, 0, 0.61111],
    71: [0, 0.68889, 0, 0, 0.77778],
    72: [0, 0.68889, 0, 0, 0.77778],
    73: [0, 0.68889, 0, 0, 0.38889],
    74: [0.16667, 0.68889, 0, 0, 0.5],
    75: [0, 0.68889, 0, 0, 0.77778],
    76: [0, 0.68889, 0, 0, 0.66667],
    77: [0, 0.68889, 0, 0, 0.94445],
    78: [0, 0.68889, 0, 0, 0.72222],
    79: [0.16667, 0.68889, 0, 0, 0.77778],
    80: [0, 0.68889, 0, 0, 0.61111],
    81: [0.16667, 0.68889, 0, 0, 0.77778],
    82: [0, 0.68889, 0, 0, 0.72222],
    83: [0, 0.68889, 0, 0, 0.55556],
    84: [0, 0.68889, 0, 0, 0.66667],
    85: [0, 0.68889, 0, 0, 0.72222],
    86: [0, 0.68889, 0, 0, 0.72222],
    87: [0, 0.68889, 0, 0, 1],
    88: [0, 0.68889, 0, 0, 0.72222],
    89: [0, 0.68889, 0, 0, 0.72222],
    90: [0, 0.68889, 0, 0, 0.66667],
    107: [0, 0.68889, 0, 0, 0.55556],
    160: [0, 0, 0, 0, 0.25],
    165: [0, 0.675, 0.025, 0, 0.75],
    174: [0.15559, 0.69224, 0, 0, 0.94666],
    240: [0, 0.68889, 0, 0, 0.55556],
    295: [0, 0.68889, 0, 0, 0.54028],
    710: [0, 0.825, 0, 0, 2.33334],
    732: [0, 0.9, 0, 0, 2.33334],
    770: [0, 0.825, 0, 0, 2.33334],
    771: [0, 0.9, 0, 0, 2.33334],
    989: [0.08167, 0.58167, 0, 0, 0.77778],
    1008: [0, 0.43056, 0.04028, 0, 0.66667],
    8245: [0, 0.54986, 0, 0, 0.275],
    8463: [0, 0.68889, 0, 0, 0.54028],
    8487: [0, 0.68889, 0, 0, 0.72222],
    8498: [0, 0.68889, 0, 0, 0.55556],
    8502: [0, 0.68889, 0, 0, 0.66667],
    8503: [0, 0.68889, 0, 0, 0.44445],
    8504: [0, 0.68889, 0, 0, 0.66667],
    8513: [0, 0.68889, 0, 0, 0.63889],
    8592: [-0.03598, 0.46402, 0, 0, 0.5],
    8594: [-0.03598, 0.46402, 0, 0, 0.5],
    8602: [-0.13313, 0.36687, 0, 0, 1],
    8603: [-0.13313, 0.36687, 0, 0, 1],
    8606: [0.01354, 0.52239, 0, 0, 1],
    8608: [0.01354, 0.52239, 0, 0, 1],
    8610: [0.01354, 0.52239, 0, 0, 1.11111],
    8611: [0.01354, 0.52239, 0, 0, 1.11111],
    8619: [0, 0.54986, 0, 0, 1],
    8620: [0, 0.54986, 0, 0, 1],
    8621: [-0.13313, 0.37788, 0, 0, 1.38889],
    8622: [-0.13313, 0.36687, 0, 0, 1],
    8624: [0, 0.69224, 0, 0, 0.5],
    8625: [0, 0.69224, 0, 0, 0.5],
    8630: [0, 0.43056, 0, 0, 1],
    8631: [0, 0.43056, 0, 0, 1],
    8634: [0.08198, 0.58198, 0, 0, 0.77778],
    8635: [0.08198, 0.58198, 0, 0, 0.77778],
    8638: [0.19444, 0.69224, 0, 0, 0.41667],
    8639: [0.19444, 0.69224, 0, 0, 0.41667],
    8642: [0.19444, 0.69224, 0, 0, 0.41667],
    8643: [0.19444, 0.69224, 0, 0, 0.41667],
    8644: [0.1808, 0.675, 0, 0, 1],
    8646: [0.1808, 0.675, 0, 0, 1],
    8647: [0.1808, 0.675, 0, 0, 1],
    8648: [0.19444, 0.69224, 0, 0, 0.83334],
    8649: [0.1808, 0.675, 0, 0, 1],
    8650: [0.19444, 0.69224, 0, 0, 0.83334],
    8651: [0.01354, 0.52239, 0, 0, 1],
    8652: [0.01354, 0.52239, 0, 0, 1],
    8653: [-0.13313, 0.36687, 0, 0, 1],
    8654: [-0.13313, 0.36687, 0, 0, 1],
    8655: [-0.13313, 0.36687, 0, 0, 1],
    8666: [0.13667, 0.63667, 0, 0, 1],
    8667: [0.13667, 0.63667, 0, 0, 1],
    8669: [-0.13313, 0.37788, 0, 0, 1],
    8672: [-0.064, 0.437, 0, 0, 1.334],
    8674: [-0.064, 0.437, 0, 0, 1.334],
    8705: [0, 0.825, 0, 0, 0.5],
    8708: [0, 0.68889, 0, 0, 0.55556],
    8709: [0.08167, 0.58167, 0, 0, 0.77778],
    8717: [0, 0.43056, 0, 0, 0.42917],
    8722: [-0.03598, 0.46402, 0, 0, 0.5],
    8724: [0.08198, 0.69224, 0, 0, 0.77778],
    8726: [0.08167, 0.58167, 0, 0, 0.77778],
    8733: [0, 0.69224, 0, 0, 0.77778],
    8736: [0, 0.69224, 0, 0, 0.72222],
    8737: [0, 0.69224, 0, 0, 0.72222],
    8738: [0.03517, 0.52239, 0, 0, 0.72222],
    8739: [0.08167, 0.58167, 0, 0, 0.22222],
    8740: [0.25142, 0.74111, 0, 0, 0.27778],
    8741: [0.08167, 0.58167, 0, 0, 0.38889],
    8742: [0.25142, 0.74111, 0, 0, 0.5],
    8756: [0, 0.69224, 0, 0, 0.66667],
    8757: [0, 0.69224, 0, 0, 0.66667],
    8764: [-0.13313, 0.36687, 0, 0, 0.77778],
    8765: [-0.13313, 0.37788, 0, 0, 0.77778],
    8769: [-0.13313, 0.36687, 0, 0, 0.77778],
    8770: [-0.03625, 0.46375, 0, 0, 0.77778],
    8774: [0.30274, 0.79383, 0, 0, 0.77778],
    8776: [-0.01688, 0.48312, 0, 0, 0.77778],
    8778: [0.08167, 0.58167, 0, 0, 0.77778],
    8782: [0.06062, 0.54986, 0, 0, 0.77778],
    8783: [0.06062, 0.54986, 0, 0, 0.77778],
    8785: [0.08198, 0.58198, 0, 0, 0.77778],
    8786: [0.08198, 0.58198, 0, 0, 0.77778],
    8787: [0.08198, 0.58198, 0, 0, 0.77778],
    8790: [0, 0.69224, 0, 0, 0.77778],
    8791: [0.22958, 0.72958, 0, 0, 0.77778],
    8796: [0.08198, 0.91667, 0, 0, 0.77778],
    8806: [0.25583, 0.75583, 0, 0, 0.77778],
    8807: [0.25583, 0.75583, 0, 0, 0.77778],
    8808: [0.25142, 0.75726, 0, 0, 0.77778],
    8809: [0.25142, 0.75726, 0, 0, 0.77778],
    8812: [0.25583, 0.75583, 0, 0, 0.5],
    8814: [0.20576, 0.70576, 0, 0, 0.77778],
    8815: [0.20576, 0.70576, 0, 0, 0.77778],
    8816: [0.30274, 0.79383, 0, 0, 0.77778],
    8817: [0.30274, 0.79383, 0, 0, 0.77778],
    8818: [0.22958, 0.72958, 0, 0, 0.77778],
    8819: [0.22958, 0.72958, 0, 0, 0.77778],
    8822: [0.1808, 0.675, 0, 0, 0.77778],
    8823: [0.1808, 0.675, 0, 0, 0.77778],
    8828: [0.13667, 0.63667, 0, 0, 0.77778],
    8829: [0.13667, 0.63667, 0, 0, 0.77778],
    8830: [0.22958, 0.72958, 0, 0, 0.77778],
    8831: [0.22958, 0.72958, 0, 0, 0.77778],
    8832: [0.20576, 0.70576, 0, 0, 0.77778],
    8833: [0.20576, 0.70576, 0, 0, 0.77778],
    8840: [0.30274, 0.79383, 0, 0, 0.77778],
    8841: [0.30274, 0.79383, 0, 0, 0.77778],
    8842: [0.13597, 0.63597, 0, 0, 0.77778],
    8843: [0.13597, 0.63597, 0, 0, 0.77778],
    8847: [0.03517, 0.54986, 0, 0, 0.77778],
    8848: [0.03517, 0.54986, 0, 0, 0.77778],
    8858: [0.08198, 0.58198, 0, 0, 0.77778],
    8859: [0.08198, 0.58198, 0, 0, 0.77778],
    8861: [0.08198, 0.58198, 0, 0, 0.77778],
    8862: [0, 0.675, 0, 0, 0.77778],
    8863: [0, 0.675, 0, 0, 0.77778],
    8864: [0, 0.675, 0, 0, 0.77778],
    8865: [0, 0.675, 0, 0, 0.77778],
    8872: [0, 0.69224, 0, 0, 0.61111],
    8873: [0, 0.69224, 0, 0, 0.72222],
    8874: [0, 0.69224, 0, 0, 0.88889],
    8876: [0, 0.68889, 0, 0, 0.61111],
    8877: [0, 0.68889, 0, 0, 0.61111],
    8878: [0, 0.68889, 0, 0, 0.72222],
    8879: [0, 0.68889, 0, 0, 0.72222],
    8882: [0.03517, 0.54986, 0, 0, 0.77778],
    8883: [0.03517, 0.54986, 0, 0, 0.77778],
    8884: [0.13667, 0.63667, 0, 0, 0.77778],
    8885: [0.13667, 0.63667, 0, 0, 0.77778],
    8888: [0, 0.54986, 0, 0, 1.11111],
    8890: [0.19444, 0.43056, 0, 0, 0.55556],
    8891: [0.19444, 0.69224, 0, 0, 0.61111],
    8892: [0.19444, 0.69224, 0, 0, 0.61111],
    8901: [0, 0.54986, 0, 0, 0.27778],
    8903: [0.08167, 0.58167, 0, 0, 0.77778],
    8905: [0.08167, 0.58167, 0, 0, 0.77778],
    8906: [0.08167, 0.58167, 0, 0, 0.77778],
    8907: [0, 0.69224, 0, 0, 0.77778],
    8908: [0, 0.69224, 0, 0, 0.77778],
    8909: [-0.03598, 0.46402, 0, 0, 0.77778],
    8910: [0, 0.54986, 0, 0, 0.76042],
    8911: [0, 0.54986, 0, 0, 0.76042],
    8912: [0.03517, 0.54986, 0, 0, 0.77778],
    8913: [0.03517, 0.54986, 0, 0, 0.77778],
    8914: [0, 0.54986, 0, 0, 0.66667],
    8915: [0, 0.54986, 0, 0, 0.66667],
    8916: [0, 0.69224, 0, 0, 0.66667],
    8918: [0.0391, 0.5391, 0, 0, 0.77778],
    8919: [0.0391, 0.5391, 0, 0, 0.77778],
    8920: [0.03517, 0.54986, 0, 0, 1.33334],
    8921: [0.03517, 0.54986, 0, 0, 1.33334],
    8922: [0.38569, 0.88569, 0, 0, 0.77778],
    8923: [0.38569, 0.88569, 0, 0, 0.77778],
    8926: [0.13667, 0.63667, 0, 0, 0.77778],
    8927: [0.13667, 0.63667, 0, 0, 0.77778],
    8928: [0.30274, 0.79383, 0, 0, 0.77778],
    8929: [0.30274, 0.79383, 0, 0, 0.77778],
    8934: [0.23222, 0.74111, 0, 0, 0.77778],
    8935: [0.23222, 0.74111, 0, 0, 0.77778],
    8936: [0.23222, 0.74111, 0, 0, 0.77778],
    8937: [0.23222, 0.74111, 0, 0, 0.77778],
    8938: [0.20576, 0.70576, 0, 0, 0.77778],
    8939: [0.20576, 0.70576, 0, 0, 0.77778],
    8940: [0.30274, 0.79383, 0, 0, 0.77778],
    8941: [0.30274, 0.79383, 0, 0, 0.77778],
    8994: [0.19444, 0.69224, 0, 0, 0.77778],
    8995: [0.19444, 0.69224, 0, 0, 0.77778],
    9416: [0.15559, 0.69224, 0, 0, 0.90222],
    9484: [0, 0.69224, 0, 0, 0.5],
    9488: [0, 0.69224, 0, 0, 0.5],
    9492: [0, 0.37788, 0, 0, 0.5],
    9496: [0, 0.37788, 0, 0, 0.5],
    9585: [0.19444, 0.68889, 0, 0, 0.88889],
    9586: [0.19444, 0.74111, 0, 0, 0.88889],
    9632: [0, 0.675, 0, 0, 0.77778],
    9633: [0, 0.675, 0, 0, 0.77778],
    9650: [0, 0.54986, 0, 0, 0.72222],
    9651: [0, 0.54986, 0, 0, 0.72222],
    9654: [0.03517, 0.54986, 0, 0, 0.77778],
    9660: [0, 0.54986, 0, 0, 0.72222],
    9661: [0, 0.54986, 0, 0, 0.72222],
    9664: [0.03517, 0.54986, 0, 0, 0.77778],
    9674: [0.11111, 0.69224, 0, 0, 0.66667],
    9733: [0.19444, 0.69224, 0, 0, 0.94445],
    10003: [0, 0.69224, 0, 0, 0.83334],
    10016: [0, 0.69224, 0, 0, 0.83334],
    10731: [0.11111, 0.69224, 0, 0, 0.66667],
    10846: [0.19444, 0.75583, 0, 0, 0.61111],
    10877: [0.13667, 0.63667, 0, 0, 0.77778],
    10878: [0.13667, 0.63667, 0, 0, 0.77778],
    10885: [0.25583, 0.75583, 0, 0, 0.77778],
    10886: [0.25583, 0.75583, 0, 0, 0.77778],
    10887: [0.13597, 0.63597, 0, 0, 0.77778],
    10888: [0.13597, 0.63597, 0, 0, 0.77778],
    10889: [0.26167, 0.75726, 0, 0, 0.77778],
    10890: [0.26167, 0.75726, 0, 0, 0.77778],
    10891: [0.48256, 0.98256, 0, 0, 0.77778],
    10892: [0.48256, 0.98256, 0, 0, 0.77778],
    10901: [0.13667, 0.63667, 0, 0, 0.77778],
    10902: [0.13667, 0.63667, 0, 0, 0.77778],
    10933: [0.25142, 0.75726, 0, 0, 0.77778],
    10934: [0.25142, 0.75726, 0, 0, 0.77778],
    10935: [0.26167, 0.75726, 0, 0, 0.77778],
    10936: [0.26167, 0.75726, 0, 0, 0.77778],
    10937: [0.26167, 0.75726, 0, 0, 0.77778],
    10938: [0.26167, 0.75726, 0, 0, 0.77778],
    10949: [0.25583, 0.75583, 0, 0, 0.77778],
    10950: [0.25583, 0.75583, 0, 0, 0.77778],
    10955: [0.28481, 0.79383, 0, 0, 0.77778],
    10956: [0.28481, 0.79383, 0, 0, 0.77778],
    57350: [0.08167, 0.58167, 0, 0, 0.22222],
    57351: [0.08167, 0.58167, 0, 0, 0.38889],
    57352: [0.08167, 0.58167, 0, 0, 0.77778],
    57353: [0, 0.43056, 0.04028, 0, 0.66667],
    57356: [0.25142, 0.75726, 0, 0, 0.77778],
    57357: [0.25142, 0.75726, 0, 0, 0.77778],
    57358: [0.41951, 0.91951, 0, 0, 0.77778],
    57359: [0.30274, 0.79383, 0, 0, 0.77778],
    57360: [0.30274, 0.79383, 0, 0, 0.77778],
    57361: [0.41951, 0.91951, 0, 0, 0.77778],
    57366: [0.25142, 0.75726, 0, 0, 0.77778],
    57367: [0.25142, 0.75726, 0, 0, 0.77778],
    57368: [0.25142, 0.75726, 0, 0, 0.77778],
    57369: [0.25142, 0.75726, 0, 0, 0.77778],
    57370: [0.13597, 0.63597, 0, 0, 0.77778],
    57371: [0.13597, 0.63597, 0, 0, 0.77778]
  },
  "Caligraphic-Regular": {
    32: [0, 0, 0, 0, 0.25],
    65: [0, 0.68333, 0, 0.19445, 0.79847],
    66: [0, 0.68333, 0.03041, 0.13889, 0.65681],
    67: [0, 0.68333, 0.05834, 0.13889, 0.52653],
    68: [0, 0.68333, 0.02778, 0.08334, 0.77139],
    69: [0, 0.68333, 0.08944, 0.11111, 0.52778],
    70: [0, 0.68333, 0.09931, 0.11111, 0.71875],
    71: [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
    72: [0, 0.68333, 965e-5, 0.11111, 0.84452],
    73: [0, 0.68333, 0.07382, 0, 0.54452],
    74: [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
    75: [0, 0.68333, 0.01445, 0.05556, 0.76195],
    76: [0, 0.68333, 0, 0.13889, 0.68972],
    77: [0, 0.68333, 0, 0.13889, 1.2009],
    78: [0, 0.68333, 0.14736, 0.08334, 0.82049],
    79: [0, 0.68333, 0.02778, 0.11111, 0.79611],
    80: [0, 0.68333, 0.08222, 0.08334, 0.69556],
    81: [0.09722, 0.68333, 0, 0.11111, 0.81667],
    82: [0, 0.68333, 0, 0.08334, 0.8475],
    83: [0, 0.68333, 0.075, 0.13889, 0.60556],
    84: [0, 0.68333, 0.25417, 0, 0.54464],
    85: [0, 0.68333, 0.09931, 0.08334, 0.62583],
    86: [0, 0.68333, 0.08222, 0, 0.61278],
    87: [0, 0.68333, 0.08222, 0.08334, 0.98778],
    88: [0, 0.68333, 0.14643, 0.13889, 0.7133],
    89: [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
    90: [0, 0.68333, 0.07944, 0.13889, 0.72473],
    160: [0, 0, 0, 0, 0.25]
  },
  "Fraktur-Regular": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69141, 0, 0, 0.29574],
    34: [0, 0.69141, 0, 0, 0.21471],
    38: [0, 0.69141, 0, 0, 0.73786],
    39: [0, 0.69141, 0, 0, 0.21201],
    40: [0.24982, 0.74947, 0, 0, 0.38865],
    41: [0.24982, 0.74947, 0, 0, 0.38865],
    42: [0, 0.62119, 0, 0, 0.27764],
    43: [0.08319, 0.58283, 0, 0, 0.75623],
    44: [0, 0.10803, 0, 0, 0.27764],
    45: [0.08319, 0.58283, 0, 0, 0.75623],
    46: [0, 0.10803, 0, 0, 0.27764],
    47: [0.24982, 0.74947, 0, 0, 0.50181],
    48: [0, 0.47534, 0, 0, 0.50181],
    49: [0, 0.47534, 0, 0, 0.50181],
    50: [0, 0.47534, 0, 0, 0.50181],
    51: [0.18906, 0.47534, 0, 0, 0.50181],
    52: [0.18906, 0.47534, 0, 0, 0.50181],
    53: [0.18906, 0.47534, 0, 0, 0.50181],
    54: [0, 0.69141, 0, 0, 0.50181],
    55: [0.18906, 0.47534, 0, 0, 0.50181],
    56: [0, 0.69141, 0, 0, 0.50181],
    57: [0.18906, 0.47534, 0, 0, 0.50181],
    58: [0, 0.47534, 0, 0, 0.21606],
    59: [0.12604, 0.47534, 0, 0, 0.21606],
    61: [-0.13099, 0.36866, 0, 0, 0.75623],
    63: [0, 0.69141, 0, 0, 0.36245],
    65: [0, 0.69141, 0, 0, 0.7176],
    66: [0, 0.69141, 0, 0, 0.88397],
    67: [0, 0.69141, 0, 0, 0.61254],
    68: [0, 0.69141, 0, 0, 0.83158],
    69: [0, 0.69141, 0, 0, 0.66278],
    70: [0.12604, 0.69141, 0, 0, 0.61119],
    71: [0, 0.69141, 0, 0, 0.78539],
    72: [0.06302, 0.69141, 0, 0, 0.7203],
    73: [0, 0.69141, 0, 0, 0.55448],
    74: [0.12604, 0.69141, 0, 0, 0.55231],
    75: [0, 0.69141, 0, 0, 0.66845],
    76: [0, 0.69141, 0, 0, 0.66602],
    77: [0, 0.69141, 0, 0, 1.04953],
    78: [0, 0.69141, 0, 0, 0.83212],
    79: [0, 0.69141, 0, 0, 0.82699],
    80: [0.18906, 0.69141, 0, 0, 0.82753],
    81: [0.03781, 0.69141, 0, 0, 0.82699],
    82: [0, 0.69141, 0, 0, 0.82807],
    83: [0, 0.69141, 0, 0, 0.82861],
    84: [0, 0.69141, 0, 0, 0.66899],
    85: [0, 0.69141, 0, 0, 0.64576],
    86: [0, 0.69141, 0, 0, 0.83131],
    87: [0, 0.69141, 0, 0, 1.04602],
    88: [0, 0.69141, 0, 0, 0.71922],
    89: [0.18906, 0.69141, 0, 0, 0.83293],
    90: [0.12604, 0.69141, 0, 0, 0.60201],
    91: [0.24982, 0.74947, 0, 0, 0.27764],
    93: [0.24982, 0.74947, 0, 0, 0.27764],
    94: [0, 0.69141, 0, 0, 0.49965],
    97: [0, 0.47534, 0, 0, 0.50046],
    98: [0, 0.69141, 0, 0, 0.51315],
    99: [0, 0.47534, 0, 0, 0.38946],
    100: [0, 0.62119, 0, 0, 0.49857],
    101: [0, 0.47534, 0, 0, 0.40053],
    102: [0.18906, 0.69141, 0, 0, 0.32626],
    103: [0.18906, 0.47534, 0, 0, 0.5037],
    104: [0.18906, 0.69141, 0, 0, 0.52126],
    105: [0, 0.69141, 0, 0, 0.27899],
    106: [0, 0.69141, 0, 0, 0.28088],
    107: [0, 0.69141, 0, 0, 0.38946],
    108: [0, 0.69141, 0, 0, 0.27953],
    109: [0, 0.47534, 0, 0, 0.76676],
    110: [0, 0.47534, 0, 0, 0.52666],
    111: [0, 0.47534, 0, 0, 0.48885],
    112: [0.18906, 0.52396, 0, 0, 0.50046],
    113: [0.18906, 0.47534, 0, 0, 0.48912],
    114: [0, 0.47534, 0, 0, 0.38919],
    115: [0, 0.47534, 0, 0, 0.44266],
    116: [0, 0.62119, 0, 0, 0.33301],
    117: [0, 0.47534, 0, 0, 0.5172],
    118: [0, 0.52396, 0, 0, 0.5118],
    119: [0, 0.52396, 0, 0, 0.77351],
    120: [0.18906, 0.47534, 0, 0, 0.38865],
    121: [0.18906, 0.47534, 0, 0, 0.49884],
    122: [0.18906, 0.47534, 0, 0, 0.39054],
    160: [0, 0, 0, 0, 0.25],
    8216: [0, 0.69141, 0, 0, 0.21471],
    8217: [0, 0.69141, 0, 0, 0.21471],
    58112: [0, 0.62119, 0, 0, 0.49749],
    58113: [0, 0.62119, 0, 0, 0.4983],
    58114: [0.18906, 0.69141, 0, 0, 0.33328],
    58115: [0.18906, 0.69141, 0, 0, 0.32923],
    58116: [0.18906, 0.47534, 0, 0, 0.50343],
    58117: [0, 0.69141, 0, 0, 0.33301],
    58118: [0, 0.62119, 0, 0, 0.33409],
    58119: [0, 0.47534, 0, 0, 0.50073]
  },
  "Main-Bold": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.35],
    34: [0, 0.69444, 0, 0, 0.60278],
    35: [0.19444, 0.69444, 0, 0, 0.95833],
    36: [0.05556, 0.75, 0, 0, 0.575],
    37: [0.05556, 0.75, 0, 0, 0.95833],
    38: [0, 0.69444, 0, 0, 0.89444],
    39: [0, 0.69444, 0, 0, 0.31944],
    40: [0.25, 0.75, 0, 0, 0.44722],
    41: [0.25, 0.75, 0, 0, 0.44722],
    42: [0, 0.75, 0, 0, 0.575],
    43: [0.13333, 0.63333, 0, 0, 0.89444],
    44: [0.19444, 0.15556, 0, 0, 0.31944],
    45: [0, 0.44444, 0, 0, 0.38333],
    46: [0, 0.15556, 0, 0, 0.31944],
    47: [0.25, 0.75, 0, 0, 0.575],
    48: [0, 0.64444, 0, 0, 0.575],
    49: [0, 0.64444, 0, 0, 0.575],
    50: [0, 0.64444, 0, 0, 0.575],
    51: [0, 0.64444, 0, 0, 0.575],
    52: [0, 0.64444, 0, 0, 0.575],
    53: [0, 0.64444, 0, 0, 0.575],
    54: [0, 0.64444, 0, 0, 0.575],
    55: [0, 0.64444, 0, 0, 0.575],
    56: [0, 0.64444, 0, 0, 0.575],
    57: [0, 0.64444, 0, 0, 0.575],
    58: [0, 0.44444, 0, 0, 0.31944],
    59: [0.19444, 0.44444, 0, 0, 0.31944],
    60: [0.08556, 0.58556, 0, 0, 0.89444],
    61: [-0.10889, 0.39111, 0, 0, 0.89444],
    62: [0.08556, 0.58556, 0, 0, 0.89444],
    63: [0, 0.69444, 0, 0, 0.54305],
    64: [0, 0.69444, 0, 0, 0.89444],
    65: [0, 0.68611, 0, 0, 0.86944],
    66: [0, 0.68611, 0, 0, 0.81805],
    67: [0, 0.68611, 0, 0, 0.83055],
    68: [0, 0.68611, 0, 0, 0.88194],
    69: [0, 0.68611, 0, 0, 0.75555],
    70: [0, 0.68611, 0, 0, 0.72361],
    71: [0, 0.68611, 0, 0, 0.90416],
    72: [0, 0.68611, 0, 0, 0.9],
    73: [0, 0.68611, 0, 0, 0.43611],
    74: [0, 0.68611, 0, 0, 0.59444],
    75: [0, 0.68611, 0, 0, 0.90138],
    76: [0, 0.68611, 0, 0, 0.69166],
    77: [0, 0.68611, 0, 0, 1.09166],
    78: [0, 0.68611, 0, 0, 0.9],
    79: [0, 0.68611, 0, 0, 0.86388],
    80: [0, 0.68611, 0, 0, 0.78611],
    81: [0.19444, 0.68611, 0, 0, 0.86388],
    82: [0, 0.68611, 0, 0, 0.8625],
    83: [0, 0.68611, 0, 0, 0.63889],
    84: [0, 0.68611, 0, 0, 0.8],
    85: [0, 0.68611, 0, 0, 0.88472],
    86: [0, 0.68611, 0.01597, 0, 0.86944],
    87: [0, 0.68611, 0.01597, 0, 1.18888],
    88: [0, 0.68611, 0, 0, 0.86944],
    89: [0, 0.68611, 0.02875, 0, 0.86944],
    90: [0, 0.68611, 0, 0, 0.70277],
    91: [0.25, 0.75, 0, 0, 0.31944],
    92: [0.25, 0.75, 0, 0, 0.575],
    93: [0.25, 0.75, 0, 0, 0.31944],
    94: [0, 0.69444, 0, 0, 0.575],
    95: [0.31, 0.13444, 0.03194, 0, 0.575],
    97: [0, 0.44444, 0, 0, 0.55902],
    98: [0, 0.69444, 0, 0, 0.63889],
    99: [0, 0.44444, 0, 0, 0.51111],
    100: [0, 0.69444, 0, 0, 0.63889],
    101: [0, 0.44444, 0, 0, 0.52708],
    102: [0, 0.69444, 0.10903, 0, 0.35139],
    103: [0.19444, 0.44444, 0.01597, 0, 0.575],
    104: [0, 0.69444, 0, 0, 0.63889],
    105: [0, 0.69444, 0, 0, 0.31944],
    106: [0.19444, 0.69444, 0, 0, 0.35139],
    107: [0, 0.69444, 0, 0, 0.60694],
    108: [0, 0.69444, 0, 0, 0.31944],
    109: [0, 0.44444, 0, 0, 0.95833],
    110: [0, 0.44444, 0, 0, 0.63889],
    111: [0, 0.44444, 0, 0, 0.575],
    112: [0.19444, 0.44444, 0, 0, 0.63889],
    113: [0.19444, 0.44444, 0, 0, 0.60694],
    114: [0, 0.44444, 0, 0, 0.47361],
    115: [0, 0.44444, 0, 0, 0.45361],
    116: [0, 0.63492, 0, 0, 0.44722],
    117: [0, 0.44444, 0, 0, 0.63889],
    118: [0, 0.44444, 0.01597, 0, 0.60694],
    119: [0, 0.44444, 0.01597, 0, 0.83055],
    120: [0, 0.44444, 0, 0, 0.60694],
    121: [0.19444, 0.44444, 0.01597, 0, 0.60694],
    122: [0, 0.44444, 0, 0, 0.51111],
    123: [0.25, 0.75, 0, 0, 0.575],
    124: [0.25, 0.75, 0, 0, 0.31944],
    125: [0.25, 0.75, 0, 0, 0.575],
    126: [0.35, 0.34444, 0, 0, 0.575],
    160: [0, 0, 0, 0, 0.25],
    163: [0, 0.69444, 0, 0, 0.86853],
    168: [0, 0.69444, 0, 0, 0.575],
    172: [0, 0.44444, 0, 0, 0.76666],
    176: [0, 0.69444, 0, 0, 0.86944],
    177: [0.13333, 0.63333, 0, 0, 0.89444],
    184: [0.17014, 0, 0, 0, 0.51111],
    198: [0, 0.68611, 0, 0, 1.04166],
    215: [0.13333, 0.63333, 0, 0, 0.89444],
    216: [0.04861, 0.73472, 0, 0, 0.89444],
    223: [0, 0.69444, 0, 0, 0.59722],
    230: [0, 0.44444, 0, 0, 0.83055],
    247: [0.13333, 0.63333, 0, 0, 0.89444],
    248: [0.09722, 0.54167, 0, 0, 0.575],
    305: [0, 0.44444, 0, 0, 0.31944],
    338: [0, 0.68611, 0, 0, 1.16944],
    339: [0, 0.44444, 0, 0, 0.89444],
    567: [0.19444, 0.44444, 0, 0, 0.35139],
    710: [0, 0.69444, 0, 0, 0.575],
    711: [0, 0.63194, 0, 0, 0.575],
    713: [0, 0.59611, 0, 0, 0.575],
    714: [0, 0.69444, 0, 0, 0.575],
    715: [0, 0.69444, 0, 0, 0.575],
    728: [0, 0.69444, 0, 0, 0.575],
    729: [0, 0.69444, 0, 0, 0.31944],
    730: [0, 0.69444, 0, 0, 0.86944],
    732: [0, 0.69444, 0, 0, 0.575],
    733: [0, 0.69444, 0, 0, 0.575],
    915: [0, 0.68611, 0, 0, 0.69166],
    916: [0, 0.68611, 0, 0, 0.95833],
    920: [0, 0.68611, 0, 0, 0.89444],
    923: [0, 0.68611, 0, 0, 0.80555],
    926: [0, 0.68611, 0, 0, 0.76666],
    928: [0, 0.68611, 0, 0, 0.9],
    931: [0, 0.68611, 0, 0, 0.83055],
    933: [0, 0.68611, 0, 0, 0.89444],
    934: [0, 0.68611, 0, 0, 0.83055],
    936: [0, 0.68611, 0, 0, 0.89444],
    937: [0, 0.68611, 0, 0, 0.83055],
    8211: [0, 0.44444, 0.03194, 0, 0.575],
    8212: [0, 0.44444, 0.03194, 0, 1.14999],
    8216: [0, 0.69444, 0, 0, 0.31944],
    8217: [0, 0.69444, 0, 0, 0.31944],
    8220: [0, 0.69444, 0, 0, 0.60278],
    8221: [0, 0.69444, 0, 0, 0.60278],
    8224: [0.19444, 0.69444, 0, 0, 0.51111],
    8225: [0.19444, 0.69444, 0, 0, 0.51111],
    8242: [0, 0.55556, 0, 0, 0.34444],
    8407: [0, 0.72444, 0.15486, 0, 0.575],
    8463: [0, 0.69444, 0, 0, 0.66759],
    8465: [0, 0.69444, 0, 0, 0.83055],
    8467: [0, 0.69444, 0, 0, 0.47361],
    8472: [0.19444, 0.44444, 0, 0, 0.74027],
    8476: [0, 0.69444, 0, 0, 0.83055],
    8501: [0, 0.69444, 0, 0, 0.70277],
    8592: [-0.10889, 0.39111, 0, 0, 1.14999],
    8593: [0.19444, 0.69444, 0, 0, 0.575],
    8594: [-0.10889, 0.39111, 0, 0, 1.14999],
    8595: [0.19444, 0.69444, 0, 0, 0.575],
    8596: [-0.10889, 0.39111, 0, 0, 1.14999],
    8597: [0.25, 0.75, 0, 0, 0.575],
    8598: [0.19444, 0.69444, 0, 0, 1.14999],
    8599: [0.19444, 0.69444, 0, 0, 1.14999],
    8600: [0.19444, 0.69444, 0, 0, 1.14999],
    8601: [0.19444, 0.69444, 0, 0, 1.14999],
    8636: [-0.10889, 0.39111, 0, 0, 1.14999],
    8637: [-0.10889, 0.39111, 0, 0, 1.14999],
    8640: [-0.10889, 0.39111, 0, 0, 1.14999],
    8641: [-0.10889, 0.39111, 0, 0, 1.14999],
    8656: [-0.10889, 0.39111, 0, 0, 1.14999],
    8657: [0.19444, 0.69444, 0, 0, 0.70277],
    8658: [-0.10889, 0.39111, 0, 0, 1.14999],
    8659: [0.19444, 0.69444, 0, 0, 0.70277],
    8660: [-0.10889, 0.39111, 0, 0, 1.14999],
    8661: [0.25, 0.75, 0, 0, 0.70277],
    8704: [0, 0.69444, 0, 0, 0.63889],
    8706: [0, 0.69444, 0.06389, 0, 0.62847],
    8707: [0, 0.69444, 0, 0, 0.63889],
    8709: [0.05556, 0.75, 0, 0, 0.575],
    8711: [0, 0.68611, 0, 0, 0.95833],
    8712: [0.08556, 0.58556, 0, 0, 0.76666],
    8715: [0.08556, 0.58556, 0, 0, 0.76666],
    8722: [0.13333, 0.63333, 0, 0, 0.89444],
    8723: [0.13333, 0.63333, 0, 0, 0.89444],
    8725: [0.25, 0.75, 0, 0, 0.575],
    8726: [0.25, 0.75, 0, 0, 0.575],
    8727: [-0.02778, 0.47222, 0, 0, 0.575],
    8728: [-0.02639, 0.47361, 0, 0, 0.575],
    8729: [-0.02639, 0.47361, 0, 0, 0.575],
    8730: [0.18, 0.82, 0, 0, 0.95833],
    8733: [0, 0.44444, 0, 0, 0.89444],
    8734: [0, 0.44444, 0, 0, 1.14999],
    8736: [0, 0.69224, 0, 0, 0.72222],
    8739: [0.25, 0.75, 0, 0, 0.31944],
    8741: [0.25, 0.75, 0, 0, 0.575],
    8743: [0, 0.55556, 0, 0, 0.76666],
    8744: [0, 0.55556, 0, 0, 0.76666],
    8745: [0, 0.55556, 0, 0, 0.76666],
    8746: [0, 0.55556, 0, 0, 0.76666],
    8747: [0.19444, 0.69444, 0.12778, 0, 0.56875],
    8764: [-0.10889, 0.39111, 0, 0, 0.89444],
    8768: [0.19444, 0.69444, 0, 0, 0.31944],
    8771: [222e-5, 0.50222, 0, 0, 0.89444],
    8773: [0.027, 0.638, 0, 0, 0.894],
    8776: [0.02444, 0.52444, 0, 0, 0.89444],
    8781: [222e-5, 0.50222, 0, 0, 0.89444],
    8801: [222e-5, 0.50222, 0, 0, 0.89444],
    8804: [0.19667, 0.69667, 0, 0, 0.89444],
    8805: [0.19667, 0.69667, 0, 0, 0.89444],
    8810: [0.08556, 0.58556, 0, 0, 1.14999],
    8811: [0.08556, 0.58556, 0, 0, 1.14999],
    8826: [0.08556, 0.58556, 0, 0, 0.89444],
    8827: [0.08556, 0.58556, 0, 0, 0.89444],
    8834: [0.08556, 0.58556, 0, 0, 0.89444],
    8835: [0.08556, 0.58556, 0, 0, 0.89444],
    8838: [0.19667, 0.69667, 0, 0, 0.89444],
    8839: [0.19667, 0.69667, 0, 0, 0.89444],
    8846: [0, 0.55556, 0, 0, 0.76666],
    8849: [0.19667, 0.69667, 0, 0, 0.89444],
    8850: [0.19667, 0.69667, 0, 0, 0.89444],
    8851: [0, 0.55556, 0, 0, 0.76666],
    8852: [0, 0.55556, 0, 0, 0.76666],
    8853: [0.13333, 0.63333, 0, 0, 0.89444],
    8854: [0.13333, 0.63333, 0, 0, 0.89444],
    8855: [0.13333, 0.63333, 0, 0, 0.89444],
    8856: [0.13333, 0.63333, 0, 0, 0.89444],
    8857: [0.13333, 0.63333, 0, 0, 0.89444],
    8866: [0, 0.69444, 0, 0, 0.70277],
    8867: [0, 0.69444, 0, 0, 0.70277],
    8868: [0, 0.69444, 0, 0, 0.89444],
    8869: [0, 0.69444, 0, 0, 0.89444],
    8900: [-0.02639, 0.47361, 0, 0, 0.575],
    8901: [-0.02639, 0.47361, 0, 0, 0.31944],
    8902: [-0.02778, 0.47222, 0, 0, 0.575],
    8968: [0.25, 0.75, 0, 0, 0.51111],
    8969: [0.25, 0.75, 0, 0, 0.51111],
    8970: [0.25, 0.75, 0, 0, 0.51111],
    8971: [0.25, 0.75, 0, 0, 0.51111],
    8994: [-0.13889, 0.36111, 0, 0, 1.14999],
    8995: [-0.13889, 0.36111, 0, 0, 1.14999],
    9651: [0.19444, 0.69444, 0, 0, 1.02222],
    9657: [-0.02778, 0.47222, 0, 0, 0.575],
    9661: [0.19444, 0.69444, 0, 0, 1.02222],
    9667: [-0.02778, 0.47222, 0, 0, 0.575],
    9711: [0.19444, 0.69444, 0, 0, 1.14999],
    9824: [0.12963, 0.69444, 0, 0, 0.89444],
    9825: [0.12963, 0.69444, 0, 0, 0.89444],
    9826: [0.12963, 0.69444, 0, 0, 0.89444],
    9827: [0.12963, 0.69444, 0, 0, 0.89444],
    9837: [0, 0.75, 0, 0, 0.44722],
    9838: [0.19444, 0.69444, 0, 0, 0.44722],
    9839: [0.19444, 0.69444, 0, 0, 0.44722],
    10216: [0.25, 0.75, 0, 0, 0.44722],
    10217: [0.25, 0.75, 0, 0, 0.44722],
    10815: [0, 0.68611, 0, 0, 0.9],
    10927: [0.19667, 0.69667, 0, 0, 0.89444],
    10928: [0.19667, 0.69667, 0, 0, 0.89444],
    57376: [0.19444, 0.69444, 0, 0, 0]
  },
  "Main-BoldItalic": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0.11417, 0, 0.38611],
    34: [0, 0.69444, 0.07939, 0, 0.62055],
    35: [0.19444, 0.69444, 0.06833, 0, 0.94444],
    37: [0.05556, 0.75, 0.12861, 0, 0.94444],
    38: [0, 0.69444, 0.08528, 0, 0.88555],
    39: [0, 0.69444, 0.12945, 0, 0.35555],
    40: [0.25, 0.75, 0.15806, 0, 0.47333],
    41: [0.25, 0.75, 0.03306, 0, 0.47333],
    42: [0, 0.75, 0.14333, 0, 0.59111],
    43: [0.10333, 0.60333, 0.03306, 0, 0.88555],
    44: [0.19444, 0.14722, 0, 0, 0.35555],
    45: [0, 0.44444, 0.02611, 0, 0.41444],
    46: [0, 0.14722, 0, 0, 0.35555],
    47: [0.25, 0.75, 0.15806, 0, 0.59111],
    48: [0, 0.64444, 0.13167, 0, 0.59111],
    49: [0, 0.64444, 0.13167, 0, 0.59111],
    50: [0, 0.64444, 0.13167, 0, 0.59111],
    51: [0, 0.64444, 0.13167, 0, 0.59111],
    52: [0.19444, 0.64444, 0.13167, 0, 0.59111],
    53: [0, 0.64444, 0.13167, 0, 0.59111],
    54: [0, 0.64444, 0.13167, 0, 0.59111],
    55: [0.19444, 0.64444, 0.13167, 0, 0.59111],
    56: [0, 0.64444, 0.13167, 0, 0.59111],
    57: [0, 0.64444, 0.13167, 0, 0.59111],
    58: [0, 0.44444, 0.06695, 0, 0.35555],
    59: [0.19444, 0.44444, 0.06695, 0, 0.35555],
    61: [-0.10889, 0.39111, 0.06833, 0, 0.88555],
    63: [0, 0.69444, 0.11472, 0, 0.59111],
    64: [0, 0.69444, 0.09208, 0, 0.88555],
    65: [0, 0.68611, 0, 0, 0.86555],
    66: [0, 0.68611, 0.0992, 0, 0.81666],
    67: [0, 0.68611, 0.14208, 0, 0.82666],
    68: [0, 0.68611, 0.09062, 0, 0.87555],
    69: [0, 0.68611, 0.11431, 0, 0.75666],
    70: [0, 0.68611, 0.12903, 0, 0.72722],
    71: [0, 0.68611, 0.07347, 0, 0.89527],
    72: [0, 0.68611, 0.17208, 0, 0.8961],
    73: [0, 0.68611, 0.15681, 0, 0.47166],
    74: [0, 0.68611, 0.145, 0, 0.61055],
    75: [0, 0.68611, 0.14208, 0, 0.89499],
    76: [0, 0.68611, 0, 0, 0.69777],
    77: [0, 0.68611, 0.17208, 0, 1.07277],
    78: [0, 0.68611, 0.17208, 0, 0.8961],
    79: [0, 0.68611, 0.09062, 0, 0.85499],
    80: [0, 0.68611, 0.0992, 0, 0.78721],
    81: [0.19444, 0.68611, 0.09062, 0, 0.85499],
    82: [0, 0.68611, 0.02559, 0, 0.85944],
    83: [0, 0.68611, 0.11264, 0, 0.64999],
    84: [0, 0.68611, 0.12903, 0, 0.7961],
    85: [0, 0.68611, 0.17208, 0, 0.88083],
    86: [0, 0.68611, 0.18625, 0, 0.86555],
    87: [0, 0.68611, 0.18625, 0, 1.15999],
    88: [0, 0.68611, 0.15681, 0, 0.86555],
    89: [0, 0.68611, 0.19803, 0, 0.86555],
    90: [0, 0.68611, 0.14208, 0, 0.70888],
    91: [0.25, 0.75, 0.1875, 0, 0.35611],
    93: [0.25, 0.75, 0.09972, 0, 0.35611],
    94: [0, 0.69444, 0.06709, 0, 0.59111],
    95: [0.31, 0.13444, 0.09811, 0, 0.59111],
    97: [0, 0.44444, 0.09426, 0, 0.59111],
    98: [0, 0.69444, 0.07861, 0, 0.53222],
    99: [0, 0.44444, 0.05222, 0, 0.53222],
    100: [0, 0.69444, 0.10861, 0, 0.59111],
    101: [0, 0.44444, 0.085, 0, 0.53222],
    102: [0.19444, 0.69444, 0.21778, 0, 0.4],
    103: [0.19444, 0.44444, 0.105, 0, 0.53222],
    104: [0, 0.69444, 0.09426, 0, 0.59111],
    105: [0, 0.69326, 0.11387, 0, 0.35555],
    106: [0.19444, 0.69326, 0.1672, 0, 0.35555],
    107: [0, 0.69444, 0.11111, 0, 0.53222],
    108: [0, 0.69444, 0.10861, 0, 0.29666],
    109: [0, 0.44444, 0.09426, 0, 0.94444],
    110: [0, 0.44444, 0.09426, 0, 0.64999],
    111: [0, 0.44444, 0.07861, 0, 0.59111],
    112: [0.19444, 0.44444, 0.07861, 0, 0.59111],
    113: [0.19444, 0.44444, 0.105, 0, 0.53222],
    114: [0, 0.44444, 0.11111, 0, 0.50167],
    115: [0, 0.44444, 0.08167, 0, 0.48694],
    116: [0, 0.63492, 0.09639, 0, 0.385],
    117: [0, 0.44444, 0.09426, 0, 0.62055],
    118: [0, 0.44444, 0.11111, 0, 0.53222],
    119: [0, 0.44444, 0.11111, 0, 0.76777],
    120: [0, 0.44444, 0.12583, 0, 0.56055],
    121: [0.19444, 0.44444, 0.105, 0, 0.56166],
    122: [0, 0.44444, 0.13889, 0, 0.49055],
    126: [0.35, 0.34444, 0.11472, 0, 0.59111],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.69444, 0.11473, 0, 0.59111],
    176: [0, 0.69444, 0, 0, 0.94888],
    184: [0.17014, 0, 0, 0, 0.53222],
    198: [0, 0.68611, 0.11431, 0, 1.02277],
    216: [0.04861, 0.73472, 0.09062, 0, 0.88555],
    223: [0.19444, 0.69444, 0.09736, 0, 0.665],
    230: [0, 0.44444, 0.085, 0, 0.82666],
    248: [0.09722, 0.54167, 0.09458, 0, 0.59111],
    305: [0, 0.44444, 0.09426, 0, 0.35555],
    338: [0, 0.68611, 0.11431, 0, 1.14054],
    339: [0, 0.44444, 0.085, 0, 0.82666],
    567: [0.19444, 0.44444, 0.04611, 0, 0.385],
    710: [0, 0.69444, 0.06709, 0, 0.59111],
    711: [0, 0.63194, 0.08271, 0, 0.59111],
    713: [0, 0.59444, 0.10444, 0, 0.59111],
    714: [0, 0.69444, 0.08528, 0, 0.59111],
    715: [0, 0.69444, 0, 0, 0.59111],
    728: [0, 0.69444, 0.10333, 0, 0.59111],
    729: [0, 0.69444, 0.12945, 0, 0.35555],
    730: [0, 0.69444, 0, 0, 0.94888],
    732: [0, 0.69444, 0.11472, 0, 0.59111],
    733: [0, 0.69444, 0.11472, 0, 0.59111],
    915: [0, 0.68611, 0.12903, 0, 0.69777],
    916: [0, 0.68611, 0, 0, 0.94444],
    920: [0, 0.68611, 0.09062, 0, 0.88555],
    923: [0, 0.68611, 0, 0, 0.80666],
    926: [0, 0.68611, 0.15092, 0, 0.76777],
    928: [0, 0.68611, 0.17208, 0, 0.8961],
    931: [0, 0.68611, 0.11431, 0, 0.82666],
    933: [0, 0.68611, 0.10778, 0, 0.88555],
    934: [0, 0.68611, 0.05632, 0, 0.82666],
    936: [0, 0.68611, 0.10778, 0, 0.88555],
    937: [0, 0.68611, 0.0992, 0, 0.82666],
    8211: [0, 0.44444, 0.09811, 0, 0.59111],
    8212: [0, 0.44444, 0.09811, 0, 1.18221],
    8216: [0, 0.69444, 0.12945, 0, 0.35555],
    8217: [0, 0.69444, 0.12945, 0, 0.35555],
    8220: [0, 0.69444, 0.16772, 0, 0.62055],
    8221: [0, 0.69444, 0.07939, 0, 0.62055]
  },
  "Main-Italic": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0.12417, 0, 0.30667],
    34: [0, 0.69444, 0.06961, 0, 0.51444],
    35: [0.19444, 0.69444, 0.06616, 0, 0.81777],
    37: [0.05556, 0.75, 0.13639, 0, 0.81777],
    38: [0, 0.69444, 0.09694, 0, 0.76666],
    39: [0, 0.69444, 0.12417, 0, 0.30667],
    40: [0.25, 0.75, 0.16194, 0, 0.40889],
    41: [0.25, 0.75, 0.03694, 0, 0.40889],
    42: [0, 0.75, 0.14917, 0, 0.51111],
    43: [0.05667, 0.56167, 0.03694, 0, 0.76666],
    44: [0.19444, 0.10556, 0, 0, 0.30667],
    45: [0, 0.43056, 0.02826, 0, 0.35778],
    46: [0, 0.10556, 0, 0, 0.30667],
    47: [0.25, 0.75, 0.16194, 0, 0.51111],
    48: [0, 0.64444, 0.13556, 0, 0.51111],
    49: [0, 0.64444, 0.13556, 0, 0.51111],
    50: [0, 0.64444, 0.13556, 0, 0.51111],
    51: [0, 0.64444, 0.13556, 0, 0.51111],
    52: [0.19444, 0.64444, 0.13556, 0, 0.51111],
    53: [0, 0.64444, 0.13556, 0, 0.51111],
    54: [0, 0.64444, 0.13556, 0, 0.51111],
    55: [0.19444, 0.64444, 0.13556, 0, 0.51111],
    56: [0, 0.64444, 0.13556, 0, 0.51111],
    57: [0, 0.64444, 0.13556, 0, 0.51111],
    58: [0, 0.43056, 0.0582, 0, 0.30667],
    59: [0.19444, 0.43056, 0.0582, 0, 0.30667],
    61: [-0.13313, 0.36687, 0.06616, 0, 0.76666],
    63: [0, 0.69444, 0.1225, 0, 0.51111],
    64: [0, 0.69444, 0.09597, 0, 0.76666],
    65: [0, 0.68333, 0, 0, 0.74333],
    66: [0, 0.68333, 0.10257, 0, 0.70389],
    67: [0, 0.68333, 0.14528, 0, 0.71555],
    68: [0, 0.68333, 0.09403, 0, 0.755],
    69: [0, 0.68333, 0.12028, 0, 0.67833],
    70: [0, 0.68333, 0.13305, 0, 0.65277],
    71: [0, 0.68333, 0.08722, 0, 0.77361],
    72: [0, 0.68333, 0.16389, 0, 0.74333],
    73: [0, 0.68333, 0.15806, 0, 0.38555],
    74: [0, 0.68333, 0.14028, 0, 0.525],
    75: [0, 0.68333, 0.14528, 0, 0.76888],
    76: [0, 0.68333, 0, 0, 0.62722],
    77: [0, 0.68333, 0.16389, 0, 0.89666],
    78: [0, 0.68333, 0.16389, 0, 0.74333],
    79: [0, 0.68333, 0.09403, 0, 0.76666],
    80: [0, 0.68333, 0.10257, 0, 0.67833],
    81: [0.19444, 0.68333, 0.09403, 0, 0.76666],
    82: [0, 0.68333, 0.03868, 0, 0.72944],
    83: [0, 0.68333, 0.11972, 0, 0.56222],
    84: [0, 0.68333, 0.13305, 0, 0.71555],
    85: [0, 0.68333, 0.16389, 0, 0.74333],
    86: [0, 0.68333, 0.18361, 0, 0.74333],
    87: [0, 0.68333, 0.18361, 0, 0.99888],
    88: [0, 0.68333, 0.15806, 0, 0.74333],
    89: [0, 0.68333, 0.19383, 0, 0.74333],
    90: [0, 0.68333, 0.14528, 0, 0.61333],
    91: [0.25, 0.75, 0.1875, 0, 0.30667],
    93: [0.25, 0.75, 0.10528, 0, 0.30667],
    94: [0, 0.69444, 0.06646, 0, 0.51111],
    95: [0.31, 0.12056, 0.09208, 0, 0.51111],
    97: [0, 0.43056, 0.07671, 0, 0.51111],
    98: [0, 0.69444, 0.06312, 0, 0.46],
    99: [0, 0.43056, 0.05653, 0, 0.46],
    100: [0, 0.69444, 0.10333, 0, 0.51111],
    101: [0, 0.43056, 0.07514, 0, 0.46],
    102: [0.19444, 0.69444, 0.21194, 0, 0.30667],
    103: [0.19444, 0.43056, 0.08847, 0, 0.46],
    104: [0, 0.69444, 0.07671, 0, 0.51111],
    105: [0, 0.65536, 0.1019, 0, 0.30667],
    106: [0.19444, 0.65536, 0.14467, 0, 0.30667],
    107: [0, 0.69444, 0.10764, 0, 0.46],
    108: [0, 0.69444, 0.10333, 0, 0.25555],
    109: [0, 0.43056, 0.07671, 0, 0.81777],
    110: [0, 0.43056, 0.07671, 0, 0.56222],
    111: [0, 0.43056, 0.06312, 0, 0.51111],
    112: [0.19444, 0.43056, 0.06312, 0, 0.51111],
    113: [0.19444, 0.43056, 0.08847, 0, 0.46],
    114: [0, 0.43056, 0.10764, 0, 0.42166],
    115: [0, 0.43056, 0.08208, 0, 0.40889],
    116: [0, 0.61508, 0.09486, 0, 0.33222],
    117: [0, 0.43056, 0.07671, 0, 0.53666],
    118: [0, 0.43056, 0.10764, 0, 0.46],
    119: [0, 0.43056, 0.10764, 0, 0.66444],
    120: [0, 0.43056, 0.12042, 0, 0.46389],
    121: [0.19444, 0.43056, 0.08847, 0, 0.48555],
    122: [0, 0.43056, 0.12292, 0, 0.40889],
    126: [0.35, 0.31786, 0.11585, 0, 0.51111],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.66786, 0.10474, 0, 0.51111],
    176: [0, 0.69444, 0, 0, 0.83129],
    184: [0.17014, 0, 0, 0, 0.46],
    198: [0, 0.68333, 0.12028, 0, 0.88277],
    216: [0.04861, 0.73194, 0.09403, 0, 0.76666],
    223: [0.19444, 0.69444, 0.10514, 0, 0.53666],
    230: [0, 0.43056, 0.07514, 0, 0.71555],
    248: [0.09722, 0.52778, 0.09194, 0, 0.51111],
    338: [0, 0.68333, 0.12028, 0, 0.98499],
    339: [0, 0.43056, 0.07514, 0, 0.71555],
    710: [0, 0.69444, 0.06646, 0, 0.51111],
    711: [0, 0.62847, 0.08295, 0, 0.51111],
    713: [0, 0.56167, 0.10333, 0, 0.51111],
    714: [0, 0.69444, 0.09694, 0, 0.51111],
    715: [0, 0.69444, 0, 0, 0.51111],
    728: [0, 0.69444, 0.10806, 0, 0.51111],
    729: [0, 0.66786, 0.11752, 0, 0.30667],
    730: [0, 0.69444, 0, 0, 0.83129],
    732: [0, 0.66786, 0.11585, 0, 0.51111],
    733: [0, 0.69444, 0.1225, 0, 0.51111],
    915: [0, 0.68333, 0.13305, 0, 0.62722],
    916: [0, 0.68333, 0, 0, 0.81777],
    920: [0, 0.68333, 0.09403, 0, 0.76666],
    923: [0, 0.68333, 0, 0, 0.69222],
    926: [0, 0.68333, 0.15294, 0, 0.66444],
    928: [0, 0.68333, 0.16389, 0, 0.74333],
    931: [0, 0.68333, 0.12028, 0, 0.71555],
    933: [0, 0.68333, 0.11111, 0, 0.76666],
    934: [0, 0.68333, 0.05986, 0, 0.71555],
    936: [0, 0.68333, 0.11111, 0, 0.76666],
    937: [0, 0.68333, 0.10257, 0, 0.71555],
    8211: [0, 0.43056, 0.09208, 0, 0.51111],
    8212: [0, 0.43056, 0.09208, 0, 1.02222],
    8216: [0, 0.69444, 0.12417, 0, 0.30667],
    8217: [0, 0.69444, 0.12417, 0, 0.30667],
    8220: [0, 0.69444, 0.1685, 0, 0.51444],
    8221: [0, 0.69444, 0.06961, 0, 0.51444],
    8463: [0, 0.68889, 0, 0, 0.54028]
  },
  "Main-Regular": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.27778],
    34: [0, 0.69444, 0, 0, 0.5],
    35: [0.19444, 0.69444, 0, 0, 0.83334],
    36: [0.05556, 0.75, 0, 0, 0.5],
    37: [0.05556, 0.75, 0, 0, 0.83334],
    38: [0, 0.69444, 0, 0, 0.77778],
    39: [0, 0.69444, 0, 0, 0.27778],
    40: [0.25, 0.75, 0, 0, 0.38889],
    41: [0.25, 0.75, 0, 0, 0.38889],
    42: [0, 0.75, 0, 0, 0.5],
    43: [0.08333, 0.58333, 0, 0, 0.77778],
    44: [0.19444, 0.10556, 0, 0, 0.27778],
    45: [0, 0.43056, 0, 0, 0.33333],
    46: [0, 0.10556, 0, 0, 0.27778],
    47: [0.25, 0.75, 0, 0, 0.5],
    48: [0, 0.64444, 0, 0, 0.5],
    49: [0, 0.64444, 0, 0, 0.5],
    50: [0, 0.64444, 0, 0, 0.5],
    51: [0, 0.64444, 0, 0, 0.5],
    52: [0, 0.64444, 0, 0, 0.5],
    53: [0, 0.64444, 0, 0, 0.5],
    54: [0, 0.64444, 0, 0, 0.5],
    55: [0, 0.64444, 0, 0, 0.5],
    56: [0, 0.64444, 0, 0, 0.5],
    57: [0, 0.64444, 0, 0, 0.5],
    58: [0, 0.43056, 0, 0, 0.27778],
    59: [0.19444, 0.43056, 0, 0, 0.27778],
    60: [0.0391, 0.5391, 0, 0, 0.77778],
    61: [-0.13313, 0.36687, 0, 0, 0.77778],
    62: [0.0391, 0.5391, 0, 0, 0.77778],
    63: [0, 0.69444, 0, 0, 0.47222],
    64: [0, 0.69444, 0, 0, 0.77778],
    65: [0, 0.68333, 0, 0, 0.75],
    66: [0, 0.68333, 0, 0, 0.70834],
    67: [0, 0.68333, 0, 0, 0.72222],
    68: [0, 0.68333, 0, 0, 0.76389],
    69: [0, 0.68333, 0, 0, 0.68056],
    70: [0, 0.68333, 0, 0, 0.65278],
    71: [0, 0.68333, 0, 0, 0.78472],
    72: [0, 0.68333, 0, 0, 0.75],
    73: [0, 0.68333, 0, 0, 0.36111],
    74: [0, 0.68333, 0, 0, 0.51389],
    75: [0, 0.68333, 0, 0, 0.77778],
    76: [0, 0.68333, 0, 0, 0.625],
    77: [0, 0.68333, 0, 0, 0.91667],
    78: [0, 0.68333, 0, 0, 0.75],
    79: [0, 0.68333, 0, 0, 0.77778],
    80: [0, 0.68333, 0, 0, 0.68056],
    81: [0.19444, 0.68333, 0, 0, 0.77778],
    82: [0, 0.68333, 0, 0, 0.73611],
    83: [0, 0.68333, 0, 0, 0.55556],
    84: [0, 0.68333, 0, 0, 0.72222],
    85: [0, 0.68333, 0, 0, 0.75],
    86: [0, 0.68333, 0.01389, 0, 0.75],
    87: [0, 0.68333, 0.01389, 0, 1.02778],
    88: [0, 0.68333, 0, 0, 0.75],
    89: [0, 0.68333, 0.025, 0, 0.75],
    90: [0, 0.68333, 0, 0, 0.61111],
    91: [0.25, 0.75, 0, 0, 0.27778],
    92: [0.25, 0.75, 0, 0, 0.5],
    93: [0.25, 0.75, 0, 0, 0.27778],
    94: [0, 0.69444, 0, 0, 0.5],
    95: [0.31, 0.12056, 0.02778, 0, 0.5],
    97: [0, 0.43056, 0, 0, 0.5],
    98: [0, 0.69444, 0, 0, 0.55556],
    99: [0, 0.43056, 0, 0, 0.44445],
    100: [0, 0.69444, 0, 0, 0.55556],
    101: [0, 0.43056, 0, 0, 0.44445],
    102: [0, 0.69444, 0.07778, 0, 0.30556],
    103: [0.19444, 0.43056, 0.01389, 0, 0.5],
    104: [0, 0.69444, 0, 0, 0.55556],
    105: [0, 0.66786, 0, 0, 0.27778],
    106: [0.19444, 0.66786, 0, 0, 0.30556],
    107: [0, 0.69444, 0, 0, 0.52778],
    108: [0, 0.69444, 0, 0, 0.27778],
    109: [0, 0.43056, 0, 0, 0.83334],
    110: [0, 0.43056, 0, 0, 0.55556],
    111: [0, 0.43056, 0, 0, 0.5],
    112: [0.19444, 0.43056, 0, 0, 0.55556],
    113: [0.19444, 0.43056, 0, 0, 0.52778],
    114: [0, 0.43056, 0, 0, 0.39167],
    115: [0, 0.43056, 0, 0, 0.39445],
    116: [0, 0.61508, 0, 0, 0.38889],
    117: [0, 0.43056, 0, 0, 0.55556],
    118: [0, 0.43056, 0.01389, 0, 0.52778],
    119: [0, 0.43056, 0.01389, 0, 0.72222],
    120: [0, 0.43056, 0, 0, 0.52778],
    121: [0.19444, 0.43056, 0.01389, 0, 0.52778],
    122: [0, 0.43056, 0, 0, 0.44445],
    123: [0.25, 0.75, 0, 0, 0.5],
    124: [0.25, 0.75, 0, 0, 0.27778],
    125: [0.25, 0.75, 0, 0, 0.5],
    126: [0.35, 0.31786, 0, 0, 0.5],
    160: [0, 0, 0, 0, 0.25],
    163: [0, 0.69444, 0, 0, 0.76909],
    167: [0.19444, 0.69444, 0, 0, 0.44445],
    168: [0, 0.66786, 0, 0, 0.5],
    172: [0, 0.43056, 0, 0, 0.66667],
    176: [0, 0.69444, 0, 0, 0.75],
    177: [0.08333, 0.58333, 0, 0, 0.77778],
    182: [0.19444, 0.69444, 0, 0, 0.61111],
    184: [0.17014, 0, 0, 0, 0.44445],
    198: [0, 0.68333, 0, 0, 0.90278],
    215: [0.08333, 0.58333, 0, 0, 0.77778],
    216: [0.04861, 0.73194, 0, 0, 0.77778],
    223: [0, 0.69444, 0, 0, 0.5],
    230: [0, 0.43056, 0, 0, 0.72222],
    247: [0.08333, 0.58333, 0, 0, 0.77778],
    248: [0.09722, 0.52778, 0, 0, 0.5],
    305: [0, 0.43056, 0, 0, 0.27778],
    338: [0, 0.68333, 0, 0, 1.01389],
    339: [0, 0.43056, 0, 0, 0.77778],
    567: [0.19444, 0.43056, 0, 0, 0.30556],
    710: [0, 0.69444, 0, 0, 0.5],
    711: [0, 0.62847, 0, 0, 0.5],
    713: [0, 0.56778, 0, 0, 0.5],
    714: [0, 0.69444, 0, 0, 0.5],
    715: [0, 0.69444, 0, 0, 0.5],
    728: [0, 0.69444, 0, 0, 0.5],
    729: [0, 0.66786, 0, 0, 0.27778],
    730: [0, 0.69444, 0, 0, 0.75],
    732: [0, 0.66786, 0, 0, 0.5],
    733: [0, 0.69444, 0, 0, 0.5],
    915: [0, 0.68333, 0, 0, 0.625],
    916: [0, 0.68333, 0, 0, 0.83334],
    920: [0, 0.68333, 0, 0, 0.77778],
    923: [0, 0.68333, 0, 0, 0.69445],
    926: [0, 0.68333, 0, 0, 0.66667],
    928: [0, 0.68333, 0, 0, 0.75],
    931: [0, 0.68333, 0, 0, 0.72222],
    933: [0, 0.68333, 0, 0, 0.77778],
    934: [0, 0.68333, 0, 0, 0.72222],
    936: [0, 0.68333, 0, 0, 0.77778],
    937: [0, 0.68333, 0, 0, 0.72222],
    8211: [0, 0.43056, 0.02778, 0, 0.5],
    8212: [0, 0.43056, 0.02778, 0, 1],
    8216: [0, 0.69444, 0, 0, 0.27778],
    8217: [0, 0.69444, 0, 0, 0.27778],
    8220: [0, 0.69444, 0, 0, 0.5],
    8221: [0, 0.69444, 0, 0, 0.5],
    8224: [0.19444, 0.69444, 0, 0, 0.44445],
    8225: [0.19444, 0.69444, 0, 0, 0.44445],
    8230: [0, 0.123, 0, 0, 1.172],
    8242: [0, 0.55556, 0, 0, 0.275],
    8407: [0, 0.71444, 0.15382, 0, 0.5],
    8463: [0, 0.68889, 0, 0, 0.54028],
    8465: [0, 0.69444, 0, 0, 0.72222],
    8467: [0, 0.69444, 0, 0.11111, 0.41667],
    8472: [0.19444, 0.43056, 0, 0.11111, 0.63646],
    8476: [0, 0.69444, 0, 0, 0.72222],
    8501: [0, 0.69444, 0, 0, 0.61111],
    8592: [-0.13313, 0.36687, 0, 0, 1],
    8593: [0.19444, 0.69444, 0, 0, 0.5],
    8594: [-0.13313, 0.36687, 0, 0, 1],
    8595: [0.19444, 0.69444, 0, 0, 0.5],
    8596: [-0.13313, 0.36687, 0, 0, 1],
    8597: [0.25, 0.75, 0, 0, 0.5],
    8598: [0.19444, 0.69444, 0, 0, 1],
    8599: [0.19444, 0.69444, 0, 0, 1],
    8600: [0.19444, 0.69444, 0, 0, 1],
    8601: [0.19444, 0.69444, 0, 0, 1],
    8614: [0.011, 0.511, 0, 0, 1],
    8617: [0.011, 0.511, 0, 0, 1.126],
    8618: [0.011, 0.511, 0, 0, 1.126],
    8636: [-0.13313, 0.36687, 0, 0, 1],
    8637: [-0.13313, 0.36687, 0, 0, 1],
    8640: [-0.13313, 0.36687, 0, 0, 1],
    8641: [-0.13313, 0.36687, 0, 0, 1],
    8652: [0.011, 0.671, 0, 0, 1],
    8656: [-0.13313, 0.36687, 0, 0, 1],
    8657: [0.19444, 0.69444, 0, 0, 0.61111],
    8658: [-0.13313, 0.36687, 0, 0, 1],
    8659: [0.19444, 0.69444, 0, 0, 0.61111],
    8660: [-0.13313, 0.36687, 0, 0, 1],
    8661: [0.25, 0.75, 0, 0, 0.61111],
    8704: [0, 0.69444, 0, 0, 0.55556],
    8706: [0, 0.69444, 0.05556, 0.08334, 0.5309],
    8707: [0, 0.69444, 0, 0, 0.55556],
    8709: [0.05556, 0.75, 0, 0, 0.5],
    8711: [0, 0.68333, 0, 0, 0.83334],
    8712: [0.0391, 0.5391, 0, 0, 0.66667],
    8715: [0.0391, 0.5391, 0, 0, 0.66667],
    8722: [0.08333, 0.58333, 0, 0, 0.77778],
    8723: [0.08333, 0.58333, 0, 0, 0.77778],
    8725: [0.25, 0.75, 0, 0, 0.5],
    8726: [0.25, 0.75, 0, 0, 0.5],
    8727: [-0.03472, 0.46528, 0, 0, 0.5],
    8728: [-0.05555, 0.44445, 0, 0, 0.5],
    8729: [-0.05555, 0.44445, 0, 0, 0.5],
    8730: [0.2, 0.8, 0, 0, 0.83334],
    8733: [0, 0.43056, 0, 0, 0.77778],
    8734: [0, 0.43056, 0, 0, 1],
    8736: [0, 0.69224, 0, 0, 0.72222],
    8739: [0.25, 0.75, 0, 0, 0.27778],
    8741: [0.25, 0.75, 0, 0, 0.5],
    8743: [0, 0.55556, 0, 0, 0.66667],
    8744: [0, 0.55556, 0, 0, 0.66667],
    8745: [0, 0.55556, 0, 0, 0.66667],
    8746: [0, 0.55556, 0, 0, 0.66667],
    8747: [0.19444, 0.69444, 0.11111, 0, 0.41667],
    8764: [-0.13313, 0.36687, 0, 0, 0.77778],
    8768: [0.19444, 0.69444, 0, 0, 0.27778],
    8771: [-0.03625, 0.46375, 0, 0, 0.77778],
    8773: [-0.022, 0.589, 0, 0, 0.778],
    8776: [-0.01688, 0.48312, 0, 0, 0.77778],
    8781: [-0.03625, 0.46375, 0, 0, 0.77778],
    8784: [-0.133, 0.673, 0, 0, 0.778],
    8801: [-0.03625, 0.46375, 0, 0, 0.77778],
    8804: [0.13597, 0.63597, 0, 0, 0.77778],
    8805: [0.13597, 0.63597, 0, 0, 0.77778],
    8810: [0.0391, 0.5391, 0, 0, 1],
    8811: [0.0391, 0.5391, 0, 0, 1],
    8826: [0.0391, 0.5391, 0, 0, 0.77778],
    8827: [0.0391, 0.5391, 0, 0, 0.77778],
    8834: [0.0391, 0.5391, 0, 0, 0.77778],
    8835: [0.0391, 0.5391, 0, 0, 0.77778],
    8838: [0.13597, 0.63597, 0, 0, 0.77778],
    8839: [0.13597, 0.63597, 0, 0, 0.77778],
    8846: [0, 0.55556, 0, 0, 0.66667],
    8849: [0.13597, 0.63597, 0, 0, 0.77778],
    8850: [0.13597, 0.63597, 0, 0, 0.77778],
    8851: [0, 0.55556, 0, 0, 0.66667],
    8852: [0, 0.55556, 0, 0, 0.66667],
    8853: [0.08333, 0.58333, 0, 0, 0.77778],
    8854: [0.08333, 0.58333, 0, 0, 0.77778],
    8855: [0.08333, 0.58333, 0, 0, 0.77778],
    8856: [0.08333, 0.58333, 0, 0, 0.77778],
    8857: [0.08333, 0.58333, 0, 0, 0.77778],
    8866: [0, 0.69444, 0, 0, 0.61111],
    8867: [0, 0.69444, 0, 0, 0.61111],
    8868: [0, 0.69444, 0, 0, 0.77778],
    8869: [0, 0.69444, 0, 0, 0.77778],
    8872: [0.249, 0.75, 0, 0, 0.867],
    8900: [-0.05555, 0.44445, 0, 0, 0.5],
    8901: [-0.05555, 0.44445, 0, 0, 0.27778],
    8902: [-0.03472, 0.46528, 0, 0, 0.5],
    8904: [5e-3, 0.505, 0, 0, 0.9],
    8942: [0.03, 0.903, 0, 0, 0.278],
    8943: [-0.19, 0.313, 0, 0, 1.172],
    8945: [-0.1, 0.823, 0, 0, 1.282],
    8968: [0.25, 0.75, 0, 0, 0.44445],
    8969: [0.25, 0.75, 0, 0, 0.44445],
    8970: [0.25, 0.75, 0, 0, 0.44445],
    8971: [0.25, 0.75, 0, 0, 0.44445],
    8994: [-0.14236, 0.35764, 0, 0, 1],
    8995: [-0.14236, 0.35764, 0, 0, 1],
    9136: [0.244, 0.744, 0, 0, 0.412],
    9137: [0.244, 0.745, 0, 0, 0.412],
    9651: [0.19444, 0.69444, 0, 0, 0.88889],
    9657: [-0.03472, 0.46528, 0, 0, 0.5],
    9661: [0.19444, 0.69444, 0, 0, 0.88889],
    9667: [-0.03472, 0.46528, 0, 0, 0.5],
    9711: [0.19444, 0.69444, 0, 0, 1],
    9824: [0.12963, 0.69444, 0, 0, 0.77778],
    9825: [0.12963, 0.69444, 0, 0, 0.77778],
    9826: [0.12963, 0.69444, 0, 0, 0.77778],
    9827: [0.12963, 0.69444, 0, 0, 0.77778],
    9837: [0, 0.75, 0, 0, 0.38889],
    9838: [0.19444, 0.69444, 0, 0, 0.38889],
    9839: [0.19444, 0.69444, 0, 0, 0.38889],
    10216: [0.25, 0.75, 0, 0, 0.38889],
    10217: [0.25, 0.75, 0, 0, 0.38889],
    10222: [0.244, 0.744, 0, 0, 0.412],
    10223: [0.244, 0.745, 0, 0, 0.412],
    10229: [0.011, 0.511, 0, 0, 1.609],
    10230: [0.011, 0.511, 0, 0, 1.638],
    10231: [0.011, 0.511, 0, 0, 1.859],
    10232: [0.024, 0.525, 0, 0, 1.609],
    10233: [0.024, 0.525, 0, 0, 1.638],
    10234: [0.024, 0.525, 0, 0, 1.858],
    10236: [0.011, 0.511, 0, 0, 1.638],
    10815: [0, 0.68333, 0, 0, 0.75],
    10927: [0.13597, 0.63597, 0, 0, 0.77778],
    10928: [0.13597, 0.63597, 0, 0, 0.77778],
    57376: [0.19444, 0.69444, 0, 0, 0]
  },
  "Math-BoldItalic": {
    32: [0, 0, 0, 0, 0.25],
    48: [0, 0.44444, 0, 0, 0.575],
    49: [0, 0.44444, 0, 0, 0.575],
    50: [0, 0.44444, 0, 0, 0.575],
    51: [0.19444, 0.44444, 0, 0, 0.575],
    52: [0.19444, 0.44444, 0, 0, 0.575],
    53: [0.19444, 0.44444, 0, 0, 0.575],
    54: [0, 0.64444, 0, 0, 0.575],
    55: [0.19444, 0.44444, 0, 0, 0.575],
    56: [0, 0.64444, 0, 0, 0.575],
    57: [0.19444, 0.44444, 0, 0, 0.575],
    65: [0, 0.68611, 0, 0, 0.86944],
    66: [0, 0.68611, 0.04835, 0, 0.8664],
    67: [0, 0.68611, 0.06979, 0, 0.81694],
    68: [0, 0.68611, 0.03194, 0, 0.93812],
    69: [0, 0.68611, 0.05451, 0, 0.81007],
    70: [0, 0.68611, 0.15972, 0, 0.68889],
    71: [0, 0.68611, 0, 0, 0.88673],
    72: [0, 0.68611, 0.08229, 0, 0.98229],
    73: [0, 0.68611, 0.07778, 0, 0.51111],
    74: [0, 0.68611, 0.10069, 0, 0.63125],
    75: [0, 0.68611, 0.06979, 0, 0.97118],
    76: [0, 0.68611, 0, 0, 0.75555],
    77: [0, 0.68611, 0.11424, 0, 1.14201],
    78: [0, 0.68611, 0.11424, 0, 0.95034],
    79: [0, 0.68611, 0.03194, 0, 0.83666],
    80: [0, 0.68611, 0.15972, 0, 0.72309],
    81: [0.19444, 0.68611, 0, 0, 0.86861],
    82: [0, 0.68611, 421e-5, 0, 0.87235],
    83: [0, 0.68611, 0.05382, 0, 0.69271],
    84: [0, 0.68611, 0.15972, 0, 0.63663],
    85: [0, 0.68611, 0.11424, 0, 0.80027],
    86: [0, 0.68611, 0.25555, 0, 0.67778],
    87: [0, 0.68611, 0.15972, 0, 1.09305],
    88: [0, 0.68611, 0.07778, 0, 0.94722],
    89: [0, 0.68611, 0.25555, 0, 0.67458],
    90: [0, 0.68611, 0.06979, 0, 0.77257],
    97: [0, 0.44444, 0, 0, 0.63287],
    98: [0, 0.69444, 0, 0, 0.52083],
    99: [0, 0.44444, 0, 0, 0.51342],
    100: [0, 0.69444, 0, 0, 0.60972],
    101: [0, 0.44444, 0, 0, 0.55361],
    102: [0.19444, 0.69444, 0.11042, 0, 0.56806],
    103: [0.19444, 0.44444, 0.03704, 0, 0.5449],
    104: [0, 0.69444, 0, 0, 0.66759],
    105: [0, 0.69326, 0, 0, 0.4048],
    106: [0.19444, 0.69326, 0.0622, 0, 0.47083],
    107: [0, 0.69444, 0.01852, 0, 0.6037],
    108: [0, 0.69444, 88e-4, 0, 0.34815],
    109: [0, 0.44444, 0, 0, 1.0324],
    110: [0, 0.44444, 0, 0, 0.71296],
    111: [0, 0.44444, 0, 0, 0.58472],
    112: [0.19444, 0.44444, 0, 0, 0.60092],
    113: [0.19444, 0.44444, 0.03704, 0, 0.54213],
    114: [0, 0.44444, 0.03194, 0, 0.5287],
    115: [0, 0.44444, 0, 0, 0.53125],
    116: [0, 0.63492, 0, 0, 0.41528],
    117: [0, 0.44444, 0, 0, 0.68102],
    118: [0, 0.44444, 0.03704, 0, 0.56666],
    119: [0, 0.44444, 0.02778, 0, 0.83148],
    120: [0, 0.44444, 0, 0, 0.65903],
    121: [0.19444, 0.44444, 0.03704, 0, 0.59028],
    122: [0, 0.44444, 0.04213, 0, 0.55509],
    160: [0, 0, 0, 0, 0.25],
    915: [0, 0.68611, 0.15972, 0, 0.65694],
    916: [0, 0.68611, 0, 0, 0.95833],
    920: [0, 0.68611, 0.03194, 0, 0.86722],
    923: [0, 0.68611, 0, 0, 0.80555],
    926: [0, 0.68611, 0.07458, 0, 0.84125],
    928: [0, 0.68611, 0.08229, 0, 0.98229],
    931: [0, 0.68611, 0.05451, 0, 0.88507],
    933: [0, 0.68611, 0.15972, 0, 0.67083],
    934: [0, 0.68611, 0, 0, 0.76666],
    936: [0, 0.68611, 0.11653, 0, 0.71402],
    937: [0, 0.68611, 0.04835, 0, 0.8789],
    945: [0, 0.44444, 0, 0, 0.76064],
    946: [0.19444, 0.69444, 0.03403, 0, 0.65972],
    947: [0.19444, 0.44444, 0.06389, 0, 0.59003],
    948: [0, 0.69444, 0.03819, 0, 0.52222],
    949: [0, 0.44444, 0, 0, 0.52882],
    950: [0.19444, 0.69444, 0.06215, 0, 0.50833],
    951: [0.19444, 0.44444, 0.03704, 0, 0.6],
    952: [0, 0.69444, 0.03194, 0, 0.5618],
    953: [0, 0.44444, 0, 0, 0.41204],
    954: [0, 0.44444, 0, 0, 0.66759],
    955: [0, 0.69444, 0, 0, 0.67083],
    956: [0.19444, 0.44444, 0, 0, 0.70787],
    957: [0, 0.44444, 0.06898, 0, 0.57685],
    958: [0.19444, 0.69444, 0.03021, 0, 0.50833],
    959: [0, 0.44444, 0, 0, 0.58472],
    960: [0, 0.44444, 0.03704, 0, 0.68241],
    961: [0.19444, 0.44444, 0, 0, 0.6118],
    962: [0.09722, 0.44444, 0.07917, 0, 0.42361],
    963: [0, 0.44444, 0.03704, 0, 0.68588],
    964: [0, 0.44444, 0.13472, 0, 0.52083],
    965: [0, 0.44444, 0.03704, 0, 0.63055],
    966: [0.19444, 0.44444, 0, 0, 0.74722],
    967: [0.19444, 0.44444, 0, 0, 0.71805],
    968: [0.19444, 0.69444, 0.03704, 0, 0.75833],
    969: [0, 0.44444, 0.03704, 0, 0.71782],
    977: [0, 0.69444, 0, 0, 0.69155],
    981: [0.19444, 0.69444, 0, 0, 0.7125],
    982: [0, 0.44444, 0.03194, 0, 0.975],
    1009: [0.19444, 0.44444, 0, 0, 0.6118],
    1013: [0, 0.44444, 0, 0, 0.48333],
    57649: [0, 0.44444, 0, 0, 0.39352],
    57911: [0.19444, 0.44444, 0, 0, 0.43889]
  },
  "Math-Italic": {
    32: [0, 0, 0, 0, 0.25],
    48: [0, 0.43056, 0, 0, 0.5],
    49: [0, 0.43056, 0, 0, 0.5],
    50: [0, 0.43056, 0, 0, 0.5],
    51: [0.19444, 0.43056, 0, 0, 0.5],
    52: [0.19444, 0.43056, 0, 0, 0.5],
    53: [0.19444, 0.43056, 0, 0, 0.5],
    54: [0, 0.64444, 0, 0, 0.5],
    55: [0.19444, 0.43056, 0, 0, 0.5],
    56: [0, 0.64444, 0, 0, 0.5],
    57: [0.19444, 0.43056, 0, 0, 0.5],
    65: [0, 0.68333, 0, 0.13889, 0.75],
    66: [0, 0.68333, 0.05017, 0.08334, 0.75851],
    67: [0, 0.68333, 0.07153, 0.08334, 0.71472],
    68: [0, 0.68333, 0.02778, 0.05556, 0.82792],
    69: [0, 0.68333, 0.05764, 0.08334, 0.7382],
    70: [0, 0.68333, 0.13889, 0.08334, 0.64306],
    71: [0, 0.68333, 0, 0.08334, 0.78625],
    72: [0, 0.68333, 0.08125, 0.05556, 0.83125],
    73: [0, 0.68333, 0.07847, 0.11111, 0.43958],
    74: [0, 0.68333, 0.09618, 0.16667, 0.55451],
    75: [0, 0.68333, 0.07153, 0.05556, 0.84931],
    76: [0, 0.68333, 0, 0.02778, 0.68056],
    77: [0, 0.68333, 0.10903, 0.08334, 0.97014],
    78: [0, 0.68333, 0.10903, 0.08334, 0.80347],
    79: [0, 0.68333, 0.02778, 0.08334, 0.76278],
    80: [0, 0.68333, 0.13889, 0.08334, 0.64201],
    81: [0.19444, 0.68333, 0, 0.08334, 0.79056],
    82: [0, 0.68333, 773e-5, 0.08334, 0.75929],
    83: [0, 0.68333, 0.05764, 0.08334, 0.6132],
    84: [0, 0.68333, 0.13889, 0.08334, 0.58438],
    85: [0, 0.68333, 0.10903, 0.02778, 0.68278],
    86: [0, 0.68333, 0.22222, 0, 0.58333],
    87: [0, 0.68333, 0.13889, 0, 0.94445],
    88: [0, 0.68333, 0.07847, 0.08334, 0.82847],
    89: [0, 0.68333, 0.22222, 0, 0.58056],
    90: [0, 0.68333, 0.07153, 0.08334, 0.68264],
    97: [0, 0.43056, 0, 0, 0.52859],
    98: [0, 0.69444, 0, 0, 0.42917],
    99: [0, 0.43056, 0, 0.05556, 0.43276],
    100: [0, 0.69444, 0, 0.16667, 0.52049],
    101: [0, 0.43056, 0, 0.05556, 0.46563],
    102: [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
    103: [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
    104: [0, 0.69444, 0, 0, 0.57616],
    105: [0, 0.65952, 0, 0, 0.34451],
    106: [0.19444, 0.65952, 0.05724, 0, 0.41181],
    107: [0, 0.69444, 0.03148, 0, 0.5206],
    108: [0, 0.69444, 0.01968, 0.08334, 0.29838],
    109: [0, 0.43056, 0, 0, 0.87801],
    110: [0, 0.43056, 0, 0, 0.60023],
    111: [0, 0.43056, 0, 0.05556, 0.48472],
    112: [0.19444, 0.43056, 0, 0.08334, 0.50313],
    113: [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
    114: [0, 0.43056, 0.02778, 0.05556, 0.45116],
    115: [0, 0.43056, 0, 0.05556, 0.46875],
    116: [0, 0.61508, 0, 0.08334, 0.36111],
    117: [0, 0.43056, 0, 0.02778, 0.57246],
    118: [0, 0.43056, 0.03588, 0.02778, 0.48472],
    119: [0, 0.43056, 0.02691, 0.08334, 0.71592],
    120: [0, 0.43056, 0, 0.02778, 0.57153],
    121: [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
    122: [0, 0.43056, 0.04398, 0.05556, 0.46505],
    160: [0, 0, 0, 0, 0.25],
    915: [0, 0.68333, 0.13889, 0.08334, 0.61528],
    916: [0, 0.68333, 0, 0.16667, 0.83334],
    920: [0, 0.68333, 0.02778, 0.08334, 0.76278],
    923: [0, 0.68333, 0, 0.16667, 0.69445],
    926: [0, 0.68333, 0.07569, 0.08334, 0.74236],
    928: [0, 0.68333, 0.08125, 0.05556, 0.83125],
    931: [0, 0.68333, 0.05764, 0.08334, 0.77986],
    933: [0, 0.68333, 0.13889, 0.05556, 0.58333],
    934: [0, 0.68333, 0, 0.08334, 0.66667],
    936: [0, 0.68333, 0.11, 0.05556, 0.61222],
    937: [0, 0.68333, 0.05017, 0.08334, 0.7724],
    945: [0, 0.43056, 37e-4, 0.02778, 0.6397],
    946: [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
    947: [0.19444, 0.43056, 0.05556, 0, 0.51773],
    948: [0, 0.69444, 0.03785, 0.05556, 0.44444],
    949: [0, 0.43056, 0, 0.08334, 0.46632],
    950: [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
    951: [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
    952: [0, 0.69444, 0.02778, 0.08334, 0.46944],
    953: [0, 0.43056, 0, 0.05556, 0.35394],
    954: [0, 0.43056, 0, 0, 0.57616],
    955: [0, 0.69444, 0, 0, 0.58334],
    956: [0.19444, 0.43056, 0, 0.02778, 0.60255],
    957: [0, 0.43056, 0.06366, 0.02778, 0.49398],
    958: [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
    959: [0, 0.43056, 0, 0.05556, 0.48472],
    960: [0, 0.43056, 0.03588, 0, 0.57003],
    961: [0.19444, 0.43056, 0, 0.08334, 0.51702],
    962: [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
    963: [0, 0.43056, 0.03588, 0, 0.57141],
    964: [0, 0.43056, 0.1132, 0.02778, 0.43715],
    965: [0, 0.43056, 0.03588, 0.02778, 0.54028],
    966: [0.19444, 0.43056, 0, 0.08334, 0.65417],
    967: [0.19444, 0.43056, 0, 0.05556, 0.62569],
    968: [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
    969: [0, 0.43056, 0.03588, 0, 0.62245],
    977: [0, 0.69444, 0, 0.08334, 0.59144],
    981: [0.19444, 0.69444, 0, 0.08334, 0.59583],
    982: [0, 0.43056, 0.02778, 0, 0.82813],
    1009: [0.19444, 0.43056, 0, 0.08334, 0.51702],
    1013: [0, 0.43056, 0, 0.05556, 0.4059],
    57649: [0, 0.43056, 0, 0.02778, 0.32246],
    57911: [0.19444, 0.43056, 0, 0.08334, 0.38403]
  },
  "SansSerif-Bold": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.36667],
    34: [0, 0.69444, 0, 0, 0.55834],
    35: [0.19444, 0.69444, 0, 0, 0.91667],
    36: [0.05556, 0.75, 0, 0, 0.55],
    37: [0.05556, 0.75, 0, 0, 1.02912],
    38: [0, 0.69444, 0, 0, 0.83056],
    39: [0, 0.69444, 0, 0, 0.30556],
    40: [0.25, 0.75, 0, 0, 0.42778],
    41: [0.25, 0.75, 0, 0, 0.42778],
    42: [0, 0.75, 0, 0, 0.55],
    43: [0.11667, 0.61667, 0, 0, 0.85556],
    44: [0.10556, 0.13056, 0, 0, 0.30556],
    45: [0, 0.45833, 0, 0, 0.36667],
    46: [0, 0.13056, 0, 0, 0.30556],
    47: [0.25, 0.75, 0, 0, 0.55],
    48: [0, 0.69444, 0, 0, 0.55],
    49: [0, 0.69444, 0, 0, 0.55],
    50: [0, 0.69444, 0, 0, 0.55],
    51: [0, 0.69444, 0, 0, 0.55],
    52: [0, 0.69444, 0, 0, 0.55],
    53: [0, 0.69444, 0, 0, 0.55],
    54: [0, 0.69444, 0, 0, 0.55],
    55: [0, 0.69444, 0, 0, 0.55],
    56: [0, 0.69444, 0, 0, 0.55],
    57: [0, 0.69444, 0, 0, 0.55],
    58: [0, 0.45833, 0, 0, 0.30556],
    59: [0.10556, 0.45833, 0, 0, 0.30556],
    61: [-0.09375, 0.40625, 0, 0, 0.85556],
    63: [0, 0.69444, 0, 0, 0.51945],
    64: [0, 0.69444, 0, 0, 0.73334],
    65: [0, 0.69444, 0, 0, 0.73334],
    66: [0, 0.69444, 0, 0, 0.73334],
    67: [0, 0.69444, 0, 0, 0.70278],
    68: [0, 0.69444, 0, 0, 0.79445],
    69: [0, 0.69444, 0, 0, 0.64167],
    70: [0, 0.69444, 0, 0, 0.61111],
    71: [0, 0.69444, 0, 0, 0.73334],
    72: [0, 0.69444, 0, 0, 0.79445],
    73: [0, 0.69444, 0, 0, 0.33056],
    74: [0, 0.69444, 0, 0, 0.51945],
    75: [0, 0.69444, 0, 0, 0.76389],
    76: [0, 0.69444, 0, 0, 0.58056],
    77: [0, 0.69444, 0, 0, 0.97778],
    78: [0, 0.69444, 0, 0, 0.79445],
    79: [0, 0.69444, 0, 0, 0.79445],
    80: [0, 0.69444, 0, 0, 0.70278],
    81: [0.10556, 0.69444, 0, 0, 0.79445],
    82: [0, 0.69444, 0, 0, 0.70278],
    83: [0, 0.69444, 0, 0, 0.61111],
    84: [0, 0.69444, 0, 0, 0.73334],
    85: [0, 0.69444, 0, 0, 0.76389],
    86: [0, 0.69444, 0.01528, 0, 0.73334],
    87: [0, 0.69444, 0.01528, 0, 1.03889],
    88: [0, 0.69444, 0, 0, 0.73334],
    89: [0, 0.69444, 0.0275, 0, 0.73334],
    90: [0, 0.69444, 0, 0, 0.67223],
    91: [0.25, 0.75, 0, 0, 0.34306],
    93: [0.25, 0.75, 0, 0, 0.34306],
    94: [0, 0.69444, 0, 0, 0.55],
    95: [0.35, 0.10833, 0.03056, 0, 0.55],
    97: [0, 0.45833, 0, 0, 0.525],
    98: [0, 0.69444, 0, 0, 0.56111],
    99: [0, 0.45833, 0, 0, 0.48889],
    100: [0, 0.69444, 0, 0, 0.56111],
    101: [0, 0.45833, 0, 0, 0.51111],
    102: [0, 0.69444, 0.07639, 0, 0.33611],
    103: [0.19444, 0.45833, 0.01528, 0, 0.55],
    104: [0, 0.69444, 0, 0, 0.56111],
    105: [0, 0.69444, 0, 0, 0.25556],
    106: [0.19444, 0.69444, 0, 0, 0.28611],
    107: [0, 0.69444, 0, 0, 0.53056],
    108: [0, 0.69444, 0, 0, 0.25556],
    109: [0, 0.45833, 0, 0, 0.86667],
    110: [0, 0.45833, 0, 0, 0.56111],
    111: [0, 0.45833, 0, 0, 0.55],
    112: [0.19444, 0.45833, 0, 0, 0.56111],
    113: [0.19444, 0.45833, 0, 0, 0.56111],
    114: [0, 0.45833, 0.01528, 0, 0.37222],
    115: [0, 0.45833, 0, 0, 0.42167],
    116: [0, 0.58929, 0, 0, 0.40417],
    117: [0, 0.45833, 0, 0, 0.56111],
    118: [0, 0.45833, 0.01528, 0, 0.5],
    119: [0, 0.45833, 0.01528, 0, 0.74445],
    120: [0, 0.45833, 0, 0, 0.5],
    121: [0.19444, 0.45833, 0.01528, 0, 0.5],
    122: [0, 0.45833, 0, 0, 0.47639],
    126: [0.35, 0.34444, 0, 0, 0.55],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.69444, 0, 0, 0.55],
    176: [0, 0.69444, 0, 0, 0.73334],
    180: [0, 0.69444, 0, 0, 0.55],
    184: [0.17014, 0, 0, 0, 0.48889],
    305: [0, 0.45833, 0, 0, 0.25556],
    567: [0.19444, 0.45833, 0, 0, 0.28611],
    710: [0, 0.69444, 0, 0, 0.55],
    711: [0, 0.63542, 0, 0, 0.55],
    713: [0, 0.63778, 0, 0, 0.55],
    728: [0, 0.69444, 0, 0, 0.55],
    729: [0, 0.69444, 0, 0, 0.30556],
    730: [0, 0.69444, 0, 0, 0.73334],
    732: [0, 0.69444, 0, 0, 0.55],
    733: [0, 0.69444, 0, 0, 0.55],
    915: [0, 0.69444, 0, 0, 0.58056],
    916: [0, 0.69444, 0, 0, 0.91667],
    920: [0, 0.69444, 0, 0, 0.85556],
    923: [0, 0.69444, 0, 0, 0.67223],
    926: [0, 0.69444, 0, 0, 0.73334],
    928: [0, 0.69444, 0, 0, 0.79445],
    931: [0, 0.69444, 0, 0, 0.79445],
    933: [0, 0.69444, 0, 0, 0.85556],
    934: [0, 0.69444, 0, 0, 0.79445],
    936: [0, 0.69444, 0, 0, 0.85556],
    937: [0, 0.69444, 0, 0, 0.79445],
    8211: [0, 0.45833, 0.03056, 0, 0.55],
    8212: [0, 0.45833, 0.03056, 0, 1.10001],
    8216: [0, 0.69444, 0, 0, 0.30556],
    8217: [0, 0.69444, 0, 0, 0.30556],
    8220: [0, 0.69444, 0, 0, 0.55834],
    8221: [0, 0.69444, 0, 0, 0.55834]
  },
  "SansSerif-Italic": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0.05733, 0, 0.31945],
    34: [0, 0.69444, 316e-5, 0, 0.5],
    35: [0.19444, 0.69444, 0.05087, 0, 0.83334],
    36: [0.05556, 0.75, 0.11156, 0, 0.5],
    37: [0.05556, 0.75, 0.03126, 0, 0.83334],
    38: [0, 0.69444, 0.03058, 0, 0.75834],
    39: [0, 0.69444, 0.07816, 0, 0.27778],
    40: [0.25, 0.75, 0.13164, 0, 0.38889],
    41: [0.25, 0.75, 0.02536, 0, 0.38889],
    42: [0, 0.75, 0.11775, 0, 0.5],
    43: [0.08333, 0.58333, 0.02536, 0, 0.77778],
    44: [0.125, 0.08333, 0, 0, 0.27778],
    45: [0, 0.44444, 0.01946, 0, 0.33333],
    46: [0, 0.08333, 0, 0, 0.27778],
    47: [0.25, 0.75, 0.13164, 0, 0.5],
    48: [0, 0.65556, 0.11156, 0, 0.5],
    49: [0, 0.65556, 0.11156, 0, 0.5],
    50: [0, 0.65556, 0.11156, 0, 0.5],
    51: [0, 0.65556, 0.11156, 0, 0.5],
    52: [0, 0.65556, 0.11156, 0, 0.5],
    53: [0, 0.65556, 0.11156, 0, 0.5],
    54: [0, 0.65556, 0.11156, 0, 0.5],
    55: [0, 0.65556, 0.11156, 0, 0.5],
    56: [0, 0.65556, 0.11156, 0, 0.5],
    57: [0, 0.65556, 0.11156, 0, 0.5],
    58: [0, 0.44444, 0.02502, 0, 0.27778],
    59: [0.125, 0.44444, 0.02502, 0, 0.27778],
    61: [-0.13, 0.37, 0.05087, 0, 0.77778],
    63: [0, 0.69444, 0.11809, 0, 0.47222],
    64: [0, 0.69444, 0.07555, 0, 0.66667],
    65: [0, 0.69444, 0, 0, 0.66667],
    66: [0, 0.69444, 0.08293, 0, 0.66667],
    67: [0, 0.69444, 0.11983, 0, 0.63889],
    68: [0, 0.69444, 0.07555, 0, 0.72223],
    69: [0, 0.69444, 0.11983, 0, 0.59722],
    70: [0, 0.69444, 0.13372, 0, 0.56945],
    71: [0, 0.69444, 0.11983, 0, 0.66667],
    72: [0, 0.69444, 0.08094, 0, 0.70834],
    73: [0, 0.69444, 0.13372, 0, 0.27778],
    74: [0, 0.69444, 0.08094, 0, 0.47222],
    75: [0, 0.69444, 0.11983, 0, 0.69445],
    76: [0, 0.69444, 0, 0, 0.54167],
    77: [0, 0.69444, 0.08094, 0, 0.875],
    78: [0, 0.69444, 0.08094, 0, 0.70834],
    79: [0, 0.69444, 0.07555, 0, 0.73611],
    80: [0, 0.69444, 0.08293, 0, 0.63889],
    81: [0.125, 0.69444, 0.07555, 0, 0.73611],
    82: [0, 0.69444, 0.08293, 0, 0.64584],
    83: [0, 0.69444, 0.09205, 0, 0.55556],
    84: [0, 0.69444, 0.13372, 0, 0.68056],
    85: [0, 0.69444, 0.08094, 0, 0.6875],
    86: [0, 0.69444, 0.1615, 0, 0.66667],
    87: [0, 0.69444, 0.1615, 0, 0.94445],
    88: [0, 0.69444, 0.13372, 0, 0.66667],
    89: [0, 0.69444, 0.17261, 0, 0.66667],
    90: [0, 0.69444, 0.11983, 0, 0.61111],
    91: [0.25, 0.75, 0.15942, 0, 0.28889],
    93: [0.25, 0.75, 0.08719, 0, 0.28889],
    94: [0, 0.69444, 0.0799, 0, 0.5],
    95: [0.35, 0.09444, 0.08616, 0, 0.5],
    97: [0, 0.44444, 981e-5, 0, 0.48056],
    98: [0, 0.69444, 0.03057, 0, 0.51667],
    99: [0, 0.44444, 0.08336, 0, 0.44445],
    100: [0, 0.69444, 0.09483, 0, 0.51667],
    101: [0, 0.44444, 0.06778, 0, 0.44445],
    102: [0, 0.69444, 0.21705, 0, 0.30556],
    103: [0.19444, 0.44444, 0.10836, 0, 0.5],
    104: [0, 0.69444, 0.01778, 0, 0.51667],
    105: [0, 0.67937, 0.09718, 0, 0.23889],
    106: [0.19444, 0.67937, 0.09162, 0, 0.26667],
    107: [0, 0.69444, 0.08336, 0, 0.48889],
    108: [0, 0.69444, 0.09483, 0, 0.23889],
    109: [0, 0.44444, 0.01778, 0, 0.79445],
    110: [0, 0.44444, 0.01778, 0, 0.51667],
    111: [0, 0.44444, 0.06613, 0, 0.5],
    112: [0.19444, 0.44444, 0.0389, 0, 0.51667],
    113: [0.19444, 0.44444, 0.04169, 0, 0.51667],
    114: [0, 0.44444, 0.10836, 0, 0.34167],
    115: [0, 0.44444, 0.0778, 0, 0.38333],
    116: [0, 0.57143, 0.07225, 0, 0.36111],
    117: [0, 0.44444, 0.04169, 0, 0.51667],
    118: [0, 0.44444, 0.10836, 0, 0.46111],
    119: [0, 0.44444, 0.10836, 0, 0.68334],
    120: [0, 0.44444, 0.09169, 0, 0.46111],
    121: [0.19444, 0.44444, 0.10836, 0, 0.46111],
    122: [0, 0.44444, 0.08752, 0, 0.43472],
    126: [0.35, 0.32659, 0.08826, 0, 0.5],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.67937, 0.06385, 0, 0.5],
    176: [0, 0.69444, 0, 0, 0.73752],
    184: [0.17014, 0, 0, 0, 0.44445],
    305: [0, 0.44444, 0.04169, 0, 0.23889],
    567: [0.19444, 0.44444, 0.04169, 0, 0.26667],
    710: [0, 0.69444, 0.0799, 0, 0.5],
    711: [0, 0.63194, 0.08432, 0, 0.5],
    713: [0, 0.60889, 0.08776, 0, 0.5],
    714: [0, 0.69444, 0.09205, 0, 0.5],
    715: [0, 0.69444, 0, 0, 0.5],
    728: [0, 0.69444, 0.09483, 0, 0.5],
    729: [0, 0.67937, 0.07774, 0, 0.27778],
    730: [0, 0.69444, 0, 0, 0.73752],
    732: [0, 0.67659, 0.08826, 0, 0.5],
    733: [0, 0.69444, 0.09205, 0, 0.5],
    915: [0, 0.69444, 0.13372, 0, 0.54167],
    916: [0, 0.69444, 0, 0, 0.83334],
    920: [0, 0.69444, 0.07555, 0, 0.77778],
    923: [0, 0.69444, 0, 0, 0.61111],
    926: [0, 0.69444, 0.12816, 0, 0.66667],
    928: [0, 0.69444, 0.08094, 0, 0.70834],
    931: [0, 0.69444, 0.11983, 0, 0.72222],
    933: [0, 0.69444, 0.09031, 0, 0.77778],
    934: [0, 0.69444, 0.04603, 0, 0.72222],
    936: [0, 0.69444, 0.09031, 0, 0.77778],
    937: [0, 0.69444, 0.08293, 0, 0.72222],
    8211: [0, 0.44444, 0.08616, 0, 0.5],
    8212: [0, 0.44444, 0.08616, 0, 1],
    8216: [0, 0.69444, 0.07816, 0, 0.27778],
    8217: [0, 0.69444, 0.07816, 0, 0.27778],
    8220: [0, 0.69444, 0.14205, 0, 0.5],
    8221: [0, 0.69444, 316e-5, 0, 0.5]
  },
  "SansSerif-Regular": {
    32: [0, 0, 0, 0, 0.25],
    33: [0, 0.69444, 0, 0, 0.31945],
    34: [0, 0.69444, 0, 0, 0.5],
    35: [0.19444, 0.69444, 0, 0, 0.83334],
    36: [0.05556, 0.75, 0, 0, 0.5],
    37: [0.05556, 0.75, 0, 0, 0.83334],
    38: [0, 0.69444, 0, 0, 0.75834],
    39: [0, 0.69444, 0, 0, 0.27778],
    40: [0.25, 0.75, 0, 0, 0.38889],
    41: [0.25, 0.75, 0, 0, 0.38889],
    42: [0, 0.75, 0, 0, 0.5],
    43: [0.08333, 0.58333, 0, 0, 0.77778],
    44: [0.125, 0.08333, 0, 0, 0.27778],
    45: [0, 0.44444, 0, 0, 0.33333],
    46: [0, 0.08333, 0, 0, 0.27778],
    47: [0.25, 0.75, 0, 0, 0.5],
    48: [0, 0.65556, 0, 0, 0.5],
    49: [0, 0.65556, 0, 0, 0.5],
    50: [0, 0.65556, 0, 0, 0.5],
    51: [0, 0.65556, 0, 0, 0.5],
    52: [0, 0.65556, 0, 0, 0.5],
    53: [0, 0.65556, 0, 0, 0.5],
    54: [0, 0.65556, 0, 0, 0.5],
    55: [0, 0.65556, 0, 0, 0.5],
    56: [0, 0.65556, 0, 0, 0.5],
    57: [0, 0.65556, 0, 0, 0.5],
    58: [0, 0.44444, 0, 0, 0.27778],
    59: [0.125, 0.44444, 0, 0, 0.27778],
    61: [-0.13, 0.37, 0, 0, 0.77778],
    63: [0, 0.69444, 0, 0, 0.47222],
    64: [0, 0.69444, 0, 0, 0.66667],
    65: [0, 0.69444, 0, 0, 0.66667],
    66: [0, 0.69444, 0, 0, 0.66667],
    67: [0, 0.69444, 0, 0, 0.63889],
    68: [0, 0.69444, 0, 0, 0.72223],
    69: [0, 0.69444, 0, 0, 0.59722],
    70: [0, 0.69444, 0, 0, 0.56945],
    71: [0, 0.69444, 0, 0, 0.66667],
    72: [0, 0.69444, 0, 0, 0.70834],
    73: [0, 0.69444, 0, 0, 0.27778],
    74: [0, 0.69444, 0, 0, 0.47222],
    75: [0, 0.69444, 0, 0, 0.69445],
    76: [0, 0.69444, 0, 0, 0.54167],
    77: [0, 0.69444, 0, 0, 0.875],
    78: [0, 0.69444, 0, 0, 0.70834],
    79: [0, 0.69444, 0, 0, 0.73611],
    80: [0, 0.69444, 0, 0, 0.63889],
    81: [0.125, 0.69444, 0, 0, 0.73611],
    82: [0, 0.69444, 0, 0, 0.64584],
    83: [0, 0.69444, 0, 0, 0.55556],
    84: [0, 0.69444, 0, 0, 0.68056],
    85: [0, 0.69444, 0, 0, 0.6875],
    86: [0, 0.69444, 0.01389, 0, 0.66667],
    87: [0, 0.69444, 0.01389, 0, 0.94445],
    88: [0, 0.69444, 0, 0, 0.66667],
    89: [0, 0.69444, 0.025, 0, 0.66667],
    90: [0, 0.69444, 0, 0, 0.61111],
    91: [0.25, 0.75, 0, 0, 0.28889],
    93: [0.25, 0.75, 0, 0, 0.28889],
    94: [0, 0.69444, 0, 0, 0.5],
    95: [0.35, 0.09444, 0.02778, 0, 0.5],
    97: [0, 0.44444, 0, 0, 0.48056],
    98: [0, 0.69444, 0, 0, 0.51667],
    99: [0, 0.44444, 0, 0, 0.44445],
    100: [0, 0.69444, 0, 0, 0.51667],
    101: [0, 0.44444, 0, 0, 0.44445],
    102: [0, 0.69444, 0.06944, 0, 0.30556],
    103: [0.19444, 0.44444, 0.01389, 0, 0.5],
    104: [0, 0.69444, 0, 0, 0.51667],
    105: [0, 0.67937, 0, 0, 0.23889],
    106: [0.19444, 0.67937, 0, 0, 0.26667],
    107: [0, 0.69444, 0, 0, 0.48889],
    108: [0, 0.69444, 0, 0, 0.23889],
    109: [0, 0.44444, 0, 0, 0.79445],
    110: [0, 0.44444, 0, 0, 0.51667],
    111: [0, 0.44444, 0, 0, 0.5],
    112: [0.19444, 0.44444, 0, 0, 0.51667],
    113: [0.19444, 0.44444, 0, 0, 0.51667],
    114: [0, 0.44444, 0.01389, 0, 0.34167],
    115: [0, 0.44444, 0, 0, 0.38333],
    116: [0, 0.57143, 0, 0, 0.36111],
    117: [0, 0.44444, 0, 0, 0.51667],
    118: [0, 0.44444, 0.01389, 0, 0.46111],
    119: [0, 0.44444, 0.01389, 0, 0.68334],
    120: [0, 0.44444, 0, 0, 0.46111],
    121: [0.19444, 0.44444, 0.01389, 0, 0.46111],
    122: [0, 0.44444, 0, 0, 0.43472],
    126: [0.35, 0.32659, 0, 0, 0.5],
    160: [0, 0, 0, 0, 0.25],
    168: [0, 0.67937, 0, 0, 0.5],
    176: [0, 0.69444, 0, 0, 0.66667],
    184: [0.17014, 0, 0, 0, 0.44445],
    305: [0, 0.44444, 0, 0, 0.23889],
    567: [0.19444, 0.44444, 0, 0, 0.26667],
    710: [0, 0.69444, 0, 0, 0.5],
    711: [0, 0.63194, 0, 0, 0.5],
    713: [0, 0.60889, 0, 0, 0.5],
    714: [0, 0.69444, 0, 0, 0.5],
    715: [0, 0.69444, 0, 0, 0.5],
    728: [0, 0.69444, 0, 0, 0.5],
    729: [0, 0.67937, 0, 0, 0.27778],
    730: [0, 0.69444, 0, 0, 0.66667],
    732: [0, 0.67659, 0, 0, 0.5],
    733: [0, 0.69444, 0, 0, 0.5],
    915: [0, 0.69444, 0, 0, 0.54167],
    916: [0, 0.69444, 0, 0, 0.83334],
    920: [0, 0.69444, 0, 0, 0.77778],
    923: [0, 0.69444, 0, 0, 0.61111],
    926: [0, 0.69444, 0, 0, 0.66667],
    928: [0, 0.69444, 0, 0, 0.70834],
    931: [0, 0.69444, 0, 0, 0.72222],
    933: [0, 0.69444, 0, 0, 0.77778],
    934: [0, 0.69444, 0, 0, 0.72222],
    936: [0, 0.69444, 0, 0, 0.77778],
    937: [0, 0.69444, 0, 0, 0.72222],
    8211: [0, 0.44444, 0.02778, 0, 0.5],
    8212: [0, 0.44444, 0.02778, 0, 1],
    8216: [0, 0.69444, 0, 0, 0.27778],
    8217: [0, 0.69444, 0, 0, 0.27778],
    8220: [0, 0.69444, 0, 0, 0.5],
    8221: [0, 0.69444, 0, 0, 0.5]
  },
  "Script-Regular": {
    32: [0, 0, 0, 0, 0.25],
    65: [0, 0.7, 0.22925, 0, 0.80253],
    66: [0, 0.7, 0.04087, 0, 0.90757],
    67: [0, 0.7, 0.1689, 0, 0.66619],
    68: [0, 0.7, 0.09371, 0, 0.77443],
    69: [0, 0.7, 0.18583, 0, 0.56162],
    70: [0, 0.7, 0.13634, 0, 0.89544],
    71: [0, 0.7, 0.17322, 0, 0.60961],
    72: [0, 0.7, 0.29694, 0, 0.96919],
    73: [0, 0.7, 0.19189, 0, 0.80907],
    74: [0.27778, 0.7, 0.19189, 0, 1.05159],
    75: [0, 0.7, 0.31259, 0, 0.91364],
    76: [0, 0.7, 0.19189, 0, 0.87373],
    77: [0, 0.7, 0.15981, 0, 1.08031],
    78: [0, 0.7, 0.3525, 0, 0.9015],
    79: [0, 0.7, 0.08078, 0, 0.73787],
    80: [0, 0.7, 0.08078, 0, 1.01262],
    81: [0, 0.7, 0.03305, 0, 0.88282],
    82: [0, 0.7, 0.06259, 0, 0.85],
    83: [0, 0.7, 0.19189, 0, 0.86767],
    84: [0, 0.7, 0.29087, 0, 0.74697],
    85: [0, 0.7, 0.25815, 0, 0.79996],
    86: [0, 0.7, 0.27523, 0, 0.62204],
    87: [0, 0.7, 0.27523, 0, 0.80532],
    88: [0, 0.7, 0.26006, 0, 0.94445],
    89: [0, 0.7, 0.2939, 0, 0.70961],
    90: [0, 0.7, 0.24037, 0, 0.8212],
    160: [0, 0, 0, 0, 0.25]
  },
  "Size1-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [0.35001, 0.85, 0, 0, 0.45834],
    41: [0.35001, 0.85, 0, 0, 0.45834],
    47: [0.35001, 0.85, 0, 0, 0.57778],
    91: [0.35001, 0.85, 0, 0, 0.41667],
    92: [0.35001, 0.85, 0, 0, 0.57778],
    93: [0.35001, 0.85, 0, 0, 0.41667],
    123: [0.35001, 0.85, 0, 0, 0.58334],
    125: [0.35001, 0.85, 0, 0, 0.58334],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.72222, 0, 0, 0.55556],
    732: [0, 0.72222, 0, 0, 0.55556],
    770: [0, 0.72222, 0, 0, 0.55556],
    771: [0, 0.72222, 0, 0, 0.55556],
    8214: [-99e-5, 0.601, 0, 0, 0.77778],
    8593: [1e-5, 0.6, 0, 0, 0.66667],
    8595: [1e-5, 0.6, 0, 0, 0.66667],
    8657: [1e-5, 0.6, 0, 0, 0.77778],
    8659: [1e-5, 0.6, 0, 0, 0.77778],
    8719: [0.25001, 0.75, 0, 0, 0.94445],
    8720: [0.25001, 0.75, 0, 0, 0.94445],
    8721: [0.25001, 0.75, 0, 0, 1.05556],
    8730: [0.35001, 0.85, 0, 0, 1],
    8739: [-599e-5, 0.606, 0, 0, 0.33333],
    8741: [-599e-5, 0.606, 0, 0, 0.55556],
    8747: [0.30612, 0.805, 0.19445, 0, 0.47222],
    8748: [0.306, 0.805, 0.19445, 0, 0.47222],
    8749: [0.306, 0.805, 0.19445, 0, 0.47222],
    8750: [0.30612, 0.805, 0.19445, 0, 0.47222],
    8896: [0.25001, 0.75, 0, 0, 0.83334],
    8897: [0.25001, 0.75, 0, 0, 0.83334],
    8898: [0.25001, 0.75, 0, 0, 0.83334],
    8899: [0.25001, 0.75, 0, 0, 0.83334],
    8968: [0.35001, 0.85, 0, 0, 0.47222],
    8969: [0.35001, 0.85, 0, 0, 0.47222],
    8970: [0.35001, 0.85, 0, 0, 0.47222],
    8971: [0.35001, 0.85, 0, 0, 0.47222],
    9168: [-99e-5, 0.601, 0, 0, 0.66667],
    10216: [0.35001, 0.85, 0, 0, 0.47222],
    10217: [0.35001, 0.85, 0, 0, 0.47222],
    10752: [0.25001, 0.75, 0, 0, 1.11111],
    10753: [0.25001, 0.75, 0, 0, 1.11111],
    10754: [0.25001, 0.75, 0, 0, 1.11111],
    10756: [0.25001, 0.75, 0, 0, 0.83334],
    10758: [0.25001, 0.75, 0, 0, 0.83334]
  },
  "Size2-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [0.65002, 1.15, 0, 0, 0.59722],
    41: [0.65002, 1.15, 0, 0, 0.59722],
    47: [0.65002, 1.15, 0, 0, 0.81111],
    91: [0.65002, 1.15, 0, 0, 0.47222],
    92: [0.65002, 1.15, 0, 0, 0.81111],
    93: [0.65002, 1.15, 0, 0, 0.47222],
    123: [0.65002, 1.15, 0, 0, 0.66667],
    125: [0.65002, 1.15, 0, 0, 0.66667],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.75, 0, 0, 1],
    732: [0, 0.75, 0, 0, 1],
    770: [0, 0.75, 0, 0, 1],
    771: [0, 0.75, 0, 0, 1],
    8719: [0.55001, 1.05, 0, 0, 1.27778],
    8720: [0.55001, 1.05, 0, 0, 1.27778],
    8721: [0.55001, 1.05, 0, 0, 1.44445],
    8730: [0.65002, 1.15, 0, 0, 1],
    8747: [0.86225, 1.36, 0.44445, 0, 0.55556],
    8748: [0.862, 1.36, 0.44445, 0, 0.55556],
    8749: [0.862, 1.36, 0.44445, 0, 0.55556],
    8750: [0.86225, 1.36, 0.44445, 0, 0.55556],
    8896: [0.55001, 1.05, 0, 0, 1.11111],
    8897: [0.55001, 1.05, 0, 0, 1.11111],
    8898: [0.55001, 1.05, 0, 0, 1.11111],
    8899: [0.55001, 1.05, 0, 0, 1.11111],
    8968: [0.65002, 1.15, 0, 0, 0.52778],
    8969: [0.65002, 1.15, 0, 0, 0.52778],
    8970: [0.65002, 1.15, 0, 0, 0.52778],
    8971: [0.65002, 1.15, 0, 0, 0.52778],
    10216: [0.65002, 1.15, 0, 0, 0.61111],
    10217: [0.65002, 1.15, 0, 0, 0.61111],
    10752: [0.55001, 1.05, 0, 0, 1.51112],
    10753: [0.55001, 1.05, 0, 0, 1.51112],
    10754: [0.55001, 1.05, 0, 0, 1.51112],
    10756: [0.55001, 1.05, 0, 0, 1.11111],
    10758: [0.55001, 1.05, 0, 0, 1.11111]
  },
  "Size3-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [0.95003, 1.45, 0, 0, 0.73611],
    41: [0.95003, 1.45, 0, 0, 0.73611],
    47: [0.95003, 1.45, 0, 0, 1.04445],
    91: [0.95003, 1.45, 0, 0, 0.52778],
    92: [0.95003, 1.45, 0, 0, 1.04445],
    93: [0.95003, 1.45, 0, 0, 0.52778],
    123: [0.95003, 1.45, 0, 0, 0.75],
    125: [0.95003, 1.45, 0, 0, 0.75],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.75, 0, 0, 1.44445],
    732: [0, 0.75, 0, 0, 1.44445],
    770: [0, 0.75, 0, 0, 1.44445],
    771: [0, 0.75, 0, 0, 1.44445],
    8730: [0.95003, 1.45, 0, 0, 1],
    8968: [0.95003, 1.45, 0, 0, 0.58334],
    8969: [0.95003, 1.45, 0, 0, 0.58334],
    8970: [0.95003, 1.45, 0, 0, 0.58334],
    8971: [0.95003, 1.45, 0, 0, 0.58334],
    10216: [0.95003, 1.45, 0, 0, 0.75],
    10217: [0.95003, 1.45, 0, 0, 0.75]
  },
  "Size4-Regular": {
    32: [0, 0, 0, 0, 0.25],
    40: [1.25003, 1.75, 0, 0, 0.79167],
    41: [1.25003, 1.75, 0, 0, 0.79167],
    47: [1.25003, 1.75, 0, 0, 1.27778],
    91: [1.25003, 1.75, 0, 0, 0.58334],
    92: [1.25003, 1.75, 0, 0, 1.27778],
    93: [1.25003, 1.75, 0, 0, 0.58334],
    123: [1.25003, 1.75, 0, 0, 0.80556],
    125: [1.25003, 1.75, 0, 0, 0.80556],
    160: [0, 0, 0, 0, 0.25],
    710: [0, 0.825, 0, 0, 1.8889],
    732: [0, 0.825, 0, 0, 1.8889],
    770: [0, 0.825, 0, 0, 1.8889],
    771: [0, 0.825, 0, 0, 1.8889],
    8730: [1.25003, 1.75, 0, 0, 1],
    8968: [1.25003, 1.75, 0, 0, 0.63889],
    8969: [1.25003, 1.75, 0, 0, 0.63889],
    8970: [1.25003, 1.75, 0, 0, 0.63889],
    8971: [1.25003, 1.75, 0, 0, 0.63889],
    9115: [0.64502, 1.155, 0, 0, 0.875],
    9116: [1e-5, 0.6, 0, 0, 0.875],
    9117: [0.64502, 1.155, 0, 0, 0.875],
    9118: [0.64502, 1.155, 0, 0, 0.875],
    9119: [1e-5, 0.6, 0, 0, 0.875],
    9120: [0.64502, 1.155, 0, 0, 0.875],
    9121: [0.64502, 1.155, 0, 0, 0.66667],
    9122: [-99e-5, 0.601, 0, 0, 0.66667],
    9123: [0.64502, 1.155, 0, 0, 0.66667],
    9124: [0.64502, 1.155, 0, 0, 0.66667],
    9125: [-99e-5, 0.601, 0, 0, 0.66667],
    9126: [0.64502, 1.155, 0, 0, 0.66667],
    9127: [1e-5, 0.9, 0, 0, 0.88889],
    9128: [0.65002, 1.15, 0, 0, 0.88889],
    9129: [0.90001, 0, 0, 0, 0.88889],
    9130: [0, 0.3, 0, 0, 0.88889],
    9131: [1e-5, 0.9, 0, 0, 0.88889],
    9132: [0.65002, 1.15, 0, 0, 0.88889],
    9133: [0.90001, 0, 0, 0, 0.88889],
    9143: [0.88502, 0.915, 0, 0, 1.05556],
    10216: [1.25003, 1.75, 0, 0, 0.80556],
    10217: [1.25003, 1.75, 0, 0, 0.80556],
    57344: [-499e-5, 0.605, 0, 0, 1.05556],
    57345: [-499e-5, 0.605, 0, 0, 1.05556],
    57680: [0, 0.12, 0, 0, 0.45],
    57681: [0, 0.12, 0, 0, 0.45],
    57682: [0, 0.12, 0, 0, 0.45],
    57683: [0, 0.12, 0, 0, 0.45]
  },
  "Typewriter-Regular": {
    32: [0, 0, 0, 0, 0.525],
    33: [0, 0.61111, 0, 0, 0.525],
    34: [0, 0.61111, 0, 0, 0.525],
    35: [0, 0.61111, 0, 0, 0.525],
    36: [0.08333, 0.69444, 0, 0, 0.525],
    37: [0.08333, 0.69444, 0, 0, 0.525],
    38: [0, 0.61111, 0, 0, 0.525],
    39: [0, 0.61111, 0, 0, 0.525],
    40: [0.08333, 0.69444, 0, 0, 0.525],
    41: [0.08333, 0.69444, 0, 0, 0.525],
    42: [0, 0.52083, 0, 0, 0.525],
    43: [-0.08056, 0.53055, 0, 0, 0.525],
    44: [0.13889, 0.125, 0, 0, 0.525],
    45: [-0.08056, 0.53055, 0, 0, 0.525],
    46: [0, 0.125, 0, 0, 0.525],
    47: [0.08333, 0.69444, 0, 0, 0.525],
    48: [0, 0.61111, 0, 0, 0.525],
    49: [0, 0.61111, 0, 0, 0.525],
    50: [0, 0.61111, 0, 0, 0.525],
    51: [0, 0.61111, 0, 0, 0.525],
    52: [0, 0.61111, 0, 0, 0.525],
    53: [0, 0.61111, 0, 0, 0.525],
    54: [0, 0.61111, 0, 0, 0.525],
    55: [0, 0.61111, 0, 0, 0.525],
    56: [0, 0.61111, 0, 0, 0.525],
    57: [0, 0.61111, 0, 0, 0.525],
    58: [0, 0.43056, 0, 0, 0.525],
    59: [0.13889, 0.43056, 0, 0, 0.525],
    60: [-0.05556, 0.55556, 0, 0, 0.525],
    61: [-0.19549, 0.41562, 0, 0, 0.525],
    62: [-0.05556, 0.55556, 0, 0, 0.525],
    63: [0, 0.61111, 0, 0, 0.525],
    64: [0, 0.61111, 0, 0, 0.525],
    65: [0, 0.61111, 0, 0, 0.525],
    66: [0, 0.61111, 0, 0, 0.525],
    67: [0, 0.61111, 0, 0, 0.525],
    68: [0, 0.61111, 0, 0, 0.525],
    69: [0, 0.61111, 0, 0, 0.525],
    70: [0, 0.61111, 0, 0, 0.525],
    71: [0, 0.61111, 0, 0, 0.525],
    72: [0, 0.61111, 0, 0, 0.525],
    73: [0, 0.61111, 0, 0, 0.525],
    74: [0, 0.61111, 0, 0, 0.525],
    75: [0, 0.61111, 0, 0, 0.525],
    76: [0, 0.61111, 0, 0, 0.525],
    77: [0, 0.61111, 0, 0, 0.525],
    78: [0, 0.61111, 0, 0, 0.525],
    79: [0, 0.61111, 0, 0, 0.525],
    80: [0, 0.61111, 0, 0, 0.525],
    81: [0.13889, 0.61111, 0, 0, 0.525],
    82: [0, 0.61111, 0, 0, 0.525],
    83: [0, 0.61111, 0, 0, 0.525],
    84: [0, 0.61111, 0, 0, 0.525],
    85: [0, 0.61111, 0, 0, 0.525],
    86: [0, 0.61111, 0, 0, 0.525],
    87: [0, 0.61111, 0, 0, 0.525],
    88: [0, 0.61111, 0, 0, 0.525],
    89: [0, 0.61111, 0, 0, 0.525],
    90: [0, 0.61111, 0, 0, 0.525],
    91: [0.08333, 0.69444, 0, 0, 0.525],
    92: [0.08333, 0.69444, 0, 0, 0.525],
    93: [0.08333, 0.69444, 0, 0, 0.525],
    94: [0, 0.61111, 0, 0, 0.525],
    95: [0.09514, 0, 0, 0, 0.525],
    96: [0, 0.61111, 0, 0, 0.525],
    97: [0, 0.43056, 0, 0, 0.525],
    98: [0, 0.61111, 0, 0, 0.525],
    99: [0, 0.43056, 0, 0, 0.525],
    100: [0, 0.61111, 0, 0, 0.525],
    101: [0, 0.43056, 0, 0, 0.525],
    102: [0, 0.61111, 0, 0, 0.525],
    103: [0.22222, 0.43056, 0, 0, 0.525],
    104: [0, 0.61111, 0, 0, 0.525],
    105: [0, 0.61111, 0, 0, 0.525],
    106: [0.22222, 0.61111, 0, 0, 0.525],
    107: [0, 0.61111, 0, 0, 0.525],
    108: [0, 0.61111, 0, 0, 0.525],
    109: [0, 0.43056, 0, 0, 0.525],
    110: [0, 0.43056, 0, 0, 0.525],
    111: [0, 0.43056, 0, 0, 0.525],
    112: [0.22222, 0.43056, 0, 0, 0.525],
    113: [0.22222, 0.43056, 0, 0, 0.525],
    114: [0, 0.43056, 0, 0, 0.525],
    115: [0, 0.43056, 0, 0, 0.525],
    116: [0, 0.55358, 0, 0, 0.525],
    117: [0, 0.43056, 0, 0, 0.525],
    118: [0, 0.43056, 0, 0, 0.525],
    119: [0, 0.43056, 0, 0, 0.525],
    120: [0, 0.43056, 0, 0, 0.525],
    121: [0.22222, 0.43056, 0, 0, 0.525],
    122: [0, 0.43056, 0, 0, 0.525],
    123: [0.08333, 0.69444, 0, 0, 0.525],
    124: [0.08333, 0.69444, 0, 0, 0.525],
    125: [0.08333, 0.69444, 0, 0, 0.525],
    126: [0, 0.61111, 0, 0, 0.525],
    127: [0, 0.61111, 0, 0, 0.525],
    160: [0, 0, 0, 0, 0.525],
    176: [0, 0.61111, 0, 0, 0.525],
    184: [0.19445, 0, 0, 0, 0.525],
    305: [0, 0.43056, 0, 0, 0.525],
    567: [0.22222, 0.43056, 0, 0, 0.525],
    711: [0, 0.56597, 0, 0, 0.525],
    713: [0, 0.56555, 0, 0, 0.525],
    714: [0, 0.61111, 0, 0, 0.525],
    715: [0, 0.61111, 0, 0, 0.525],
    728: [0, 0.61111, 0, 0, 0.525],
    730: [0, 0.61111, 0, 0, 0.525],
    770: [0, 0.61111, 0, 0, 0.525],
    771: [0, 0.61111, 0, 0, 0.525],
    776: [0, 0.61111, 0, 0, 0.525],
    915: [0, 0.61111, 0, 0, 0.525],
    916: [0, 0.61111, 0, 0, 0.525],
    920: [0, 0.61111, 0, 0, 0.525],
    923: [0, 0.61111, 0, 0, 0.525],
    926: [0, 0.61111, 0, 0, 0.525],
    928: [0, 0.61111, 0, 0, 0.525],
    931: [0, 0.61111, 0, 0, 0.525],
    933: [0, 0.61111, 0, 0, 0.525],
    934: [0, 0.61111, 0, 0, 0.525],
    936: [0, 0.61111, 0, 0, 0.525],
    937: [0, 0.61111, 0, 0, 0.525],
    8216: [0, 0.61111, 0, 0, 0.525],
    8217: [0, 0.61111, 0, 0, 0.525],
    8242: [0, 0.61111, 0, 0, 0.525],
    9251: [0.11111, 0.21944, 0, 0, 0.525]
  }
}, $1 = {
  slant: [0.25, 0.25, 0.25],
  // sigma1
  space: [0, 0, 0],
  // sigma2
  stretch: [0, 0, 0],
  // sigma3
  shrink: [0, 0, 0],
  // sigma4
  xHeight: [0.431, 0.431, 0.431],
  // sigma5
  quad: [1, 1.171, 1.472],
  // sigma6
  extraSpace: [0, 0, 0],
  // sigma7
  num1: [0.677, 0.732, 0.925],
  // sigma8
  num2: [0.394, 0.384, 0.387],
  // sigma9
  num3: [0.444, 0.471, 0.504],
  // sigma10
  denom1: [0.686, 0.752, 1.025],
  // sigma11
  denom2: [0.345, 0.344, 0.532],
  // sigma12
  sup1: [0.413, 0.503, 0.504],
  // sigma13
  sup2: [0.363, 0.431, 0.404],
  // sigma14
  sup3: [0.289, 0.286, 0.294],
  // sigma15
  sub1: [0.15, 0.143, 0.2],
  // sigma16
  sub2: [0.247, 0.286, 0.4],
  // sigma17
  supDrop: [0.386, 0.353, 0.494],
  // sigma18
  subDrop: [0.05, 0.071, 0.1],
  // sigma19
  delim1: [2.39, 1.7, 1.98],
  // sigma20
  delim2: [1.01, 1.157, 1.42],
  // sigma21
  axisHeight: [0.25, 0.25, 0.25],
  // sigma22
  // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
  // they correspond to the font parameters of the extension fonts (family 3).
  // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
  // match cmex7, we'd use cmex7.tfm values for script and scriptscript
  // values.
  defaultRuleThickness: [0.04, 0.049, 0.049],
  // xi8; cmex7: 0.049
  bigOpSpacing1: [0.111, 0.111, 0.111],
  // xi9
  bigOpSpacing2: [0.166, 0.166, 0.166],
  // xi10
  bigOpSpacing3: [0.2, 0.2, 0.2],
  // xi11
  bigOpSpacing4: [0.6, 0.611, 0.611],
  // xi12; cmex7: 0.611
  bigOpSpacing5: [0.1, 0.143, 0.143],
  // xi13; cmex7: 0.143
  // The \sqrt rule width is taken from the height of the surd character.
  // Since we use the same font at all sizes, this thickness doesn't scale.
  sqrtRuleThickness: [0.04, 0.04, 0.04],
  // This value determines how large a pt is, for metrics which are defined
  // in terms of pts.
  // This value is also used in katex.scss; if you change it make sure the
  // values match.
  ptPerEm: [10, 10, 10],
  // The space between adjacent `|` columns in an array definition. From
  // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
  doubleRuleSep: [0.2, 0.2, 0.2],
  // The width of separator lines in {array} environments. From
  // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
  arrayRuleWidth: [0.04, 0.04, 0.04],
  // Two values from LaTeX source2e:
  fboxsep: [0.3, 0.3, 0.3],
  //        3 pt / ptPerEm
  fboxrule: [0.04, 0.04, 0.04]
  // 0.4 pt / ptPerEm
}, S8 = {
  // Latin-1
  Å: "A",
  Ð: "D",
  Þ: "o",
  å: "a",
  ð: "d",
  þ: "o",
  // Cyrillic
  А: "A",
  Б: "B",
  В: "B",
  Г: "F",
  Д: "A",
  Е: "E",
  Ж: "K",
  З: "3",
  И: "N",
  Й: "N",
  К: "K",
  Л: "N",
  М: "M",
  Н: "H",
  О: "O",
  П: "N",
  Р: "P",
  С: "C",
  Т: "T",
  У: "y",
  Ф: "O",
  Х: "X",
  Ц: "U",
  Ч: "h",
  Ш: "W",
  Щ: "W",
  Ъ: "B",
  Ы: "X",
  Ь: "B",
  Э: "3",
  Ю: "X",
  Я: "R",
  а: "a",
  б: "b",
  в: "a",
  г: "r",
  д: "y",
  е: "e",
  ж: "m",
  з: "e",
  и: "n",
  й: "n",
  к: "n",
  л: "n",
  м: "m",
  н: "n",
  о: "o",
  п: "n",
  р: "p",
  с: "c",
  т: "o",
  у: "y",
  ф: "b",
  х: "x",
  ц: "n",
  ч: "n",
  ш: "w",
  щ: "w",
  ъ: "a",
  ы: "m",
  ь: "a",
  э: "e",
  ю: "m",
  я: "r"
};
function d$(t, e) {
  Gs[t] = e;
}
function sk(t, e, r) {
  if (!Gs[e])
    throw new Error("Font metrics not found for font: " + e + ".");
  var n = t.charCodeAt(0), i = Gs[e][n];
  if (!i && t[0] in S8 && (n = S8[t[0]].charCodeAt(0), i = Gs[e][n]), !i && r === "text" && h$(n) && (i = Gs[e][77]), i)
    return {
      depth: i[0],
      height: i[1],
      italic: i[2],
      skew: i[3],
      width: i[4]
    };
}
var i4 = {};
function Rhe(t) {
  var e;
  if (t >= 5 ? e = 0 : t >= 3 ? e = 1 : e = 2, !i4[e]) {
    var r = i4[e] = {
      cssEmPerMu: $1.quad[e] / 18
    };
    for (var n in $1)
      $1.hasOwnProperty(n) && (r[n] = $1[n][e]);
  }
  return i4[e];
}
var Nhe = [
  // Each element contains [textsize, scriptsize, scriptscriptsize].
  // The size mappings are taken from TeX with \normalsize=10pt.
  [1, 1, 1],
  // size1: [5, 5, 5]              \tiny
  [2, 1, 1],
  // size2: [6, 5, 5]
  [3, 1, 1],
  // size3: [7, 5, 5]              \scriptsize
  [4, 2, 1],
  // size4: [8, 6, 5]              \footnotesize
  [5, 2, 1],
  // size5: [9, 6, 5]              \small
  [6, 3, 1],
  // size6: [10, 7, 5]             \normalsize
  [7, 4, 2],
  // size7: [12, 8, 6]             \large
  [8, 6, 3],
  // size8: [14.4, 10, 7]          \Large
  [9, 7, 6],
  // size9: [17.28, 12, 10]        \LARGE
  [10, 8, 7],
  // size10: [20.74, 14.4, 12]     \huge
  [11, 10, 9]
  // size11: [24.88, 20.74, 17.28] \HUGE
], C8 = [
  // fontMetrics.js:getGlobalMetrics also uses size indexes, so if
  // you change size indexes, change that function.
  0.5,
  0.6,
  0.7,
  0.8,
  0.9,
  1,
  1.2,
  1.44,
  1.728,
  2.074,
  2.488
], A8 = function(e, r) {
  return r.size < 2 ? e : Nhe[e - 1][r.size - 1];
};
class Co {
  // A font family applies to a group of fonts (i.e. SansSerif), while a font
  // represents a specific font (i.e. SansSerif Bold).
  // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
  /**
   * The base size index.
   */
  constructor(e) {
    this.style = void 0, this.color = void 0, this.size = void 0, this.textSize = void 0, this.phantom = void 0, this.font = void 0, this.fontFamily = void 0, this.fontWeight = void 0, this.fontShape = void 0, this.sizeMultiplier = void 0, this.maxSize = void 0, this.minRuleThickness = void 0, this._fontMetrics = void 0, this.style = e.style, this.color = e.color, this.size = e.size || Co.BASESIZE, this.textSize = e.textSize || this.size, this.phantom = !!e.phantom, this.font = e.font || "", this.fontFamily = e.fontFamily || "", this.fontWeight = e.fontWeight || "", this.fontShape = e.fontShape || "", this.sizeMultiplier = C8[this.size - 1], this.maxSize = e.maxSize, this.minRuleThickness = e.minRuleThickness, this._fontMetrics = void 0;
  }
  /**
   * Returns a new options object with the same properties as "this".  Properties
   * from "extension" will be copied to the new options object.
   */
  extend(e) {
    var r = {
      style: this.style,
      size: this.size,
      textSize: this.textSize,
      color: this.color,
      phantom: this.phantom,
      font: this.font,
      fontFamily: this.fontFamily,
      fontWeight: this.fontWeight,
      fontShape: this.fontShape,
      maxSize: this.maxSize,
      minRuleThickness: this.minRuleThickness
    };
    for (var n in e)
      e.hasOwnProperty(n) && (r[n] = e[n]);
    return new Co(r);
  }
  /**
   * Return an options object with the given style. If `this.style === style`,
   * returns `this`.
   */
  havingStyle(e) {
    return this.style === e ? this : this.extend({
      style: e,
      size: A8(this.textSize, e)
    });
  }
  /**
   * Return an options object with a cramped version of the current style. If
   * the current style is cramped, returns `this`.
   */
  havingCrampedStyle() {
    return this.havingStyle(this.style.cramp());
  }
  /**
   * Return an options object with the given size and in at least `\textstyle`.
   * Returns `this` if appropriate.
   */
  havingSize(e) {
    return this.size === e && this.textSize === e ? this : this.extend({
      style: this.style.text(),
      size: e,
      textSize: e,
      sizeMultiplier: C8[e - 1]
    });
  }
  /**
   * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
   * changes to at least `\textstyle`.
   */
  havingBaseStyle(e) {
    e = e || this.style.text();
    var r = A8(Co.BASESIZE, e);
    return this.size === r && this.textSize === Co.BASESIZE && this.style === e ? this : this.extend({
      style: e,
      size: r
    });
  }
  /**
   * Remove the effect of sizing changes such as \Huge.
   * Keep the effect of the current style, such as \scriptstyle.
   */
  havingBaseSizing() {
    var e;
    switch (this.style.id) {
      case 4:
      case 5:
        e = 3;
        break;
      case 6:
      case 7:
        e = 1;
        break;
      default:
        e = 6;
    }
    return this.extend({
      style: this.style.text(),
      size: e
    });
  }
  /**
   * Create a new options object with the given color.
   */
  withColor(e) {
    return this.extend({
      color: e
    });
  }
  /**
   * Create a new options object with "phantom" set to true.
   */
  withPhantom() {
    return this.extend({
      phantom: !0
    });
  }
  /**
   * Creates a new options object with the given math font or old text font.
   * @type {[type]}
   */
  withFont(e) {
    return this.extend({
      font: e
    });
  }
  /**
   * Create a new options objects with the given fontFamily.
   */
  withTextFontFamily(e) {
    return this.extend({
      fontFamily: e,
      font: ""
    });
  }
  /**
   * Creates a new options object with the given font weight
   */
  withTextFontWeight(e) {
    return this.extend({
      fontWeight: e,
      font: ""
    });
  }
  /**
   * Creates a new options object with the given font weight
   */
  withTextFontShape(e) {
    return this.extend({
      fontShape: e,
      font: ""
    });
  }
  /**
   * Return the CSS sizing classes required to switch from enclosing options
   * `oldOptions` to `this`. Returns an array of classes.
   */
  sizingClasses(e) {
    return e.size !== this.size ? ["sizing", "reset-size" + e.size, "size" + this.size] : [];
  }
  /**
   * Return the CSS sizing classes required to switch to the base size. Like
   * `this.havingSize(BASESIZE).sizingClasses(this)`.
   */
  baseSizingClasses() {
    return this.size !== Co.BASESIZE ? ["sizing", "reset-size" + this.size, "size" + Co.BASESIZE] : [];
  }
  /**
   * Return the font metrics for this size.
   */
  fontMetrics() {
    return this._fontMetrics || (this._fontMetrics = Rhe(this.size)), this._fontMetrics;
  }
  /**
   * Gets the CSS color of the current options object
   */
  getColor() {
    return this.phantom ? "transparent" : this.color;
  }
}
Co.BASESIZE = 6;
var Kw = {
  // https://en.wikibooks.org/wiki/LaTeX/Lengths and
  // https://tex.stackexchange.com/a/8263
  pt: 1,
  // TeX point
  mm: 7227 / 2540,
  // millimeter
  cm: 7227 / 254,
  // centimeter
  in: 72.27,
  // inch
  bp: 803 / 800,
  // big (PostScript) points
  pc: 12,
  // pica
  dd: 1238 / 1157,
  // didot
  cc: 14856 / 1157,
  // cicero (12 didot)
  nd: 685 / 642,
  // new didot
  nc: 1370 / 107,
  // new cicero (12 new didot)
  sp: 1 / 65536,
  // scaled point (TeX's internal smallest unit)
  // https://tex.stackexchange.com/a/41371
  px: 803 / 800
  // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
}, Mhe = {
  ex: !0,
  em: !0,
  mu: !0
}, f$ = function(e) {
  return typeof e != "string" && (e = e.unit), e in Kw || e in Mhe || e === "ex";
}, en = function(e, r) {
  var n;
  if (e.unit in Kw)
    n = Kw[e.unit] / r.fontMetrics().ptPerEm / r.sizeMultiplier;
  else if (e.unit === "mu")
    n = r.fontMetrics().cssEmPerMu;
  else {
    var i;
    if (r.style.isTight() ? i = r.havingStyle(r.style.text()) : i = r, e.unit === "ex")
      n = i.fontMetrics().xHeight;
    else if (e.unit === "em")
      n = i.fontMetrics().quad;
    else
      throw new ot("Invalid unit: '" + e.unit + "'");
    i !== r && (n *= i.sizeMultiplier / r.sizeMultiplier);
  }
  return Math.min(e.number * n, r.maxSize);
}, gt = function(e) {
  return +e.toFixed(4) + "em";
}, $l = function(e) {
  return e.filter((r) => r).join(" ");
}, p$ = function(e, r, n) {
  if (this.classes = e || [], this.attributes = {}, this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = n || {}, r) {
    r.style.isTight() && this.classes.push("mtight");
    var i = r.getColor();
    i && (this.style.color = i);
  }
}, g$ = function(e) {
  var r = document.createElement(e);
  r.className = $l(this.classes);
  for (var n in this.style)
    this.style.hasOwnProperty(n) && (r.style[n] = this.style[n]);
  for (var i in this.attributes)
    this.attributes.hasOwnProperty(i) && r.setAttribute(i, this.attributes[i]);
  for (var a = 0; a < this.children.length; a++)
    r.appendChild(this.children[a].toNode());
  return r;
}, Dhe = /[\s"'>/=\x00-\x1f]/, m$ = function(e) {
  var r = "<" + e;
  this.classes.length && (r += ' class="' + Tr.escape($l(this.classes)) + '"');
  var n = "";
  for (var i in this.style)
    this.style.hasOwnProperty(i) && (n += Tr.hyphenate(i) + ":" + this.style[i] + ";");
  n && (r += ' style="' + Tr.escape(n) + '"');
  for (var a in this.attributes)
    if (this.attributes.hasOwnProperty(a)) {
      if (Dhe.test(a))
        throw new ot("Invalid attribute name '" + a + "'");
      r += " " + a + '="' + Tr.escape(this.attributes[a]) + '"';
    }
  r += ">";
  for (var s = 0; s < this.children.length; s++)
    r += this.children[s].toMarkup();
  return r += "</" + e + ">", r;
};
class Wg {
  constructor(e, r, n, i) {
    this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.width = void 0, this.maxFontSize = void 0, this.style = void 0, p$.call(this, e, n, i), this.children = r || [];
  }
  /**
   * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
   * all browsers support attributes the same, and having too many custom
   * attributes is probably bad.
   */
  setAttribute(e, r) {
    this.attributes[e] = r;
  }
  hasClass(e) {
    return this.classes.includes(e);
  }
  toNode() {
    return g$.call(this, "span");
  }
  toMarkup() {
    return m$.call(this, "span");
  }
}
class ok {
  constructor(e, r, n, i) {
    this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, p$.call(this, r, i), this.children = n || [], this.setAttribute("href", e);
  }
  setAttribute(e, r) {
    this.attributes[e] = r;
  }
  hasClass(e) {
    return this.classes.includes(e);
  }
  toNode() {
    return g$.call(this, "a");
  }
  toMarkup() {
    return m$.call(this, "a");
  }
}
class Ihe {
  constructor(e, r, n) {
    this.src = void 0, this.alt = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.alt = r, this.src = e, this.classes = ["mord"], this.style = n;
  }
  hasClass(e) {
    return this.classes.includes(e);
  }
  toNode() {
    var e = document.createElement("img");
    e.src = this.src, e.alt = this.alt, e.className = "mord";
    for (var r in this.style)
      this.style.hasOwnProperty(r) && (e.style[r] = this.style[r]);
    return e;
  }
  toMarkup() {
    var e = '<img src="' + Tr.escape(this.src) + '"' + (' alt="' + Tr.escape(this.alt) + '"'), r = "";
    for (var n in this.style)
      this.style.hasOwnProperty(n) && (r += Tr.hyphenate(n) + ":" + this.style[n] + ";");
    return r && (e += ' style="' + Tr.escape(r) + '"'), e += "'/>", e;
  }
}
var Ohe = {
  î: "ı̂",
  ï: "ı̈",
  í: "ı́",
  // 'ī': '\u0131\u0304', // enable when we add Extended Latin
  ì: "ı̀"
};
class rs {
  constructor(e, r, n, i, a, s, o, l) {
    this.text = void 0, this.height = void 0, this.depth = void 0, this.italic = void 0, this.skew = void 0, this.width = void 0, this.maxFontSize = void 0, this.classes = void 0, this.style = void 0, this.text = e, this.height = r || 0, this.depth = n || 0, this.italic = i || 0, this.skew = a || 0, this.width = s || 0, this.classes = o || [], this.style = l || {}, this.maxFontSize = 0;
    var u = xhe(this.text.charCodeAt(0));
    u && this.classes.push(u + "_fallback"), /[îïíì]/.test(this.text) && (this.text = Ohe[this.text]);
  }
  hasClass(e) {
    return this.classes.includes(e);
  }
  /**
   * Creates a text node or span from a symbol node. Note that a span is only
   * created if it is needed.
   */
  toNode() {
    var e = document.createTextNode(this.text), r = null;
    this.italic > 0 && (r = document.createElement("span"), r.style.marginRight = gt(this.italic)), this.classes.length > 0 && (r = r || document.createElement("span"), r.className = $l(this.classes));
    for (var n in this.style)
      this.style.hasOwnProperty(n) && (r = r || document.createElement("span"), r.style[n] = this.style[n]);
    return r ? (r.appendChild(e), r) : e;
  }
  /**
   * Creates markup for a symbol node.
   */
  toMarkup() {
    var e = !1, r = "<span";
    this.classes.length && (e = !0, r += ' class="', r += Tr.escape($l(this.classes)), r += '"');
    var n = "";
    this.italic > 0 && (n += "margin-right:" + this.italic + "em;");
    for (var i in this.style)
      this.style.hasOwnProperty(i) && (n += Tr.hyphenate(i) + ":" + this.style[i] + ";");
    n && (e = !0, r += ' style="' + Tr.escape(n) + '"');
    var a = Tr.escape(this.text);
    return e ? (r += ">", r += a, r += "</span>", r) : a;
  }
}
class Yo {
  constructor(e, r) {
    this.children = void 0, this.attributes = void 0, this.children = e || [], this.attributes = r || {};
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", r = document.createElementNS(e, "svg");
    for (var n in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, n) && r.setAttribute(n, this.attributes[n]);
    for (var i = 0; i < this.children.length; i++)
      r.appendChild(this.children[i].toNode());
    return r;
  }
  toMarkup() {
    var e = '<svg xmlns="http://www.w3.org/2000/svg"';
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && (e += " " + r + '="' + Tr.escape(this.attributes[r]) + '"');
    e += ">";
    for (var n = 0; n < this.children.length; n++)
      e += this.children[n].toMarkup();
    return e += "</svg>", e;
  }
}
class zl {
  constructor(e, r) {
    this.pathName = void 0, this.alternate = void 0, this.pathName = e, this.alternate = r;
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", r = document.createElementNS(e, "path");
    return this.alternate ? r.setAttribute("d", this.alternate) : r.setAttribute("d", k8[this.pathName]), r;
  }
  toMarkup() {
    return this.alternate ? '<path d="' + Tr.escape(this.alternate) + '"/>' : '<path d="' + Tr.escape(k8[this.pathName]) + '"/>';
  }
}
class Zw {
  constructor(e) {
    this.attributes = void 0, this.attributes = e || {};
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", r = document.createElementNS(e, "line");
    for (var n in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, n) && r.setAttribute(n, this.attributes[n]);
    return r;
  }
  toMarkup() {
    var e = "<line";
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && (e += " " + r + '="' + Tr.escape(this.attributes[r]) + '"');
    return e += "/>", e;
  }
}
function _8(t) {
  if (t instanceof rs)
    return t;
  throw new Error("Expected symbolNode but got " + String(t) + ".");
}
function Phe(t) {
  if (t instanceof Wg)
    return t;
  throw new Error("Expected span<HtmlDomNode> but got " + String(t) + ".");
}
var Bhe = {
  bin: 1,
  close: 1,
  inner: 1,
  open: 1,
  punct: 1,
  rel: 1
}, Fhe = {
  "accent-token": 1,
  mathord: 1,
  "op-token": 1,
  spacing: 1,
  textord: 1
}, Vr = {
  math: {},
  text: {}
};
function V(t, e, r, n, i, a) {
  Vr[t][i] = {
    font: e,
    group: r,
    replace: n
  }, a && n && (Vr[t][n] = Vr[t][i]);
}
var U = "math", tt = "text", ie = "main", ye = "ams", Zr = "accent-token", At = "bin", Zi = "close", Lf = "inner", zt = "mathord", Rn = "op-token", Da = "open", px = "punct", xe = "rel", al = "spacing", Le = "textord";
V(U, ie, xe, "≡", "\\equiv", !0);
V(U, ie, xe, "≺", "\\prec", !0);
V(U, ie, xe, "≻", "\\succ", !0);
V(U, ie, xe, "∼", "\\sim", !0);
V(U, ie, xe, "⊥", "\\perp");
V(U, ie, xe, "⪯", "\\preceq", !0);
V(U, ie, xe, "⪰", "\\succeq", !0);
V(U, ie, xe, "≃", "\\simeq", !0);
V(U, ie, xe, "∣", "\\mid", !0);
V(U, ie, xe, "≪", "\\ll", !0);
V(U, ie, xe, "≫", "\\gg", !0);
V(U, ie, xe, "≍", "\\asymp", !0);
V(U, ie, xe, "∥", "\\parallel");
V(U, ie, xe, "⋈", "\\bowtie", !0);
V(U, ie, xe, "⌣", "\\smile", !0);
V(U, ie, xe, "⊑", "\\sqsubseteq", !0);
V(U, ie, xe, "⊒", "\\sqsupseteq", !0);
V(U, ie, xe, "≐", "\\doteq", !0);
V(U, ie, xe, "⌢", "\\frown", !0);
V(U, ie, xe, "∋", "\\ni", !0);
V(U, ie, xe, "∝", "\\propto", !0);
V(U, ie, xe, "⊢", "\\vdash", !0);
V(U, ie, xe, "⊣", "\\dashv", !0);
V(U, ie, xe, "∋", "\\owns");
V(U, ie, px, ".", "\\ldotp");
V(U, ie, px, "⋅", "\\cdotp");
V(U, ie, Le, "#", "\\#");
V(tt, ie, Le, "#", "\\#");
V(U, ie, Le, "&", "\\&");
V(tt, ie, Le, "&", "\\&");
V(U, ie, Le, "ℵ", "\\aleph", !0);
V(U, ie, Le, "∀", "\\forall", !0);
V(U, ie, Le, "ℏ", "\\hbar", !0);
V(U, ie, Le, "∃", "\\exists", !0);
V(U, ie, Le, "∇", "\\nabla", !0);
V(U, ie, Le, "♭", "\\flat", !0);
V(U, ie, Le, "ℓ", "\\ell", !0);
V(U, ie, Le, "♮", "\\natural", !0);
V(U, ie, Le, "♣", "\\clubsuit", !0);
V(U, ie, Le, "℘", "\\wp", !0);
V(U, ie, Le, "♯", "\\sharp", !0);
V(U, ie, Le, "♢", "\\diamondsuit", !0);
V(U, ie, Le, "ℜ", "\\Re", !0);
V(U, ie, Le, "♡", "\\heartsuit", !0);
V(U, ie, Le, "ℑ", "\\Im", !0);
V(U, ie, Le, "♠", "\\spadesuit", !0);
V(U, ie, Le, "§", "\\S", !0);
V(tt, ie, Le, "§", "\\S");
V(U, ie, Le, "¶", "\\P", !0);
V(tt, ie, Le, "¶", "\\P");
V(U, ie, Le, "†", "\\dag");
V(tt, ie, Le, "†", "\\dag");
V(tt, ie, Le, "†", "\\textdagger");
V(U, ie, Le, "‡", "\\ddag");
V(tt, ie, Le, "‡", "\\ddag");
V(tt, ie, Le, "‡", "\\textdaggerdbl");
V(U, ie, Zi, "⎱", "\\rmoustache", !0);
V(U, ie, Da, "⎰", "\\lmoustache", !0);
V(U, ie, Zi, "⟯", "\\rgroup", !0);
V(U, ie, Da, "⟮", "\\lgroup", !0);
V(U, ie, At, "∓", "\\mp", !0);
V(U, ie, At, "⊖", "\\ominus", !0);
V(U, ie, At, "⊎", "\\uplus", !0);
V(U, ie, At, "⊓", "\\sqcap", !0);
V(U, ie, At, "∗", "\\ast");
V(U, ie, At, "⊔", "\\sqcup", !0);
V(U, ie, At, "◯", "\\bigcirc", !0);
V(U, ie, At, "∙", "\\bullet", !0);
V(U, ie, At, "‡", "\\ddagger");
V(U, ie, At, "≀", "\\wr", !0);
V(U, ie, At, "⨿", "\\amalg");
V(U, ie, At, "&", "\\And");
V(U, ie, xe, "⟵", "\\longleftarrow", !0);
V(U, ie, xe, "⇐", "\\Leftarrow", !0);
V(U, ie, xe, "⟸", "\\Longleftarrow", !0);
V(U, ie, xe, "⟶", "\\longrightarrow", !0);
V(U, ie, xe, "⇒", "\\Rightarrow", !0);
V(U, ie, xe, "⟹", "\\Longrightarrow", !0);
V(U, ie, xe, "↔", "\\leftrightarrow", !0);
V(U, ie, xe, "⟷", "\\longleftrightarrow", !0);
V(U, ie, xe, "⇔", "\\Leftrightarrow", !0);
V(U, ie, xe, "⟺", "\\Longleftrightarrow", !0);
V(U, ie, xe, "↦", "\\mapsto", !0);
V(U, ie, xe, "⟼", "\\longmapsto", !0);
V(U, ie, xe, "↗", "\\nearrow", !0);
V(U, ie, xe, "↩", "\\hookleftarrow", !0);
V(U, ie, xe, "↪", "\\hookrightarrow", !0);
V(U, ie, xe, "↘", "\\searrow", !0);
V(U, ie, xe, "↼", "\\leftharpoonup", !0);
V(U, ie, xe, "⇀", "\\rightharpoonup", !0);
V(U, ie, xe, "↙", "\\swarrow", !0);
V(U, ie, xe, "↽", "\\leftharpoondown", !0);
V(U, ie, xe, "⇁", "\\rightharpoondown", !0);
V(U, ie, xe, "↖", "\\nwarrow", !0);
V(U, ie, xe, "⇌", "\\rightleftharpoons", !0);
V(U, ye, xe, "≮", "\\nless", !0);
V(U, ye, xe, "", "\\@nleqslant");
V(U, ye, xe, "", "\\@nleqq");
V(U, ye, xe, "⪇", "\\lneq", !0);
V(U, ye, xe, "≨", "\\lneqq", !0);
V(U, ye, xe, "", "\\@lvertneqq");
V(U, ye, xe, "⋦", "\\lnsim", !0);
V(U, ye, xe, "⪉", "\\lnapprox", !0);
V(U, ye, xe, "⊀", "\\nprec", !0);
V(U, ye, xe, "⋠", "\\npreceq", !0);
V(U, ye, xe, "⋨", "\\precnsim", !0);
V(U, ye, xe, "⪹", "\\precnapprox", !0);
V(U, ye, xe, "≁", "\\nsim", !0);
V(U, ye, xe, "", "\\@nshortmid");
V(U, ye, xe, "∤", "\\nmid", !0);
V(U, ye, xe, "⊬", "\\nvdash", !0);
V(U, ye, xe, "⊭", "\\nvDash", !0);
V(U, ye, xe, "⋪", "\\ntriangleleft");
V(U, ye, xe, "⋬", "\\ntrianglelefteq", !0);
V(U, ye, xe, "⊊", "\\subsetneq", !0);
V(U, ye, xe, "", "\\@varsubsetneq");
V(U, ye, xe, "⫋", "\\subsetneqq", !0);
V(U, ye, xe, "", "\\@varsubsetneqq");
V(U, ye, xe, "≯", "\\ngtr", !0);
V(U, ye, xe, "", "\\@ngeqslant");
V(U, ye, xe, "", "\\@ngeqq");
V(U, ye, xe, "⪈", "\\gneq", !0);
V(U, ye, xe, "≩", "\\gneqq", !0);
V(U, ye, xe, "", "\\@gvertneqq");
V(U, ye, xe, "⋧", "\\gnsim", !0);
V(U, ye, xe, "⪊", "\\gnapprox", !0);
V(U, ye, xe, "⊁", "\\nsucc", !0);
V(U, ye, xe, "⋡", "\\nsucceq", !0);
V(U, ye, xe, "⋩", "\\succnsim", !0);
V(U, ye, xe, "⪺", "\\succnapprox", !0);
V(U, ye, xe, "≆", "\\ncong", !0);
V(U, ye, xe, "", "\\@nshortparallel");
V(U, ye, xe, "∦", "\\nparallel", !0);
V(U, ye, xe, "⊯", "\\nVDash", !0);
V(U, ye, xe, "⋫", "\\ntriangleright");
V(U, ye, xe, "⋭", "\\ntrianglerighteq", !0);
V(U, ye, xe, "", "\\@nsupseteqq");
V(U, ye, xe, "⊋", "\\supsetneq", !0);
V(U, ye, xe, "", "\\@varsupsetneq");
V(U, ye, xe, "⫌", "\\supsetneqq", !0);
V(U, ye, xe, "", "\\@varsupsetneqq");
V(U, ye, xe, "⊮", "\\nVdash", !0);
V(U, ye, xe, "⪵", "\\precneqq", !0);
V(U, ye, xe, "⪶", "\\succneqq", !0);
V(U, ye, xe, "", "\\@nsubseteqq");
V(U, ye, At, "⊴", "\\unlhd");
V(U, ye, At, "⊵", "\\unrhd");
V(U, ye, xe, "↚", "\\nleftarrow", !0);
V(U, ye, xe, "↛", "\\nrightarrow", !0);
V(U, ye, xe, "⇍", "\\nLeftarrow", !0);
V(U, ye, xe, "⇏", "\\nRightarrow", !0);
V(U, ye, xe, "↮", "\\nleftrightarrow", !0);
V(U, ye, xe, "⇎", "\\nLeftrightarrow", !0);
V(U, ye, xe, "△", "\\vartriangle");
V(U, ye, Le, "ℏ", "\\hslash");
V(U, ye, Le, "▽", "\\triangledown");
V(U, ye, Le, "◊", "\\lozenge");
V(U, ye, Le, "Ⓢ", "\\circledS");
V(U, ye, Le, "®", "\\circledR");
V(tt, ye, Le, "®", "\\circledR");
V(U, ye, Le, "∡", "\\measuredangle", !0);
V(U, ye, Le, "∄", "\\nexists");
V(U, ye, Le, "℧", "\\mho");
V(U, ye, Le, "Ⅎ", "\\Finv", !0);
V(U, ye, Le, "⅁", "\\Game", !0);
V(U, ye, Le, "‵", "\\backprime");
V(U, ye, Le, "▲", "\\blacktriangle");
V(U, ye, Le, "▼", "\\blacktriangledown");
V(U, ye, Le, "■", "\\blacksquare");
V(U, ye, Le, "⧫", "\\blacklozenge");
V(U, ye, Le, "★", "\\bigstar");
V(U, ye, Le, "∢", "\\sphericalangle", !0);
V(U, ye, Le, "∁", "\\complement", !0);
V(U, ye, Le, "ð", "\\eth", !0);
V(tt, ie, Le, "ð", "ð");
V(U, ye, Le, "╱", "\\diagup");
V(U, ye, Le, "╲", "\\diagdown");
V(U, ye, Le, "□", "\\square");
V(U, ye, Le, "□", "\\Box");
V(U, ye, Le, "◊", "\\Diamond");
V(U, ye, Le, "¥", "\\yen", !0);
V(tt, ye, Le, "¥", "\\yen", !0);
V(U, ye, Le, "✓", "\\checkmark", !0);
V(tt, ye, Le, "✓", "\\checkmark");
V(U, ye, Le, "ℶ", "\\beth", !0);
V(U, ye, Le, "ℸ", "\\daleth", !0);
V(U, ye, Le, "ℷ", "\\gimel", !0);
V(U, ye, Le, "ϝ", "\\digamma", !0);
V(U, ye, Le, "ϰ", "\\varkappa");
V(U, ye, Da, "┌", "\\@ulcorner", !0);
V(U, ye, Zi, "┐", "\\@urcorner", !0);
V(U, ye, Da, "└", "\\@llcorner", !0);
V(U, ye, Zi, "┘", "\\@lrcorner", !0);
V(U, ye, xe, "≦", "\\leqq", !0);
V(U, ye, xe, "⩽", "\\leqslant", !0);
V(U, ye, xe, "⪕", "\\eqslantless", !0);
V(U, ye, xe, "≲", "\\lesssim", !0);
V(U, ye, xe, "⪅", "\\lessapprox", !0);
V(U, ye, xe, "≊", "\\approxeq", !0);
V(U, ye, At, "⋖", "\\lessdot");
V(U, ye, xe, "⋘", "\\lll", !0);
V(U, ye, xe, "≶", "\\lessgtr", !0);
V(U, ye, xe, "⋚", "\\lesseqgtr", !0);
V(U, ye, xe, "⪋", "\\lesseqqgtr", !0);
V(U, ye, xe, "≑", "\\doteqdot");
V(U, ye, xe, "≓", "\\risingdotseq", !0);
V(U, ye, xe, "≒", "\\fallingdotseq", !0);
V(U, ye, xe, "∽", "\\backsim", !0);
V(U, ye, xe, "⋍", "\\backsimeq", !0);
V(U, ye, xe, "⫅", "\\subseteqq", !0);
V(U, ye, xe, "⋐", "\\Subset", !0);
V(U, ye, xe, "⊏", "\\sqsubset", !0);
V(U, ye, xe, "≼", "\\preccurlyeq", !0);
V(U, ye, xe, "⋞", "\\curlyeqprec", !0);
V(U, ye, xe, "≾", "\\precsim", !0);
V(U, ye, xe, "⪷", "\\precapprox", !0);
V(U, ye, xe, "⊲", "\\vartriangleleft");
V(U, ye, xe, "⊴", "\\trianglelefteq");
V(U, ye, xe, "⊨", "\\vDash", !0);
V(U, ye, xe, "⊪", "\\Vvdash", !0);
V(U, ye, xe, "⌣", "\\smallsmile");
V(U, ye, xe, "⌢", "\\smallfrown");
V(U, ye, xe, "≏", "\\bumpeq", !0);
V(U, ye, xe, "≎", "\\Bumpeq", !0);
V(U, ye, xe, "≧", "\\geqq", !0);
V(U, ye, xe, "⩾", "\\geqslant", !0);
V(U, ye, xe, "⪖", "\\eqslantgtr", !0);
V(U, ye, xe, "≳", "\\gtrsim", !0);
V(U, ye, xe, "⪆", "\\gtrapprox", !0);
V(U, ye, At, "⋗", "\\gtrdot");
V(U, ye, xe, "⋙", "\\ggg", !0);
V(U, ye, xe, "≷", "\\gtrless", !0);
V(U, ye, xe, "⋛", "\\gtreqless", !0);
V(U, ye, xe, "⪌", "\\gtreqqless", !0);
V(U, ye, xe, "≖", "\\eqcirc", !0);
V(U, ye, xe, "≗", "\\circeq", !0);
V(U, ye, xe, "≜", "\\triangleq", !0);
V(U, ye, xe, "∼", "\\thicksim");
V(U, ye, xe, "≈", "\\thickapprox");
V(U, ye, xe, "⫆", "\\supseteqq", !0);
V(U, ye, xe, "⋑", "\\Supset", !0);
V(U, ye, xe, "⊐", "\\sqsupset", !0);
V(U, ye, xe, "≽", "\\succcurlyeq", !0);
V(U, ye, xe, "⋟", "\\curlyeqsucc", !0);
V(U, ye, xe, "≿", "\\succsim", !0);
V(U, ye, xe, "⪸", "\\succapprox", !0);
V(U, ye, xe, "⊳", "\\vartriangleright");
V(U, ye, xe, "⊵", "\\trianglerighteq");
V(U, ye, xe, "⊩", "\\Vdash", !0);
V(U, ye, xe, "∣", "\\shortmid");
V(U, ye, xe, "∥", "\\shortparallel");
V(U, ye, xe, "≬", "\\between", !0);
V(U, ye, xe, "⋔", "\\pitchfork", !0);
V(U, ye, xe, "∝", "\\varpropto");
V(U, ye, xe, "◀", "\\blacktriangleleft");
V(U, ye, xe, "∴", "\\therefore", !0);
V(U, ye, xe, "∍", "\\backepsilon");
V(U, ye, xe, "▶", "\\blacktriangleright");
V(U, ye, xe, "∵", "\\because", !0);
V(U, ye, xe, "⋘", "\\llless");
V(U, ye, xe, "⋙", "\\gggtr");
V(U, ye, At, "⊲", "\\lhd");
V(U, ye, At, "⊳", "\\rhd");
V(U, ye, xe, "≂", "\\eqsim", !0);
V(U, ie, xe, "⋈", "\\Join");
V(U, ye, xe, "≑", "\\Doteq", !0);
V(U, ye, At, "∔", "\\dotplus", !0);
V(U, ye, At, "∖", "\\smallsetminus");
V(U, ye, At, "⋒", "\\Cap", !0);
V(U, ye, At, "⋓", "\\Cup", !0);
V(U, ye, At, "⩞", "\\doublebarwedge", !0);
V(U, ye, At, "⊟", "\\boxminus", !0);
V(U, ye, At, "⊞", "\\boxplus", !0);
V(U, ye, At, "⋇", "\\divideontimes", !0);
V(U, ye, At, "⋉", "\\ltimes", !0);
V(U, ye, At, "⋊", "\\rtimes", !0);
V(U, ye, At, "⋋", "\\leftthreetimes", !0);
V(U, ye, At, "⋌", "\\rightthreetimes", !0);
V(U, ye, At, "⋏", "\\curlywedge", !0);
V(U, ye, At, "⋎", "\\curlyvee", !0);
V(U, ye, At, "⊝", "\\circleddash", !0);
V(U, ye, At, "⊛", "\\circledast", !0);
V(U, ye, At, "⋅", "\\centerdot");
V(U, ye, At, "⊺", "\\intercal", !0);
V(U, ye, At, "⋒", "\\doublecap");
V(U, ye, At, "⋓", "\\doublecup");
V(U, ye, At, "⊠", "\\boxtimes", !0);
V(U, ye, xe, "⇢", "\\dashrightarrow", !0);
V(U, ye, xe, "⇠", "\\dashleftarrow", !0);
V(U, ye, xe, "⇇", "\\leftleftarrows", !0);
V(U, ye, xe, "⇆", "\\leftrightarrows", !0);
V(U, ye, xe, "⇚", "\\Lleftarrow", !0);
V(U, ye, xe, "↞", "\\twoheadleftarrow", !0);
V(U, ye, xe, "↢", "\\leftarrowtail", !0);
V(U, ye, xe, "↫", "\\looparrowleft", !0);
V(U, ye, xe, "⇋", "\\leftrightharpoons", !0);
V(U, ye, xe, "↶", "\\curvearrowleft", !0);
V(U, ye, xe, "↺", "\\circlearrowleft", !0);
V(U, ye, xe, "↰", "\\Lsh", !0);
V(U, ye, xe, "⇈", "\\upuparrows", !0);
V(U, ye, xe, "↿", "\\upharpoonleft", !0);
V(U, ye, xe, "⇃", "\\downharpoonleft", !0);
V(U, ie, xe, "⊶", "\\origof", !0);
V(U, ie, xe, "⊷", "\\imageof", !0);
V(U, ye, xe, "⊸", "\\multimap", !0);
V(U, ye, xe, "↭", "\\leftrightsquigarrow", !0);
V(U, ye, xe, "⇉", "\\rightrightarrows", !0);
V(U, ye, xe, "⇄", "\\rightleftarrows", !0);
V(U, ye, xe, "↠", "\\twoheadrightarrow", !0);
V(U, ye, xe, "↣", "\\rightarrowtail", !0);
V(U, ye, xe, "↬", "\\looparrowright", !0);
V(U, ye, xe, "↷", "\\curvearrowright", !0);
V(U, ye, xe, "↻", "\\circlearrowright", !0);
V(U, ye, xe, "↱", "\\Rsh", !0);
V(U, ye, xe, "⇊", "\\downdownarrows", !0);
V(U, ye, xe, "↾", "\\upharpoonright", !0);
V(U, ye, xe, "⇂", "\\downharpoonright", !0);
V(U, ye, xe, "⇝", "\\rightsquigarrow", !0);
V(U, ye, xe, "⇝", "\\leadsto");
V(U, ye, xe, "⇛", "\\Rrightarrow", !0);
V(U, ye, xe, "↾", "\\restriction");
V(U, ie, Le, "‘", "`");
V(U, ie, Le, "$", "\\$");
V(tt, ie, Le, "$", "\\$");
V(tt, ie, Le, "$", "\\textdollar");
V(U, ie, Le, "%", "\\%");
V(tt, ie, Le, "%", "\\%");
V(U, ie, Le, "_", "\\_");
V(tt, ie, Le, "_", "\\_");
V(tt, ie, Le, "_", "\\textunderscore");
V(U, ie, Le, "∠", "\\angle", !0);
V(U, ie, Le, "∞", "\\infty", !0);
V(U, ie, Le, "′", "\\prime");
V(U, ie, Le, "△", "\\triangle");
V(U, ie, Le, "Γ", "\\Gamma", !0);
V(U, ie, Le, "Δ", "\\Delta", !0);
V(U, ie, Le, "Θ", "\\Theta", !0);
V(U, ie, Le, "Λ", "\\Lambda", !0);
V(U, ie, Le, "Ξ", "\\Xi", !0);
V(U, ie, Le, "Π", "\\Pi", !0);
V(U, ie, Le, "Σ", "\\Sigma", !0);
V(U, ie, Le, "Υ", "\\Upsilon", !0);
V(U, ie, Le, "Φ", "\\Phi", !0);
V(U, ie, Le, "Ψ", "\\Psi", !0);
V(U, ie, Le, "Ω", "\\Omega", !0);
V(U, ie, Le, "A", "Α");
V(U, ie, Le, "B", "Β");
V(U, ie, Le, "E", "Ε");
V(U, ie, Le, "Z", "Ζ");
V(U, ie, Le, "H", "Η");
V(U, ie, Le, "I", "Ι");
V(U, ie, Le, "K", "Κ");
V(U, ie, Le, "M", "Μ");
V(U, ie, Le, "N", "Ν");
V(U, ie, Le, "O", "Ο");
V(U, ie, Le, "P", "Ρ");
V(U, ie, Le, "T", "Τ");
V(U, ie, Le, "X", "Χ");
V(U, ie, Le, "¬", "\\neg", !0);
V(U, ie, Le, "¬", "\\lnot");
V(U, ie, Le, "⊤", "\\top");
V(U, ie, Le, "⊥", "\\bot");
V(U, ie, Le, "∅", "\\emptyset");
V(U, ye, Le, "∅", "\\varnothing");
V(U, ie, zt, "α", "\\alpha", !0);
V(U, ie, zt, "β", "\\beta", !0);
V(U, ie, zt, "γ", "\\gamma", !0);
V(U, ie, zt, "δ", "\\delta", !0);
V(U, ie, zt, "ϵ", "\\epsilon", !0);
V(U, ie, zt, "ζ", "\\zeta", !0);
V(U, ie, zt, "η", "\\eta", !0);
V(U, ie, zt, "θ", "\\theta", !0);
V(U, ie, zt, "ι", "\\iota", !0);
V(U, ie, zt, "κ", "\\kappa", !0);
V(U, ie, zt, "λ", "\\lambda", !0);
V(U, ie, zt, "μ", "\\mu", !0);
V(U, ie, zt, "ν", "\\nu", !0);
V(U, ie, zt, "ξ", "\\xi", !0);
V(U, ie, zt, "ο", "\\omicron", !0);
V(U, ie, zt, "π", "\\pi", !0);
V(U, ie, zt, "ρ", "\\rho", !0);
V(U, ie, zt, "σ", "\\sigma", !0);
V(U, ie, zt, "τ", "\\tau", !0);
V(U, ie, zt, "υ", "\\upsilon", !0);
V(U, ie, zt, "ϕ", "\\phi", !0);
V(U, ie, zt, "χ", "\\chi", !0);
V(U, ie, zt, "ψ", "\\psi", !0);
V(U, ie, zt, "ω", "\\omega", !0);
V(U, ie, zt, "ε", "\\varepsilon", !0);
V(U, ie, zt, "ϑ", "\\vartheta", !0);
V(U, ie, zt, "ϖ", "\\varpi", !0);
V(U, ie, zt, "ϱ", "\\varrho", !0);
V(U, ie, zt, "ς", "\\varsigma", !0);
V(U, ie, zt, "φ", "\\varphi", !0);
V(U, ie, At, "∗", "*", !0);
V(U, ie, At, "+", "+");
V(U, ie, At, "−", "-", !0);
V(U, ie, At, "⋅", "\\cdot", !0);
V(U, ie, At, "∘", "\\circ", !0);
V(U, ie, At, "÷", "\\div", !0);
V(U, ie, At, "±", "\\pm", !0);
V(U, ie, At, "×", "\\times", !0);
V(U, ie, At, "∩", "\\cap", !0);
V(U, ie, At, "∪", "\\cup", !0);
V(U, ie, At, "∖", "\\setminus", !0);
V(U, ie, At, "∧", "\\land");
V(U, ie, At, "∨", "\\lor");
V(U, ie, At, "∧", "\\wedge", !0);
V(U, ie, At, "∨", "\\vee", !0);
V(U, ie, Le, "√", "\\surd");
V(U, ie, Da, "⟨", "\\langle", !0);
V(U, ie, Da, "∣", "\\lvert");
V(U, ie, Da, "∥", "\\lVert");
V(U, ie, Zi, "?", "?");
V(U, ie, Zi, "!", "!");
V(U, ie, Zi, "⟩", "\\rangle", !0);
V(U, ie, Zi, "∣", "\\rvert");
V(U, ie, Zi, "∥", "\\rVert");
V(U, ie, xe, "=", "=");
V(U, ie, xe, ":", ":");
V(U, ie, xe, "≈", "\\approx", !0);
V(U, ie, xe, "≅", "\\cong", !0);
V(U, ie, xe, "≥", "\\ge");
V(U, ie, xe, "≥", "\\geq", !0);
V(U, ie, xe, "←", "\\gets");
V(U, ie, xe, ">", "\\gt", !0);
V(U, ie, xe, "∈", "\\in", !0);
V(U, ie, xe, "", "\\@not");
V(U, ie, xe, "⊂", "\\subset", !0);
V(U, ie, xe, "⊃", "\\supset", !0);
V(U, ie, xe, "⊆", "\\subseteq", !0);
V(U, ie, xe, "⊇", "\\supseteq", !0);
V(U, ye, xe, "⊈", "\\nsubseteq", !0);
V(U, ye, xe, "⊉", "\\nsupseteq", !0);
V(U, ie, xe, "⊨", "\\models");
V(U, ie, xe, "←", "\\leftarrow", !0);
V(U, ie, xe, "≤", "\\le");
V(U, ie, xe, "≤", "\\leq", !0);
V(U, ie, xe, "<", "\\lt", !0);
V(U, ie, xe, "→", "\\rightarrow", !0);
V(U, ie, xe, "→", "\\to");
V(U, ye, xe, "≱", "\\ngeq", !0);
V(U, ye, xe, "≰", "\\nleq", !0);
V(U, ie, al, " ", "\\ ");
V(U, ie, al, " ", "\\space");
V(U, ie, al, " ", "\\nobreakspace");
V(tt, ie, al, " ", "\\ ");
V(tt, ie, al, " ", " ");
V(tt, ie, al, " ", "\\space");
V(tt, ie, al, " ", "\\nobreakspace");
V(U, ie, al, null, "\\nobreak");
V(U, ie, al, null, "\\allowbreak");
V(U, ie, px, ",", ",");
V(U, ie, px, ";", ";");
V(U, ye, At, "⊼", "\\barwedge", !0);
V(U, ye, At, "⊻", "\\veebar", !0);
V(U, ie, At, "⊙", "\\odot", !0);
V(U, ie, At, "⊕", "\\oplus", !0);
V(U, ie, At, "⊗", "\\otimes", !0);
V(U, ie, Le, "∂", "\\partial", !0);
V(U, ie, At, "⊘", "\\oslash", !0);
V(U, ye, At, "⊚", "\\circledcirc", !0);
V(U, ye, At, "⊡", "\\boxdot", !0);
V(U, ie, At, "△", "\\bigtriangleup");
V(U, ie, At, "▽", "\\bigtriangledown");
V(U, ie, At, "†", "\\dagger");
V(U, ie, At, "⋄", "\\diamond");
V(U, ie, At, "⋆", "\\star");
V(U, ie, At, "◃", "\\triangleleft");
V(U, ie, At, "▹", "\\triangleright");
V(U, ie, Da, "{", "\\{");
V(tt, ie, Le, "{", "\\{");
V(tt, ie, Le, "{", "\\textbraceleft");
V(U, ie, Zi, "}", "\\}");
V(tt, ie, Le, "}", "\\}");
V(tt, ie, Le, "}", "\\textbraceright");
V(U, ie, Da, "{", "\\lbrace");
V(U, ie, Zi, "}", "\\rbrace");
V(U, ie, Da, "[", "\\lbrack", !0);
V(tt, ie, Le, "[", "\\lbrack", !0);
V(U, ie, Zi, "]", "\\rbrack", !0);
V(tt, ie, Le, "]", "\\rbrack", !0);
V(U, ie, Da, "(", "\\lparen", !0);
V(U, ie, Zi, ")", "\\rparen", !0);
V(tt, ie, Le, "<", "\\textless", !0);
V(tt, ie, Le, ">", "\\textgreater", !0);
V(U, ie, Da, "⌊", "\\lfloor", !0);
V(U, ie, Zi, "⌋", "\\rfloor", !0);
V(U, ie, Da, "⌈", "\\lceil", !0);
V(U, ie, Zi, "⌉", "\\rceil", !0);
V(U, ie, Le, "\\", "\\backslash");
V(U, ie, Le, "∣", "|");
V(U, ie, Le, "∣", "\\vert");
V(tt, ie, Le, "|", "\\textbar", !0);
V(U, ie, Le, "∥", "\\|");
V(U, ie, Le, "∥", "\\Vert");
V(tt, ie, Le, "∥", "\\textbardbl");
V(tt, ie, Le, "~", "\\textasciitilde");
V(tt, ie, Le, "\\", "\\textbackslash");
V(tt, ie, Le, "^", "\\textasciicircum");
V(U, ie, xe, "↑", "\\uparrow", !0);
V(U, ie, xe, "⇑", "\\Uparrow", !0);
V(U, ie, xe, "↓", "\\downarrow", !0);
V(U, ie, xe, "⇓", "\\Downarrow", !0);
V(U, ie, xe, "↕", "\\updownarrow", !0);
V(U, ie, xe, "⇕", "\\Updownarrow", !0);
V(U, ie, Rn, "∐", "\\coprod");
V(U, ie, Rn, "⋁", "\\bigvee");
V(U, ie, Rn, "⋀", "\\bigwedge");
V(U, ie, Rn, "⨄", "\\biguplus");
V(U, ie, Rn, "⋂", "\\bigcap");
V(U, ie, Rn, "⋃", "\\bigcup");
V(U, ie, Rn, "∫", "\\int");
V(U, ie, Rn, "∫", "\\intop");
V(U, ie, Rn, "∬", "\\iint");
V(U, ie, Rn, "∭", "\\iiint");
V(U, ie, Rn, "∏", "\\prod");
V(U, ie, Rn, "∑", "\\sum");
V(U, ie, Rn, "⨂", "\\bigotimes");
V(U, ie, Rn, "⨁", "\\bigoplus");
V(U, ie, Rn, "⨀", "\\bigodot");
V(U, ie, Rn, "∮", "\\oint");
V(U, ie, Rn, "∯", "\\oiint");
V(U, ie, Rn, "∰", "\\oiiint");
V(U, ie, Rn, "⨆", "\\bigsqcup");
V(U, ie, Rn, "∫", "\\smallint");
V(tt, ie, Lf, "…", "\\textellipsis");
V(U, ie, Lf, "…", "\\mathellipsis");
V(tt, ie, Lf, "…", "\\ldots", !0);
V(U, ie, Lf, "…", "\\ldots", !0);
V(U, ie, Lf, "⋯", "\\@cdots", !0);
V(U, ie, Lf, "⋱", "\\ddots", !0);
V(U, ie, Le, "⋮", "\\varvdots");
V(tt, ie, Le, "⋮", "\\varvdots");
V(U, ie, Zr, "ˊ", "\\acute");
V(U, ie, Zr, "ˋ", "\\grave");
V(U, ie, Zr, "¨", "\\ddot");
V(U, ie, Zr, "~", "\\tilde");
V(U, ie, Zr, "ˉ", "\\bar");
V(U, ie, Zr, "˘", "\\breve");
V(U, ie, Zr, "ˇ", "\\check");
V(U, ie, Zr, "^", "\\hat");
V(U, ie, Zr, "⃗", "\\vec");
V(U, ie, Zr, "˙", "\\dot");
V(U, ie, Zr, "˚", "\\mathring");
V(U, ie, zt, "", "\\@imath");
V(U, ie, zt, "", "\\@jmath");
V(U, ie, Le, "ı", "ı");
V(U, ie, Le, "ȷ", "ȷ");
V(tt, ie, Le, "ı", "\\i", !0);
V(tt, ie, Le, "ȷ", "\\j", !0);
V(tt, ie, Le, "ß", "\\ss", !0);
V(tt, ie, Le, "æ", "\\ae", !0);
V(tt, ie, Le, "œ", "\\oe", !0);
V(tt, ie, Le, "ø", "\\o", !0);
V(tt, ie, Le, "Æ", "\\AE", !0);
V(tt, ie, Le, "Œ", "\\OE", !0);
V(tt, ie, Le, "Ø", "\\O", !0);
V(tt, ie, Zr, "ˊ", "\\'");
V(tt, ie, Zr, "ˋ", "\\`");
V(tt, ie, Zr, "ˆ", "\\^");
V(tt, ie, Zr, "˜", "\\~");
V(tt, ie, Zr, "ˉ", "\\=");
V(tt, ie, Zr, "˘", "\\u");
V(tt, ie, Zr, "˙", "\\.");
V(tt, ie, Zr, "¸", "\\c");
V(tt, ie, Zr, "˚", "\\r");
V(tt, ie, Zr, "ˇ", "\\v");
V(tt, ie, Zr, "¨", '\\"');
V(tt, ie, Zr, "˝", "\\H");
V(tt, ie, Zr, "◯", "\\textcircled");
var v$ = {
  "--": !0,
  "---": !0,
  "``": !0,
  "''": !0
};
V(tt, ie, Le, "–", "--", !0);
V(tt, ie, Le, "–", "\\textendash");
V(tt, ie, Le, "—", "---", !0);
V(tt, ie, Le, "—", "\\textemdash");
V(tt, ie, Le, "‘", "`", !0);
V(tt, ie, Le, "‘", "\\textquoteleft");
V(tt, ie, Le, "’", "'", !0);
V(tt, ie, Le, "’", "\\textquoteright");
V(tt, ie, Le, "“", "``", !0);
V(tt, ie, Le, "“", "\\textquotedblleft");
V(tt, ie, Le, "”", "''", !0);
V(tt, ie, Le, "”", "\\textquotedblright");
V(U, ie, Le, "°", "\\degree", !0);
V(tt, ie, Le, "°", "\\degree");
V(tt, ie, Le, "°", "\\textdegree", !0);
V(U, ie, Le, "£", "\\pounds");
V(U, ie, Le, "£", "\\mathsterling", !0);
V(tt, ie, Le, "£", "\\pounds");
V(tt, ie, Le, "£", "\\textsterling", !0);
V(U, ye, Le, "✠", "\\maltese");
V(tt, ye, Le, "✠", "\\maltese");
var L8 = '0123456789/@."';
for (var a4 = 0; a4 < L8.length; a4++) {
  var R8 = L8.charAt(a4);
  V(U, ie, Le, R8, R8);
}
var N8 = '0123456789!@*()-=+";:?/.,';
for (var s4 = 0; s4 < N8.length; s4++) {
  var M8 = N8.charAt(s4);
  V(tt, ie, Le, M8, M8);
}
var Ay = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (var o4 = 0; o4 < Ay.length; o4++) {
  var z1 = Ay.charAt(o4);
  V(U, ie, zt, z1, z1), V(tt, ie, Le, z1, z1);
}
V(U, ye, Le, "C", "ℂ");
V(tt, ye, Le, "C", "ℂ");
V(U, ye, Le, "H", "ℍ");
V(tt, ye, Le, "H", "ℍ");
V(U, ye, Le, "N", "ℕ");
V(tt, ye, Le, "N", "ℕ");
V(U, ye, Le, "P", "ℙ");
V(tt, ye, Le, "P", "ℙ");
V(U, ye, Le, "Q", "ℚ");
V(tt, ye, Le, "Q", "ℚ");
V(U, ye, Le, "R", "ℝ");
V(tt, ye, Le, "R", "ℝ");
V(U, ye, Le, "Z", "ℤ");
V(tt, ye, Le, "Z", "ℤ");
V(U, ie, zt, "h", "ℎ");
V(tt, ie, zt, "h", "ℎ");
var qt = "";
for (var Di = 0; Di < Ay.length; Di++) {
  var sn = Ay.charAt(Di);
  qt = String.fromCharCode(55349, 56320 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56372 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56424 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56580 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56684 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56736 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56788 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56840 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56944 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), Di < 26 && (qt = String.fromCharCode(55349, 56632 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt), qt = String.fromCharCode(55349, 56476 + Di), V(U, ie, zt, sn, qt), V(tt, ie, Le, sn, qt));
}
qt = "𝕜";
V(U, ie, zt, "k", qt);
V(tt, ie, Le, "k", qt);
for (var Sc = 0; Sc < 10; Sc++) {
  var hl = Sc.toString();
  qt = String.fromCharCode(55349, 57294 + Sc), V(U, ie, zt, hl, qt), V(tt, ie, Le, hl, qt), qt = String.fromCharCode(55349, 57314 + Sc), V(U, ie, zt, hl, qt), V(tt, ie, Le, hl, qt), qt = String.fromCharCode(55349, 57324 + Sc), V(U, ie, zt, hl, qt), V(tt, ie, Le, hl, qt), qt = String.fromCharCode(55349, 57334 + Sc), V(U, ie, zt, hl, qt), V(tt, ie, Le, hl, qt);
}
var Qw = "ÐÞþ";
for (var l4 = 0; l4 < Qw.length; l4++) {
  var V1 = Qw.charAt(l4);
  V(U, ie, zt, V1, V1), V(tt, ie, Le, V1, V1);
}
var G1 = [
  ["mathbf", "textbf", "Main-Bold"],
  // A-Z bold upright
  ["mathbf", "textbf", "Main-Bold"],
  // a-z bold upright
  ["mathnormal", "textit", "Math-Italic"],
  // A-Z italic
  ["mathnormal", "textit", "Math-Italic"],
  // a-z italic
  ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
  // A-Z bold italic
  ["boldsymbol", "boldsymbol", "Main-BoldItalic"],
  // a-z bold italic
  // Map fancy A-Z letters to script, not calligraphic.
  // This aligns with unicode-math and math fonts (except Cambria Math).
  ["mathscr", "textscr", "Script-Regular"],
  // A-Z script
  ["", "", ""],
  // a-z script.  No font
  ["", "", ""],
  // A-Z bold script. No font
  ["", "", ""],
  // a-z bold script. No font
  ["mathfrak", "textfrak", "Fraktur-Regular"],
  // A-Z Fraktur
  ["mathfrak", "textfrak", "Fraktur-Regular"],
  // a-z Fraktur
  ["mathbb", "textbb", "AMS-Regular"],
  // A-Z double-struck
  ["mathbb", "textbb", "AMS-Regular"],
  // k double-struck
  // Note that we are using a bold font, but font metrics for regular Fraktur.
  ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
  // A-Z bold Fraktur
  ["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
  // a-z bold Fraktur
  ["mathsf", "textsf", "SansSerif-Regular"],
  // A-Z sans-serif
  ["mathsf", "textsf", "SansSerif-Regular"],
  // a-z sans-serif
  ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  // A-Z bold sans-serif
  ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  // a-z bold sans-serif
  ["mathitsf", "textitsf", "SansSerif-Italic"],
  // A-Z italic sans-serif
  ["mathitsf", "textitsf", "SansSerif-Italic"],
  // a-z italic sans-serif
  ["", "", ""],
  // A-Z bold italic sans. No font
  ["", "", ""],
  // a-z bold italic sans. No font
  ["mathtt", "texttt", "Typewriter-Regular"],
  // A-Z monospace
  ["mathtt", "texttt", "Typewriter-Regular"]
  // a-z monospace
], D8 = [
  ["mathbf", "textbf", "Main-Bold"],
  // 0-9 bold
  ["", "", ""],
  // 0-9 double-struck. No KaTeX font.
  ["mathsf", "textsf", "SansSerif-Regular"],
  // 0-9 sans-serif
  ["mathboldsf", "textboldsf", "SansSerif-Bold"],
  // 0-9 bold sans-serif
  ["mathtt", "texttt", "Typewriter-Regular"]
  // 0-9 monospace
], $he = function(e, r) {
  var n = e.charCodeAt(0), i = e.charCodeAt(1), a = (n - 55296) * 1024 + (i - 56320) + 65536, s = r === "math" ? 0 : 1;
  if (119808 <= a && a < 120484) {
    var o = Math.floor((a - 119808) / 26);
    return [G1[o][2], G1[o][s]];
  } else if (120782 <= a && a <= 120831) {
    var l = Math.floor((a - 120782) / 10);
    return [D8[l][2], D8[l][s]];
  } else {
    if (a === 120485 || a === 120486)
      return [G1[0][2], G1[0][s]];
    if (120486 < a && a < 120782)
      return ["", ""];
    throw new ot("Unsupported character: " + e);
  }
}, gx = function(e, r, n) {
  return Vr[n][e] && Vr[n][e].replace && (e = Vr[n][e].replace), {
    value: e,
    metrics: sk(e, r, n)
  };
}, ls = function(e, r, n, i, a) {
  var s = gx(e, r, n), o = s.metrics;
  e = s.value;
  var l;
  if (o) {
    var u = o.italic;
    (n === "text" || i && i.font === "mathit") && (u = 0), l = new rs(e, o.height, o.depth, u, o.skew, o.width, a);
  } else
    typeof console < "u" && console.warn("No character metrics " + ("for '" + e + "' in style '" + r + "' and mode '" + n + "'")), l = new rs(e, 0, 0, 0, 0, 0, a);
  if (i) {
    l.maxFontSize = i.sizeMultiplier, i.style.isTight() && l.classes.push("mtight");
    var h = i.getColor();
    h && (l.style.color = h);
  }
  return l;
}, zhe = function(e, r, n, i) {
  return i === void 0 && (i = []), n.font === "boldsymbol" && gx(e, "Main-Bold", r).metrics ? ls(e, "Main-Bold", r, n, i.concat(["mathbf"])) : e === "\\" || Vr[r][e].font === "main" ? ls(e, "Main-Regular", r, n, i) : ls(e, "AMS-Regular", r, n, i.concat(["amsrm"]));
}, Vhe = function(e, r, n, i, a) {
  return a !== "textord" && gx(e, "Math-BoldItalic", r).metrics ? {
    fontName: "Math-BoldItalic",
    fontClass: "boldsymbol"
  } : {
    fontName: "Main-Bold",
    fontClass: "mathbf"
  };
}, Ghe = function(e, r, n) {
  var i = e.mode, a = e.text, s = ["mord"], o = i === "math" || i === "text" && r.font, l = o ? r.font : r.fontFamily, u = "", h = "";
  if (a.charCodeAt(0) === 55349 && ([u, h] = $he(a, i)), u.length > 0)
    return ls(a, u, i, r, s.concat(h));
  if (l) {
    var d, f;
    if (l === "boldsymbol") {
      var p = Vhe(a, i, r, s, n);
      d = p.fontName, f = [p.fontClass];
    } else o ? (d = b$[l].fontName, f = [l]) : (d = U1(l, r.fontWeight, r.fontShape), f = [l, r.fontWeight, r.fontShape]);
    if (gx(a, d, i).metrics)
      return ls(a, d, i, r, s.concat(f));
    if (v$.hasOwnProperty(a) && d.slice(0, 10) === "Typewriter") {
      for (var g = [], m = 0; m < a.length; m++)
        g.push(ls(a[m], d, i, r, s.concat(f)));
      return x$(g);
    }
  }
  if (n === "mathord")
    return ls(a, "Math-Italic", i, r, s.concat(["mathnormal"]));
  if (n === "textord") {
    var v = Vr[i][a] && Vr[i][a].font;
    if (v === "ams") {
      var y = U1("amsrm", r.fontWeight, r.fontShape);
      return ls(a, y, i, r, s.concat("amsrm", r.fontWeight, r.fontShape));
    } else if (v === "main" || !v) {
      var b = U1("textrm", r.fontWeight, r.fontShape);
      return ls(a, b, i, r, s.concat(r.fontWeight, r.fontShape));
    } else {
      var w = U1(v, r.fontWeight, r.fontShape);
      return ls(a, w, i, r, s.concat(w, r.fontWeight, r.fontShape));
    }
  } else
    throw new Error("unexpected type: " + n + " in makeOrd");
}, Uhe = (t, e) => {
  if ($l(t.classes) !== $l(e.classes) || t.skew !== e.skew || t.maxFontSize !== e.maxFontSize)
    return !1;
  if (t.classes.length === 1) {
    var r = t.classes[0];
    if (r === "mbin" || r === "mord")
      return !1;
  }
  for (var n in t.style)
    if (t.style.hasOwnProperty(n) && t.style[n] !== e.style[n])
      return !1;
  for (var i in e.style)
    if (e.style.hasOwnProperty(i) && t.style[i] !== e.style[i])
      return !1;
  return !0;
}, Whe = (t) => {
  for (var e = 0; e < t.length - 1; e++) {
    var r = t[e], n = t[e + 1];
    r instanceof rs && n instanceof rs && Uhe(r, n) && (r.text += n.text, r.height = Math.max(r.height, n.height), r.depth = Math.max(r.depth, n.depth), r.italic = n.italic, t.splice(e + 1, 1), e--);
  }
  return t;
}, lk = function(e) {
  for (var r = 0, n = 0, i = 0, a = 0; a < e.children.length; a++) {
    var s = e.children[a];
    s.height > r && (r = s.height), s.depth > n && (n = s.depth), s.maxFontSize > i && (i = s.maxFontSize);
  }
  e.height = r, e.depth = n, e.maxFontSize = i;
}, ra = function(e, r, n, i) {
  var a = new Wg(e, r, n, i);
  return lk(a), a;
}, y$ = (t, e, r, n) => new Wg(t, e, r, n), Hhe = function(e, r, n) {
  var i = ra([e], [], r);
  return i.height = Math.max(n || r.fontMetrics().defaultRuleThickness, r.minRuleThickness), i.style.borderBottomWidth = gt(i.height), i.maxFontSize = 1, i;
}, qhe = function(e, r, n, i) {
  var a = new ok(e, r, n, i);
  return lk(a), a;
}, x$ = function(e) {
  var r = new Ug(e);
  return lk(r), r;
}, Yhe = function(e, r) {
  return e instanceof Ug ? ra([], [e], r) : e;
}, Xhe = function(e) {
  if (e.positionType === "individualShift") {
    for (var r = e.children, n = [r[0]], i = -r[0].shift - r[0].elem.depth, a = i, s = 1; s < r.length; s++) {
      var o = -r[s].shift - a - r[s].elem.depth, l = o - (r[s - 1].elem.height + r[s - 1].elem.depth);
      a = a + o, n.push({
        type: "kern",
        size: l
      }), n.push(r[s]);
    }
    return {
      children: n,
      depth: i
    };
  }
  var u;
  if (e.positionType === "top") {
    for (var h = e.positionData, d = 0; d < e.children.length; d++) {
      var f = e.children[d];
      h -= f.type === "kern" ? f.size : f.elem.height + f.elem.depth;
    }
    u = h;
  } else if (e.positionType === "bottom")
    u = -e.positionData;
  else {
    var p = e.children[0];
    if (p.type !== "elem")
      throw new Error('First child must have type "elem".');
    if (e.positionType === "shift")
      u = -p.elem.depth - e.positionData;
    else if (e.positionType === "firstBaseline")
      u = -p.elem.depth;
    else
      throw new Error("Invalid positionType " + e.positionType + ".");
  }
  return {
    children: e.children,
    depth: u
  };
}, jhe = function(e, r) {
  for (var {
    children: n,
    depth: i
  } = Xhe(e), a = 0, s = 0; s < n.length; s++) {
    var o = n[s];
    if (o.type === "elem") {
      var l = o.elem;
      a = Math.max(a, l.maxFontSize, l.height);
    }
  }
  a += 2;
  var u = ra(["pstrut"], []);
  u.style.height = gt(a);
  for (var h = [], d = i, f = i, p = i, g = 0; g < n.length; g++) {
    var m = n[g];
    if (m.type === "kern")
      p += m.size;
    else {
      var v = m.elem, y = m.wrapperClasses || [], b = m.wrapperStyle || {}, w = ra(y, [u, v], void 0, b);
      w.style.top = gt(-a - p - v.depth), m.marginLeft && (w.style.marginLeft = m.marginLeft), m.marginRight && (w.style.marginRight = m.marginRight), h.push(w), p += v.height + v.depth;
    }
    d = Math.min(d, p), f = Math.max(f, p);
  }
  var T = ra(["vlist"], h);
  T.style.height = gt(f);
  var E;
  if (d < 0) {
    var C = ra([], []), k = ra(["vlist"], [C]);
    k.style.height = gt(-d);
    var _ = ra(["vlist-s"], [new rs("​")]);
    E = [ra(["vlist-r"], [T, _]), ra(["vlist-r"], [k])];
  } else
    E = [ra(["vlist-r"], [T])];
  var L = ra(["vlist-t"], E);
  return E.length === 2 && L.classes.push("vlist-t2"), L.height = f, L.depth = -d, L;
}, Khe = (t, e) => {
  var r = ra(["mspace"], [], e), n = en(t, e);
  return r.style.marginRight = gt(n), r;
}, U1 = function(e, r, n) {
  var i = "";
  switch (e) {
    case "amsrm":
      i = "AMS";
      break;
    case "textrm":
      i = "Main";
      break;
    case "textsf":
      i = "SansSerif";
      break;
    case "texttt":
      i = "Typewriter";
      break;
    default:
      i = e;
  }
  var a;
  return r === "textbf" && n === "textit" ? a = "BoldItalic" : r === "textbf" ? a = "Bold" : r === "textit" ? a = "Italic" : a = "Regular", i + "-" + a;
}, b$ = {
  // styles
  mathbf: {
    variant: "bold",
    fontName: "Main-Bold"
  },
  mathrm: {
    variant: "normal",
    fontName: "Main-Regular"
  },
  textit: {
    variant: "italic",
    fontName: "Main-Italic"
  },
  mathit: {
    variant: "italic",
    fontName: "Main-Italic"
  },
  mathnormal: {
    variant: "italic",
    fontName: "Math-Italic"
  },
  mathsfit: {
    variant: "sans-serif-italic",
    fontName: "SansSerif-Italic"
  },
  // "boldsymbol" is missing because they require the use of multiple fonts:
  // Math-BoldItalic and Main-Bold.  This is handled by a special case in
  // makeOrd which ends up calling boldsymbol.
  // families
  mathbb: {
    variant: "double-struck",
    fontName: "AMS-Regular"
  },
  mathcal: {
    variant: "script",
    fontName: "Caligraphic-Regular"
  },
  mathfrak: {
    variant: "fraktur",
    fontName: "Fraktur-Regular"
  },
  mathscr: {
    variant: "script",
    fontName: "Script-Regular"
  },
  mathsf: {
    variant: "sans-serif",
    fontName: "SansSerif-Regular"
  },
  mathtt: {
    variant: "monospace",
    fontName: "Typewriter-Regular"
  }
}, w$ = {
  //   path, width, height
  vec: ["vec", 0.471, 0.714],
  // values from the font glyph
  oiintSize1: ["oiintSize1", 0.957, 0.499],
  // oval to overlay the integrand
  oiintSize2: ["oiintSize2", 1.472, 0.659],
  oiiintSize1: ["oiiintSize1", 1.304, 0.499],
  oiiintSize2: ["oiiintSize2", 1.98, 0.659]
}, Zhe = function(e, r) {
  var [n, i, a] = w$[e], s = new zl(n), o = new Yo([s], {
    width: gt(i),
    height: gt(a),
    // Override CSS rule `.katex svg { width: 100% }`
    style: "width:" + gt(i),
    viewBox: "0 0 " + 1e3 * i + " " + 1e3 * a,
    preserveAspectRatio: "xMinYMin"
  }), l = y$(["overlay"], [o], r);
  return l.height = a, l.style.height = gt(a), l.style.width = gt(i), l;
}, Fe = {
  fontMap: b$,
  makeSymbol: ls,
  mathsym: zhe,
  makeSpan: ra,
  makeSvgSpan: y$,
  makeLineSpan: Hhe,
  makeAnchor: qhe,
  makeFragment: x$,
  wrapFragment: Yhe,
  makeVList: jhe,
  makeOrd: Ghe,
  makeGlue: Khe,
  staticSvg: Zhe,
  svgData: w$,
  tryCombineChars: Whe
}, Jr = {
  number: 3,
  unit: "mu"
}, Cc = {
  number: 4,
  unit: "mu"
}, vo = {
  number: 5,
  unit: "mu"
}, Qhe = {
  mord: {
    mop: Jr,
    mbin: Cc,
    mrel: vo,
    minner: Jr
  },
  mop: {
    mord: Jr,
    mop: Jr,
    mrel: vo,
    minner: Jr
  },
  mbin: {
    mord: Cc,
    mop: Cc,
    mopen: Cc,
    minner: Cc
  },
  mrel: {
    mord: vo,
    mop: vo,
    mopen: vo,
    minner: vo
  },
  mopen: {},
  mclose: {
    mop: Jr,
    mbin: Cc,
    mrel: vo,
    minner: Jr
  },
  mpunct: {
    mord: Jr,
    mop: Jr,
    mrel: vo,
    mopen: Jr,
    mclose: Jr,
    mpunct: Jr,
    minner: Jr
  },
  minner: {
    mord: Jr,
    mop: Jr,
    mbin: Cc,
    mrel: vo,
    mopen: Jr,
    mpunct: Jr,
    minner: Jr
  }
}, Jhe = {
  mord: {
    mop: Jr
  },
  mop: {
    mord: Jr,
    mop: Jr
  },
  mbin: {},
  mrel: {},
  mopen: {},
  mclose: {
    mop: Jr
  },
  mpunct: {},
  minner: {
    mop: Jr
  }
}, T$ = {}, _y = {}, Ly = {};
function Et(t) {
  for (var {
    type: e,
    names: r,
    props: n,
    handler: i,
    htmlBuilder: a,
    mathmlBuilder: s
  } = t, o = {
    type: e,
    numArgs: n.numArgs,
    argTypes: n.argTypes,
    allowedInArgument: !!n.allowedInArgument,
    allowedInText: !!n.allowedInText,
    allowedInMath: n.allowedInMath === void 0 ? !0 : n.allowedInMath,
    numOptionalArgs: n.numOptionalArgs || 0,
    infix: !!n.infix,
    primitive: !!n.primitive,
    handler: i
  }, l = 0; l < r.length; ++l)
    T$[r[l]] = o;
  e && (a && (_y[e] = a), s && (Ly[e] = s));
}
function Ou(t) {
  var {
    type: e,
    htmlBuilder: r,
    mathmlBuilder: n
  } = t;
  Et({
    type: e,
    names: [],
    props: {
      numArgs: 0
    },
    handler() {
      throw new Error("Should never be called.");
    },
    htmlBuilder: r,
    mathmlBuilder: n
  });
}
var Ry = function(e) {
  return e.type === "ordgroup" && e.body.length === 1 ? e.body[0] : e;
}, yn = function(e) {
  return e.type === "ordgroup" ? e.body : [e];
}, Xo = Fe.makeSpan, ede = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"], tde = ["rightmost", "mrel", "mclose", "mpunct"], rde = {
  display: Vt.DISPLAY,
  text: Vt.TEXT,
  script: Vt.SCRIPT,
  scriptscript: Vt.SCRIPTSCRIPT
}, nde = {
  mord: "mord",
  mop: "mop",
  mbin: "mbin",
  mrel: "mrel",
  mopen: "mopen",
  mclose: "mclose",
  mpunct: "mpunct",
  minner: "minner"
}, Fn = function(e, r, n, i) {
  i === void 0 && (i = [null, null]);
  for (var a = [], s = 0; s < e.length; s++) {
    var o = yr(e[s], r);
    if (o instanceof Ug) {
      var l = o.children;
      a.push(...l);
    } else
      a.push(o);
  }
  if (Fe.tryCombineChars(a), !n)
    return a;
  var u = r;
  if (e.length === 1) {
    var h = e[0];
    h.type === "sizing" ? u = r.havingSize(h.size) : h.type === "styling" && (u = r.havingStyle(rde[h.style]));
  }
  var d = Xo([i[0] || "leftmost"], [], r), f = Xo([i[1] || "rightmost"], [], r), p = n === "root";
  return I8(a, (g, m) => {
    var v = m.classes[0], y = g.classes[0];
    v === "mbin" && tde.includes(y) ? m.classes[0] = "mord" : y === "mbin" && ede.includes(v) && (g.classes[0] = "mord");
  }, {
    node: d
  }, f, p), I8(a, (g, m) => {
    var v = Jw(m), y = Jw(g), b = v && y ? g.hasClass("mtight") ? Jhe[v][y] : Qhe[v][y] : null;
    if (b)
      return Fe.makeGlue(b, u);
  }, {
    node: d
  }, f, p), a;
}, I8 = function t(e, r, n, i, a) {
  i && e.push(i);
  for (var s = 0; s < e.length; s++) {
    var o = e[s], l = E$(o);
    if (l) {
      t(l.children, r, n, null, a);
      continue;
    }
    var u = !o.hasClass("mspace");
    if (u) {
      var h = r(o, n.node);
      h && (n.insertAfter ? n.insertAfter(h) : (e.unshift(h), s++));
    }
    u ? n.node = o : a && o.hasClass("newline") && (n.node = Xo(["leftmost"])), n.insertAfter = /* @__PURE__ */ ((d) => (f) => {
      e.splice(d + 1, 0, f), s++;
    })(s);
  }
  i && e.pop();
}, E$ = function(e) {
  return e instanceof Ug || e instanceof ok || e instanceof Wg && e.hasClass("enclosing") ? e : null;
}, ide = function t(e, r) {
  var n = E$(e);
  if (n) {
    var i = n.children;
    if (i.length) {
      if (r === "right")
        return t(i[i.length - 1], "right");
      if (r === "left")
        return t(i[0], "left");
    }
  }
  return e;
}, Jw = function(e, r) {
  return e ? (r && (e = ide(e, r)), nde[e.classes[0]] || null) : null;
}, eg = function(e, r) {
  var n = ["nulldelimiter"].concat(e.baseSizingClasses());
  return Xo(r.concat(n));
}, yr = function(e, r, n) {
  if (!e)
    return Xo();
  if (_y[e.type]) {
    var i = _y[e.type](e, r);
    if (n && r.size !== n.size) {
      i = Xo(r.sizingClasses(n), [i], r);
      var a = r.sizeMultiplier / n.sizeMultiplier;
      i.height *= a, i.depth *= a;
    }
    return i;
  } else
    throw new ot("Got group of unknown type: '" + e.type + "'");
};
function W1(t, e) {
  var r = Xo(["base"], t, e), n = Xo(["strut"]);
  return n.style.height = gt(r.height + r.depth), r.depth && (n.style.verticalAlign = gt(-r.depth)), r.children.unshift(n), r;
}
function eT(t, e) {
  var r = null;
  t.length === 1 && t[0].type === "tag" && (r = t[0].tag, t = t[0].body);
  var n = Fn(t, e, "root"), i;
  n.length === 2 && n[1].hasClass("tag") && (i = n.pop());
  for (var a = [], s = [], o = 0; o < n.length; o++)
    if (s.push(n[o]), n[o].hasClass("mbin") || n[o].hasClass("mrel") || n[o].hasClass("allowbreak")) {
      for (var l = !1; o < n.length - 1 && n[o + 1].hasClass("mspace") && !n[o + 1].hasClass("newline"); )
        o++, s.push(n[o]), n[o].hasClass("nobreak") && (l = !0);
      l || (a.push(W1(s, e)), s = []);
    } else n[o].hasClass("newline") && (s.pop(), s.length > 0 && (a.push(W1(s, e)), s = []), a.push(n[o]));
  s.length > 0 && a.push(W1(s, e));
  var u;
  r ? (u = W1(Fn(r, e, !0)), u.classes = ["tag"], a.push(u)) : i && a.push(i);
  var h = Xo(["katex-html"], a);
  if (h.setAttribute("aria-hidden", "true"), u) {
    var d = u.children[0];
    d.style.height = gt(h.height + h.depth), h.depth && (d.style.verticalAlign = gt(-h.depth));
  }
  return h;
}
function k$(t) {
  return new Ug(t);
}
class ka {
  constructor(e, r, n) {
    this.type = void 0, this.attributes = void 0, this.children = void 0, this.classes = void 0, this.type = e, this.attributes = {}, this.children = r || [], this.classes = n || [];
  }
  /**
   * Sets an attribute on a MathML node. MathML depends on attributes to convey a
   * semantic content, so this is used heavily.
   */
  setAttribute(e, r) {
    this.attributes[e] = r;
  }
  /**
   * Gets an attribute on a MathML node.
   */
  getAttribute(e) {
    return this.attributes[e];
  }
  /**
   * Converts the math node into a MathML-namespaced DOM element.
   */
  toNode() {
    var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && e.setAttribute(r, this.attributes[r]);
    this.classes.length > 0 && (e.className = $l(this.classes));
    for (var n = 0; n < this.children.length; n++)
      if (this.children[n] instanceof Us && this.children[n + 1] instanceof Us) {
        for (var i = this.children[n].toText() + this.children[++n].toText(); this.children[n + 1] instanceof Us; )
          i += this.children[++n].toText();
        e.appendChild(new Us(i).toNode());
      } else
        e.appendChild(this.children[n].toNode());
    return e;
  }
  /**
   * Converts the math node into an HTML markup string.
   */
  toMarkup() {
    var e = "<" + this.type;
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && (e += " " + r + '="', e += Tr.escape(this.attributes[r]), e += '"');
    this.classes.length > 0 && (e += ' class ="' + Tr.escape($l(this.classes)) + '"'), e += ">";
    for (var n = 0; n < this.children.length; n++)
      e += this.children[n].toMarkup();
    return e += "</" + this.type + ">", e;
  }
  /**
   * Converts the math node into a string, similar to innerText, but escaped.
   */
  toText() {
    return this.children.map((e) => e.toText()).join("");
  }
}
class Us {
  constructor(e) {
    this.text = void 0, this.text = e;
  }
  /**
   * Converts the text node into a DOM text node.
   */
  toNode() {
    return document.createTextNode(this.text);
  }
  /**
   * Converts the text node into escaped HTML markup
   * (representing the text itself).
   */
  toMarkup() {
    return Tr.escape(this.toText());
  }
  /**
   * Converts the text node into a string
   * (representing the text itself).
   */
  toText() {
    return this.text;
  }
}
class ade {
  /**
   * Create a Space node with width given in CSS ems.
   */
  constructor(e) {
    this.width = void 0, this.character = void 0, this.width = e, e >= 0.05555 && e <= 0.05556 ? this.character = " " : e >= 0.1666 && e <= 0.1667 ? this.character = " " : e >= 0.2222 && e <= 0.2223 ? this.character = " " : e >= 0.2777 && e <= 0.2778 ? this.character = "  " : e >= -0.05556 && e <= -0.05555 ? this.character = " ⁣" : e >= -0.1667 && e <= -0.1666 ? this.character = " ⁣" : e >= -0.2223 && e <= -0.2222 ? this.character = " ⁣" : e >= -0.2778 && e <= -0.2777 ? this.character = " ⁣" : this.character = null;
  }
  /**
   * Converts the math node into a MathML-namespaced DOM element.
   */
  toNode() {
    if (this.character)
      return document.createTextNode(this.character);
    var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
    return e.setAttribute("width", gt(this.width)), e;
  }
  /**
   * Converts the math node into an HTML markup string.
   */
  toMarkup() {
    return this.character ? "<mtext>" + this.character + "</mtext>" : '<mspace width="' + gt(this.width) + '"/>';
  }
  /**
   * Converts the math node into a string, similar to innerText.
   */
  toText() {
    return this.character ? this.character : " ";
  }
}
var it = {
  MathNode: ka,
  TextNode: Us,
  SpaceNode: ade,
  newDocumentFragment: k$
}, ns = function(e, r, n) {
  return Vr[r][e] && Vr[r][e].replace && e.charCodeAt(0) !== 55349 && !(v$.hasOwnProperty(e) && n && (n.fontFamily && n.fontFamily.slice(4, 6) === "tt" || n.font && n.font.slice(4, 6) === "tt")) && (e = Vr[r][e].replace), new it.TextNode(e);
}, ck = function(e) {
  return e.length === 1 ? e[0] : new it.MathNode("mrow", e);
}, uk = function(e, r) {
  if (r.fontFamily === "texttt")
    return "monospace";
  if (r.fontFamily === "textsf")
    return r.fontShape === "textit" && r.fontWeight === "textbf" ? "sans-serif-bold-italic" : r.fontShape === "textit" ? "sans-serif-italic" : r.fontWeight === "textbf" ? "bold-sans-serif" : "sans-serif";
  if (r.fontShape === "textit" && r.fontWeight === "textbf")
    return "bold-italic";
  if (r.fontShape === "textit")
    return "italic";
  if (r.fontWeight === "textbf")
    return "bold";
  var n = r.font;
  if (!n || n === "mathnormal")
    return null;
  var i = e.mode;
  if (n === "mathit")
    return "italic";
  if (n === "boldsymbol")
    return e.type === "textord" ? "bold" : "bold-italic";
  if (n === "mathbf")
    return "bold";
  if (n === "mathbb")
    return "double-struck";
  if (n === "mathsfit")
    return "sans-serif-italic";
  if (n === "mathfrak")
    return "fraktur";
  if (n === "mathscr" || n === "mathcal")
    return "script";
  if (n === "mathsf")
    return "sans-serif";
  if (n === "mathtt")
    return "monospace";
  var a = e.text;
  if (["\\imath", "\\jmath"].includes(a))
    return null;
  Vr[i][a] && Vr[i][a].replace && (a = Vr[i][a].replace);
  var s = Fe.fontMap[n].fontName;
  return sk(a, s, i) ? Fe.fontMap[n].variant : null;
};
function c4(t) {
  if (!t)
    return !1;
  if (t.type === "mi" && t.children.length === 1) {
    var e = t.children[0];
    return e instanceof Us && e.text === ".";
  } else if (t.type === "mo" && t.children.length === 1 && t.getAttribute("separator") === "true" && t.getAttribute("lspace") === "0em" && t.getAttribute("rspace") === "0em") {
    var r = t.children[0];
    return r instanceof Us && r.text === ",";
  } else
    return !1;
}
var ga = function(e, r, n) {
  if (e.length === 1) {
    var i = Fr(e[0], r);
    return n && i instanceof ka && i.type === "mo" && (i.setAttribute("lspace", "0em"), i.setAttribute("rspace", "0em")), [i];
  }
  for (var a = [], s, o = 0; o < e.length; o++) {
    var l = Fr(e[o], r);
    if (l instanceof ka && s instanceof ka) {
      if (l.type === "mtext" && s.type === "mtext" && l.getAttribute("mathvariant") === s.getAttribute("mathvariant")) {
        s.children.push(...l.children);
        continue;
      } else if (l.type === "mn" && s.type === "mn") {
        s.children.push(...l.children);
        continue;
      } else if (c4(l) && s.type === "mn") {
        s.children.push(...l.children);
        continue;
      } else if (l.type === "mn" && c4(s))
        l.children = [...s.children, ...l.children], a.pop();
      else if ((l.type === "msup" || l.type === "msub") && l.children.length >= 1 && (s.type === "mn" || c4(s))) {
        var u = l.children[0];
        u instanceof ka && u.type === "mn" && (u.children = [...s.children, ...u.children], a.pop());
      } else if (s.type === "mi" && s.children.length === 1) {
        var h = s.children[0];
        if (h instanceof Us && h.text === "̸" && (l.type === "mo" || l.type === "mi" || l.type === "mn")) {
          var d = l.children[0];
          d instanceof Us && d.text.length > 0 && (d.text = d.text.slice(0, 1) + "̸" + d.text.slice(1), a.pop());
        }
      }
    }
    a.push(l), s = l;
  }
  return a;
}, Vl = function(e, r, n) {
  return ck(ga(e, r, n));
}, Fr = function(e, r) {
  if (!e)
    return new it.MathNode("mrow");
  if (Ly[e.type]) {
    var n = Ly[e.type](e, r);
    return n;
  } else
    throw new ot("Got group of unknown type: '" + e.type + "'");
};
function O8(t, e, r, n, i) {
  var a = ga(t, r), s;
  a.length === 1 && a[0] instanceof ka && ["mrow", "mtable"].includes(a[0].type) ? s = a[0] : s = new it.MathNode("mrow", a);
  var o = new it.MathNode("annotation", [new it.TextNode(e)]);
  o.setAttribute("encoding", "application/x-tex");
  var l = new it.MathNode("semantics", [s, o]), u = new it.MathNode("math", [l]);
  u.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"), n && u.setAttribute("display", "block");
  var h = i ? "katex" : "katex-mathml";
  return Fe.makeSpan([h], [u]);
}
var S$ = function(e) {
  return new Co({
    style: e.displayMode ? Vt.DISPLAY : Vt.TEXT,
    maxSize: e.maxSize,
    minRuleThickness: e.minRuleThickness
  });
}, C$ = function(e, r) {
  if (r.displayMode) {
    var n = ["katex-display"];
    r.leqno && n.push("leqno"), r.fleqn && n.push("fleqn"), e = Fe.makeSpan(n, [e]);
  }
  return e;
}, sde = function(e, r, n) {
  var i = S$(n), a;
  if (n.output === "mathml")
    return O8(e, r, i, n.displayMode, !0);
  if (n.output === "html") {
    var s = eT(e, i);
    a = Fe.makeSpan(["katex"], [s]);
  } else {
    var o = O8(e, r, i, n.displayMode, !1), l = eT(e, i);
    a = Fe.makeSpan(["katex"], [o, l]);
  }
  return C$(a, n);
}, ode = function(e, r, n) {
  var i = S$(n), a = eT(e, i), s = Fe.makeSpan(["katex"], [a]);
  return C$(s, n);
}, lde = {
  widehat: "^",
  widecheck: "ˇ",
  widetilde: "~",
  utilde: "~",
  overleftarrow: "←",
  underleftarrow: "←",
  xleftarrow: "←",
  overrightarrow: "→",
  underrightarrow: "→",
  xrightarrow: "→",
  underbrace: "⏟",
  overbrace: "⏞",
  overgroup: "⏠",
  undergroup: "⏡",
  overleftrightarrow: "↔",
  underleftrightarrow: "↔",
  xleftrightarrow: "↔",
  Overrightarrow: "⇒",
  xRightarrow: "⇒",
  overleftharpoon: "↼",
  xleftharpoonup: "↼",
  overrightharpoon: "⇀",
  xrightharpoonup: "⇀",
  xLeftarrow: "⇐",
  xLeftrightarrow: "⇔",
  xhookleftarrow: "↩",
  xhookrightarrow: "↪",
  xmapsto: "↦",
  xrightharpoondown: "⇁",
  xleftharpoondown: "↽",
  xrightleftharpoons: "⇌",
  xleftrightharpoons: "⇋",
  xtwoheadleftarrow: "↞",
  xtwoheadrightarrow: "↠",
  xlongequal: "=",
  xtofrom: "⇄",
  xrightleftarrows: "⇄",
  xrightequilibrium: "⇌",
  // Not a perfect match.
  xleftequilibrium: "⇋",
  // None better available.
  "\\cdrightarrow": "→",
  "\\cdleftarrow": "←",
  "\\cdlongequal": "="
}, cde = function(e) {
  var r = new it.MathNode("mo", [new it.TextNode(lde[e.replace(/^\\/, "")])]);
  return r.setAttribute("stretchy", "true"), r;
}, ude = {
  //   path(s), minWidth, height, align
  overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
  underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
  xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
  "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"],
  // CD minwwidth2.5pc
  xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
  "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"],
  Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
  xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
  xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
  overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
  xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
  overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
  xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
  xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
  "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"],
  xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
  xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
  overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
  underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
  underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
  xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
  xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
  xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
  xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
  xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
  xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
  overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
  overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
  undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
  xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
  xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
  // The next three arrows are from the mhchem package.
  // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
  // document as \xrightarrow or \xrightleftharpoons. Those have
  // min-length = 1.75em, so we set min-length on these next three to match.
  xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
  xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
  xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
}, hde = function(e) {
  return e.type === "ordgroup" ? e.body.length : 1;
}, dde = function(e, r) {
  function n() {
    var o = 4e5, l = e.label.slice(1);
    if (["widehat", "widecheck", "widetilde", "utilde"].includes(l)) {
      var u = e, h = hde(u.base), d, f, p;
      if (h > 5)
        l === "widehat" || l === "widecheck" ? (d = 420, o = 2364, p = 0.42, f = l + "4") : (d = 312, o = 2340, p = 0.34, f = "tilde4");
      else {
        var g = [1, 1, 2, 2, 3, 3][h];
        l === "widehat" || l === "widecheck" ? (o = [0, 1062, 2364, 2364, 2364][g], d = [0, 239, 300, 360, 420][g], p = [0, 0.24, 0.3, 0.3, 0.36, 0.42][g], f = l + g) : (o = [0, 600, 1033, 2339, 2340][g], d = [0, 260, 286, 306, 312][g], p = [0, 0.26, 0.286, 0.3, 0.306, 0.34][g], f = "tilde" + g);
      }
      var m = new zl(f), v = new Yo([m], {
        width: "100%",
        height: gt(p),
        viewBox: "0 0 " + o + " " + d,
        preserveAspectRatio: "none"
      });
      return {
        span: Fe.makeSvgSpan([], [v], r),
        minWidth: 0,
        height: p
      };
    } else {
      var y = [], b = ude[l], [w, T, E] = b, C = E / 1e3, k = w.length, _, L;
      if (k === 1) {
        var N = b[3];
        _ = ["hide-tail"], L = [N];
      } else if (k === 2)
        _ = ["halfarrow-left", "halfarrow-right"], L = ["xMinYMin", "xMaxYMin"];
      else if (k === 3)
        _ = ["brace-left", "brace-center", "brace-right"], L = ["xMinYMin", "xMidYMin", "xMaxYMin"];
      else
        throw new Error(`Correct katexImagesData or update code here to support
                    ` + k + " children.");
      for (var A = 0; A < k; A++) {
        var O = new zl(w[A]), P = new Yo([O], {
          width: "400em",
          height: gt(C),
          viewBox: "0 0 " + o + " " + E,
          preserveAspectRatio: L[A] + " slice"
        }), S = Fe.makeSvgSpan([_[A]], [P], r);
        if (k === 1)
          return {
            span: S,
            minWidth: T,
            height: C
          };
        S.style.height = gt(C), y.push(S);
      }
      return {
        span: Fe.makeSpan(["stretchy"], y, r),
        minWidth: T,
        height: C
      };
    }
  }
  var {
    span: i,
    minWidth: a,
    height: s
  } = n();
  return i.height = s, i.style.height = gt(s), a > 0 && (i.style.minWidth = gt(a)), i;
}, fde = function(e, r, n, i, a) {
  var s, o = e.height + e.depth + n + i;
  if (/fbox|color|angl/.test(r)) {
    if (s = Fe.makeSpan(["stretchy", r], [], a), r === "fbox") {
      var l = a.color && a.getColor();
      l && (s.style.borderColor = l);
    }
  } else {
    var u = [];
    /^[bx]cancel$/.test(r) && u.push(new Zw({
      x1: "0",
      y1: "0",
      x2: "100%",
      y2: "100%",
      "stroke-width": "0.046em"
    })), /^x?cancel$/.test(r) && u.push(new Zw({
      x1: "0",
      y1: "100%",
      x2: "100%",
      y2: "0",
      "stroke-width": "0.046em"
    }));
    var h = new Yo(u, {
      width: "100%",
      height: gt(o)
    });
    s = Fe.makeSvgSpan([], [h], a);
  }
  return s.height = o, s.style.height = gt(o), s;
}, jo = {
  encloseSpan: fde,
  mathMLnode: cde,
  svgSpan: dde
};
function Qt(t, e) {
  if (!t || t.type !== e)
    throw new Error("Expected node of type " + e + ", but got " + (t ? "node of type " + t.type : String(t)));
  return t;
}
function hk(t) {
  var e = mx(t);
  if (!e)
    throw new Error("Expected node of symbol group type, but got " + (t ? "node of type " + t.type : String(t)));
  return e;
}
function mx(t) {
  return t && (t.type === "atom" || Fhe.hasOwnProperty(t.type)) ? t : null;
}
var dk = (t, e) => {
  var r, n, i;
  t && t.type === "supsub" ? (n = Qt(t.base, "accent"), r = n.base, t.base = r, i = Phe(yr(t, e)), t.base = n) : (n = Qt(t, "accent"), r = n.base);
  var a = yr(r, e.havingCrampedStyle()), s = n.isShifty && Tr.isCharacterBox(r), o = 0;
  if (s) {
    var l = Tr.getBaseElem(r), u = yr(l, e.havingCrampedStyle());
    o = _8(u).skew;
  }
  var h = n.label === "\\c", d = h ? a.height + a.depth : Math.min(a.height, e.fontMetrics().xHeight), f;
  if (n.isStretchy)
    f = jo.svgSpan(n, e), f = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: a
      }, {
        type: "elem",
        elem: f,
        wrapperClasses: ["svg-align"],
        wrapperStyle: o > 0 ? {
          width: "calc(100% - " + gt(2 * o) + ")",
          marginLeft: gt(2 * o)
        } : void 0
      }]
    }, e);
  else {
    var p, g;
    n.label === "\\vec" ? (p = Fe.staticSvg("vec", e), g = Fe.svgData.vec[1]) : (p = Fe.makeOrd({
      mode: n.mode,
      text: n.label
    }, e, "textord"), p = _8(p), p.italic = 0, g = p.width, h && (d += p.depth)), f = Fe.makeSpan(["accent-body"], [p]);
    var m = n.label === "\\textcircled";
    m && (f.classes.push("accent-full"), d = a.height);
    var v = o;
    m || (v -= g / 2), f.style.left = gt(v), n.label === "\\textcircled" && (f.style.top = ".2em"), f = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: a
      }, {
        type: "kern",
        size: -d
      }, {
        type: "elem",
        elem: f
      }]
    }, e);
  }
  var y = Fe.makeSpan(["mord", "accent"], [f], e);
  return i ? (i.children[0] = y, i.height = Math.max(y.height, i.height), i.classes[0] = "mord", i) : y;
}, A$ = (t, e) => {
  var r = t.isStretchy ? jo.mathMLnode(t.label) : new it.MathNode("mo", [ns(t.label, t.mode)]), n = new it.MathNode("mover", [Fr(t.base, e), r]);
  return n.setAttribute("accent", "true"), n;
}, pde = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((t) => "\\" + t).join("|"));
Et({
  type: "accent",
  names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
  props: {
    numArgs: 1
  },
  handler: (t, e) => {
    var r = Ry(e[0]), n = !pde.test(t.funcName), i = !n || t.funcName === "\\widehat" || t.funcName === "\\widetilde" || t.funcName === "\\widecheck";
    return {
      type: "accent",
      mode: t.parser.mode,
      label: t.funcName,
      isStretchy: n,
      isShifty: i,
      base: r
    };
  },
  htmlBuilder: dk,
  mathmlBuilder: A$
});
Et({
  type: "accent",
  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
  props: {
    numArgs: 1,
    allowedInText: !0,
    allowedInMath: !0,
    // unless in strict mode
    argTypes: ["primitive"]
  },
  handler: (t, e) => {
    var r = e[0], n = t.parser.mode;
    return n === "math" && (t.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + t.funcName + " works only in text mode"), n = "text"), {
      type: "accent",
      mode: n,
      label: t.funcName,
      isStretchy: !1,
      isShifty: !0,
      base: r
    };
  },
  htmlBuilder: dk,
  mathmlBuilder: A$
});
Et({
  type: "accentUnder",
  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
  props: {
    numArgs: 1
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    return {
      type: "accentUnder",
      mode: r.mode,
      label: n,
      base: i
    };
  },
  htmlBuilder: (t, e) => {
    var r = yr(t.base, e), n = jo.svgSpan(t, e), i = t.label === "\\utilde" ? 0.12 : 0, a = Fe.makeVList({
      positionType: "top",
      positionData: r.height,
      children: [{
        type: "elem",
        elem: n,
        wrapperClasses: ["svg-align"]
      }, {
        type: "kern",
        size: i
      }, {
        type: "elem",
        elem: r
      }]
    }, e);
    return Fe.makeSpan(["mord", "accentunder"], [a], e);
  },
  mathmlBuilder: (t, e) => {
    var r = jo.mathMLnode(t.label), n = new it.MathNode("munder", [Fr(t.base, e), r]);
    return n.setAttribute("accentunder", "true"), n;
  }
});
var H1 = (t) => {
  var e = new it.MathNode("mpadded", t ? [t] : []);
  return e.setAttribute("width", "+0.6em"), e.setAttribute("lspace", "0.3em"), e;
};
Et({
  type: "xArrow",
  names: [
    "\\xleftarrow",
    "\\xrightarrow",
    "\\xLeftarrow",
    "\\xRightarrow",
    "\\xleftrightarrow",
    "\\xLeftrightarrow",
    "\\xhookleftarrow",
    "\\xhookrightarrow",
    "\\xmapsto",
    "\\xrightharpoondown",
    "\\xrightharpoonup",
    "\\xleftharpoondown",
    "\\xleftharpoonup",
    "\\xrightleftharpoons",
    "\\xleftrightharpoons",
    "\\xlongequal",
    "\\xtwoheadrightarrow",
    "\\xtwoheadleftarrow",
    "\\xtofrom",
    // The next 3 functions are here to support the mhchem extension.
    // Direct use of these functions is discouraged and may break someday.
    "\\xrightleftarrows",
    "\\xrightequilibrium",
    "\\xleftequilibrium",
    // The next 3 functions are here only to support the {CD} environment.
    "\\\\cdrightarrow",
    "\\\\cdleftarrow",
    "\\\\cdlongequal"
  ],
  props: {
    numArgs: 1,
    numOptionalArgs: 1
  },
  handler(t, e, r) {
    var {
      parser: n,
      funcName: i
    } = t;
    return {
      type: "xArrow",
      mode: n.mode,
      label: i,
      body: e[0],
      below: r[0]
    };
  },
  // Flow is unable to correctly infer the type of `group`, even though it's
  // unambiguously determined from the passed-in `type` above.
  htmlBuilder(t, e) {
    var r = e.style, n = e.havingStyle(r.sup()), i = Fe.wrapFragment(yr(t.body, n, e), e), a = t.label.slice(0, 2) === "\\x" ? "x" : "cd";
    i.classes.push(a + "-arrow-pad");
    var s;
    t.below && (n = e.havingStyle(r.sub()), s = Fe.wrapFragment(yr(t.below, n, e), e), s.classes.push(a + "-arrow-pad"));
    var o = jo.svgSpan(t, e), l = -e.fontMetrics().axisHeight + 0.5 * o.height, u = -e.fontMetrics().axisHeight - 0.5 * o.height - 0.111;
    (i.depth > 0.25 || t.label === "\\xleftequilibrium") && (u -= i.depth);
    var h;
    if (s) {
      var d = -e.fontMetrics().axisHeight + s.height + 0.5 * o.height + 0.111;
      h = Fe.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: i,
          shift: u
        }, {
          type: "elem",
          elem: o,
          shift: l
        }, {
          type: "elem",
          elem: s,
          shift: d
        }]
      }, e);
    } else
      h = Fe.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: i,
          shift: u
        }, {
          type: "elem",
          elem: o,
          shift: l
        }]
      }, e);
    return h.children[0].children[0].children[1].classes.push("svg-align"), Fe.makeSpan(["mrel", "x-arrow"], [h], e);
  },
  mathmlBuilder(t, e) {
    var r = jo.mathMLnode(t.label);
    r.setAttribute("minsize", t.label.charAt(0) === "x" ? "1.75em" : "3.0em");
    var n;
    if (t.body) {
      var i = H1(Fr(t.body, e));
      if (t.below) {
        var a = H1(Fr(t.below, e));
        n = new it.MathNode("munderover", [r, a, i]);
      } else
        n = new it.MathNode("mover", [r, i]);
    } else if (t.below) {
      var s = H1(Fr(t.below, e));
      n = new it.MathNode("munder", [r, s]);
    } else
      n = H1(), n = new it.MathNode("mover", [r, n]);
    return n;
  }
});
var gde = Fe.makeSpan;
function _$(t, e) {
  var r = Fn(t.body, e, !0);
  return gde([t.mclass], r, e);
}
function L$(t, e) {
  var r, n = ga(t.body, e);
  return t.mclass === "minner" ? r = new it.MathNode("mpadded", n) : t.mclass === "mord" ? t.isCharacterBox ? (r = n[0], r.type = "mi") : r = new it.MathNode("mi", n) : (t.isCharacterBox ? (r = n[0], r.type = "mo") : r = new it.MathNode("mo", n), t.mclass === "mbin" ? (r.attributes.lspace = "0.22em", r.attributes.rspace = "0.22em") : t.mclass === "mpunct" ? (r.attributes.lspace = "0em", r.attributes.rspace = "0.17em") : t.mclass === "mopen" || t.mclass === "mclose" ? (r.attributes.lspace = "0em", r.attributes.rspace = "0em") : t.mclass === "minner" && (r.attributes.lspace = "0.0556em", r.attributes.width = "+0.1111em")), r;
}
Et({
  type: "mclass",
  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    return {
      type: "mclass",
      mode: r.mode,
      mclass: "m" + n.slice(5),
      // TODO(kevinb): don't prefix with 'm'
      body: yn(i),
      isCharacterBox: Tr.isCharacterBox(i)
    };
  },
  htmlBuilder: _$,
  mathmlBuilder: L$
});
var vx = (t) => {
  var e = t.type === "ordgroup" && t.body.length ? t.body[0] : t;
  return e.type === "atom" && (e.family === "bin" || e.family === "rel") ? "m" + e.family : "mord";
};
Et({
  type: "mclass",
  names: ["\\@binrel"],
  props: {
    numArgs: 2
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "mclass",
      mode: r.mode,
      mclass: vx(e[0]),
      body: yn(e[1]),
      isCharacterBox: Tr.isCharacterBox(e[1])
    };
  }
});
Et({
  type: "mclass",
  names: ["\\stackrel", "\\overset", "\\underset"],
  props: {
    numArgs: 2
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t, i = e[1], a = e[0], s;
    n !== "\\stackrel" ? s = vx(i) : s = "mrel";
    var o = {
      type: "op",
      mode: i.mode,
      limits: !0,
      alwaysHandleSupSub: !0,
      parentIsSupSub: !1,
      symbol: !1,
      suppressBaseShift: n !== "\\stackrel",
      body: yn(i)
    }, l = {
      type: "supsub",
      mode: a.mode,
      base: o,
      sup: n === "\\underset" ? null : a,
      sub: n === "\\underset" ? a : null
    };
    return {
      type: "mclass",
      mode: r.mode,
      mclass: s,
      body: [l],
      isCharacterBox: Tr.isCharacterBox(l)
    };
  },
  htmlBuilder: _$,
  mathmlBuilder: L$
});
Et({
  type: "pmb",
  names: ["\\pmb"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "pmb",
      mode: r.mode,
      mclass: vx(e[0]),
      body: yn(e[0])
    };
  },
  htmlBuilder(t, e) {
    var r = Fn(t.body, e, !0), n = Fe.makeSpan([t.mclass], r, e);
    return n.style.textShadow = "0.02em 0.01em 0.04px", n;
  },
  mathmlBuilder(t, e) {
    var r = ga(t.body, e), n = new it.MathNode("mstyle", r);
    return n.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"), n;
  }
});
var mde = {
  ">": "\\\\cdrightarrow",
  "<": "\\\\cdleftarrow",
  "=": "\\\\cdlongequal",
  A: "\\uparrow",
  V: "\\downarrow",
  "|": "\\Vert",
  ".": "no arrow"
}, P8 = () => ({
  type: "styling",
  body: [],
  mode: "math",
  style: "display"
}), B8 = (t) => t.type === "textord" && t.text === "@", vde = (t, e) => (t.type === "mathord" || t.type === "atom") && t.text === e;
function yde(t, e, r) {
  var n = mde[t];
  switch (n) {
    case "\\\\cdrightarrow":
    case "\\\\cdleftarrow":
      return r.callFunction(n, [e[0]], [e[1]]);
    case "\\uparrow":
    case "\\downarrow": {
      var i = r.callFunction("\\\\cdleft", [e[0]], []), a = {
        type: "atom",
        text: n,
        mode: "math",
        family: "rel"
      }, s = r.callFunction("\\Big", [a], []), o = r.callFunction("\\\\cdright", [e[1]], []), l = {
        type: "ordgroup",
        mode: "math",
        body: [i, s, o]
      };
      return r.callFunction("\\\\cdparent", [l], []);
    }
    case "\\\\cdlongequal":
      return r.callFunction("\\\\cdlongequal", [], []);
    case "\\Vert": {
      var u = {
        type: "textord",
        text: "\\Vert",
        mode: "math"
      };
      return r.callFunction("\\Big", [u], []);
    }
    default:
      return {
        type: "textord",
        text: " ",
        mode: "math"
      };
  }
}
function xde(t) {
  var e = [];
  for (t.gullet.beginGroup(), t.gullet.macros.set("\\cr", "\\\\\\relax"), t.gullet.beginGroup(); ; ) {
    e.push(t.parseExpression(!1, "\\\\")), t.gullet.endGroup(), t.gullet.beginGroup();
    var r = t.fetch().text;
    if (r === "&" || r === "\\\\")
      t.consume();
    else if (r === "\\end") {
      e[e.length - 1].length === 0 && e.pop();
      break;
    } else
      throw new ot("Expected \\\\ or \\cr or \\end", t.nextToken);
  }
  for (var n = [], i = [n], a = 0; a < e.length; a++) {
    for (var s = e[a], o = P8(), l = 0; l < s.length; l++)
      if (!B8(s[l]))
        o.body.push(s[l]);
      else {
        n.push(o), l += 1;
        var u = hk(s[l]).text, h = new Array(2);
        if (h[0] = {
          type: "ordgroup",
          mode: "math",
          body: []
        }, h[1] = {
          type: "ordgroup",
          mode: "math",
          body: []
        }, !("=|.".indexOf(u) > -1)) if ("<>AV".indexOf(u) > -1)
          for (var d = 0; d < 2; d++) {
            for (var f = !0, p = l + 1; p < s.length; p++) {
              if (vde(s[p], u)) {
                f = !1, l = p;
                break;
              }
              if (B8(s[p]))
                throw new ot("Missing a " + u + " character to complete a CD arrow.", s[p]);
              h[d].body.push(s[p]);
            }
            if (f)
              throw new ot("Missing a " + u + " character to complete a CD arrow.", s[l]);
          }
        else
          throw new ot('Expected one of "<>AV=|." after @', s[l]);
        var g = yde(u, h, t), m = {
          type: "styling",
          body: [g],
          mode: "math",
          style: "display"
          // CD is always displaystyle.
        };
        n.push(m), o = P8();
      }
    a % 2 === 0 ? n.push(o) : n.shift(), n = [], i.push(n);
  }
  t.gullet.endGroup(), t.gullet.endGroup();
  var v = new Array(i[0].length).fill({
    type: "align",
    align: "c",
    pregap: 0.25,
    // CD package sets \enskip between columns.
    postgap: 0.25
    // So pre and post each get half an \enskip, i.e. 0.25em.
  });
  return {
    type: "array",
    mode: "math",
    body: i,
    arraystretch: 1,
    addJot: !0,
    rowGaps: [null],
    cols: v,
    colSeparationType: "CD",
    hLinesBeforeRow: new Array(i.length + 1).fill([])
  };
}
Et({
  type: "cdlabel",
  names: ["\\\\cdleft", "\\\\cdright"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t;
    return {
      type: "cdlabel",
      mode: r.mode,
      side: n.slice(4),
      label: e[0]
    };
  },
  htmlBuilder(t, e) {
    var r = e.havingStyle(e.style.sup()), n = Fe.wrapFragment(yr(t.label, r, e), e);
    return n.classes.push("cd-label-" + t.side), n.style.bottom = gt(0.8 - n.depth), n.height = 0, n.depth = 0, n;
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mrow", [Fr(t.label, e)]);
    return r = new it.MathNode("mpadded", [r]), r.setAttribute("width", "0"), t.side === "left" && r.setAttribute("lspace", "-1width"), r.setAttribute("voffset", "0.7em"), r = new it.MathNode("mstyle", [r]), r.setAttribute("displaystyle", "false"), r.setAttribute("scriptlevel", "1"), r;
  }
});
Et({
  type: "cdlabelparent",
  names: ["\\\\cdparent"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "cdlabelparent",
      mode: r.mode,
      fragment: e[0]
    };
  },
  htmlBuilder(t, e) {
    var r = Fe.wrapFragment(yr(t.fragment, e), e);
    return r.classes.push("cd-vert-arrow"), r;
  },
  mathmlBuilder(t, e) {
    return new it.MathNode("mrow", [Fr(t.fragment, e)]);
  }
});
Et({
  type: "textord",
  names: ["\\@char"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(t, e) {
    for (var {
      parser: r
    } = t, n = Qt(e[0], "ordgroup"), i = n.body, a = "", s = 0; s < i.length; s++) {
      var o = Qt(i[s], "textord");
      a += o.text;
    }
    var l = parseInt(a), u;
    if (isNaN(l))
      throw new ot("\\@char has non-numeric argument " + a);
    if (l < 0 || l >= 1114111)
      throw new ot("\\@char with invalid code point " + a);
    return l <= 65535 ? u = String.fromCharCode(l) : (l -= 65536, u = String.fromCharCode((l >> 10) + 55296, (l & 1023) + 56320)), {
      type: "textord",
      mode: r.mode,
      text: u
    };
  }
});
var R$ = (t, e) => {
  var r = Fn(t.body, e.withColor(t.color), !1);
  return Fe.makeFragment(r);
}, N$ = (t, e) => {
  var r = ga(t.body, e.withColor(t.color)), n = new it.MathNode("mstyle", r);
  return n.setAttribute("mathcolor", t.color), n;
};
Et({
  type: "color",
  names: ["\\textcolor"],
  props: {
    numArgs: 2,
    allowedInText: !0,
    argTypes: ["color", "original"]
  },
  handler(t, e) {
    var {
      parser: r
    } = t, n = Qt(e[0], "color-token").color, i = e[1];
    return {
      type: "color",
      mode: r.mode,
      color: n,
      body: yn(i)
    };
  },
  htmlBuilder: R$,
  mathmlBuilder: N$
});
Et({
  type: "color",
  names: ["\\color"],
  props: {
    numArgs: 1,
    allowedInText: !0,
    argTypes: ["color"]
  },
  handler(t, e) {
    var {
      parser: r,
      breakOnTokenText: n
    } = t, i = Qt(e[0], "color-token").color;
    r.gullet.macros.set("\\current@color", i);
    var a = r.parseExpression(!0, n);
    return {
      type: "color",
      mode: r.mode,
      color: i,
      body: a
    };
  },
  htmlBuilder: R$,
  mathmlBuilder: N$
});
Et({
  type: "cr",
  names: ["\\\\"],
  props: {
    numArgs: 0,
    numOptionalArgs: 0,
    allowedInText: !0
  },
  handler(t, e, r) {
    var {
      parser: n
    } = t, i = n.gullet.future().text === "[" ? n.parseSizeGroup(!0) : null, a = !n.settings.displayMode || !n.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
    return {
      type: "cr",
      mode: n.mode,
      newLine: a,
      size: i && Qt(i, "size").value
    };
  },
  // The following builders are called only at the top level,
  // not within tabular/array environments.
  htmlBuilder(t, e) {
    var r = Fe.makeSpan(["mspace"], [], e);
    return t.newLine && (r.classes.push("newline"), t.size && (r.style.marginTop = gt(en(t.size, e)))), r;
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mspace");
    return t.newLine && (r.setAttribute("linebreak", "newline"), t.size && r.setAttribute("height", gt(en(t.size, e)))), r;
  }
});
var tT = {
  "\\global": "\\global",
  "\\long": "\\\\globallong",
  "\\\\globallong": "\\\\globallong",
  "\\def": "\\gdef",
  "\\gdef": "\\gdef",
  "\\edef": "\\xdef",
  "\\xdef": "\\xdef",
  "\\let": "\\\\globallet",
  "\\futurelet": "\\\\globalfuture"
}, M$ = (t) => {
  var e = t.text;
  if (/^(?:[\\{}$&#^_]|EOF)$/.test(e))
    throw new ot("Expected a control sequence", t);
  return e;
}, bde = (t) => {
  var e = t.gullet.popToken();
  return e.text === "=" && (e = t.gullet.popToken(), e.text === " " && (e = t.gullet.popToken())), e;
}, D$ = (t, e, r, n) => {
  var i = t.gullet.macros.get(r.text);
  i == null && (r.noexpand = !0, i = {
    tokens: [r],
    numArgs: 0,
    // reproduce the same behavior in expansion
    unexpandable: !t.gullet.isExpandable(r.text)
  }), t.gullet.macros.set(e, i, n);
};
Et({
  type: "internal",
  names: [
    "\\global",
    "\\long",
    "\\\\globallong"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t;
    e.consumeSpaces();
    var n = e.fetch();
    if (tT[n.text])
      return (r === "\\global" || r === "\\\\globallong") && (n.text = tT[n.text]), Qt(e.parseFunction(), "internal");
    throw new ot("Invalid token after macro prefix", n);
  }
});
Et({
  type: "internal",
  names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t, n = e.gullet.popToken(), i = n.text;
    if (/^(?:[\\{}$&#^_]|EOF)$/.test(i))
      throw new ot("Expected a control sequence", n);
    for (var a = 0, s, o = [[]]; e.gullet.future().text !== "{"; )
      if (n = e.gullet.popToken(), n.text === "#") {
        if (e.gullet.future().text === "{") {
          s = e.gullet.future(), o[a].push("{");
          break;
        }
        if (n = e.gullet.popToken(), !/^[1-9]$/.test(n.text))
          throw new ot('Invalid argument number "' + n.text + '"');
        if (parseInt(n.text) !== a + 1)
          throw new ot('Argument number "' + n.text + '" out of order');
        a++, o.push([]);
      } else {
        if (n.text === "EOF")
          throw new ot("Expected a macro definition");
        o[a].push(n.text);
      }
    var {
      tokens: l
    } = e.gullet.consumeArg();
    return s && l.unshift(s), (r === "\\edef" || r === "\\xdef") && (l = e.gullet.expandTokens(l), l.reverse()), e.gullet.macros.set(i, {
      tokens: l,
      numArgs: a,
      delimiters: o
    }, r === tT[r]), {
      type: "internal",
      mode: e.mode
    };
  }
});
Et({
  type: "internal",
  names: [
    "\\let",
    "\\\\globallet"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t, n = M$(e.gullet.popToken());
    e.gullet.consumeSpaces();
    var i = bde(e);
    return D$(e, n, i, r === "\\\\globallet"), {
      type: "internal",
      mode: e.mode
    };
  }
});
Et({
  type: "internal",
  names: [
    "\\futurelet",
    "\\\\globalfuture"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t, n = M$(e.gullet.popToken()), i = e.gullet.popToken(), a = e.gullet.popToken();
    return D$(e, n, a, r === "\\\\globalfuture"), e.gullet.pushToken(a), e.gullet.pushToken(i), {
      type: "internal",
      mode: e.mode
    };
  }
});
var C0 = function(e, r, n) {
  var i = Vr.math[e] && Vr.math[e].replace, a = sk(i || e, r, n);
  if (!a)
    throw new Error("Unsupported symbol " + e + " and font size " + r + ".");
  return a;
}, fk = function(e, r, n, i) {
  var a = n.havingBaseStyle(r), s = Fe.makeSpan(i.concat(a.sizingClasses(n)), [e], n), o = a.sizeMultiplier / n.sizeMultiplier;
  return s.height *= o, s.depth *= o, s.maxFontSize = a.sizeMultiplier, s;
}, I$ = function(e, r, n) {
  var i = r.havingBaseStyle(n), a = (1 - r.sizeMultiplier / i.sizeMultiplier) * r.fontMetrics().axisHeight;
  e.classes.push("delimcenter"), e.style.top = gt(a), e.height -= a, e.depth += a;
}, wde = function(e, r, n, i, a, s) {
  var o = Fe.makeSymbol(e, "Main-Regular", a, i), l = fk(o, r, i, s);
  return n && I$(l, i, r), l;
}, Tde = function(e, r, n, i) {
  return Fe.makeSymbol(e, "Size" + r + "-Regular", n, i);
}, O$ = function(e, r, n, i, a, s) {
  var o = Tde(e, r, a, i), l = fk(Fe.makeSpan(["delimsizing", "size" + r], [o], i), Vt.TEXT, i, s);
  return n && I$(l, i, Vt.TEXT), l;
}, u4 = function(e, r, n) {
  var i;
  r === "Size1-Regular" ? i = "delim-size1" : i = "delim-size4";
  var a = Fe.makeSpan(["delimsizinginner", i], [Fe.makeSpan([], [Fe.makeSymbol(e, r, n)])]);
  return {
    type: "elem",
    elem: a
  };
}, h4 = function(e, r, n) {
  var i = Gs["Size4-Regular"][e.charCodeAt(0)] ? Gs["Size4-Regular"][e.charCodeAt(0)][4] : Gs["Size1-Regular"][e.charCodeAt(0)][4], a = new zl("inner", _he(e, Math.round(1e3 * r))), s = new Yo([a], {
    width: gt(i),
    height: gt(r),
    // Override CSS rule `.katex svg { width: 100% }`
    style: "width:" + gt(i),
    viewBox: "0 0 " + 1e3 * i + " " + Math.round(1e3 * r),
    preserveAspectRatio: "xMinYMin"
  }), o = Fe.makeSvgSpan([], [s], n);
  return o.height = r, o.style.height = gt(r), o.style.width = gt(i), {
    type: "elem",
    elem: o
  };
}, rT = 8e-3, q1 = {
  type: "kern",
  size: -1 * rT
}, Ede = ["|", "\\lvert", "\\rvert", "\\vert"], kde = ["\\|", "\\lVert", "\\rVert", "\\Vert"], P$ = function(e, r, n, i, a, s) {
  var o, l, u, h, d = "", f = 0;
  o = u = h = e, l = null;
  var p = "Size1-Regular";
  e === "\\uparrow" ? u = h = "⏐" : e === "\\Uparrow" ? u = h = "‖" : e === "\\downarrow" ? o = u = "⏐" : e === "\\Downarrow" ? o = u = "‖" : e === "\\updownarrow" ? (o = "\\uparrow", u = "⏐", h = "\\downarrow") : e === "\\Updownarrow" ? (o = "\\Uparrow", u = "‖", h = "\\Downarrow") : Ede.includes(e) ? (u = "∣", d = "vert", f = 333) : kde.includes(e) ? (u = "∥", d = "doublevert", f = 556) : e === "[" || e === "\\lbrack" ? (o = "⎡", u = "⎢", h = "⎣", p = "Size4-Regular", d = "lbrack", f = 667) : e === "]" || e === "\\rbrack" ? (o = "⎤", u = "⎥", h = "⎦", p = "Size4-Regular", d = "rbrack", f = 667) : e === "\\lfloor" || e === "⌊" ? (u = o = "⎢", h = "⎣", p = "Size4-Regular", d = "lfloor", f = 667) : e === "\\lceil" || e === "⌈" ? (o = "⎡", u = h = "⎢", p = "Size4-Regular", d = "lceil", f = 667) : e === "\\rfloor" || e === "⌋" ? (u = o = "⎥", h = "⎦", p = "Size4-Regular", d = "rfloor", f = 667) : e === "\\rceil" || e === "⌉" ? (o = "⎤", u = h = "⎥", p = "Size4-Regular", d = "rceil", f = 667) : e === "(" || e === "\\lparen" ? (o = "⎛", u = "⎜", h = "⎝", p = "Size4-Regular", d = "lparen", f = 875) : e === ")" || e === "\\rparen" ? (o = "⎞", u = "⎟", h = "⎠", p = "Size4-Regular", d = "rparen", f = 875) : e === "\\{" || e === "\\lbrace" ? (o = "⎧", l = "⎨", h = "⎩", u = "⎪", p = "Size4-Regular") : e === "\\}" || e === "\\rbrace" ? (o = "⎫", l = "⎬", h = "⎭", u = "⎪", p = "Size4-Regular") : e === "\\lgroup" || e === "⟮" ? (o = "⎧", h = "⎩", u = "⎪", p = "Size4-Regular") : e === "\\rgroup" || e === "⟯" ? (o = "⎫", h = "⎭", u = "⎪", p = "Size4-Regular") : e === "\\lmoustache" || e === "⎰" ? (o = "⎧", h = "⎭", u = "⎪", p = "Size4-Regular") : (e === "\\rmoustache" || e === "⎱") && (o = "⎫", h = "⎩", u = "⎪", p = "Size4-Regular");
  var g = C0(o, p, a), m = g.height + g.depth, v = C0(u, p, a), y = v.height + v.depth, b = C0(h, p, a), w = b.height + b.depth, T = 0, E = 1;
  if (l !== null) {
    var C = C0(l, p, a);
    T = C.height + C.depth, E = 2;
  }
  var k = m + w + T, _ = Math.max(0, Math.ceil((r - k) / (E * y))), L = k + _ * E * y, N = i.fontMetrics().axisHeight;
  n && (N *= i.sizeMultiplier);
  var A = L / 2 - N, O = [];
  if (d.length > 0) {
    var P = L - m - w, S = Math.round(L * 1e3), R = Lhe(d, Math.round(P * 1e3)), I = new zl(d, R), D = (f / 1e3).toFixed(3) + "em", M = (S / 1e3).toFixed(3) + "em", B = new Yo([I], {
      width: D,
      height: M,
      viewBox: "0 0 " + f + " " + S
    }), $ = Fe.makeSvgSpan([], [B], i);
    $.height = S / 1e3, $.style.width = D, $.style.height = M, O.push({
      type: "elem",
      elem: $
    });
  } else {
    if (O.push(u4(h, p, a)), O.push(q1), l === null) {
      var F = L - m - w + 2 * rT;
      O.push(h4(u, F, i));
    } else {
      var G = (L - m - w - T) / 2 + 2 * rT;
      O.push(h4(u, G, i)), O.push(q1), O.push(u4(l, p, a)), O.push(q1), O.push(h4(u, G, i));
    }
    O.push(q1), O.push(u4(o, p, a));
  }
  var H = i.havingBaseStyle(Vt.TEXT), ee = Fe.makeVList({
    positionType: "bottom",
    positionData: A,
    children: O
  }, H);
  return fk(Fe.makeSpan(["delimsizing", "mult"], [ee], H), Vt.TEXT, i, s);
}, d4 = 80, f4 = 0.08, p4 = function(e, r, n, i, a) {
  var s = Ahe(e, i, n), o = new zl(e, s), l = new Yo([o], {
    // Note: 1000:1 ratio of viewBox to document em width.
    width: "400em",
    height: gt(r),
    viewBox: "0 0 400000 " + n,
    preserveAspectRatio: "xMinYMin slice"
  });
  return Fe.makeSvgSpan(["hide-tail"], [l], a);
}, Sde = function(e, r) {
  var n = r.havingBaseSizing(), i = z$("\\surd", e * n.sizeMultiplier, $$, n), a = n.sizeMultiplier, s = Math.max(0, r.minRuleThickness - r.fontMetrics().sqrtRuleThickness), o, l = 0, u = 0, h = 0, d;
  return i.type === "small" ? (h = 1e3 + 1e3 * s + d4, e < 1 ? a = 1 : e < 1.4 && (a = 0.7), l = (1 + s + f4) / a, u = (1 + s) / a, o = p4("sqrtMain", l, h, s, r), o.style.minWidth = "0.853em", d = 0.833 / a) : i.type === "large" ? (h = (1e3 + d4) * Cp[i.size], u = (Cp[i.size] + s) / a, l = (Cp[i.size] + s + f4) / a, o = p4("sqrtSize" + i.size, l, h, s, r), o.style.minWidth = "1.02em", d = 1 / a) : (l = e + s + f4, u = e + s, h = Math.floor(1e3 * e + s) + d4, o = p4("sqrtTall", l, h, s, r), o.style.minWidth = "0.742em", d = 1.056), o.height = u, o.style.height = gt(l), {
    span: o,
    advanceWidth: d,
    // Calculate the actual line width.
    // This actually should depend on the chosen font -- e.g. \boldmath
    // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
    // have thicker rules.
    ruleWidth: (r.fontMetrics().sqrtRuleThickness + s) * a
  };
}, B$ = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"], Cde = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"], F$ = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"], Cp = [0, 1.2, 1.8, 2.4, 3], Ade = function(e, r, n, i, a) {
  if (e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"), B$.includes(e) || F$.includes(e))
    return O$(e, r, !1, n, i, a);
  if (Cde.includes(e))
    return P$(e, Cp[r], !1, n, i, a);
  throw new ot("Illegal delimiter: '" + e + "'");
}, _de = [{
  type: "small",
  style: Vt.SCRIPTSCRIPT
}, {
  type: "small",
  style: Vt.SCRIPT
}, {
  type: "small",
  style: Vt.TEXT
}, {
  type: "large",
  size: 1
}, {
  type: "large",
  size: 2
}, {
  type: "large",
  size: 3
}, {
  type: "large",
  size: 4
}], Lde = [{
  type: "small",
  style: Vt.SCRIPTSCRIPT
}, {
  type: "small",
  style: Vt.SCRIPT
}, {
  type: "small",
  style: Vt.TEXT
}, {
  type: "stack"
}], $$ = [{
  type: "small",
  style: Vt.SCRIPTSCRIPT
}, {
  type: "small",
  style: Vt.SCRIPT
}, {
  type: "small",
  style: Vt.TEXT
}, {
  type: "large",
  size: 1
}, {
  type: "large",
  size: 2
}, {
  type: "large",
  size: 3
}, {
  type: "large",
  size: 4
}, {
  type: "stack"
}], Rde = function(e) {
  if (e.type === "small")
    return "Main-Regular";
  if (e.type === "large")
    return "Size" + e.size + "-Regular";
  if (e.type === "stack")
    return "Size4-Regular";
  throw new Error("Add support for delim type '" + e.type + "' here.");
}, z$ = function(e, r, n, i) {
  for (var a = Math.min(2, 3 - i.style.size), s = a; s < n.length && n[s].type !== "stack"; s++) {
    var o = C0(e, Rde(n[s]), "math"), l = o.height + o.depth;
    if (n[s].type === "small") {
      var u = i.havingBaseStyle(n[s].style);
      l *= u.sizeMultiplier;
    }
    if (l > r)
      return n[s];
  }
  return n[n.length - 1];
}, V$ = function(e, r, n, i, a, s) {
  e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle");
  var o;
  F$.includes(e) ? o = _de : B$.includes(e) ? o = $$ : o = Lde;
  var l = z$(e, r, o, i);
  return l.type === "small" ? wde(e, l.style, n, i, a, s) : l.type === "large" ? O$(e, l.size, n, i, a, s) : P$(e, r, n, i, a, s);
}, Nde = function(e, r, n, i, a, s) {
  var o = i.fontMetrics().axisHeight * i.sizeMultiplier, l = 901, u = 5 / i.fontMetrics().ptPerEm, h = Math.max(r - o, n + o), d = Math.max(
    // In real TeX, calculations are done using integral values which are
    // 65536 per pt, or 655360 per em. So, the division here truncates in
    // TeX but doesn't here, producing different results. If we wanted to
    // exactly match TeX's calculation, we could do
    //   Math.floor(655360 * maxDistFromAxis / 500) *
    //    delimiterFactor / 655360
    // (To see the difference, compare
    //    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
    // in TeX and KaTeX)
    h / 500 * l,
    2 * h - u
  );
  return V$(e, d, !0, i, a, s);
}, Vo = {
  sqrtImage: Sde,
  sizedDelim: Ade,
  sizeToMaxHeight: Cp,
  customSizedDelim: V$,
  leftRightDelim: Nde
}, F8 = {
  "\\bigl": {
    mclass: "mopen",
    size: 1
  },
  "\\Bigl": {
    mclass: "mopen",
    size: 2
  },
  "\\biggl": {
    mclass: "mopen",
    size: 3
  },
  "\\Biggl": {
    mclass: "mopen",
    size: 4
  },
  "\\bigr": {
    mclass: "mclose",
    size: 1
  },
  "\\Bigr": {
    mclass: "mclose",
    size: 2
  },
  "\\biggr": {
    mclass: "mclose",
    size: 3
  },
  "\\Biggr": {
    mclass: "mclose",
    size: 4
  },
  "\\bigm": {
    mclass: "mrel",
    size: 1
  },
  "\\Bigm": {
    mclass: "mrel",
    size: 2
  },
  "\\biggm": {
    mclass: "mrel",
    size: 3
  },
  "\\Biggm": {
    mclass: "mrel",
    size: 4
  },
  "\\big": {
    mclass: "mord",
    size: 1
  },
  "\\Big": {
    mclass: "mord",
    size: 2
  },
  "\\bigg": {
    mclass: "mord",
    size: 3
  },
  "\\Bigg": {
    mclass: "mord",
    size: 4
  }
}, Mde = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "<", ">", "\\langle", "⟨", "\\rangle", "⟩", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."];
function yx(t, e) {
  var r = mx(t);
  if (r && Mde.includes(r.text))
    return r;
  throw r ? new ot("Invalid delimiter '" + r.text + "' after '" + e.funcName + "'", t) : new ot("Invalid delimiter type '" + t.type + "'", t);
}
Et({
  type: "delimsizing",
  names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
  props: {
    numArgs: 1,
    argTypes: ["primitive"]
  },
  handler: (t, e) => {
    var r = yx(e[0], t);
    return {
      type: "delimsizing",
      mode: t.parser.mode,
      size: F8[t.funcName].size,
      mclass: F8[t.funcName].mclass,
      delim: r.text
    };
  },
  htmlBuilder: (t, e) => t.delim === "." ? Fe.makeSpan([t.mclass]) : Vo.sizedDelim(t.delim, t.size, e, t.mode, [t.mclass]),
  mathmlBuilder: (t) => {
    var e = [];
    t.delim !== "." && e.push(ns(t.delim, t.mode));
    var r = new it.MathNode("mo", e);
    t.mclass === "mopen" || t.mclass === "mclose" ? r.setAttribute("fence", "true") : r.setAttribute("fence", "false"), r.setAttribute("stretchy", "true");
    var n = gt(Vo.sizeToMaxHeight[t.size]);
    return r.setAttribute("minsize", n), r.setAttribute("maxsize", n), r;
  }
});
function $8(t) {
  if (!t.body)
    throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
}
Et({
  type: "leftright-right",
  names: ["\\right"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (t, e) => {
    var r = t.parser.gullet.macros.get("\\current@color");
    if (r && typeof r != "string")
      throw new ot("\\current@color set to non-string in \\right");
    return {
      type: "leftright-right",
      mode: t.parser.mode,
      delim: yx(e[0], t).text,
      color: r
      // undefined if not set via \color
    };
  }
});
Et({
  type: "leftright",
  names: ["\\left"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (t, e) => {
    var r = yx(e[0], t), n = t.parser;
    ++n.leftrightDepth;
    var i = n.parseExpression(!1);
    --n.leftrightDepth, n.expect("\\right", !1);
    var a = Qt(n.parseFunction(), "leftright-right");
    return {
      type: "leftright",
      mode: n.mode,
      body: i,
      left: r.text,
      right: a.delim,
      rightColor: a.color
    };
  },
  htmlBuilder: (t, e) => {
    $8(t);
    for (var r = Fn(t.body, e, !0, ["mopen", "mclose"]), n = 0, i = 0, a = !1, s = 0; s < r.length; s++)
      r[s].isMiddle ? a = !0 : (n = Math.max(r[s].height, n), i = Math.max(r[s].depth, i));
    n *= e.sizeMultiplier, i *= e.sizeMultiplier;
    var o;
    if (t.left === "." ? o = eg(e, ["mopen"]) : o = Vo.leftRightDelim(t.left, n, i, e, t.mode, ["mopen"]), r.unshift(o), a)
      for (var l = 1; l < r.length; l++) {
        var u = r[l], h = u.isMiddle;
        h && (r[l] = Vo.leftRightDelim(h.delim, n, i, h.options, t.mode, []));
      }
    var d;
    if (t.right === ".")
      d = eg(e, ["mclose"]);
    else {
      var f = t.rightColor ? e.withColor(t.rightColor) : e;
      d = Vo.leftRightDelim(t.right, n, i, f, t.mode, ["mclose"]);
    }
    return r.push(d), Fe.makeSpan(["minner"], r, e);
  },
  mathmlBuilder: (t, e) => {
    $8(t);
    var r = ga(t.body, e);
    if (t.left !== ".") {
      var n = new it.MathNode("mo", [ns(t.left, t.mode)]);
      n.setAttribute("fence", "true"), r.unshift(n);
    }
    if (t.right !== ".") {
      var i = new it.MathNode("mo", [ns(t.right, t.mode)]);
      i.setAttribute("fence", "true"), t.rightColor && i.setAttribute("mathcolor", t.rightColor), r.push(i);
    }
    return ck(r);
  }
});
Et({
  type: "middle",
  names: ["\\middle"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (t, e) => {
    var r = yx(e[0], t);
    if (!t.parser.leftrightDepth)
      throw new ot("\\middle without preceding \\left", r);
    return {
      type: "middle",
      mode: t.parser.mode,
      delim: r.text
    };
  },
  htmlBuilder: (t, e) => {
    var r;
    if (t.delim === ".")
      r = eg(e, []);
    else {
      r = Vo.sizedDelim(t.delim, 1, e, t.mode, []);
      var n = {
        delim: t.delim,
        options: e
      };
      r.isMiddle = n;
    }
    return r;
  },
  mathmlBuilder: (t, e) => {
    var r = t.delim === "\\vert" || t.delim === "|" ? ns("|", "text") : ns(t.delim, t.mode), n = new it.MathNode("mo", [r]);
    return n.setAttribute("fence", "true"), n.setAttribute("lspace", "0.05em"), n.setAttribute("rspace", "0.05em"), n;
  }
});
var pk = (t, e) => {
  var r = Fe.wrapFragment(yr(t.body, e), e), n = t.label.slice(1), i = e.sizeMultiplier, a, s = 0, o = Tr.isCharacterBox(t.body);
  if (n === "sout")
    a = Fe.makeSpan(["stretchy", "sout"]), a.height = e.fontMetrics().defaultRuleThickness / i, s = -0.5 * e.fontMetrics().xHeight;
  else if (n === "phase") {
    var l = en({
      number: 0.6,
      unit: "pt"
    }, e), u = en({
      number: 0.35,
      unit: "ex"
    }, e), h = e.havingBaseSizing();
    i = i / h.sizeMultiplier;
    var d = r.height + r.depth + l + u;
    r.style.paddingLeft = gt(d / 2 + l);
    var f = Math.floor(1e3 * d * i), p = She(f), g = new Yo([new zl("phase", p)], {
      width: "400em",
      height: gt(f / 1e3),
      viewBox: "0 0 400000 " + f,
      preserveAspectRatio: "xMinYMin slice"
    });
    a = Fe.makeSvgSpan(["hide-tail"], [g], e), a.style.height = gt(d), s = r.depth + l + u;
  } else {
    /cancel/.test(n) ? o || r.classes.push("cancel-pad") : n === "angl" ? r.classes.push("anglpad") : r.classes.push("boxpad");
    var m = 0, v = 0, y = 0;
    /box/.test(n) ? (y = Math.max(
      e.fontMetrics().fboxrule,
      // default
      e.minRuleThickness
      // User override.
    ), m = e.fontMetrics().fboxsep + (n === "colorbox" ? 0 : y), v = m) : n === "angl" ? (y = Math.max(e.fontMetrics().defaultRuleThickness, e.minRuleThickness), m = 4 * y, v = Math.max(0, 0.25 - r.depth)) : (m = o ? 0.2 : 0, v = m), a = jo.encloseSpan(r, n, m, v, e), /fbox|boxed|fcolorbox/.test(n) ? (a.style.borderStyle = "solid", a.style.borderWidth = gt(y)) : n === "angl" && y !== 0.049 && (a.style.borderTopWidth = gt(y), a.style.borderRightWidth = gt(y)), s = r.depth + v, t.backgroundColor && (a.style.backgroundColor = t.backgroundColor, t.borderColor && (a.style.borderColor = t.borderColor));
  }
  var b;
  if (t.backgroundColor)
    b = Fe.makeVList({
      positionType: "individualShift",
      children: [
        // Put the color background behind inner;
        {
          type: "elem",
          elem: a,
          shift: s
        },
        {
          type: "elem",
          elem: r,
          shift: 0
        }
      ]
    }, e);
  else {
    var w = /cancel|phase/.test(n) ? ["svg-align"] : [];
    b = Fe.makeVList({
      positionType: "individualShift",
      children: [
        // Write the \cancel stroke on top of inner.
        {
          type: "elem",
          elem: r,
          shift: 0
        },
        {
          type: "elem",
          elem: a,
          shift: s,
          wrapperClasses: w
        }
      ]
    }, e);
  }
  return /cancel/.test(n) && (b.height = r.height, b.depth = r.depth), /cancel/.test(n) && !o ? Fe.makeSpan(["mord", "cancel-lap"], [b], e) : Fe.makeSpan(["mord"], [b], e);
}, gk = (t, e) => {
  var r = 0, n = new it.MathNode(t.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [Fr(t.body, e)]);
  switch (t.label) {
    case "\\cancel":
      n.setAttribute("notation", "updiagonalstrike");
      break;
    case "\\bcancel":
      n.setAttribute("notation", "downdiagonalstrike");
      break;
    case "\\phase":
      n.setAttribute("notation", "phasorangle");
      break;
    case "\\sout":
      n.setAttribute("notation", "horizontalstrike");
      break;
    case "\\fbox":
      n.setAttribute("notation", "box");
      break;
    case "\\angl":
      n.setAttribute("notation", "actuarial");
      break;
    case "\\fcolorbox":
    case "\\colorbox":
      if (r = e.fontMetrics().fboxsep * e.fontMetrics().ptPerEm, n.setAttribute("width", "+" + 2 * r + "pt"), n.setAttribute("height", "+" + 2 * r + "pt"), n.setAttribute("lspace", r + "pt"), n.setAttribute("voffset", r + "pt"), t.label === "\\fcolorbox") {
        var i = Math.max(
          e.fontMetrics().fboxrule,
          // default
          e.minRuleThickness
          // user override
        );
        n.setAttribute("style", "border: " + i + "em solid " + String(t.borderColor));
      }
      break;
    case "\\xcancel":
      n.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
      break;
  }
  return t.backgroundColor && n.setAttribute("mathbackground", t.backgroundColor), n;
};
Et({
  type: "enclose",
  names: ["\\colorbox"],
  props: {
    numArgs: 2,
    allowedInText: !0,
    argTypes: ["color", "text"]
  },
  handler(t, e, r) {
    var {
      parser: n,
      funcName: i
    } = t, a = Qt(e[0], "color-token").color, s = e[1];
    return {
      type: "enclose",
      mode: n.mode,
      label: i,
      backgroundColor: a,
      body: s
    };
  },
  htmlBuilder: pk,
  mathmlBuilder: gk
});
Et({
  type: "enclose",
  names: ["\\fcolorbox"],
  props: {
    numArgs: 3,
    allowedInText: !0,
    argTypes: ["color", "color", "text"]
  },
  handler(t, e, r) {
    var {
      parser: n,
      funcName: i
    } = t, a = Qt(e[0], "color-token").color, s = Qt(e[1], "color-token").color, o = e[2];
    return {
      type: "enclose",
      mode: n.mode,
      label: i,
      backgroundColor: s,
      borderColor: a,
      body: o
    };
  },
  htmlBuilder: pk,
  mathmlBuilder: gk
});
Et({
  type: "enclose",
  names: ["\\fbox"],
  props: {
    numArgs: 1,
    argTypes: ["hbox"],
    allowedInText: !0
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "enclose",
      mode: r.mode,
      label: "\\fbox",
      body: e[0]
    };
  }
});
Et({
  type: "enclose",
  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    return {
      type: "enclose",
      mode: r.mode,
      label: n,
      body: i
    };
  },
  htmlBuilder: pk,
  mathmlBuilder: gk
});
Et({
  type: "enclose",
  names: ["\\angl"],
  props: {
    numArgs: 1,
    argTypes: ["hbox"],
    allowedInText: !1
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "enclose",
      mode: r.mode,
      label: "\\angl",
      body: e[0]
    };
  }
});
var G$ = {};
function so(t) {
  for (var {
    type: e,
    names: r,
    props: n,
    handler: i,
    htmlBuilder: a,
    mathmlBuilder: s
  } = t, o = {
    type: e,
    numArgs: n.numArgs || 0,
    allowedInText: !1,
    numOptionalArgs: 0,
    handler: i
  }, l = 0; l < r.length; ++l)
    G$[r[l]] = o;
  a && (_y[e] = a), s && (Ly[e] = s);
}
var U$ = {};
function le(t, e) {
  U$[t] = e;
}
function z8(t) {
  var e = [];
  t.consumeSpaces();
  var r = t.fetch().text;
  for (r === "\\relax" && (t.consume(), t.consumeSpaces(), r = t.fetch().text); r === "\\hline" || r === "\\hdashline"; )
    t.consume(), e.push(r === "\\hdashline"), t.consumeSpaces(), r = t.fetch().text;
  return e;
}
var xx = (t) => {
  var e = t.parser.settings;
  if (!e.displayMode)
    throw new ot("{" + t.envName + "} can be used only in display mode.");
};
function mk(t) {
  if (t.indexOf("ed") === -1)
    return t.indexOf("*") === -1;
}
function ac(t, e, r) {
  var {
    hskipBeforeAndAfter: n,
    addJot: i,
    cols: a,
    arraystretch: s,
    colSeparationType: o,
    autoTag: l,
    singleRow: u,
    emptySingleRow: h,
    maxNumCols: d,
    leqno: f
  } = e;
  if (t.gullet.beginGroup(), u || t.gullet.macros.set("\\cr", "\\\\\\relax"), !s) {
    var p = t.gullet.expandMacroAsText("\\arraystretch");
    if (p == null)
      s = 1;
    else if (s = parseFloat(p), !s || s < 0)
      throw new ot("Invalid \\arraystretch: " + p);
  }
  t.gullet.beginGroup();
  var g = [], m = [g], v = [], y = [], b = l != null ? [] : void 0;
  function w() {
    l && t.gullet.macros.set("\\@eqnsw", "1", !0);
  }
  function T() {
    b && (t.gullet.macros.get("\\df@tag") ? (b.push(t.subparse([new Aa("\\df@tag")])), t.gullet.macros.set("\\df@tag", void 0, !0)) : b.push(!!l && t.gullet.macros.get("\\@eqnsw") === "1"));
  }
  for (w(), y.push(z8(t)); ; ) {
    var E = t.parseExpression(!1, u ? "\\end" : "\\\\");
    t.gullet.endGroup(), t.gullet.beginGroup(), E = {
      type: "ordgroup",
      mode: t.mode,
      body: E
    }, r && (E = {
      type: "styling",
      mode: t.mode,
      style: r,
      body: [E]
    }), g.push(E);
    var C = t.fetch().text;
    if (C === "&") {
      if (d && g.length === d) {
        if (u || o)
          throw new ot("Too many tab characters: &", t.nextToken);
        t.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
      }
      t.consume();
    } else if (C === "\\end") {
      T(), g.length === 1 && E.type === "styling" && E.body[0].body.length === 0 && (m.length > 1 || !h) && m.pop(), y.length < m.length + 1 && y.push([]);
      break;
    } else if (C === "\\\\") {
      t.consume();
      var k = void 0;
      t.gullet.future().text !== " " && (k = t.parseSizeGroup(!0)), v.push(k ? k.value : null), T(), y.push(z8(t)), g = [], m.push(g), w();
    } else
      throw new ot("Expected & or \\\\ or \\cr or \\end", t.nextToken);
  }
  return t.gullet.endGroup(), t.gullet.endGroup(), {
    type: "array",
    mode: t.mode,
    addJot: i,
    arraystretch: s,
    body: m,
    cols: a,
    rowGaps: v,
    hskipBeforeAndAfter: n,
    hLinesBeforeRow: y,
    colSeparationType: o,
    tags: b,
    leqno: f
  };
}
function vk(t) {
  return t.slice(0, 1) === "d" ? "display" : "text";
}
var oo = function(e, r) {
  var n, i, a = e.body.length, s = e.hLinesBeforeRow, o = 0, l = new Array(a), u = [], h = Math.max(
    // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
    r.fontMetrics().arrayRuleWidth,
    r.minRuleThickness
    // User override.
  ), d = 1 / r.fontMetrics().ptPerEm, f = 5 * d;
  if (e.colSeparationType && e.colSeparationType === "small") {
    var p = r.havingStyle(Vt.SCRIPT).sizeMultiplier;
    f = 0.2778 * (p / r.sizeMultiplier);
  }
  var g = e.colSeparationType === "CD" ? en({
    number: 3,
    unit: "ex"
  }, r) : 12 * d, m = 3 * d, v = e.arraystretch * g, y = 0.7 * v, b = 0.3 * v, w = 0;
  function T(W) {
    for (var Oe = 0; Oe < W.length; ++Oe)
      Oe > 0 && (w += 0.25), u.push({
        pos: w,
        isDashed: W[Oe]
      });
  }
  for (T(s[0]), n = 0; n < e.body.length; ++n) {
    var E = e.body[n], C = y, k = b;
    o < E.length && (o = E.length);
    var _ = new Array(E.length);
    for (i = 0; i < E.length; ++i) {
      var L = yr(E[i], r);
      k < L.depth && (k = L.depth), C < L.height && (C = L.height), _[i] = L;
    }
    var N = e.rowGaps[n], A = 0;
    N && (A = en(N, r), A > 0 && (A += b, k < A && (k = A), A = 0)), e.addJot && (k += m), _.height = C, _.depth = k, w += C, _.pos = w, w += k + A, l[n] = _, T(s[n + 1]);
  }
  var O = w / 2 + r.fontMetrics().axisHeight, P = e.cols || [], S = [], R, I, D = [];
  if (e.tags && e.tags.some((W) => W))
    for (n = 0; n < a; ++n) {
      var M = l[n], B = M.pos - O, $ = e.tags[n], F = void 0;
      $ === !0 ? F = Fe.makeSpan(["eqn-num"], [], r) : $ === !1 ? F = Fe.makeSpan([], [], r) : F = Fe.makeSpan([], Fn($, r, !0), r), F.depth = M.depth, F.height = M.height, D.push({
        type: "elem",
        elem: F,
        shift: B
      });
    }
  for (
    i = 0, I = 0;
    // Continue while either there are more columns or more column
    // descriptions, so trailing separators don't get lost.
    i < o || I < P.length;
    ++i, ++I
  ) {
    for (var G = P[I] || {}, H = !0; G.type === "separator"; ) {
      if (H || (R = Fe.makeSpan(["arraycolsep"], []), R.style.width = gt(r.fontMetrics().doubleRuleSep), S.push(R)), G.separator === "|" || G.separator === ":") {
        var ee = G.separator === "|" ? "solid" : "dashed", Y = Fe.makeSpan(["vertical-separator"], [], r);
        Y.style.height = gt(w), Y.style.borderRightWidth = gt(h), Y.style.borderRightStyle = ee, Y.style.margin = "0 " + gt(-h / 2);
        var re = w - O;
        re && (Y.style.verticalAlign = gt(-re)), S.push(Y);
      } else
        throw new ot("Invalid separator type: " + G.separator);
      I++, G = P[I] || {}, H = !1;
    }
    if (!(i >= o)) {
      var ne = void 0;
      (i > 0 || e.hskipBeforeAndAfter) && (ne = Tr.deflt(G.pregap, f), ne !== 0 && (R = Fe.makeSpan(["arraycolsep"], []), R.style.width = gt(ne), S.push(R)));
      var he = [];
      for (n = 0; n < a; ++n) {
        var K = l[n], Z = K[i];
        if (Z) {
          var X = K.pos - O;
          Z.depth = K.depth, Z.height = K.height, he.push({
            type: "elem",
            elem: Z,
            shift: X
          });
        }
      }
      he = Fe.makeVList({
        positionType: "individualShift",
        children: he
      }, r), he = Fe.makeSpan(["col-align-" + (G.align || "c")], [he]), S.push(he), (i < o - 1 || e.hskipBeforeAndAfter) && (ne = Tr.deflt(G.postgap, f), ne !== 0 && (R = Fe.makeSpan(["arraycolsep"], []), R.style.width = gt(ne), S.push(R)));
    }
  }
  if (l = Fe.makeSpan(["mtable"], S), u.length > 0) {
    for (var q = Fe.makeLineSpan("hline", r, h), J = Fe.makeLineSpan("hdashline", r, h), j = [{
      type: "elem",
      elem: l,
      shift: 0
    }]; u.length > 0; ) {
      var pe = u.pop(), te = pe.pos - O;
      pe.isDashed ? j.push({
        type: "elem",
        elem: J,
        shift: te
      }) : j.push({
        type: "elem",
        elem: q,
        shift: te
      });
    }
    l = Fe.makeVList({
      positionType: "individualShift",
      children: j
    }, r);
  }
  if (D.length === 0)
    return Fe.makeSpan(["mord"], [l], r);
  var Ae = Fe.makeVList({
    positionType: "individualShift",
    children: D
  }, r);
  return Ae = Fe.makeSpan(["tag"], [Ae], r), Fe.makeFragment([l, Ae]);
}, Dde = {
  c: "center ",
  l: "left ",
  r: "right "
}, lo = function(e, r) {
  for (var n = [], i = new it.MathNode("mtd", [], ["mtr-glue"]), a = new it.MathNode("mtd", [], ["mml-eqn-num"]), s = 0; s < e.body.length; s++) {
    for (var o = e.body[s], l = [], u = 0; u < o.length; u++)
      l.push(new it.MathNode("mtd", [Fr(o[u], r)]));
    e.tags && e.tags[s] && (l.unshift(i), l.push(i), e.leqno ? l.unshift(a) : l.push(a)), n.push(new it.MathNode("mtr", l));
  }
  var h = new it.MathNode("mtable", n), d = e.arraystretch === 0.5 ? 0.1 : 0.16 + e.arraystretch - 1 + (e.addJot ? 0.09 : 0);
  h.setAttribute("rowspacing", gt(d));
  var f = "", p = "";
  if (e.cols && e.cols.length > 0) {
    var g = e.cols, m = "", v = !1, y = 0, b = g.length;
    g[0].type === "separator" && (f += "top ", y = 1), g[g.length - 1].type === "separator" && (f += "bottom ", b -= 1);
    for (var w = y; w < b; w++)
      g[w].type === "align" ? (p += Dde[g[w].align], v && (m += "none "), v = !0) : g[w].type === "separator" && v && (m += g[w].separator === "|" ? "solid " : "dashed ", v = !1);
    h.setAttribute("columnalign", p.trim()), /[sd]/.test(m) && h.setAttribute("columnlines", m.trim());
  }
  if (e.colSeparationType === "align") {
    for (var T = e.cols || [], E = "", C = 1; C < T.length; C++)
      E += C % 2 ? "0em " : "1em ";
    h.setAttribute("columnspacing", E.trim());
  } else e.colSeparationType === "alignat" || e.colSeparationType === "gather" ? h.setAttribute("columnspacing", "0em") : e.colSeparationType === "small" ? h.setAttribute("columnspacing", "0.2778em") : e.colSeparationType === "CD" ? h.setAttribute("columnspacing", "0.5em") : h.setAttribute("columnspacing", "1em");
  var k = "", _ = e.hLinesBeforeRow;
  f += _[0].length > 0 ? "left " : "", f += _[_.length - 1].length > 0 ? "right " : "";
  for (var L = 1; L < _.length - 1; L++)
    k += _[L].length === 0 ? "none " : _[L][0] ? "dashed " : "solid ";
  return /[sd]/.test(k) && h.setAttribute("rowlines", k.trim()), f !== "" && (h = new it.MathNode("menclose", [h]), h.setAttribute("notation", f.trim())), e.arraystretch && e.arraystretch < 1 && (h = new it.MathNode("mstyle", [h]), h.setAttribute("scriptlevel", "1")), h;
}, W$ = function(e, r) {
  e.envName.indexOf("ed") === -1 && xx(e);
  var n = [], i = e.envName.indexOf("at") > -1 ? "alignat" : "align", a = e.envName === "split", s = ac(e.parser, {
    cols: n,
    addJot: !0,
    autoTag: a ? void 0 : mk(e.envName),
    emptySingleRow: !0,
    colSeparationType: i,
    maxNumCols: a ? 2 : void 0,
    leqno: e.parser.settings.leqno
  }, "display"), o, l = 0, u = {
    type: "ordgroup",
    mode: e.mode,
    body: []
  };
  if (r[0] && r[0].type === "ordgroup") {
    for (var h = "", d = 0; d < r[0].body.length; d++) {
      var f = Qt(r[0].body[d], "textord");
      h += f.text;
    }
    o = Number(h), l = o * 2;
  }
  var p = !l;
  s.body.forEach(function(y) {
    for (var b = 1; b < y.length; b += 2) {
      var w = Qt(y[b], "styling"), T = Qt(w.body[0], "ordgroup");
      T.body.unshift(u);
    }
    if (p)
      l < y.length && (l = y.length);
    else {
      var E = y.length / 2;
      if (o < E)
        throw new ot("Too many math in a row: " + ("expected " + o + ", but got " + E), y[0]);
    }
  });
  for (var g = 0; g < l; ++g) {
    var m = "r", v = 0;
    g % 2 === 1 ? m = "l" : g > 0 && p && (v = 1), n[g] = {
      type: "align",
      align: m,
      pregap: v,
      postgap: 0
    };
  }
  return s.colSeparationType = p ? "align" : "alignat", s;
};
so({
  type: "array",
  names: ["array", "darray"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var r = mx(e[0]), n = r ? [e[0]] : Qt(e[0], "ordgroup").body, i = n.map(function(s) {
      var o = hk(s), l = o.text;
      if ("lcr".indexOf(l) !== -1)
        return {
          type: "align",
          align: l
        };
      if (l === "|")
        return {
          type: "separator",
          separator: "|"
        };
      if (l === ":")
        return {
          type: "separator",
          separator: ":"
        };
      throw new ot("Unknown column alignment: " + l, s);
    }), a = {
      cols: i,
      hskipBeforeAndAfter: !0,
      // \@preamble in lttab.dtx
      maxNumCols: i.length
    };
    return ac(t.parser, a, vk(t.envName));
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
  props: {
    numArgs: 0
  },
  handler(t) {
    var e = {
      matrix: null,
      pmatrix: ["(", ")"],
      bmatrix: ["[", "]"],
      Bmatrix: ["\\{", "\\}"],
      vmatrix: ["|", "|"],
      Vmatrix: ["\\Vert", "\\Vert"]
    }[t.envName.replace("*", "")], r = "c", n = {
      hskipBeforeAndAfter: !1,
      cols: [{
        type: "align",
        align: r
      }]
    };
    if (t.envName.charAt(t.envName.length - 1) === "*") {
      var i = t.parser;
      if (i.consumeSpaces(), i.fetch().text === "[") {
        if (i.consume(), i.consumeSpaces(), r = i.fetch().text, "lcr".indexOf(r) === -1)
          throw new ot("Expected l or c or r", i.nextToken);
        i.consume(), i.consumeSpaces(), i.expect("]"), i.consume(), n.cols = [{
          type: "align",
          align: r
        }];
      }
    }
    var a = ac(t.parser, n, vk(t.envName)), s = Math.max(0, ...a.body.map((o) => o.length));
    return a.cols = new Array(s).fill({
      type: "align",
      align: r
    }), e ? {
      type: "leftright",
      mode: t.mode,
      body: [a],
      left: e[0],
      right: e[1],
      rightColor: void 0
      // \right uninfluenced by \color in array
    } : a;
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["smallmatrix"],
  props: {
    numArgs: 0
  },
  handler(t) {
    var e = {
      arraystretch: 0.5
    }, r = ac(t.parser, e, "script");
    return r.colSeparationType = "small", r;
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["subarray"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var r = mx(e[0]), n = r ? [e[0]] : Qt(e[0], "ordgroup").body, i = n.map(function(s) {
      var o = hk(s), l = o.text;
      if ("lc".indexOf(l) !== -1)
        return {
          type: "align",
          align: l
        };
      throw new ot("Unknown column alignment: " + l, s);
    });
    if (i.length > 1)
      throw new ot("{subarray} can contain only one column");
    var a = {
      cols: i,
      hskipBeforeAndAfter: !1,
      arraystretch: 0.5
    };
    if (a = ac(t.parser, a, "script"), a.body.length > 0 && a.body[0].length > 1)
      throw new ot("{subarray} can contain only one column");
    return a;
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["cases", "dcases", "rcases", "drcases"],
  props: {
    numArgs: 0
  },
  handler(t) {
    var e = {
      arraystretch: 1.2,
      cols: [{
        type: "align",
        align: "l",
        pregap: 0,
        // TODO(kevinb) get the current style.
        // For now we use the metrics for TEXT style which is what we were
        // doing before.  Before attempting to get the current style we
        // should look at TeX's behavior especially for \over and matrices.
        postgap: 1
        /* 1em quad */
      }, {
        type: "align",
        align: "l",
        pregap: 0,
        postgap: 0
      }]
    }, r = ac(t.parser, e, vk(t.envName));
    return {
      type: "leftright",
      mode: t.mode,
      body: [r],
      left: t.envName.indexOf("r") > -1 ? "." : "\\{",
      right: t.envName.indexOf("r") > -1 ? "\\}" : ".",
      rightColor: void 0
    };
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["align", "align*", "aligned", "split"],
  props: {
    numArgs: 0
  },
  handler: W$,
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["gathered", "gather", "gather*"],
  props: {
    numArgs: 0
  },
  handler(t) {
    ["gather", "gather*"].includes(t.envName) && xx(t);
    var e = {
      cols: [{
        type: "align",
        align: "c"
      }],
      addJot: !0,
      colSeparationType: "gather",
      autoTag: mk(t.envName),
      emptySingleRow: !0,
      leqno: t.parser.settings.leqno
    };
    return ac(t.parser, e, "display");
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["alignat", "alignat*", "alignedat"],
  props: {
    numArgs: 1
  },
  handler: W$,
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["equation", "equation*"],
  props: {
    numArgs: 0
  },
  handler(t) {
    xx(t);
    var e = {
      autoTag: mk(t.envName),
      emptySingleRow: !0,
      singleRow: !0,
      maxNumCols: 1,
      leqno: t.parser.settings.leqno
    };
    return ac(t.parser, e, "display");
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
so({
  type: "array",
  names: ["CD"],
  props: {
    numArgs: 0
  },
  handler(t) {
    return xx(t), xde(t.parser);
  },
  htmlBuilder: oo,
  mathmlBuilder: lo
});
le("\\nonumber", "\\gdef\\@eqnsw{0}");
le("\\notag", "\\nonumber");
Et({
  type: "text",
  // Doesn't matter what this is.
  names: ["\\hline", "\\hdashline"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !0
  },
  handler(t, e) {
    throw new ot(t.funcName + " valid only within array environment");
  }
});
var V8 = G$;
Et({
  type: "environment",
  names: ["\\begin", "\\end"],
  props: {
    numArgs: 1,
    argTypes: ["text"]
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    if (i.type !== "ordgroup")
      throw new ot("Invalid environment name", i);
    for (var a = "", s = 0; s < i.body.length; ++s)
      a += Qt(i.body[s], "textord").text;
    if (n === "\\begin") {
      if (!V8.hasOwnProperty(a))
        throw new ot("No such environment: " + a, i);
      var o = V8[a], {
        args: l,
        optArgs: u
      } = r.parseArguments("\\begin{" + a + "}", o), h = {
        mode: r.mode,
        envName: a,
        parser: r
      }, d = o.handler(h, l, u);
      r.expect("\\end", !1);
      var f = r.nextToken, p = Qt(r.parseFunction(), "environment");
      if (p.name !== a)
        throw new ot("Mismatch: \\begin{" + a + "} matched by \\end{" + p.name + "}", f);
      return d;
    }
    return {
      type: "environment",
      mode: r.mode,
      name: a,
      nameGroup: i
    };
  }
});
var H$ = (t, e) => {
  var r = t.font, n = e.withFont(r);
  return yr(t.body, n);
}, q$ = (t, e) => {
  var r = t.font, n = e.withFont(r);
  return Fr(t.body, n);
}, G8 = {
  "\\Bbb": "\\mathbb",
  "\\bold": "\\mathbf",
  "\\frak": "\\mathfrak",
  "\\bm": "\\boldsymbol"
};
Et({
  type: "font",
  names: [
    // styles, except \boldsymbol defined below
    "\\mathrm",
    "\\mathit",
    "\\mathbf",
    "\\mathnormal",
    "\\mathsfit",
    // families
    "\\mathbb",
    "\\mathcal",
    "\\mathfrak",
    "\\mathscr",
    "\\mathsf",
    "\\mathtt",
    // aliases, except \bm defined below
    "\\Bbb",
    "\\bold",
    "\\frak"
  ],
  props: {
    numArgs: 1,
    allowedInArgument: !0
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = Ry(e[0]), a = n;
    return a in G8 && (a = G8[a]), {
      type: "font",
      mode: r.mode,
      font: a.slice(1),
      body: i
    };
  },
  htmlBuilder: H$,
  mathmlBuilder: q$
});
Et({
  type: "mclass",
  names: ["\\boldsymbol", "\\bm"],
  props: {
    numArgs: 1
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = e[0], i = Tr.isCharacterBox(n);
    return {
      type: "mclass",
      mode: r.mode,
      mclass: vx(n),
      body: [{
        type: "font",
        mode: r.mode,
        font: "boldsymbol",
        body: n
      }],
      isCharacterBox: i
    };
  }
});
Et({
  type: "font",
  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n,
      breakOnTokenText: i
    } = t, {
      mode: a
    } = r, s = r.parseExpression(!0, i), o = "math" + n.slice(1);
    return {
      type: "font",
      mode: a,
      font: o,
      body: {
        type: "ordgroup",
        mode: r.mode,
        body: s
      }
    };
  },
  htmlBuilder: H$,
  mathmlBuilder: q$
});
var Y$ = (t, e) => {
  var r = e;
  return t === "display" ? r = r.id >= Vt.SCRIPT.id ? r.text() : Vt.DISPLAY : t === "text" && r.size === Vt.DISPLAY.size ? r = Vt.TEXT : t === "script" ? r = Vt.SCRIPT : t === "scriptscript" && (r = Vt.SCRIPTSCRIPT), r;
}, yk = (t, e) => {
  var r = Y$(t.size, e.style), n = r.fracNum(), i = r.fracDen(), a;
  a = e.havingStyle(n);
  var s = yr(t.numer, a, e);
  if (t.continued) {
    var o = 8.5 / e.fontMetrics().ptPerEm, l = 3.5 / e.fontMetrics().ptPerEm;
    s.height = s.height < o ? o : s.height, s.depth = s.depth < l ? l : s.depth;
  }
  a = e.havingStyle(i);
  var u = yr(t.denom, a, e), h, d, f;
  t.hasBarLine ? (t.barSize ? (d = en(t.barSize, e), h = Fe.makeLineSpan("frac-line", e, d)) : h = Fe.makeLineSpan("frac-line", e), d = h.height, f = h.height) : (h = null, d = 0, f = e.fontMetrics().defaultRuleThickness);
  var p, g, m;
  r.size === Vt.DISPLAY.size || t.size === "display" ? (p = e.fontMetrics().num1, d > 0 ? g = 3 * f : g = 7 * f, m = e.fontMetrics().denom1) : (d > 0 ? (p = e.fontMetrics().num2, g = f) : (p = e.fontMetrics().num3, g = 3 * f), m = e.fontMetrics().denom2);
  var v;
  if (h) {
    var b = e.fontMetrics().axisHeight;
    p - s.depth - (b + 0.5 * d) < g && (p += g - (p - s.depth - (b + 0.5 * d))), b - 0.5 * d - (u.height - m) < g && (m += g - (b - 0.5 * d - (u.height - m)));
    var w = -(b - 0.5 * d);
    v = Fe.makeVList({
      positionType: "individualShift",
      children: [{
        type: "elem",
        elem: u,
        shift: m
      }, {
        type: "elem",
        elem: h,
        shift: w
      }, {
        type: "elem",
        elem: s,
        shift: -p
      }]
    }, e);
  } else {
    var y = p - s.depth - (u.height - m);
    y < g && (p += 0.5 * (g - y), m += 0.5 * (g - y)), v = Fe.makeVList({
      positionType: "individualShift",
      children: [{
        type: "elem",
        elem: u,
        shift: m
      }, {
        type: "elem",
        elem: s,
        shift: -p
      }]
    }, e);
  }
  a = e.havingStyle(r), v.height *= a.sizeMultiplier / e.sizeMultiplier, v.depth *= a.sizeMultiplier / e.sizeMultiplier;
  var T;
  r.size === Vt.DISPLAY.size ? T = e.fontMetrics().delim1 : r.size === Vt.SCRIPTSCRIPT.size ? T = e.havingStyle(Vt.SCRIPT).fontMetrics().delim2 : T = e.fontMetrics().delim2;
  var E, C;
  return t.leftDelim == null ? E = eg(e, ["mopen"]) : E = Vo.customSizedDelim(t.leftDelim, T, !0, e.havingStyle(r), t.mode, ["mopen"]), t.continued ? C = Fe.makeSpan([]) : t.rightDelim == null ? C = eg(e, ["mclose"]) : C = Vo.customSizedDelim(t.rightDelim, T, !0, e.havingStyle(r), t.mode, ["mclose"]), Fe.makeSpan(["mord"].concat(a.sizingClasses(e)), [E, Fe.makeSpan(["mfrac"], [v]), C], e);
}, xk = (t, e) => {
  var r = new it.MathNode("mfrac", [Fr(t.numer, e), Fr(t.denom, e)]);
  if (!t.hasBarLine)
    r.setAttribute("linethickness", "0px");
  else if (t.barSize) {
    var n = en(t.barSize, e);
    r.setAttribute("linethickness", gt(n));
  }
  var i = Y$(t.size, e.style);
  if (i.size !== e.style.size) {
    r = new it.MathNode("mstyle", [r]);
    var a = i.size === Vt.DISPLAY.size ? "true" : "false";
    r.setAttribute("displaystyle", a), r.setAttribute("scriptlevel", "0");
  }
  if (t.leftDelim != null || t.rightDelim != null) {
    var s = [];
    if (t.leftDelim != null) {
      var o = new it.MathNode("mo", [new it.TextNode(t.leftDelim.replace("\\", ""))]);
      o.setAttribute("fence", "true"), s.push(o);
    }
    if (s.push(r), t.rightDelim != null) {
      var l = new it.MathNode("mo", [new it.TextNode(t.rightDelim.replace("\\", ""))]);
      l.setAttribute("fence", "true"), s.push(l);
    }
    return ck(s);
  }
  return r;
};
Et({
  type: "genfrac",
  names: [
    "\\dfrac",
    "\\frac",
    "\\tfrac",
    "\\dbinom",
    "\\binom",
    "\\tbinom",
    "\\\\atopfrac",
    // can’t be entered directly
    "\\\\bracefrac",
    "\\\\brackfrac"
    // ditto
  ],
  props: {
    numArgs: 2,
    allowedInArgument: !0
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0], a = e[1], s, o = null, l = null, u = "auto";
    switch (n) {
      case "\\dfrac":
      case "\\frac":
      case "\\tfrac":
        s = !0;
        break;
      case "\\\\atopfrac":
        s = !1;
        break;
      case "\\dbinom":
      case "\\binom":
      case "\\tbinom":
        s = !1, o = "(", l = ")";
        break;
      case "\\\\bracefrac":
        s = !1, o = "\\{", l = "\\}";
        break;
      case "\\\\brackfrac":
        s = !1, o = "[", l = "]";
        break;
      default:
        throw new Error("Unrecognized genfrac command");
    }
    switch (n) {
      case "\\dfrac":
      case "\\dbinom":
        u = "display";
        break;
      case "\\tfrac":
      case "\\tbinom":
        u = "text";
        break;
    }
    return {
      type: "genfrac",
      mode: r.mode,
      continued: !1,
      numer: i,
      denom: a,
      hasBarLine: s,
      leftDelim: o,
      rightDelim: l,
      size: u,
      barSize: null
    };
  },
  htmlBuilder: yk,
  mathmlBuilder: xk
});
Et({
  type: "genfrac",
  names: ["\\cfrac"],
  props: {
    numArgs: 2
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0], a = e[1];
    return {
      type: "genfrac",
      mode: r.mode,
      continued: !0,
      numer: i,
      denom: a,
      hasBarLine: !0,
      leftDelim: null,
      rightDelim: null,
      size: "display",
      barSize: null
    };
  }
});
Et({
  type: "infix",
  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
  props: {
    numArgs: 0,
    infix: !0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r,
      token: n
    } = t, i;
    switch (r) {
      case "\\over":
        i = "\\frac";
        break;
      case "\\choose":
        i = "\\binom";
        break;
      case "\\atop":
        i = "\\\\atopfrac";
        break;
      case "\\brace":
        i = "\\\\bracefrac";
        break;
      case "\\brack":
        i = "\\\\brackfrac";
        break;
      default:
        throw new Error("Unrecognized infix genfrac command");
    }
    return {
      type: "infix",
      mode: e.mode,
      replaceWith: i,
      token: n
    };
  }
});
var U8 = ["display", "text", "script", "scriptscript"], W8 = function(e) {
  var r = null;
  return e.length > 0 && (r = e, r = r === "." ? null : r), r;
};
Et({
  type: "genfrac",
  names: ["\\genfrac"],
  props: {
    numArgs: 6,
    allowedInArgument: !0,
    argTypes: ["math", "math", "size", "text", "math", "math"]
  },
  handler(t, e) {
    var {
      parser: r
    } = t, n = e[4], i = e[5], a = Ry(e[0]), s = a.type === "atom" && a.family === "open" ? W8(a.text) : null, o = Ry(e[1]), l = o.type === "atom" && o.family === "close" ? W8(o.text) : null, u = Qt(e[2], "size"), h, d = null;
    u.isBlank ? h = !0 : (d = u.value, h = d.number > 0);
    var f = "auto", p = e[3];
    if (p.type === "ordgroup") {
      if (p.body.length > 0) {
        var g = Qt(p.body[0], "textord");
        f = U8[Number(g.text)];
      }
    } else
      p = Qt(p, "textord"), f = U8[Number(p.text)];
    return {
      type: "genfrac",
      mode: r.mode,
      numer: n,
      denom: i,
      continued: !1,
      hasBarLine: h,
      barSize: d,
      leftDelim: s,
      rightDelim: l,
      size: f
    };
  },
  htmlBuilder: yk,
  mathmlBuilder: xk
});
Et({
  type: "infix",
  names: ["\\above"],
  props: {
    numArgs: 1,
    argTypes: ["size"],
    infix: !0
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n,
      token: i
    } = t;
    return {
      type: "infix",
      mode: r.mode,
      replaceWith: "\\\\abovefrac",
      size: Qt(e[0], "size").value,
      token: i
    };
  }
});
Et({
  type: "genfrac",
  names: ["\\\\abovefrac"],
  props: {
    numArgs: 3,
    argTypes: ["math", "size", "math"]
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0], a = uhe(Qt(e[1], "infix").size), s = e[2], o = a.number > 0;
    return {
      type: "genfrac",
      mode: r.mode,
      numer: i,
      denom: s,
      continued: !1,
      hasBarLine: o,
      barSize: a,
      leftDelim: null,
      rightDelim: null,
      size: "auto"
    };
  },
  htmlBuilder: yk,
  mathmlBuilder: xk
});
var X$ = (t, e) => {
  var r = e.style, n, i;
  t.type === "supsub" ? (n = t.sup ? yr(t.sup, e.havingStyle(r.sup()), e) : yr(t.sub, e.havingStyle(r.sub()), e), i = Qt(t.base, "horizBrace")) : i = Qt(t, "horizBrace");
  var a = yr(i.base, e.havingBaseStyle(Vt.DISPLAY)), s = jo.svgSpan(i, e), o;
  if (i.isOver ? (o = Fe.makeVList({
    positionType: "firstBaseline",
    children: [{
      type: "elem",
      elem: a
    }, {
      type: "kern",
      size: 0.1
    }, {
      type: "elem",
      elem: s
    }]
  }, e), o.children[0].children[0].children[1].classes.push("svg-align")) : (o = Fe.makeVList({
    positionType: "bottom",
    positionData: a.depth + 0.1 + s.height,
    children: [{
      type: "elem",
      elem: s
    }, {
      type: "kern",
      size: 0.1
    }, {
      type: "elem",
      elem: a
    }]
  }, e), o.children[0].children[0].children[0].classes.push("svg-align")), n) {
    var l = Fe.makeSpan(["mord", i.isOver ? "mover" : "munder"], [o], e);
    i.isOver ? o = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: l
      }, {
        type: "kern",
        size: 0.2
      }, {
        type: "elem",
        elem: n
      }]
    }, e) : o = Fe.makeVList({
      positionType: "bottom",
      positionData: l.depth + 0.2 + n.height + n.depth,
      children: [{
        type: "elem",
        elem: n
      }, {
        type: "kern",
        size: 0.2
      }, {
        type: "elem",
        elem: l
      }]
    }, e);
  }
  return Fe.makeSpan(["mord", i.isOver ? "mover" : "munder"], [o], e);
}, Ide = (t, e) => {
  var r = jo.mathMLnode(t.label);
  return new it.MathNode(t.isOver ? "mover" : "munder", [Fr(t.base, e), r]);
};
Et({
  type: "horizBrace",
  names: ["\\overbrace", "\\underbrace"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t;
    return {
      type: "horizBrace",
      mode: r.mode,
      label: n,
      isOver: /^\\over/.test(n),
      base: e[0]
    };
  },
  htmlBuilder: X$,
  mathmlBuilder: Ide
});
Et({
  type: "href",
  names: ["\\href"],
  props: {
    numArgs: 2,
    argTypes: ["url", "original"],
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = e[1], i = Qt(e[0], "url").url;
    return r.settings.isTrusted({
      command: "\\href",
      url: i
    }) ? {
      type: "href",
      mode: r.mode,
      href: i,
      body: yn(n)
    } : r.formatUnsupportedCmd("\\href");
  },
  htmlBuilder: (t, e) => {
    var r = Fn(t.body, e, !1);
    return Fe.makeAnchor(t.href, [], r, e);
  },
  mathmlBuilder: (t, e) => {
    var r = Vl(t.body, e);
    return r instanceof ka || (r = new ka("mrow", [r])), r.setAttribute("href", t.href), r;
  }
});
Et({
  type: "href",
  names: ["\\url"],
  props: {
    numArgs: 1,
    argTypes: ["url"],
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = Qt(e[0], "url").url;
    if (!r.settings.isTrusted({
      command: "\\url",
      url: n
    }))
      return r.formatUnsupportedCmd("\\url");
    for (var i = [], a = 0; a < n.length; a++) {
      var s = n[a];
      s === "~" && (s = "\\textasciitilde"), i.push({
        type: "textord",
        mode: "text",
        text: s
      });
    }
    var o = {
      type: "text",
      mode: r.mode,
      font: "\\texttt",
      body: i
    };
    return {
      type: "href",
      mode: r.mode,
      href: n,
      body: yn(o)
    };
  }
});
Et({
  type: "hbox",
  names: ["\\hbox"],
  props: {
    numArgs: 1,
    argTypes: ["text"],
    allowedInText: !0,
    primitive: !0
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "hbox",
      mode: r.mode,
      body: yn(e[0])
    };
  },
  htmlBuilder(t, e) {
    var r = Fn(t.body, e, !1);
    return Fe.makeFragment(r);
  },
  mathmlBuilder(t, e) {
    return new it.MathNode("mrow", ga(t.body, e));
  }
});
Et({
  type: "html",
  names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
  props: {
    numArgs: 2,
    argTypes: ["raw", "original"],
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n,
      token: i
    } = t, a = Qt(e[0], "raw").string, s = e[1];
    r.settings.strict && r.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
    var o, l = {};
    switch (n) {
      case "\\htmlClass":
        l.class = a, o = {
          command: "\\htmlClass",
          class: a
        };
        break;
      case "\\htmlId":
        l.id = a, o = {
          command: "\\htmlId",
          id: a
        };
        break;
      case "\\htmlStyle":
        l.style = a, o = {
          command: "\\htmlStyle",
          style: a
        };
        break;
      case "\\htmlData": {
        for (var u = a.split(","), h = 0; h < u.length; h++) {
          var d = u[h].split("=");
          if (d.length !== 2)
            throw new ot("Error parsing key-value for \\htmlData");
          l["data-" + d[0].trim()] = d[1].trim();
        }
        o = {
          command: "\\htmlData",
          attributes: l
        };
        break;
      }
      default:
        throw new Error("Unrecognized html command");
    }
    return r.settings.isTrusted(o) ? {
      type: "html",
      mode: r.mode,
      attributes: l,
      body: yn(s)
    } : r.formatUnsupportedCmd(n);
  },
  htmlBuilder: (t, e) => {
    var r = Fn(t.body, e, !1), n = ["enclosing"];
    t.attributes.class && n.push(...t.attributes.class.trim().split(/\s+/));
    var i = Fe.makeSpan(n, r, e);
    for (var a in t.attributes)
      a !== "class" && t.attributes.hasOwnProperty(a) && i.setAttribute(a, t.attributes[a]);
    return i;
  },
  mathmlBuilder: (t, e) => Vl(t.body, e)
});
Et({
  type: "htmlmathml",
  names: ["\\html@mathml"],
  props: {
    numArgs: 2,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t;
    return {
      type: "htmlmathml",
      mode: r.mode,
      html: yn(e[0]),
      mathml: yn(e[1])
    };
  },
  htmlBuilder: (t, e) => {
    var r = Fn(t.html, e, !1);
    return Fe.makeFragment(r);
  },
  mathmlBuilder: (t, e) => Vl(t.mathml, e)
});
var g4 = function(e) {
  if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))
    return {
      number: +e,
      unit: "bp"
    };
  var r = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);
  if (!r)
    throw new ot("Invalid size: '" + e + "' in \\includegraphics");
  var n = {
    number: +(r[1] + r[2]),
    // sign + magnitude, cast to number
    unit: r[3]
  };
  if (!f$(n))
    throw new ot("Invalid unit: '" + n.unit + "' in \\includegraphics.");
  return n;
};
Et({
  type: "includegraphics",
  names: ["\\includegraphics"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1,
    argTypes: ["raw", "url"],
    allowedInText: !1
  },
  handler: (t, e, r) => {
    var {
      parser: n
    } = t, i = {
      number: 0,
      unit: "em"
    }, a = {
      number: 0.9,
      unit: "em"
    }, s = {
      number: 0,
      unit: "em"
    }, o = "";
    if (r[0])
      for (var l = Qt(r[0], "raw").string, u = l.split(","), h = 0; h < u.length; h++) {
        var d = u[h].split("=");
        if (d.length === 2) {
          var f = d[1].trim();
          switch (d[0].trim()) {
            case "alt":
              o = f;
              break;
            case "width":
              i = g4(f);
              break;
            case "height":
              a = g4(f);
              break;
            case "totalheight":
              s = g4(f);
              break;
            default:
              throw new ot("Invalid key: '" + d[0] + "' in \\includegraphics.");
          }
        }
      }
    var p = Qt(e[0], "url").url;
    return o === "" && (o = p, o = o.replace(/^.*[\\/]/, ""), o = o.substring(0, o.lastIndexOf("."))), n.settings.isTrusted({
      command: "\\includegraphics",
      url: p
    }) ? {
      type: "includegraphics",
      mode: n.mode,
      alt: o,
      width: i,
      height: a,
      totalheight: s,
      src: p
    } : n.formatUnsupportedCmd("\\includegraphics");
  },
  htmlBuilder: (t, e) => {
    var r = en(t.height, e), n = 0;
    t.totalheight.number > 0 && (n = en(t.totalheight, e) - r);
    var i = 0;
    t.width.number > 0 && (i = en(t.width, e));
    var a = {
      height: gt(r + n)
    };
    i > 0 && (a.width = gt(i)), n > 0 && (a.verticalAlign = gt(-n));
    var s = new Ihe(t.src, t.alt, a);
    return s.height = r, s.depth = n, s;
  },
  mathmlBuilder: (t, e) => {
    var r = new it.MathNode("mglyph", []);
    r.setAttribute("alt", t.alt);
    var n = en(t.height, e), i = 0;
    if (t.totalheight.number > 0 && (i = en(t.totalheight, e) - n, r.setAttribute("valign", gt(-i))), r.setAttribute("height", gt(n + i)), t.width.number > 0) {
      var a = en(t.width, e);
      r.setAttribute("width", gt(a));
    }
    return r.setAttribute("src", t.src), r;
  }
});
Et({
  type: "kern",
  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
  props: {
    numArgs: 1,
    argTypes: ["size"],
    primitive: !0,
    allowedInText: !0
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t, i = Qt(e[0], "size");
    if (r.settings.strict) {
      var a = n[1] === "m", s = i.value.unit === "mu";
      a ? (s || r.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + n + " supports only mu units, " + ("not " + i.value.unit + " units")), r.mode !== "math" && r.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + n + " works only in math mode")) : s && r.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + n + " doesn't support mu units");
    }
    return {
      type: "kern",
      mode: r.mode,
      dimension: i.value
    };
  },
  htmlBuilder(t, e) {
    return Fe.makeGlue(t.dimension, e);
  },
  mathmlBuilder(t, e) {
    var r = en(t.dimension, e);
    return new it.SpaceNode(r);
  }
});
Et({
  type: "lap",
  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    return {
      type: "lap",
      mode: r.mode,
      alignment: n.slice(5),
      body: i
    };
  },
  htmlBuilder: (t, e) => {
    var r;
    t.alignment === "clap" ? (r = Fe.makeSpan([], [yr(t.body, e)]), r = Fe.makeSpan(["inner"], [r], e)) : r = Fe.makeSpan(["inner"], [yr(t.body, e)]);
    var n = Fe.makeSpan(["fix"], []), i = Fe.makeSpan([t.alignment], [r, n], e), a = Fe.makeSpan(["strut"]);
    return a.style.height = gt(i.height + i.depth), i.depth && (a.style.verticalAlign = gt(-i.depth)), i.children.unshift(a), i = Fe.makeSpan(["thinbox"], [i], e), Fe.makeSpan(["mord", "vbox"], [i], e);
  },
  mathmlBuilder: (t, e) => {
    var r = new it.MathNode("mpadded", [Fr(t.body, e)]);
    if (t.alignment !== "rlap") {
      var n = t.alignment === "llap" ? "-1" : "-0.5";
      r.setAttribute("lspace", n + "width");
    }
    return r.setAttribute("width", "0px"), r;
  }
});
Et({
  type: "styling",
  names: ["\\(", "$"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !1
  },
  handler(t, e) {
    var {
      funcName: r,
      parser: n
    } = t, i = n.mode;
    n.switchMode("math");
    var a = r === "\\(" ? "\\)" : "$", s = n.parseExpression(!1, a);
    return n.expect(a), n.switchMode(i), {
      type: "styling",
      mode: n.mode,
      style: "text",
      body: s
    };
  }
});
Et({
  type: "text",
  // Doesn't matter what this is.
  names: ["\\)", "\\]"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !1
  },
  handler(t, e) {
    throw new ot("Mismatched " + t.funcName);
  }
});
var H8 = (t, e) => {
  switch (e.style.size) {
    case Vt.DISPLAY.size:
      return t.display;
    case Vt.TEXT.size:
      return t.text;
    case Vt.SCRIPT.size:
      return t.script;
    case Vt.SCRIPTSCRIPT.size:
      return t.scriptscript;
    default:
      return t.text;
  }
};
Et({
  type: "mathchoice",
  names: ["\\mathchoice"],
  props: {
    numArgs: 4,
    primitive: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t;
    return {
      type: "mathchoice",
      mode: r.mode,
      display: yn(e[0]),
      text: yn(e[1]),
      script: yn(e[2]),
      scriptscript: yn(e[3])
    };
  },
  htmlBuilder: (t, e) => {
    var r = H8(t, e), n = Fn(r, e, !1);
    return Fe.makeFragment(n);
  },
  mathmlBuilder: (t, e) => {
    var r = H8(t, e);
    return Vl(r, e);
  }
});
var j$ = (t, e, r, n, i, a, s) => {
  t = Fe.makeSpan([], [t]);
  var o = r && Tr.isCharacterBox(r), l, u;
  if (e) {
    var h = yr(e, n.havingStyle(i.sup()), n);
    u = {
      elem: h,
      kern: Math.max(n.fontMetrics().bigOpSpacing1, n.fontMetrics().bigOpSpacing3 - h.depth)
    };
  }
  if (r) {
    var d = yr(r, n.havingStyle(i.sub()), n);
    l = {
      elem: d,
      kern: Math.max(n.fontMetrics().bigOpSpacing2, n.fontMetrics().bigOpSpacing4 - d.height)
    };
  }
  var f;
  if (u && l) {
    var p = n.fontMetrics().bigOpSpacing5 + l.elem.height + l.elem.depth + l.kern + t.depth + s;
    f = Fe.makeVList({
      positionType: "bottom",
      positionData: p,
      children: [{
        type: "kern",
        size: n.fontMetrics().bigOpSpacing5
      }, {
        type: "elem",
        elem: l.elem,
        marginLeft: gt(-a)
      }, {
        type: "kern",
        size: l.kern
      }, {
        type: "elem",
        elem: t
      }, {
        type: "kern",
        size: u.kern
      }, {
        type: "elem",
        elem: u.elem,
        marginLeft: gt(a)
      }, {
        type: "kern",
        size: n.fontMetrics().bigOpSpacing5
      }]
    }, n);
  } else if (l) {
    var g = t.height - s;
    f = Fe.makeVList({
      positionType: "top",
      positionData: g,
      children: [{
        type: "kern",
        size: n.fontMetrics().bigOpSpacing5
      }, {
        type: "elem",
        elem: l.elem,
        marginLeft: gt(-a)
      }, {
        type: "kern",
        size: l.kern
      }, {
        type: "elem",
        elem: t
      }]
    }, n);
  } else if (u) {
    var m = t.depth + s;
    f = Fe.makeVList({
      positionType: "bottom",
      positionData: m,
      children: [{
        type: "elem",
        elem: t
      }, {
        type: "kern",
        size: u.kern
      }, {
        type: "elem",
        elem: u.elem,
        marginLeft: gt(a)
      }, {
        type: "kern",
        size: n.fontMetrics().bigOpSpacing5
      }]
    }, n);
  } else
    return t;
  var v = [f];
  if (l && a !== 0 && !o) {
    var y = Fe.makeSpan(["mspace"], [], n);
    y.style.marginRight = gt(a), v.unshift(y);
  }
  return Fe.makeSpan(["mop", "op-limits"], v, n);
}, K$ = ["\\smallint"], Rf = (t, e) => {
  var r, n, i = !1, a;
  t.type === "supsub" ? (r = t.sup, n = t.sub, a = Qt(t.base, "op"), i = !0) : a = Qt(t, "op");
  var s = e.style, o = !1;
  s.size === Vt.DISPLAY.size && a.symbol && !K$.includes(a.name) && (o = !0);
  var l;
  if (a.symbol) {
    var u = o ? "Size2-Regular" : "Size1-Regular", h = "";
    if ((a.name === "\\oiint" || a.name === "\\oiiint") && (h = a.name.slice(1), a.name = h === "oiint" ? "\\iint" : "\\iiint"), l = Fe.makeSymbol(a.name, u, "math", e, ["mop", "op-symbol", o ? "large-op" : "small-op"]), h.length > 0) {
      var d = l.italic, f = Fe.staticSvg(h + "Size" + (o ? "2" : "1"), e);
      l = Fe.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: l,
          shift: 0
        }, {
          type: "elem",
          elem: f,
          shift: o ? 0.08 : 0
        }]
      }, e), a.name = "\\" + h, l.classes.unshift("mop"), l.italic = d;
    }
  } else if (a.body) {
    var p = Fn(a.body, e, !0);
    p.length === 1 && p[0] instanceof rs ? (l = p[0], l.classes[0] = "mop") : l = Fe.makeSpan(["mop"], p, e);
  } else {
    for (var g = [], m = 1; m < a.name.length; m++)
      g.push(Fe.mathsym(a.name[m], a.mode, e));
    l = Fe.makeSpan(["mop"], g, e);
  }
  var v = 0, y = 0;
  return (l instanceof rs || a.name === "\\oiint" || a.name === "\\oiiint") && !a.suppressBaseShift && (v = (l.height - l.depth) / 2 - e.fontMetrics().axisHeight, y = l.italic), i ? j$(l, r, n, e, s, y, v) : (v && (l.style.position = "relative", l.style.top = gt(v)), l);
}, Hg = (t, e) => {
  var r;
  if (t.symbol)
    r = new ka("mo", [ns(t.name, t.mode)]), K$.includes(t.name) && r.setAttribute("largeop", "false");
  else if (t.body)
    r = new ka("mo", ga(t.body, e));
  else {
    r = new ka("mi", [new Us(t.name.slice(1))]);
    var n = new ka("mo", [ns("⁡", "text")]);
    t.parentIsSupSub ? r = new ka("mrow", [r, n]) : r = k$([r, n]);
  }
  return r;
}, Ode = {
  "∏": "\\prod",
  "∐": "\\coprod",
  "∑": "\\sum",
  "⋀": "\\bigwedge",
  "⋁": "\\bigvee",
  "⋂": "\\bigcap",
  "⋃": "\\bigcup",
  "⨀": "\\bigodot",
  "⨁": "\\bigoplus",
  "⨂": "\\bigotimes",
  "⨄": "\\biguplus",
  "⨆": "\\bigsqcup"
};
Et({
  type: "op",
  names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"],
  props: {
    numArgs: 0
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = n;
    return i.length === 1 && (i = Ode[i]), {
      type: "op",
      mode: r.mode,
      limits: !0,
      parentIsSupSub: !1,
      symbol: !0,
      name: i
    };
  },
  htmlBuilder: Rf,
  mathmlBuilder: Hg
});
Et({
  type: "op",
  names: ["\\mathop"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = e[0];
    return {
      type: "op",
      mode: r.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !1,
      body: yn(n)
    };
  },
  htmlBuilder: Rf,
  mathmlBuilder: Hg
});
var Pde = {
  "∫": "\\int",
  "∬": "\\iint",
  "∭": "\\iiint",
  "∮": "\\oint",
  "∯": "\\oiint",
  "∰": "\\oiiint"
};
Et({
  type: "op",
  names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
  props: {
    numArgs: 0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t;
    return {
      type: "op",
      mode: e.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !1,
      name: r
    };
  },
  htmlBuilder: Rf,
  mathmlBuilder: Hg
});
Et({
  type: "op",
  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
  props: {
    numArgs: 0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t;
    return {
      type: "op",
      mode: e.mode,
      limits: !0,
      parentIsSupSub: !1,
      symbol: !1,
      name: r
    };
  },
  htmlBuilder: Rf,
  mathmlBuilder: Hg
});
Et({
  type: "op",
  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"],
  props: {
    numArgs: 0
  },
  handler(t) {
    var {
      parser: e,
      funcName: r
    } = t, n = r;
    return n.length === 1 && (n = Pde[n]), {
      type: "op",
      mode: e.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !0,
      name: n
    };
  },
  htmlBuilder: Rf,
  mathmlBuilder: Hg
});
var Z$ = (t, e) => {
  var r, n, i = !1, a;
  t.type === "supsub" ? (r = t.sup, n = t.sub, a = Qt(t.base, "operatorname"), i = !0) : a = Qt(t, "operatorname");
  var s;
  if (a.body.length > 0) {
    for (var o = a.body.map((d) => {
      var f = d.text;
      return typeof f == "string" ? {
        type: "textord",
        mode: d.mode,
        text: f
      } : d;
    }), l = Fn(o, e.withFont("mathrm"), !0), u = 0; u < l.length; u++) {
      var h = l[u];
      h instanceof rs && (h.text = h.text.replace(/\u2212/, "-").replace(/\u2217/, "*"));
    }
    s = Fe.makeSpan(["mop"], l, e);
  } else
    s = Fe.makeSpan(["mop"], [], e);
  return i ? j$(s, r, n, e, e.style, 0, 0) : s;
}, Bde = (t, e) => {
  for (var r = ga(t.body, e.withFont("mathrm")), n = !0, i = 0; i < r.length; i++) {
    var a = r[i];
    if (!(a instanceof it.SpaceNode)) if (a instanceof it.MathNode)
      switch (a.type) {
        case "mi":
        case "mn":
        case "ms":
        case "mspace":
        case "mtext":
          break;
        case "mo": {
          var s = a.children[0];
          a.children.length === 1 && s instanceof it.TextNode ? s.text = s.text.replace(/\u2212/, "-").replace(/\u2217/, "*") : n = !1;
          break;
        }
        default:
          n = !1;
      }
    else
      n = !1;
  }
  if (n) {
    var o = r.map((h) => h.toText()).join("");
    r = [new it.TextNode(o)];
  }
  var l = new it.MathNode("mi", r);
  l.setAttribute("mathvariant", "normal");
  var u = new it.MathNode("mo", [ns("⁡", "text")]);
  return t.parentIsSupSub ? new it.MathNode("mrow", [l, u]) : it.newDocumentFragment([l, u]);
};
Et({
  type: "operatorname",
  names: ["\\operatorname@", "\\operatornamewithlimits"],
  props: {
    numArgs: 1
  },
  handler: (t, e) => {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    return {
      type: "operatorname",
      mode: r.mode,
      body: yn(i),
      alwaysHandleSupSub: n === "\\operatornamewithlimits",
      limits: !1,
      parentIsSupSub: !1
    };
  },
  htmlBuilder: Z$,
  mathmlBuilder: Bde
});
le("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
Ou({
  type: "ordgroup",
  htmlBuilder(t, e) {
    return t.semisimple ? Fe.makeFragment(Fn(t.body, e, !1)) : Fe.makeSpan(["mord"], Fn(t.body, e, !0), e);
  },
  mathmlBuilder(t, e) {
    return Vl(t.body, e, !0);
  }
});
Et({
  type: "overline",
  names: ["\\overline"],
  props: {
    numArgs: 1
  },
  handler(t, e) {
    var {
      parser: r
    } = t, n = e[0];
    return {
      type: "overline",
      mode: r.mode,
      body: n
    };
  },
  htmlBuilder(t, e) {
    var r = yr(t.body, e.havingCrampedStyle()), n = Fe.makeLineSpan("overline-line", e), i = e.fontMetrics().defaultRuleThickness, a = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r
      }, {
        type: "kern",
        size: 3 * i
      }, {
        type: "elem",
        elem: n
      }, {
        type: "kern",
        size: i
      }]
    }, e);
    return Fe.makeSpan(["mord", "overline"], [a], e);
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mo", [new it.TextNode("‾")]);
    r.setAttribute("stretchy", "true");
    var n = new it.MathNode("mover", [Fr(t.body, e), r]);
    return n.setAttribute("accent", "true"), n;
  }
});
Et({
  type: "phantom",
  names: ["\\phantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = e[0];
    return {
      type: "phantom",
      mode: r.mode,
      body: yn(n)
    };
  },
  htmlBuilder: (t, e) => {
    var r = Fn(t.body, e.withPhantom(), !1);
    return Fe.makeFragment(r);
  },
  mathmlBuilder: (t, e) => {
    var r = ga(t.body, e);
    return new it.MathNode("mphantom", r);
  }
});
Et({
  type: "hphantom",
  names: ["\\hphantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = e[0];
    return {
      type: "hphantom",
      mode: r.mode,
      body: n
    };
  },
  htmlBuilder: (t, e) => {
    var r = Fe.makeSpan([], [yr(t.body, e.withPhantom())]);
    if (r.height = 0, r.depth = 0, r.children)
      for (var n = 0; n < r.children.length; n++)
        r.children[n].height = 0, r.children[n].depth = 0;
    return r = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r
      }]
    }, e), Fe.makeSpan(["mord"], [r], e);
  },
  mathmlBuilder: (t, e) => {
    var r = ga(yn(t.body), e), n = new it.MathNode("mphantom", r), i = new it.MathNode("mpadded", [n]);
    return i.setAttribute("height", "0px"), i.setAttribute("depth", "0px"), i;
  }
});
Et({
  type: "vphantom",
  names: ["\\vphantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      parser: r
    } = t, n = e[0];
    return {
      type: "vphantom",
      mode: r.mode,
      body: n
    };
  },
  htmlBuilder: (t, e) => {
    var r = Fe.makeSpan(["inner"], [yr(t.body, e.withPhantom())]), n = Fe.makeSpan(["fix"], []);
    return Fe.makeSpan(["mord", "rlap"], [r, n], e);
  },
  mathmlBuilder: (t, e) => {
    var r = ga(yn(t.body), e), n = new it.MathNode("mphantom", r), i = new it.MathNode("mpadded", [n]);
    return i.setAttribute("width", "0px"), i;
  }
});
Et({
  type: "raisebox",
  names: ["\\raisebox"],
  props: {
    numArgs: 2,
    argTypes: ["size", "hbox"],
    allowedInText: !0
  },
  handler(t, e) {
    var {
      parser: r
    } = t, n = Qt(e[0], "size").value, i = e[1];
    return {
      type: "raisebox",
      mode: r.mode,
      dy: n,
      body: i
    };
  },
  htmlBuilder(t, e) {
    var r = yr(t.body, e), n = en(t.dy, e);
    return Fe.makeVList({
      positionType: "shift",
      positionData: -n,
      children: [{
        type: "elem",
        elem: r
      }]
    }, e);
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mpadded", [Fr(t.body, e)]), n = t.dy.number + t.dy.unit;
    return r.setAttribute("voffset", n), r;
  }
});
Et({
  type: "internal",
  names: ["\\relax"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInArgument: !0
  },
  handler(t) {
    var {
      parser: e
    } = t;
    return {
      type: "internal",
      mode: e.mode
    };
  }
});
Et({
  type: "rule",
  names: ["\\rule"],
  props: {
    numArgs: 2,
    numOptionalArgs: 1,
    allowedInText: !0,
    allowedInMath: !0,
    argTypes: ["size", "size", "size"]
  },
  handler(t, e, r) {
    var {
      parser: n
    } = t, i = r[0], a = Qt(e[0], "size"), s = Qt(e[1], "size");
    return {
      type: "rule",
      mode: n.mode,
      shift: i && Qt(i, "size").value,
      width: a.value,
      height: s.value
    };
  },
  htmlBuilder(t, e) {
    var r = Fe.makeSpan(["mord", "rule"], [], e), n = en(t.width, e), i = en(t.height, e), a = t.shift ? en(t.shift, e) : 0;
    return r.style.borderRightWidth = gt(n), r.style.borderTopWidth = gt(i), r.style.bottom = gt(a), r.width = n, r.height = i + a, r.depth = -a, r.maxFontSize = i * 1.125 * e.sizeMultiplier, r;
  },
  mathmlBuilder(t, e) {
    var r = en(t.width, e), n = en(t.height, e), i = t.shift ? en(t.shift, e) : 0, a = e.color && e.getColor() || "black", s = new it.MathNode("mspace");
    s.setAttribute("mathbackground", a), s.setAttribute("width", gt(r)), s.setAttribute("height", gt(n));
    var o = new it.MathNode("mpadded", [s]);
    return i >= 0 ? o.setAttribute("height", gt(i)) : (o.setAttribute("height", gt(i)), o.setAttribute("depth", gt(-i))), o.setAttribute("voffset", gt(i)), o;
  }
});
function Q$(t, e, r) {
  for (var n = Fn(t, e, !1), i = e.sizeMultiplier / r.sizeMultiplier, a = 0; a < n.length; a++) {
    var s = n[a].classes.indexOf("sizing");
    s < 0 ? Array.prototype.push.apply(n[a].classes, e.sizingClasses(r)) : n[a].classes[s + 1] === "reset-size" + e.size && (n[a].classes[s + 1] = "reset-size" + r.size), n[a].height *= i, n[a].depth *= i;
  }
  return Fe.makeFragment(n);
}
var q8 = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], Fde = (t, e) => {
  var r = e.havingSize(t.size);
  return Q$(t.body, r, e);
};
Et({
  type: "sizing",
  names: q8,
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler: (t, e) => {
    var {
      breakOnTokenText: r,
      funcName: n,
      parser: i
    } = t, a = i.parseExpression(!1, r);
    return {
      type: "sizing",
      mode: i.mode,
      // Figure out what size to use based on the list of functions above
      size: q8.indexOf(n) + 1,
      body: a
    };
  },
  htmlBuilder: Fde,
  mathmlBuilder: (t, e) => {
    var r = e.havingSize(t.size), n = ga(t.body, r), i = new it.MathNode("mstyle", n);
    return i.setAttribute("mathsize", gt(r.sizeMultiplier)), i;
  }
});
Et({
  type: "smash",
  names: ["\\smash"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1,
    allowedInText: !0
  },
  handler: (t, e, r) => {
    var {
      parser: n
    } = t, i = !1, a = !1, s = r[0] && Qt(r[0], "ordgroup");
    if (s)
      for (var o = "", l = 0; l < s.body.length; ++l) {
        var u = s.body[l];
        if (o = u.text, o === "t")
          i = !0;
        else if (o === "b")
          a = !0;
        else {
          i = !1, a = !1;
          break;
        }
      }
    else
      i = !0, a = !0;
    var h = e[0];
    return {
      type: "smash",
      mode: n.mode,
      body: h,
      smashHeight: i,
      smashDepth: a
    };
  },
  htmlBuilder: (t, e) => {
    var r = Fe.makeSpan([], [yr(t.body, e)]);
    if (!t.smashHeight && !t.smashDepth)
      return r;
    if (t.smashHeight && (r.height = 0, r.children))
      for (var n = 0; n < r.children.length; n++)
        r.children[n].height = 0;
    if (t.smashDepth && (r.depth = 0, r.children))
      for (var i = 0; i < r.children.length; i++)
        r.children[i].depth = 0;
    var a = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r
      }]
    }, e);
    return Fe.makeSpan(["mord"], [a], e);
  },
  mathmlBuilder: (t, e) => {
    var r = new it.MathNode("mpadded", [Fr(t.body, e)]);
    return t.smashHeight && r.setAttribute("height", "0px"), t.smashDepth && r.setAttribute("depth", "0px"), r;
  }
});
Et({
  type: "sqrt",
  names: ["\\sqrt"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1
  },
  handler(t, e, r) {
    var {
      parser: n
    } = t, i = r[0], a = e[0];
    return {
      type: "sqrt",
      mode: n.mode,
      body: a,
      index: i
    };
  },
  htmlBuilder(t, e) {
    var r = yr(t.body, e.havingCrampedStyle());
    r.height === 0 && (r.height = e.fontMetrics().xHeight), r = Fe.wrapFragment(r, e);
    var n = e.fontMetrics(), i = n.defaultRuleThickness, a = i;
    e.style.id < Vt.TEXT.id && (a = e.fontMetrics().xHeight);
    var s = i + a / 4, o = r.height + r.depth + s + i, {
      span: l,
      ruleWidth: u,
      advanceWidth: h
    } = Vo.sqrtImage(o, e), d = l.height - u;
    d > r.height + r.depth + s && (s = (s + d - r.height - r.depth) / 2);
    var f = l.height - r.height - s - u;
    r.style.paddingLeft = gt(h);
    var p = Fe.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: r,
        wrapperClasses: ["svg-align"]
      }, {
        type: "kern",
        size: -(r.height + f)
      }, {
        type: "elem",
        elem: l
      }, {
        type: "kern",
        size: u
      }]
    }, e);
    if (t.index) {
      var g = e.havingStyle(Vt.SCRIPTSCRIPT), m = yr(t.index, g, e), v = 0.6 * (p.height - p.depth), y = Fe.makeVList({
        positionType: "shift",
        positionData: -v,
        children: [{
          type: "elem",
          elem: m
        }]
      }, e), b = Fe.makeSpan(["root"], [y]);
      return Fe.makeSpan(["mord", "sqrt"], [b, p], e);
    } else
      return Fe.makeSpan(["mord", "sqrt"], [p], e);
  },
  mathmlBuilder(t, e) {
    var {
      body: r,
      index: n
    } = t;
    return n ? new it.MathNode("mroot", [Fr(r, e), Fr(n, e)]) : new it.MathNode("msqrt", [Fr(r, e)]);
  }
});
var Y8 = {
  display: Vt.DISPLAY,
  text: Vt.TEXT,
  script: Vt.SCRIPT,
  scriptscript: Vt.SCRIPTSCRIPT
};
Et({
  type: "styling",
  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(t, e) {
    var {
      breakOnTokenText: r,
      funcName: n,
      parser: i
    } = t, a = i.parseExpression(!0, r), s = n.slice(1, n.length - 5);
    return {
      type: "styling",
      mode: i.mode,
      // Figure out what style to use by pulling out the style from
      // the function name
      style: s,
      body: a
    };
  },
  htmlBuilder(t, e) {
    var r = Y8[t.style], n = e.havingStyle(r).withFont("");
    return Q$(t.body, n, e);
  },
  mathmlBuilder(t, e) {
    var r = Y8[t.style], n = e.havingStyle(r), i = ga(t.body, n), a = new it.MathNode("mstyle", i), s = {
      display: ["0", "true"],
      text: ["0", "false"],
      script: ["1", "false"],
      scriptscript: ["2", "false"]
    }, o = s[t.style];
    return a.setAttribute("scriptlevel", o[0]), a.setAttribute("displaystyle", o[1]), a;
  }
});
var $de = function(e, r) {
  var n = e.base;
  if (n)
    if (n.type === "op") {
      var i = n.limits && (r.style.size === Vt.DISPLAY.size || n.alwaysHandleSupSub);
      return i ? Rf : null;
    } else if (n.type === "operatorname") {
      var a = n.alwaysHandleSupSub && (r.style.size === Vt.DISPLAY.size || n.limits);
      return a ? Z$ : null;
    } else {
      if (n.type === "accent")
        return Tr.isCharacterBox(n.base) ? dk : null;
      if (n.type === "horizBrace") {
        var s = !e.sub;
        return s === n.isOver ? X$ : null;
      } else
        return null;
    }
  else return null;
};
Ou({
  type: "supsub",
  htmlBuilder(t, e) {
    var r = $de(t, e);
    if (r)
      return r(t, e);
    var {
      base: n,
      sup: i,
      sub: a
    } = t, s = yr(n, e), o, l, u = e.fontMetrics(), h = 0, d = 0, f = n && Tr.isCharacterBox(n);
    if (i) {
      var p = e.havingStyle(e.style.sup());
      o = yr(i, p, e), f || (h = s.height - p.fontMetrics().supDrop * p.sizeMultiplier / e.sizeMultiplier);
    }
    if (a) {
      var g = e.havingStyle(e.style.sub());
      l = yr(a, g, e), f || (d = s.depth + g.fontMetrics().subDrop * g.sizeMultiplier / e.sizeMultiplier);
    }
    var m;
    e.style === Vt.DISPLAY ? m = u.sup1 : e.style.cramped ? m = u.sup3 : m = u.sup2;
    var v = e.sizeMultiplier, y = gt(0.5 / u.ptPerEm / v), b = null;
    if (l) {
      var w = t.base && t.base.type === "op" && t.base.name && (t.base.name === "\\oiint" || t.base.name === "\\oiiint");
      (s instanceof rs || w) && (b = gt(-s.italic));
    }
    var T;
    if (o && l) {
      h = Math.max(h, m, o.depth + 0.25 * u.xHeight), d = Math.max(d, u.sub2);
      var E = u.defaultRuleThickness, C = 4 * E;
      if (h - o.depth - (l.height - d) < C) {
        d = C - (h - o.depth) + l.height;
        var k = 0.8 * u.xHeight - (h - o.depth);
        k > 0 && (h += k, d -= k);
      }
      var _ = [{
        type: "elem",
        elem: l,
        shift: d,
        marginRight: y,
        marginLeft: b
      }, {
        type: "elem",
        elem: o,
        shift: -h,
        marginRight: y
      }];
      T = Fe.makeVList({
        positionType: "individualShift",
        children: _
      }, e);
    } else if (l) {
      d = Math.max(d, u.sub1, l.height - 0.8 * u.xHeight);
      var L = [{
        type: "elem",
        elem: l,
        marginLeft: b,
        marginRight: y
      }];
      T = Fe.makeVList({
        positionType: "shift",
        positionData: d,
        children: L
      }, e);
    } else if (o)
      h = Math.max(h, m, o.depth + 0.25 * u.xHeight), T = Fe.makeVList({
        positionType: "shift",
        positionData: -h,
        children: [{
          type: "elem",
          elem: o,
          marginRight: y
        }]
      }, e);
    else
      throw new Error("supsub must have either sup or sub.");
    var N = Jw(s, "right") || "mord";
    return Fe.makeSpan([N], [s, Fe.makeSpan(["msupsub"], [T])], e);
  },
  mathmlBuilder(t, e) {
    var r = !1, n, i;
    t.base && t.base.type === "horizBrace" && (i = !!t.sup, i === t.base.isOver && (r = !0, n = t.base.isOver)), t.base && (t.base.type === "op" || t.base.type === "operatorname") && (t.base.parentIsSupSub = !0);
    var a = [Fr(t.base, e)];
    t.sub && a.push(Fr(t.sub, e)), t.sup && a.push(Fr(t.sup, e));
    var s;
    if (r)
      s = n ? "mover" : "munder";
    else if (t.sub)
      if (t.sup) {
        var u = t.base;
        u && u.type === "op" && u.limits && e.style === Vt.DISPLAY || u && u.type === "operatorname" && u.alwaysHandleSupSub && (e.style === Vt.DISPLAY || u.limits) ? s = "munderover" : s = "msubsup";
      } else {
        var l = t.base;
        l && l.type === "op" && l.limits && (e.style === Vt.DISPLAY || l.alwaysHandleSupSub) || l && l.type === "operatorname" && l.alwaysHandleSupSub && (l.limits || e.style === Vt.DISPLAY) ? s = "munder" : s = "msub";
      }
    else {
      var o = t.base;
      o && o.type === "op" && o.limits && (e.style === Vt.DISPLAY || o.alwaysHandleSupSub) || o && o.type === "operatorname" && o.alwaysHandleSupSub && (o.limits || e.style === Vt.DISPLAY) ? s = "mover" : s = "msup";
    }
    return new it.MathNode(s, a);
  }
});
Ou({
  type: "atom",
  htmlBuilder(t, e) {
    return Fe.mathsym(t.text, t.mode, e, ["m" + t.family]);
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mo", [ns(t.text, t.mode)]);
    if (t.family === "bin") {
      var n = uk(t, e);
      n === "bold-italic" && r.setAttribute("mathvariant", n);
    } else t.family === "punct" ? r.setAttribute("separator", "true") : (t.family === "open" || t.family === "close") && r.setAttribute("stretchy", "false");
    return r;
  }
});
var J$ = {
  mi: "italic",
  mn: "normal",
  mtext: "normal"
};
Ou({
  type: "mathord",
  htmlBuilder(t, e) {
    return Fe.makeOrd(t, e, "mathord");
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mi", [ns(t.text, t.mode, e)]), n = uk(t, e) || "italic";
    return n !== J$[r.type] && r.setAttribute("mathvariant", n), r;
  }
});
Ou({
  type: "textord",
  htmlBuilder(t, e) {
    return Fe.makeOrd(t, e, "textord");
  },
  mathmlBuilder(t, e) {
    var r = ns(t.text, t.mode, e), n = uk(t, e) || "normal", i;
    return t.mode === "text" ? i = new it.MathNode("mtext", [r]) : /[0-9]/.test(t.text) ? i = new it.MathNode("mn", [r]) : t.text === "\\prime" ? i = new it.MathNode("mo", [r]) : i = new it.MathNode("mi", [r]), n !== J$[i.type] && i.setAttribute("mathvariant", n), i;
  }
});
var m4 = {
  "\\nobreak": "nobreak",
  "\\allowbreak": "allowbreak"
}, v4 = {
  " ": {},
  "\\ ": {},
  "~": {
    className: "nobreak"
  },
  "\\space": {},
  "\\nobreakspace": {
    className: "nobreak"
  }
};
Ou({
  type: "spacing",
  htmlBuilder(t, e) {
    if (v4.hasOwnProperty(t.text)) {
      var r = v4[t.text].className || "";
      if (t.mode === "text") {
        var n = Fe.makeOrd(t, e, "textord");
        return n.classes.push(r), n;
      } else
        return Fe.makeSpan(["mspace", r], [Fe.mathsym(t.text, t.mode, e)], e);
    } else {
      if (m4.hasOwnProperty(t.text))
        return Fe.makeSpan(["mspace", m4[t.text]], [], e);
      throw new ot('Unknown type of space "' + t.text + '"');
    }
  },
  mathmlBuilder(t, e) {
    var r;
    if (v4.hasOwnProperty(t.text))
      r = new it.MathNode("mtext", [new it.TextNode(" ")]);
    else {
      if (m4.hasOwnProperty(t.text))
        return new it.MathNode("mspace");
      throw new ot('Unknown type of space "' + t.text + '"');
    }
    return r;
  }
});
var X8 = () => {
  var t = new it.MathNode("mtd", []);
  return t.setAttribute("width", "50%"), t;
};
Ou({
  type: "tag",
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mtable", [new it.MathNode("mtr", [X8(), new it.MathNode("mtd", [Vl(t.body, e)]), X8(), new it.MathNode("mtd", [Vl(t.tag, e)])])]);
    return r.setAttribute("width", "100%"), r;
  }
});
var j8 = {
  "\\text": void 0,
  "\\textrm": "textrm",
  "\\textsf": "textsf",
  "\\texttt": "texttt",
  "\\textnormal": "textrm"
}, K8 = {
  "\\textbf": "textbf",
  "\\textmd": "textmd"
}, zde = {
  "\\textit": "textit",
  "\\textup": "textup"
}, Z8 = (t, e) => {
  var r = t.font;
  if (r) {
    if (j8[r])
      return e.withTextFontFamily(j8[r]);
    if (K8[r])
      return e.withTextFontWeight(K8[r]);
    if (r === "\\emph")
      return e.fontShape === "textit" ? e.withTextFontShape("textup") : e.withTextFontShape("textit");
  } else return e;
  return e.withTextFontShape(zde[r]);
};
Et({
  type: "text",
  names: [
    // Font families
    "\\text",
    "\\textrm",
    "\\textsf",
    "\\texttt",
    "\\textnormal",
    // Font weights
    "\\textbf",
    "\\textmd",
    // Font Shapes
    "\\textit",
    "\\textup",
    "\\emph"
  ],
  props: {
    numArgs: 1,
    argTypes: ["text"],
    allowedInArgument: !0,
    allowedInText: !0
  },
  handler(t, e) {
    var {
      parser: r,
      funcName: n
    } = t, i = e[0];
    return {
      type: "text",
      mode: r.mode,
      body: yn(i),
      font: n
    };
  },
  htmlBuilder(t, e) {
    var r = Z8(t, e), n = Fn(t.body, r, !0);
    return Fe.makeSpan(["mord", "text"], n, r);
  },
  mathmlBuilder(t, e) {
    var r = Z8(t, e);
    return Vl(t.body, r);
  }
});
Et({
  type: "underline",
  names: ["\\underline"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "underline",
      mode: r.mode,
      body: e[0]
    };
  },
  htmlBuilder(t, e) {
    var r = yr(t.body, e), n = Fe.makeLineSpan("underline-line", e), i = e.fontMetrics().defaultRuleThickness, a = Fe.makeVList({
      positionType: "top",
      positionData: r.height,
      children: [{
        type: "kern",
        size: i
      }, {
        type: "elem",
        elem: n
      }, {
        type: "kern",
        size: 3 * i
      }, {
        type: "elem",
        elem: r
      }]
    }, e);
    return Fe.makeSpan(["mord", "underline"], [a], e);
  },
  mathmlBuilder(t, e) {
    var r = new it.MathNode("mo", [new it.TextNode("‾")]);
    r.setAttribute("stretchy", "true");
    var n = new it.MathNode("munder", [Fr(t.body, e), r]);
    return n.setAttribute("accentunder", "true"), n;
  }
});
Et({
  type: "vcenter",
  names: ["\\vcenter"],
  props: {
    numArgs: 1,
    argTypes: ["original"],
    // In LaTeX, \vcenter can act only on a box.
    allowedInText: !1
  },
  handler(t, e) {
    var {
      parser: r
    } = t;
    return {
      type: "vcenter",
      mode: r.mode,
      body: e[0]
    };
  },
  htmlBuilder(t, e) {
    var r = yr(t.body, e), n = e.fontMetrics().axisHeight, i = 0.5 * (r.height - n - (r.depth + n));
    return Fe.makeVList({
      positionType: "shift",
      positionData: i,
      children: [{
        type: "elem",
        elem: r
      }]
    }, e);
  },
  mathmlBuilder(t, e) {
    return new it.MathNode("mpadded", [Fr(t.body, e)], ["vcenter"]);
  }
});
Et({
  type: "verb",
  names: ["\\verb"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(t, e, r) {
    throw new ot("\\verb ended by end of line instead of matching delimiter");
  },
  htmlBuilder(t, e) {
    for (var r = Q8(t), n = [], i = e.havingStyle(e.style.text()), a = 0; a < r.length; a++) {
      var s = r[a];
      s === "~" && (s = "\\textasciitilde"), n.push(Fe.makeSymbol(s, "Typewriter-Regular", t.mode, i, ["mord", "texttt"]));
    }
    return Fe.makeSpan(["mord", "text"].concat(i.sizingClasses(e)), Fe.tryCombineChars(n), i);
  },
  mathmlBuilder(t, e) {
    var r = new it.TextNode(Q8(t)), n = new it.MathNode("mtext", [r]);
    return n.setAttribute("mathvariant", "monospace"), n;
  }
});
var Q8 = (t) => t.body.replace(/ /g, t.star ? "␣" : " "), Tl = T$, ez = `[ \r
	]`, Vde = "\\\\[a-zA-Z@]+", Gde = "\\\\[^\uD800-\uDFFF]", Ude = "(" + Vde + ")" + ez + "*", Wde = `\\\\(
|[ \r	]+
?)[ \r	]*`, nT = "[̀-ͯ]", Hde = new RegExp(nT + "+$"), qde = "(" + ez + "+)|" + // whitespace
(Wde + "|") + // \whitespace
"([!-\\[\\]-‧‪-퟿豈-]" + // single codepoint
(nT + "*") + // ...plus accents
"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
(nT + "*") + // ...plus accents
"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred
("|" + Ude) + // \macroName + spaces
("|" + Gde + ")");
let J8 = class {
  // Category codes. The lexer only supports comment characters (14) for now.
  // MacroExpander additionally distinguishes active (13).
  constructor(e, r) {
    this.input = void 0, this.settings = void 0, this.tokenRegex = void 0, this.catcodes = void 0, this.input = e, this.settings = r, this.tokenRegex = new RegExp(qde, "g"), this.catcodes = {
      "%": 14,
      // comment character
      "~": 13
      // active character
    };
  }
  setCatcode(e, r) {
    this.catcodes[e] = r;
  }
  /**
   * This function lexes a single token.
   */
  lex() {
    var e = this.input, r = this.tokenRegex.lastIndex;
    if (r === e.length)
      return new Aa("EOF", new na(this, r, r));
    var n = this.tokenRegex.exec(e);
    if (n === null || n.index !== r)
      throw new ot("Unexpected character: '" + e[r] + "'", new Aa(e[r], new na(this, r, r + 1)));
    var i = n[6] || n[3] || (n[2] ? "\\ " : " ");
    if (this.catcodes[i] === 14) {
      var a = e.indexOf(`
`, this.tokenRegex.lastIndex);
      return a === -1 ? (this.tokenRegex.lastIndex = e.length, this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")) : this.tokenRegex.lastIndex = a + 1, this.lex();
    }
    return new Aa(i, new na(this, r, this.tokenRegex.lastIndex));
  }
};
class Yde {
  /**
   * Both arguments are optional.  The first argument is an object of
   * built-in mappings which never change.  The second argument is an object
   * of initial (global-level) mappings, which will constantly change
   * according to any global/top-level `set`s done.
   */
  constructor(e, r) {
    e === void 0 && (e = {}), r === void 0 && (r = {}), this.current = void 0, this.builtins = void 0, this.undefStack = void 0, this.current = r, this.builtins = e, this.undefStack = [];
  }
  /**
   * Start a new nested group, affecting future local `set`s.
   */
  beginGroup() {
    this.undefStack.push({});
  }
  /**
   * End current nested group, restoring values before the group began.
   */
  endGroup() {
    if (this.undefStack.length === 0)
      throw new ot("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
    var e = this.undefStack.pop();
    for (var r in e)
      e.hasOwnProperty(r) && (e[r] == null ? delete this.current[r] : this.current[r] = e[r]);
  }
  /**
   * Ends all currently nested groups (if any), restoring values before the
   * groups began.  Useful in case of an error in the middle of parsing.
   */
  endGroups() {
    for (; this.undefStack.length > 0; )
      this.endGroup();
  }
  /**
   * Detect whether `name` has a definition.  Equivalent to
   * `get(name) != null`.
   */
  has(e) {
    return this.current.hasOwnProperty(e) || this.builtins.hasOwnProperty(e);
  }
  /**
   * Get the current value of a name, or `undefined` if there is no value.
   *
   * Note: Do not use `if (namespace.get(...))` to detect whether a macro
   * is defined, as the definition may be the empty string which evaluates
   * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
   * `if (namespace.has(...))`.
   */
  get(e) {
    return this.current.hasOwnProperty(e) ? this.current[e] : this.builtins[e];
  }
  /**
   * Set the current value of a name, and optionally set it globally too.
   * Local set() sets the current value and (when appropriate) adds an undo
   * operation to the undo stack.  Global set() may change the undo
   * operation at every level, so takes time linear in their number.
   * A value of undefined means to delete existing definitions.
   */
  set(e, r, n) {
    if (n === void 0 && (n = !1), n) {
      for (var i = 0; i < this.undefStack.length; i++)
        delete this.undefStack[i][e];
      this.undefStack.length > 0 && (this.undefStack[this.undefStack.length - 1][e] = r);
    } else {
      var a = this.undefStack[this.undefStack.length - 1];
      a && !a.hasOwnProperty(e) && (a[e] = this.current[e]);
    }
    r == null ? delete this.current[e] : this.current[e] = r;
  }
}
var Xde = U$;
le("\\noexpand", function(t) {
  var e = t.popToken();
  return t.isExpandable(e.text) && (e.noexpand = !0, e.treatAsRelax = !0), {
    tokens: [e],
    numArgs: 0
  };
});
le("\\expandafter", function(t) {
  var e = t.popToken();
  return t.expandOnce(!0), {
    tokens: [e],
    numArgs: 0
  };
});
le("\\@firstoftwo", function(t) {
  var e = t.consumeArgs(2);
  return {
    tokens: e[0],
    numArgs: 0
  };
});
le("\\@secondoftwo", function(t) {
  var e = t.consumeArgs(2);
  return {
    tokens: e[1],
    numArgs: 0
  };
});
le("\\@ifnextchar", function(t) {
  var e = t.consumeArgs(3);
  t.consumeSpaces();
  var r = t.future();
  return e[0].length === 1 && e[0][0].text === r.text ? {
    tokens: e[1],
    numArgs: 0
  } : {
    tokens: e[2],
    numArgs: 0
  };
});
le("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}");
le("\\TextOrMath", function(t) {
  var e = t.consumeArgs(2);
  return t.mode === "text" ? {
    tokens: e[0],
    numArgs: 0
  } : {
    tokens: e[1],
    numArgs: 0
  };
});
var eA = {
  0: 0,
  1: 1,
  2: 2,
  3: 3,
  4: 4,
  5: 5,
  6: 6,
  7: 7,
  8: 8,
  9: 9,
  a: 10,
  A: 10,
  b: 11,
  B: 11,
  c: 12,
  C: 12,
  d: 13,
  D: 13,
  e: 14,
  E: 14,
  f: 15,
  F: 15
};
le("\\char", function(t) {
  var e = t.popToken(), r, n = "";
  if (e.text === "'")
    r = 8, e = t.popToken();
  else if (e.text === '"')
    r = 16, e = t.popToken();
  else if (e.text === "`")
    if (e = t.popToken(), e.text[0] === "\\")
      n = e.text.charCodeAt(1);
    else {
      if (e.text === "EOF")
        throw new ot("\\char` missing argument");
      n = e.text.charCodeAt(0);
    }
  else
    r = 10;
  if (r) {
    if (n = eA[e.text], n == null || n >= r)
      throw new ot("Invalid base-" + r + " digit " + e.text);
    for (var i; (i = eA[t.future().text]) != null && i < r; )
      n *= r, n += i, t.popToken();
  }
  return "\\@char{" + n + "}";
});
var bk = (t, e, r, n) => {
  var i = t.consumeArg().tokens;
  if (i.length !== 1)
    throw new ot("\\newcommand's first argument must be a macro name");
  var a = i[0].text, s = t.isDefined(a);
  if (s && !e)
    throw new ot("\\newcommand{" + a + "} attempting to redefine " + (a + "; use \\renewcommand"));
  if (!s && !r)
    throw new ot("\\renewcommand{" + a + "} when command " + a + " does not yet exist; use \\newcommand");
  var o = 0;
  if (i = t.consumeArg().tokens, i.length === 1 && i[0].text === "[") {
    for (var l = "", u = t.expandNextToken(); u.text !== "]" && u.text !== "EOF"; )
      l += u.text, u = t.expandNextToken();
    if (!l.match(/^\s*[0-9]+\s*$/))
      throw new ot("Invalid number of arguments: " + l);
    o = parseInt(l), i = t.consumeArg().tokens;
  }
  return s && n || t.macros.set(a, {
    tokens: i,
    numArgs: o
  }), "";
};
le("\\newcommand", (t) => bk(t, !1, !0, !1));
le("\\renewcommand", (t) => bk(t, !0, !1, !1));
le("\\providecommand", (t) => bk(t, !0, !0, !0));
le("\\message", (t) => {
  var e = t.consumeArgs(1)[0];
  return console.log(e.reverse().map((r) => r.text).join("")), "";
});
le("\\errmessage", (t) => {
  var e = t.consumeArgs(1)[0];
  return console.error(e.reverse().map((r) => r.text).join("")), "";
});
le("\\show", (t) => {
  var e = t.popToken(), r = e.text;
  return console.log(e, t.macros.get(r), Tl[r], Vr.math[r], Vr.text[r]), "";
});
le("\\bgroup", "{");
le("\\egroup", "}");
le("~", "\\nobreakspace");
le("\\lq", "`");
le("\\rq", "'");
le("\\aa", "\\r a");
le("\\AA", "\\r A");
le("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
le("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
le("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");
le("ℬ", "\\mathscr{B}");
le("ℰ", "\\mathscr{E}");
le("ℱ", "\\mathscr{F}");
le("ℋ", "\\mathscr{H}");
le("ℐ", "\\mathscr{I}");
le("ℒ", "\\mathscr{L}");
le("ℳ", "\\mathscr{M}");
le("ℛ", "\\mathscr{R}");
le("ℭ", "\\mathfrak{C}");
le("ℌ", "\\mathfrak{H}");
le("ℨ", "\\mathfrak{Z}");
le("\\Bbbk", "\\Bbb{k}");
le("·", "\\cdotp");
le("\\llap", "\\mathllap{\\textrm{#1}}");
le("\\rlap", "\\mathrlap{\\textrm{#1}}");
le("\\clap", "\\mathclap{\\textrm{#1}}");
le("\\mathstrut", "\\vphantom{(}");
le("\\underbar", "\\underline{\\text{#1}}");
le("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
le("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
le("\\ne", "\\neq");
le("≠", "\\neq");
le("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");
le("∉", "\\notin");
le("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");
le("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");
le("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");
le("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");
le("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");
le("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");
le("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");
le("⟂", "\\perp");
le("‼", "\\mathclose{!\\mkern-0.8mu!}");
le("∌", "\\notni");
le("⌜", "\\ulcorner");
le("⌝", "\\urcorner");
le("⌞", "\\llcorner");
le("⌟", "\\lrcorner");
le("©", "\\copyright");
le("®", "\\textregistered");
le("️", "\\textregistered");
le("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');
le("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');
le("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');
le("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');
le("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}");
le("⋮", "\\vdots");
le("\\varGamma", "\\mathit{\\Gamma}");
le("\\varDelta", "\\mathit{\\Delta}");
le("\\varTheta", "\\mathit{\\Theta}");
le("\\varLambda", "\\mathit{\\Lambda}");
le("\\varXi", "\\mathit{\\Xi}");
le("\\varPi", "\\mathit{\\Pi}");
le("\\varSigma", "\\mathit{\\Sigma}");
le("\\varUpsilon", "\\mathit{\\Upsilon}");
le("\\varPhi", "\\mathit{\\Phi}");
le("\\varPsi", "\\mathit{\\Psi}");
le("\\varOmega", "\\mathit{\\Omega}");
le("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
le("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");
le("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
le("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
le("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
le("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
le("\\dddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");
le("\\ddddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");
var tA = {
  ",": "\\dotsc",
  "\\not": "\\dotsb",
  // \keybin@ checks for the following:
  "+": "\\dotsb",
  "=": "\\dotsb",
  "<": "\\dotsb",
  ">": "\\dotsb",
  "-": "\\dotsb",
  "*": "\\dotsb",
  ":": "\\dotsb",
  // Symbols whose definition starts with \DOTSB:
  "\\DOTSB": "\\dotsb",
  "\\coprod": "\\dotsb",
  "\\bigvee": "\\dotsb",
  "\\bigwedge": "\\dotsb",
  "\\biguplus": "\\dotsb",
  "\\bigcap": "\\dotsb",
  "\\bigcup": "\\dotsb",
  "\\prod": "\\dotsb",
  "\\sum": "\\dotsb",
  "\\bigotimes": "\\dotsb",
  "\\bigoplus": "\\dotsb",
  "\\bigodot": "\\dotsb",
  "\\bigsqcup": "\\dotsb",
  "\\And": "\\dotsb",
  "\\longrightarrow": "\\dotsb",
  "\\Longrightarrow": "\\dotsb",
  "\\longleftarrow": "\\dotsb",
  "\\Longleftarrow": "\\dotsb",
  "\\longleftrightarrow": "\\dotsb",
  "\\Longleftrightarrow": "\\dotsb",
  "\\mapsto": "\\dotsb",
  "\\longmapsto": "\\dotsb",
  "\\hookrightarrow": "\\dotsb",
  "\\doteq": "\\dotsb",
  // Symbols whose definition starts with \mathbin:
  "\\mathbin": "\\dotsb",
  // Symbols whose definition starts with \mathrel:
  "\\mathrel": "\\dotsb",
  "\\relbar": "\\dotsb",
  "\\Relbar": "\\dotsb",
  "\\xrightarrow": "\\dotsb",
  "\\xleftarrow": "\\dotsb",
  // Symbols whose definition starts with \DOTSI:
  "\\DOTSI": "\\dotsi",
  "\\int": "\\dotsi",
  "\\oint": "\\dotsi",
  "\\iint": "\\dotsi",
  "\\iiint": "\\dotsi",
  "\\iiiint": "\\dotsi",
  "\\idotsint": "\\dotsi",
  // Symbols whose definition starts with \DOTSX:
  "\\DOTSX": "\\dotsx"
};
le("\\dots", function(t) {
  var e = "\\dotso", r = t.expandAfterFuture().text;
  return r in tA ? e = tA[r] : (r.slice(0, 4) === "\\not" || r in Vr.math && ["bin", "rel"].includes(Vr.math[r].group)) && (e = "\\dotsb"), e;
});
var wk = {
  // \rightdelim@ checks for the following:
  ")": !0,
  "]": !0,
  "\\rbrack": !0,
  "\\}": !0,
  "\\rbrace": !0,
  "\\rangle": !0,
  "\\rceil": !0,
  "\\rfloor": !0,
  "\\rgroup": !0,
  "\\rmoustache": !0,
  "\\right": !0,
  "\\bigr": !0,
  "\\biggr": !0,
  "\\Bigr": !0,
  "\\Biggr": !0,
  // \extra@ also tests for the following:
  $: !0,
  // \extrap@ checks for the following:
  ";": !0,
  ".": !0,
  ",": !0
};
le("\\dotso", function(t) {
  var e = t.future().text;
  return e in wk ? "\\ldots\\," : "\\ldots";
});
le("\\dotsc", function(t) {
  var e = t.future().text;
  return e in wk && e !== "," ? "\\ldots\\," : "\\ldots";
});
le("\\cdots", function(t) {
  var e = t.future().text;
  return e in wk ? "\\@cdots\\," : "\\@cdots";
});
le("\\dotsb", "\\cdots");
le("\\dotsm", "\\cdots");
le("\\dotsi", "\\!\\cdots");
le("\\dotsx", "\\ldots\\,");
le("\\DOTSI", "\\relax");
le("\\DOTSB", "\\relax");
le("\\DOTSX", "\\relax");
le("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
le("\\,", "\\tmspace+{3mu}{.1667em}");
le("\\thinspace", "\\,");
le("\\>", "\\mskip{4mu}");
le("\\:", "\\tmspace+{4mu}{.2222em}");
le("\\medspace", "\\:");
le("\\;", "\\tmspace+{5mu}{.2777em}");
le("\\thickspace", "\\;");
le("\\!", "\\tmspace-{3mu}{.1667em}");
le("\\negthinspace", "\\!");
le("\\negmedspace", "\\tmspace-{4mu}{.2222em}");
le("\\negthickspace", "\\tmspace-{5mu}{.277em}");
le("\\enspace", "\\kern.5em ");
le("\\enskip", "\\hskip.5em\\relax");
le("\\quad", "\\hskip1em\\relax");
le("\\qquad", "\\hskip2em\\relax");
le("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
le("\\tag@paren", "\\tag@literal{({#1})}");
le("\\tag@literal", (t) => {
  if (t.macros.get("\\df@tag"))
    throw new ot("Multiple \\tag");
  return "\\gdef\\df@tag{\\text{#1}}";
});
le("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
le("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
le("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
le("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");
le("\\newline", "\\\\\\relax");
le("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");
var tz = gt(Gs["Main-Regular"][84][1] - 0.7 * Gs["Main-Regular"][65][1]);
le("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + tz + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}");
le("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + tz + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}");
le("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
le("\\@hspace", "\\hskip #1\\relax");
le("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax");
le("\\ordinarycolon", ":");
le("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
le("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');
le("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');
le("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');
le("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');
le("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');
le("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');
le("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');
le("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');
le("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');
le("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');
le("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');
le("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');
le("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');
le("∷", "\\dblcolon");
le("∹", "\\eqcolon");
le("≔", "\\coloneqq");
le("≕", "\\eqqcolon");
le("⩴", "\\Coloneqq");
le("\\ratio", "\\vcentcolon");
le("\\coloncolon", "\\dblcolon");
le("\\colonequals", "\\coloneqq");
le("\\coloncolonequals", "\\Coloneqq");
le("\\equalscolon", "\\eqqcolon");
le("\\equalscoloncolon", "\\Eqqcolon");
le("\\colonminus", "\\coloneq");
le("\\coloncolonminus", "\\Coloneq");
le("\\minuscolon", "\\eqcolon");
le("\\minuscoloncolon", "\\Eqcolon");
le("\\coloncolonapprox", "\\Colonapprox");
le("\\coloncolonsim", "\\Colonsim");
le("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
le("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
le("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
le("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");
le("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");
le("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
le("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
le("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
le("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
le("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
le("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
le("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
le("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}");
le("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}");
le("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}");
le("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}");
le("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}");
le("\\nleqq", "\\html@mathml{\\@nleqq}{≰}");
le("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}");
le("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
le("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
le("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}");
le("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}");
le("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
le("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
le("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
le("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
le("\\imath", "\\html@mathml{\\@imath}{ı}");
le("\\jmath", "\\html@mathml{\\@jmath}{ȷ}");
le("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");
le("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");
le("⟦", "\\llbracket");
le("⟧", "\\rrbracket");
le("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");
le("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");
le("⦃", "\\lBrace");
le("⦄", "\\rBrace");
le("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");
le("⦵", "\\minuso");
le("\\darr", "\\downarrow");
le("\\dArr", "\\Downarrow");
le("\\Darr", "\\Downarrow");
le("\\lang", "\\langle");
le("\\rang", "\\rangle");
le("\\uarr", "\\uparrow");
le("\\uArr", "\\Uparrow");
le("\\Uarr", "\\Uparrow");
le("\\N", "\\mathbb{N}");
le("\\R", "\\mathbb{R}");
le("\\Z", "\\mathbb{Z}");
le("\\alef", "\\aleph");
le("\\alefsym", "\\aleph");
le("\\Alpha", "\\mathrm{A}");
le("\\Beta", "\\mathrm{B}");
le("\\bull", "\\bullet");
le("\\Chi", "\\mathrm{X}");
le("\\clubs", "\\clubsuit");
le("\\cnums", "\\mathbb{C}");
le("\\Complex", "\\mathbb{C}");
le("\\Dagger", "\\ddagger");
le("\\diamonds", "\\diamondsuit");
le("\\empty", "\\emptyset");
le("\\Epsilon", "\\mathrm{E}");
le("\\Eta", "\\mathrm{H}");
le("\\exist", "\\exists");
le("\\harr", "\\leftrightarrow");
le("\\hArr", "\\Leftrightarrow");
le("\\Harr", "\\Leftrightarrow");
le("\\hearts", "\\heartsuit");
le("\\image", "\\Im");
le("\\infin", "\\infty");
le("\\Iota", "\\mathrm{I}");
le("\\isin", "\\in");
le("\\Kappa", "\\mathrm{K}");
le("\\larr", "\\leftarrow");
le("\\lArr", "\\Leftarrow");
le("\\Larr", "\\Leftarrow");
le("\\lrarr", "\\leftrightarrow");
le("\\lrArr", "\\Leftrightarrow");
le("\\Lrarr", "\\Leftrightarrow");
le("\\Mu", "\\mathrm{M}");
le("\\natnums", "\\mathbb{N}");
le("\\Nu", "\\mathrm{N}");
le("\\Omicron", "\\mathrm{O}");
le("\\plusmn", "\\pm");
le("\\rarr", "\\rightarrow");
le("\\rArr", "\\Rightarrow");
le("\\Rarr", "\\Rightarrow");
le("\\real", "\\Re");
le("\\reals", "\\mathbb{R}");
le("\\Reals", "\\mathbb{R}");
le("\\Rho", "\\mathrm{P}");
le("\\sdot", "\\cdot");
le("\\sect", "\\S");
le("\\spades", "\\spadesuit");
le("\\sub", "\\subset");
le("\\sube", "\\subseteq");
le("\\supe", "\\supseteq");
le("\\Tau", "\\mathrm{T}");
le("\\thetasym", "\\vartheta");
le("\\weierp", "\\wp");
le("\\Zeta", "\\mathrm{Z}");
le("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
le("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
le("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
le("\\bra", "\\mathinner{\\langle{#1}|}");
le("\\ket", "\\mathinner{|{#1}\\rangle}");
le("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
le("\\Bra", "\\left\\langle#1\\right|");
le("\\Ket", "\\left|#1\\right\\rangle");
var rz = (t) => (e) => {
  var r = e.consumeArg().tokens, n = e.consumeArg().tokens, i = e.consumeArg().tokens, a = e.consumeArg().tokens, s = e.macros.get("|"), o = e.macros.get("\\|");
  e.macros.beginGroup();
  var l = (d) => (f) => {
    t && (f.macros.set("|", s), i.length && f.macros.set("\\|", o));
    var p = d;
    if (!d && i.length) {
      var g = f.future();
      g.text === "|" && (f.popToken(), p = !0);
    }
    return {
      tokens: p ? i : n,
      numArgs: 0
    };
  };
  e.macros.set("|", l(!1)), i.length && e.macros.set("\\|", l(!0));
  var u = e.consumeArg().tokens, h = e.expandTokens([
    ...a,
    ...u,
    ...r
    // reversed
  ]);
  return e.macros.endGroup(), {
    tokens: h.reverse(),
    numArgs: 0
  };
};
le("\\bra@ket", rz(!1));
le("\\bra@set", rz(!0));
le("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");
le("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");
le("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
le("\\angln", "{\\angl n}");
le("\\blue", "\\textcolor{##6495ed}{#1}");
le("\\orange", "\\textcolor{##ffa500}{#1}");
le("\\pink", "\\textcolor{##ff00af}{#1}");
le("\\red", "\\textcolor{##df0030}{#1}");
le("\\green", "\\textcolor{##28ae7b}{#1}");
le("\\gray", "\\textcolor{gray}{#1}");
le("\\purple", "\\textcolor{##9d38bd}{#1}");
le("\\blueA", "\\textcolor{##ccfaff}{#1}");
le("\\blueB", "\\textcolor{##80f6ff}{#1}");
le("\\blueC", "\\textcolor{##63d9ea}{#1}");
le("\\blueD", "\\textcolor{##11accd}{#1}");
le("\\blueE", "\\textcolor{##0c7f99}{#1}");
le("\\tealA", "\\textcolor{##94fff5}{#1}");
le("\\tealB", "\\textcolor{##26edd5}{#1}");
le("\\tealC", "\\textcolor{##01d1c1}{#1}");
le("\\tealD", "\\textcolor{##01a995}{#1}");
le("\\tealE", "\\textcolor{##208170}{#1}");
le("\\greenA", "\\textcolor{##b6ffb0}{#1}");
le("\\greenB", "\\textcolor{##8af281}{#1}");
le("\\greenC", "\\textcolor{##74cf70}{#1}");
le("\\greenD", "\\textcolor{##1fab54}{#1}");
le("\\greenE", "\\textcolor{##0d923f}{#1}");
le("\\goldA", "\\textcolor{##ffd0a9}{#1}");
le("\\goldB", "\\textcolor{##ffbb71}{#1}");
le("\\goldC", "\\textcolor{##ff9c39}{#1}");
le("\\goldD", "\\textcolor{##e07d10}{#1}");
le("\\goldE", "\\textcolor{##a75a05}{#1}");
le("\\redA", "\\textcolor{##fca9a9}{#1}");
le("\\redB", "\\textcolor{##ff8482}{#1}");
le("\\redC", "\\textcolor{##f9685d}{#1}");
le("\\redD", "\\textcolor{##e84d39}{#1}");
le("\\redE", "\\textcolor{##bc2612}{#1}");
le("\\maroonA", "\\textcolor{##ffbde0}{#1}");
le("\\maroonB", "\\textcolor{##ff92c6}{#1}");
le("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
le("\\maroonD", "\\textcolor{##ca337c}{#1}");
le("\\maroonE", "\\textcolor{##9e034e}{#1}");
le("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
le("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
le("\\purpleC", "\\textcolor{##aa87ff}{#1}");
le("\\purpleD", "\\textcolor{##7854ab}{#1}");
le("\\purpleE", "\\textcolor{##543b78}{#1}");
le("\\mintA", "\\textcolor{##f5f9e8}{#1}");
le("\\mintB", "\\textcolor{##edf2df}{#1}");
le("\\mintC", "\\textcolor{##e0e5cc}{#1}");
le("\\grayA", "\\textcolor{##f6f7f7}{#1}");
le("\\grayB", "\\textcolor{##f0f1f2}{#1}");
le("\\grayC", "\\textcolor{##e3e5e6}{#1}");
le("\\grayD", "\\textcolor{##d6d8da}{#1}");
le("\\grayE", "\\textcolor{##babec2}{#1}");
le("\\grayF", "\\textcolor{##888d93}{#1}");
le("\\grayG", "\\textcolor{##626569}{#1}");
le("\\grayH", "\\textcolor{##3b3e40}{#1}");
le("\\grayI", "\\textcolor{##21242c}{#1}");
le("\\kaBlue", "\\textcolor{##314453}{#1}");
le("\\kaGreen", "\\textcolor{##71B307}{#1}");
var nz = {
  "^": !0,
  // Parser.js
  _: !0,
  // Parser.js
  "\\limits": !0,
  // Parser.js
  "\\nolimits": !0
  // Parser.js
};
class jde {
  constructor(e, r, n) {
    this.settings = void 0, this.expansionCount = void 0, this.lexer = void 0, this.macros = void 0, this.stack = void 0, this.mode = void 0, this.settings = r, this.expansionCount = 0, this.feed(e), this.macros = new Yde(Xde, r.macros), this.mode = n, this.stack = [];
  }
  /**
   * Feed a new input string to the same MacroExpander
   * (with existing macros etc.).
   */
  feed(e) {
    this.lexer = new J8(e, this.settings);
  }
  /**
   * Switches between "text" and "math" modes.
   */
  switchMode(e) {
    this.mode = e;
  }
  /**
   * Start a new group nesting within all namespaces.
   */
  beginGroup() {
    this.macros.beginGroup();
  }
  /**
   * End current group nesting within all namespaces.
   */
  endGroup() {
    this.macros.endGroup();
  }
  /**
   * Ends all currently nested groups (if any), restoring values before the
   * groups began.  Useful in case of an error in the middle of parsing.
   */
  endGroups() {
    this.macros.endGroups();
  }
  /**
   * Returns the topmost token on the stack, without expanding it.
   * Similar in behavior to TeX's `\futurelet`.
   */
  future() {
    return this.stack.length === 0 && this.pushToken(this.lexer.lex()), this.stack[this.stack.length - 1];
  }
  /**
   * Remove and return the next unexpanded token.
   */
  popToken() {
    return this.future(), this.stack.pop();
  }
  /**
   * Add a given token to the token stack.  In particular, this get be used
   * to put back a token returned from one of the other methods.
   */
  pushToken(e) {
    this.stack.push(e);
  }
  /**
   * Append an array of tokens to the token stack.
   */
  pushTokens(e) {
    this.stack.push(...e);
  }
  /**
   * Find an macro argument without expanding tokens and append the array of
   * tokens to the token stack. Uses Token as a container for the result.
   */
  scanArgument(e) {
    var r, n, i;
    if (e) {
      if (this.consumeSpaces(), this.future().text !== "[")
        return null;
      r = this.popToken(), {
        tokens: i,
        end: n
      } = this.consumeArg(["]"]);
    } else
      ({
        tokens: i,
        start: r,
        end: n
      } = this.consumeArg());
    return this.pushToken(new Aa("EOF", n.loc)), this.pushTokens(i), new Aa("", na.range(r, n));
  }
  /**
   * Consume all following space tokens, without expansion.
   */
  consumeSpaces() {
    for (; ; ) {
      var e = this.future();
      if (e.text === " ")
        this.stack.pop();
      else
        break;
    }
  }
  /**
   * Consume an argument from the token stream, and return the resulting array
   * of tokens and start/end token.
   */
  consumeArg(e) {
    var r = [], n = e && e.length > 0;
    n || this.consumeSpaces();
    var i = this.future(), a, s = 0, o = 0;
    do {
      if (a = this.popToken(), r.push(a), a.text === "{")
        ++s;
      else if (a.text === "}") {
        if (--s, s === -1)
          throw new ot("Extra }", a);
      } else if (a.text === "EOF")
        throw new ot("Unexpected end of input in a macro argument, expected '" + (e && n ? e[o] : "}") + "'", a);
      if (e && n)
        if ((s === 0 || s === 1 && e[o] === "{") && a.text === e[o]) {
          if (++o, o === e.length) {
            r.splice(-o, o);
            break;
          }
        } else
          o = 0;
    } while (s !== 0 || n);
    return i.text === "{" && r[r.length - 1].text === "}" && (r.pop(), r.shift()), r.reverse(), {
      tokens: r,
      start: i,
      end: a
    };
  }
  /**
   * Consume the specified number of (delimited) arguments from the token
   * stream and return the resulting array of arguments.
   */
  consumeArgs(e, r) {
    if (r) {
      if (r.length !== e + 1)
        throw new ot("The length of delimiters doesn't match the number of args!");
      for (var n = r[0], i = 0; i < n.length; i++) {
        var a = this.popToken();
        if (n[i] !== a.text)
          throw new ot("Use of the macro doesn't match its definition", a);
      }
    }
    for (var s = [], o = 0; o < e; o++)
      s.push(this.consumeArg(r && r[o + 1]).tokens);
    return s;
  }
  /**
   * Increment `expansionCount` by the specified amount.
   * Throw an error if it exceeds `maxExpand`.
   */
  countExpansion(e) {
    if (this.expansionCount += e, this.expansionCount > this.settings.maxExpand)
      throw new ot("Too many expansions: infinite loop or need to increase maxExpand setting");
  }
  /**
   * Expand the next token only once if possible.
   *
   * If the token is expanded, the resulting tokens will be pushed onto
   * the stack in reverse order, and the number of such tokens will be
   * returned.  This number might be zero or positive.
   *
   * If not, the return value is `false`, and the next token remains at the
   * top of the stack.
   *
   * In either case, the next token will be on the top of the stack,
   * or the stack will be empty (in case of empty expansion
   * and no other tokens).
   *
   * Used to implement `expandAfterFuture` and `expandNextToken`.
   *
   * If expandableOnly, only expandable tokens are expanded and
   * an undefined control sequence results in an error.
   */
  expandOnce(e) {
    var r = this.popToken(), n = r.text, i = r.noexpand ? null : this._getExpansion(n);
    if (i == null || e && i.unexpandable) {
      if (e && i == null && n[0] === "\\" && !this.isDefined(n))
        throw new ot("Undefined control sequence: " + n);
      return this.pushToken(r), !1;
    }
    this.countExpansion(1);
    var a = i.tokens, s = this.consumeArgs(i.numArgs, i.delimiters);
    if (i.numArgs) {
      a = a.slice();
      for (var o = a.length - 1; o >= 0; --o) {
        var l = a[o];
        if (l.text === "#") {
          if (o === 0)
            throw new ot("Incomplete placeholder at end of macro body", l);
          if (l = a[--o], l.text === "#")
            a.splice(o + 1, 1);
          else if (/^[1-9]$/.test(l.text))
            a.splice(o, 2, ...s[+l.text - 1]);
          else
            throw new ot("Not a valid argument number", l);
        }
      }
    }
    return this.pushTokens(a), a.length;
  }
  /**
   * Expand the next token only once (if possible), and return the resulting
   * top token on the stack (without removing anything from the stack).
   * Similar in behavior to TeX's `\expandafter\futurelet`.
   * Equivalent to expandOnce() followed by future().
   */
  expandAfterFuture() {
    return this.expandOnce(), this.future();
  }
  /**
   * Recursively expand first token, then return first non-expandable token.
   */
  expandNextToken() {
    for (; ; )
      if (this.expandOnce() === !1) {
        var e = this.stack.pop();
        return e.treatAsRelax && (e.text = "\\relax"), e;
      }
    throw new Error();
  }
  /**
   * Fully expand the given macro name and return the resulting list of
   * tokens, or return `undefined` if no such macro is defined.
   */
  expandMacro(e) {
    return this.macros.has(e) ? this.expandTokens([new Aa(e)]) : void 0;
  }
  /**
   * Fully expand the given token stream and return the resulting list of
   * tokens.  Note that the input tokens are in reverse order, but the
   * output tokens are in forward order.
   */
  expandTokens(e) {
    var r = [], n = this.stack.length;
    for (this.pushTokens(e); this.stack.length > n; )
      if (this.expandOnce(!0) === !1) {
        var i = this.stack.pop();
        i.treatAsRelax && (i.noexpand = !1, i.treatAsRelax = !1), r.push(i);
      }
    return this.countExpansion(r.length), r;
  }
  /**
   * Fully expand the given macro name and return the result as a string,
   * or return `undefined` if no such macro is defined.
   */
  expandMacroAsText(e) {
    var r = this.expandMacro(e);
    return r && r.map((n) => n.text).join("");
  }
  /**
   * Returns the expanded macro as a reversed array of tokens and a macro
   * argument count.  Or returns `null` if no such macro.
   */
  _getExpansion(e) {
    var r = this.macros.get(e);
    if (r == null)
      return r;
    if (e.length === 1) {
      var n = this.lexer.catcodes[e];
      if (n != null && n !== 13)
        return;
    }
    var i = typeof r == "function" ? r(this) : r;
    if (typeof i == "string") {
      var a = 0;
      if (i.indexOf("#") !== -1)
        for (var s = i.replace(/##/g, ""); s.indexOf("#" + (a + 1)) !== -1; )
          ++a;
      for (var o = new J8(i, this.settings), l = [], u = o.lex(); u.text !== "EOF"; )
        l.push(u), u = o.lex();
      l.reverse();
      var h = {
        tokens: l,
        numArgs: a
      };
      return h;
    }
    return i;
  }
  /**
   * Determine whether a command is currently "defined" (has some
   * functionality), meaning that it's a macro (in the current group),
   * a function, a symbol, or one of the special commands listed in
   * `implicitCommands`.
   */
  isDefined(e) {
    return this.macros.has(e) || Tl.hasOwnProperty(e) || Vr.math.hasOwnProperty(e) || Vr.text.hasOwnProperty(e) || nz.hasOwnProperty(e);
  }
  /**
   * Determine whether a command is expandable.
   */
  isExpandable(e) {
    var r = this.macros.get(e);
    return r != null ? typeof r == "string" || typeof r == "function" || !r.unexpandable : Tl.hasOwnProperty(e) && !Tl[e].primitive;
  }
}
var rA = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/, Y1 = Object.freeze({
  "₊": "+",
  "₋": "-",
  "₌": "=",
  "₍": "(",
  "₎": ")",
  "₀": "0",
  "₁": "1",
  "₂": "2",
  "₃": "3",
  "₄": "4",
  "₅": "5",
  "₆": "6",
  "₇": "7",
  "₈": "8",
  "₉": "9",
  "ₐ": "a",
  "ₑ": "e",
  "ₕ": "h",
  "ᵢ": "i",
  "ⱼ": "j",
  "ₖ": "k",
  "ₗ": "l",
  "ₘ": "m",
  "ₙ": "n",
  "ₒ": "o",
  "ₚ": "p",
  "ᵣ": "r",
  "ₛ": "s",
  "ₜ": "t",
  "ᵤ": "u",
  "ᵥ": "v",
  "ₓ": "x",
  "ᵦ": "β",
  "ᵧ": "γ",
  "ᵨ": "ρ",
  "ᵩ": "ϕ",
  "ᵪ": "χ",
  "⁺": "+",
  "⁻": "-",
  "⁼": "=",
  "⁽": "(",
  "⁾": ")",
  "⁰": "0",
  "¹": "1",
  "²": "2",
  "³": "3",
  "⁴": "4",
  "⁵": "5",
  "⁶": "6",
  "⁷": "7",
  "⁸": "8",
  "⁹": "9",
  "ᴬ": "A",
  "ᴮ": "B",
  "ᴰ": "D",
  "ᴱ": "E",
  "ᴳ": "G",
  "ᴴ": "H",
  "ᴵ": "I",
  "ᴶ": "J",
  "ᴷ": "K",
  "ᴸ": "L",
  "ᴹ": "M",
  "ᴺ": "N",
  "ᴼ": "O",
  "ᴾ": "P",
  "ᴿ": "R",
  "ᵀ": "T",
  "ᵁ": "U",
  "ⱽ": "V",
  "ᵂ": "W",
  "ᵃ": "a",
  "ᵇ": "b",
  "ᶜ": "c",
  "ᵈ": "d",
  "ᵉ": "e",
  "ᶠ": "f",
  "ᵍ": "g",
  ʰ: "h",
  "ⁱ": "i",
  ʲ: "j",
  "ᵏ": "k",
  ˡ: "l",
  "ᵐ": "m",
  ⁿ: "n",
  "ᵒ": "o",
  "ᵖ": "p",
  ʳ: "r",
  ˢ: "s",
  "ᵗ": "t",
  "ᵘ": "u",
  "ᵛ": "v",
  ʷ: "w",
  ˣ: "x",
  ʸ: "y",
  "ᶻ": "z",
  "ᵝ": "β",
  "ᵞ": "γ",
  "ᵟ": "δ",
  "ᵠ": "ϕ",
  "ᵡ": "χ",
  "ᶿ": "θ"
}), y4 = {
  "́": {
    text: "\\'",
    math: "\\acute"
  },
  "̀": {
    text: "\\`",
    math: "\\grave"
  },
  "̈": {
    text: '\\"',
    math: "\\ddot"
  },
  "̃": {
    text: "\\~",
    math: "\\tilde"
  },
  "̄": {
    text: "\\=",
    math: "\\bar"
  },
  "̆": {
    text: "\\u",
    math: "\\breve"
  },
  "̌": {
    text: "\\v",
    math: "\\check"
  },
  "̂": {
    text: "\\^",
    math: "\\hat"
  },
  "̇": {
    text: "\\.",
    math: "\\dot"
  },
  "̊": {
    text: "\\r",
    math: "\\mathring"
  },
  "̋": {
    text: "\\H"
  },
  "̧": {
    text: "\\c"
  }
}, nA = {
  á: "á",
  à: "à",
  ä: "ä",
  ǟ: "ǟ",
  ã: "ã",
  ā: "ā",
  ă: "ă",
  ắ: "ắ",
  ằ: "ằ",
  ẵ: "ẵ",
  ǎ: "ǎ",
  â: "â",
  ấ: "ấ",
  ầ: "ầ",
  ẫ: "ẫ",
  ȧ: "ȧ",
  ǡ: "ǡ",
  å: "å",
  ǻ: "ǻ",
  ḃ: "ḃ",
  ć: "ć",
  ḉ: "ḉ",
  č: "č",
  ĉ: "ĉ",
  ċ: "ċ",
  ç: "ç",
  ď: "ď",
  ḋ: "ḋ",
  ḑ: "ḑ",
  é: "é",
  è: "è",
  ë: "ë",
  ẽ: "ẽ",
  ē: "ē",
  ḗ: "ḗ",
  ḕ: "ḕ",
  ĕ: "ĕ",
  ḝ: "ḝ",
  ě: "ě",
  ê: "ê",
  ế: "ế",
  ề: "ề",
  ễ: "ễ",
  ė: "ė",
  ȩ: "ȩ",
  ḟ: "ḟ",
  ǵ: "ǵ",
  ḡ: "ḡ",
  ğ: "ğ",
  ǧ: "ǧ",
  ĝ: "ĝ",
  ġ: "ġ",
  ģ: "ģ",
  ḧ: "ḧ",
  ȟ: "ȟ",
  ĥ: "ĥ",
  ḣ: "ḣ",
  ḩ: "ḩ",
  í: "í",
  ì: "ì",
  ï: "ï",
  ḯ: "ḯ",
  ĩ: "ĩ",
  ī: "ī",
  ĭ: "ĭ",
  ǐ: "ǐ",
  î: "î",
  ǰ: "ǰ",
  ĵ: "ĵ",
  ḱ: "ḱ",
  ǩ: "ǩ",
  ķ: "ķ",
  ĺ: "ĺ",
  ľ: "ľ",
  ļ: "ļ",
  ḿ: "ḿ",
  ṁ: "ṁ",
  ń: "ń",
  ǹ: "ǹ",
  ñ: "ñ",
  ň: "ň",
  ṅ: "ṅ",
  ņ: "ņ",
  ó: "ó",
  ò: "ò",
  ö: "ö",
  ȫ: "ȫ",
  õ: "õ",
  ṍ: "ṍ",
  ṏ: "ṏ",
  ȭ: "ȭ",
  ō: "ō",
  ṓ: "ṓ",
  ṑ: "ṑ",
  ŏ: "ŏ",
  ǒ: "ǒ",
  ô: "ô",
  ố: "ố",
  ồ: "ồ",
  ỗ: "ỗ",
  ȯ: "ȯ",
  ȱ: "ȱ",
  ő: "ő",
  ṕ: "ṕ",
  ṗ: "ṗ",
  ŕ: "ŕ",
  ř: "ř",
  ṙ: "ṙ",
  ŗ: "ŗ",
  ś: "ś",
  ṥ: "ṥ",
  š: "š",
  ṧ: "ṧ",
  ŝ: "ŝ",
  ṡ: "ṡ",
  ş: "ş",
  ẗ: "ẗ",
  ť: "ť",
  ṫ: "ṫ",
  ţ: "ţ",
  ú: "ú",
  ù: "ù",
  ü: "ü",
  ǘ: "ǘ",
  ǜ: "ǜ",
  ǖ: "ǖ",
  ǚ: "ǚ",
  ũ: "ũ",
  ṹ: "ṹ",
  ū: "ū",
  ṻ: "ṻ",
  ŭ: "ŭ",
  ǔ: "ǔ",
  û: "û",
  ů: "ů",
  ű: "ű",
  ṽ: "ṽ",
  ẃ: "ẃ",
  ẁ: "ẁ",
  ẅ: "ẅ",
  ŵ: "ŵ",
  ẇ: "ẇ",
  ẘ: "ẘ",
  ẍ: "ẍ",
  ẋ: "ẋ",
  ý: "ý",
  ỳ: "ỳ",
  ÿ: "ÿ",
  ỹ: "ỹ",
  ȳ: "ȳ",
  ŷ: "ŷ",
  ẏ: "ẏ",
  ẙ: "ẙ",
  ź: "ź",
  ž: "ž",
  ẑ: "ẑ",
  ż: "ż",
  Á: "Á",
  À: "À",
  Ä: "Ä",
  Ǟ: "Ǟ",
  Ã: "Ã",
  Ā: "Ā",
  Ă: "Ă",
  Ắ: "Ắ",
  Ằ: "Ằ",
  Ẵ: "Ẵ",
  Ǎ: "Ǎ",
  Â: "Â",
  Ấ: "Ấ",
  Ầ: "Ầ",
  Ẫ: "Ẫ",
  Ȧ: "Ȧ",
  Ǡ: "Ǡ",
  Å: "Å",
  Ǻ: "Ǻ",
  Ḃ: "Ḃ",
  Ć: "Ć",
  Ḉ: "Ḉ",
  Č: "Č",
  Ĉ: "Ĉ",
  Ċ: "Ċ",
  Ç: "Ç",
  Ď: "Ď",
  Ḋ: "Ḋ",
  Ḑ: "Ḑ",
  É: "É",
  È: "È",
  Ë: "Ë",
  Ẽ: "Ẽ",
  Ē: "Ē",
  Ḗ: "Ḗ",
  Ḕ: "Ḕ",
  Ĕ: "Ĕ",
  Ḝ: "Ḝ",
  Ě: "Ě",
  Ê: "Ê",
  Ế: "Ế",
  Ề: "Ề",
  Ễ: "Ễ",
  Ė: "Ė",
  Ȩ: "Ȩ",
  Ḟ: "Ḟ",
  Ǵ: "Ǵ",
  Ḡ: "Ḡ",
  Ğ: "Ğ",
  Ǧ: "Ǧ",
  Ĝ: "Ĝ",
  Ġ: "Ġ",
  Ģ: "Ģ",
  Ḧ: "Ḧ",
  Ȟ: "Ȟ",
  Ĥ: "Ĥ",
  Ḣ: "Ḣ",
  Ḩ: "Ḩ",
  Í: "Í",
  Ì: "Ì",
  Ï: "Ï",
  Ḯ: "Ḯ",
  Ĩ: "Ĩ",
  Ī: "Ī",
  Ĭ: "Ĭ",
  Ǐ: "Ǐ",
  Î: "Î",
  İ: "İ",
  Ĵ: "Ĵ",
  Ḱ: "Ḱ",
  Ǩ: "Ǩ",
  Ķ: "Ķ",
  Ĺ: "Ĺ",
  Ľ: "Ľ",
  Ļ: "Ļ",
  Ḿ: "Ḿ",
  Ṁ: "Ṁ",
  Ń: "Ń",
  Ǹ: "Ǹ",
  Ñ: "Ñ",
  Ň: "Ň",
  Ṅ: "Ṅ",
  Ņ: "Ņ",
  Ó: "Ó",
  Ò: "Ò",
  Ö: "Ö",
  Ȫ: "Ȫ",
  Õ: "Õ",
  Ṍ: "Ṍ",
  Ṏ: "Ṏ",
  Ȭ: "Ȭ",
  Ō: "Ō",
  Ṓ: "Ṓ",
  Ṑ: "Ṑ",
  Ŏ: "Ŏ",
  Ǒ: "Ǒ",
  Ô: "Ô",
  Ố: "Ố",
  Ồ: "Ồ",
  Ỗ: "Ỗ",
  Ȯ: "Ȯ",
  Ȱ: "Ȱ",
  Ő: "Ő",
  Ṕ: "Ṕ",
  Ṗ: "Ṗ",
  Ŕ: "Ŕ",
  Ř: "Ř",
  Ṙ: "Ṙ",
  Ŗ: "Ŗ",
  Ś: "Ś",
  Ṥ: "Ṥ",
  Š: "Š",
  Ṧ: "Ṧ",
  Ŝ: "Ŝ",
  Ṡ: "Ṡ",
  Ş: "Ş",
  Ť: "Ť",
  Ṫ: "Ṫ",
  Ţ: "Ţ",
  Ú: "Ú",
  Ù: "Ù",
  Ü: "Ü",
  Ǘ: "Ǘ",
  Ǜ: "Ǜ",
  Ǖ: "Ǖ",
  Ǚ: "Ǚ",
  Ũ: "Ũ",
  Ṹ: "Ṹ",
  Ū: "Ū",
  Ṻ: "Ṻ",
  Ŭ: "Ŭ",
  Ǔ: "Ǔ",
  Û: "Û",
  Ů: "Ů",
  Ű: "Ű",
  Ṽ: "Ṽ",
  Ẃ: "Ẃ",
  Ẁ: "Ẁ",
  Ẅ: "Ẅ",
  Ŵ: "Ŵ",
  Ẇ: "Ẇ",
  Ẍ: "Ẍ",
  Ẋ: "Ẋ",
  Ý: "Ý",
  Ỳ: "Ỳ",
  Ÿ: "Ÿ",
  Ỹ: "Ỹ",
  Ȳ: "Ȳ",
  Ŷ: "Ŷ",
  Ẏ: "Ẏ",
  Ź: "Ź",
  Ž: "Ž",
  Ẑ: "Ẑ",
  Ż: "Ż",
  ά: "ά",
  ὰ: "ὰ",
  ᾱ: "ᾱ",
  ᾰ: "ᾰ",
  έ: "έ",
  ὲ: "ὲ",
  ή: "ή",
  ὴ: "ὴ",
  ί: "ί",
  ὶ: "ὶ",
  ϊ: "ϊ",
  ΐ: "ΐ",
  ῒ: "ῒ",
  ῑ: "ῑ",
  ῐ: "ῐ",
  ό: "ό",
  ὸ: "ὸ",
  ύ: "ύ",
  ὺ: "ὺ",
  ϋ: "ϋ",
  ΰ: "ΰ",
  ῢ: "ῢ",
  ῡ: "ῡ",
  ῠ: "ῠ",
  ώ: "ώ",
  ὼ: "ὼ",
  Ύ: "Ύ",
  Ὺ: "Ὺ",
  Ϋ: "Ϋ",
  Ῡ: "Ῡ",
  Ῠ: "Ῠ",
  Ώ: "Ώ",
  Ὼ: "Ὼ"
};
let iz = class az {
  constructor(e, r) {
    this.mode = void 0, this.gullet = void 0, this.settings = void 0, this.leftrightDepth = void 0, this.nextToken = void 0, this.mode = "math", this.gullet = new jde(e, r, this.mode), this.settings = r, this.leftrightDepth = 0;
  }
  /**
   * Checks a result to make sure it has the right type, and throws an
   * appropriate error otherwise.
   */
  expect(e, r) {
    if (r === void 0 && (r = !0), this.fetch().text !== e)
      throw new ot("Expected '" + e + "', got '" + this.fetch().text + "'", this.fetch());
    r && this.consume();
  }
  /**
   * Discards the current lookahead token, considering it consumed.
   */
  consume() {
    this.nextToken = null;
  }
  /**
   * Return the current lookahead token, or if there isn't one (at the
   * beginning, or if the previous lookahead token was consume()d),
   * fetch the next token as the new lookahead token and return it.
   */
  fetch() {
    return this.nextToken == null && (this.nextToken = this.gullet.expandNextToken()), this.nextToken;
  }
  /**
   * Switches between "text" and "math" modes.
   */
  switchMode(e) {
    this.mode = e, this.gullet.switchMode(e);
  }
  /**
   * Main parsing function, which parses an entire input.
   */
  parse() {
    this.settings.globalGroup || this.gullet.beginGroup(), this.settings.colorIsTextColor && this.gullet.macros.set("\\color", "\\textcolor");
    try {
      var e = this.parseExpression(!1);
      return this.expect("EOF"), this.settings.globalGroup || this.gullet.endGroup(), e;
    } finally {
      this.gullet.endGroups();
    }
  }
  /**
   * Fully parse a separate sequence of tokens as a separate job.
   * Tokens should be specified in reverse order, as in a MacroDefinition.
   */
  subparse(e) {
    var r = this.nextToken;
    this.consume(), this.gullet.pushToken(new Aa("}")), this.gullet.pushTokens(e);
    var n = this.parseExpression(!1);
    return this.expect("}"), this.nextToken = r, n;
  }
  /**
   * Parses an "expression", which is a list of atoms.
   *
   * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
   *                 happens when functions have higher precedence han infix
   *                 nodes in implicit parses.
   *
   * `breakOnTokenText`: The text of the token that the expression should end
   *                     with, or `null` if something else should end the
   *                     expression.
   */
  parseExpression(e, r) {
    for (var n = []; ; ) {
      this.mode === "math" && this.consumeSpaces();
      var i = this.fetch();
      if (az.endOfExpression.indexOf(i.text) !== -1 || r && i.text === r || e && Tl[i.text] && Tl[i.text].infix)
        break;
      var a = this.parseAtom(r);
      if (a) {
        if (a.type === "internal")
          continue;
      } else break;
      n.push(a);
    }
    return this.mode === "text" && this.formLigatures(n), this.handleInfixNodes(n);
  }
  /**
   * Rewrites infix operators such as \over with corresponding commands such
   * as \frac.
   *
   * There can only be one infix operator per group.  If there's more than one
   * then the expression is ambiguous.  This can be resolved by adding {}.
   */
  handleInfixNodes(e) {
    for (var r = -1, n, i = 0; i < e.length; i++)
      if (e[i].type === "infix") {
        if (r !== -1)
          throw new ot("only one infix operator per group", e[i].token);
        r = i, n = e[i].replaceWith;
      }
    if (r !== -1 && n) {
      var a, s, o = e.slice(0, r), l = e.slice(r + 1);
      o.length === 1 && o[0].type === "ordgroup" ? a = o[0] : a = {
        type: "ordgroup",
        mode: this.mode,
        body: o
      }, l.length === 1 && l[0].type === "ordgroup" ? s = l[0] : s = {
        type: "ordgroup",
        mode: this.mode,
        body: l
      };
      var u;
      return n === "\\\\abovefrac" ? u = this.callFunction(n, [a, e[r], s], []) : u = this.callFunction(n, [a, s], []), [u];
    } else
      return e;
  }
  /**
   * Handle a subscript or superscript with nice errors.
   */
  handleSupSubscript(e) {
    var r = this.fetch(), n = r.text;
    this.consume(), this.consumeSpaces();
    var i;
    do {
      var a;
      i = this.parseGroup(e);
    } while (((a = i) == null ? void 0 : a.type) === "internal");
    if (!i)
      throw new ot("Expected group after '" + n + "'", r);
    return i;
  }
  /**
   * Converts the textual input of an unsupported command into a text node
   * contained within a color node whose color is determined by errorColor
   */
  formatUnsupportedCmd(e) {
    for (var r = [], n = 0; n < e.length; n++)
      r.push({
        type: "textord",
        mode: "text",
        text: e[n]
      });
    var i = {
      type: "text",
      mode: this.mode,
      body: r
    }, a = {
      type: "color",
      mode: this.mode,
      color: this.settings.errorColor,
      body: [i]
    };
    return a;
  }
  /**
   * Parses a group with optional super/subscripts.
   */
  parseAtom(e) {
    var r = this.parseGroup("atom", e);
    if ((r == null ? void 0 : r.type) === "internal" || this.mode === "text")
      return r;
    for (var n, i; ; ) {
      this.consumeSpaces();
      var a = this.fetch();
      if (a.text === "\\limits" || a.text === "\\nolimits") {
        if (r && r.type === "op") {
          var s = a.text === "\\limits";
          r.limits = s, r.alwaysHandleSupSub = !0;
        } else if (r && r.type === "operatorname")
          r.alwaysHandleSupSub && (r.limits = a.text === "\\limits");
        else
          throw new ot("Limit controls must follow a math operator", a);
        this.consume();
      } else if (a.text === "^") {
        if (n)
          throw new ot("Double superscript", a);
        n = this.handleSupSubscript("superscript");
      } else if (a.text === "_") {
        if (i)
          throw new ot("Double subscript", a);
        i = this.handleSupSubscript("subscript");
      } else if (a.text === "'") {
        if (n)
          throw new ot("Double superscript", a);
        var o = {
          type: "textord",
          mode: this.mode,
          text: "\\prime"
        }, l = [o];
        for (this.consume(); this.fetch().text === "'"; )
          l.push(o), this.consume();
        this.fetch().text === "^" && l.push(this.handleSupSubscript("superscript")), n = {
          type: "ordgroup",
          mode: this.mode,
          body: l
        };
      } else if (Y1[a.text]) {
        var u = rA.test(a.text), h = [];
        for (h.push(new Aa(Y1[a.text])), this.consume(); ; ) {
          var d = this.fetch().text;
          if (!Y1[d] || rA.test(d) !== u)
            break;
          h.unshift(new Aa(Y1[d])), this.consume();
        }
        var f = this.subparse(h);
        u ? i = {
          type: "ordgroup",
          mode: "math",
          body: f
        } : n = {
          type: "ordgroup",
          mode: "math",
          body: f
        };
      } else
        break;
    }
    return n || i ? {
      type: "supsub",
      mode: this.mode,
      base: r,
      sup: n,
      sub: i
    } : r;
  }
  /**
   * Parses an entire function, including its base and all of its arguments.
   */
  parseFunction(e, r) {
    var n = this.fetch(), i = n.text, a = Tl[i];
    if (!a)
      return null;
    if (this.consume(), r && r !== "atom" && !a.allowedInArgument)
      throw new ot("Got function '" + i + "' with no arguments" + (r ? " as " + r : ""), n);
    if (this.mode === "text" && !a.allowedInText)
      throw new ot("Can't use function '" + i + "' in text mode", n);
    if (this.mode === "math" && a.allowedInMath === !1)
      throw new ot("Can't use function '" + i + "' in math mode", n);
    var {
      args: s,
      optArgs: o
    } = this.parseArguments(i, a);
    return this.callFunction(i, s, o, n, e);
  }
  /**
   * Call a function handler with a suitable context and arguments.
   */
  callFunction(e, r, n, i, a) {
    var s = {
      funcName: e,
      parser: this,
      token: i,
      breakOnTokenText: a
    }, o = Tl[e];
    if (o && o.handler)
      return o.handler(s, r, n);
    throw new ot("No function handler for " + e);
  }
  /**
   * Parses the arguments of a function or environment
   */
  parseArguments(e, r) {
    var n = r.numArgs + r.numOptionalArgs;
    if (n === 0)
      return {
        args: [],
        optArgs: []
      };
    for (var i = [], a = [], s = 0; s < n; s++) {
      var o = r.argTypes && r.argTypes[s], l = s < r.numOptionalArgs;
      (r.primitive && o == null || // \sqrt expands into primitive if optional argument doesn't exist
      r.type === "sqrt" && s === 1 && a[0] == null) && (o = "primitive");
      var u = this.parseGroupOfType("argument to '" + e + "'", o, l);
      if (l)
        a.push(u);
      else if (u != null)
        i.push(u);
      else
        throw new ot("Null argument, please report this as a bug");
    }
    return {
      args: i,
      optArgs: a
    };
  }
  /**
   * Parses a group when the mode is changing.
   */
  parseGroupOfType(e, r, n) {
    switch (r) {
      case "color":
        return this.parseColorGroup(n);
      case "size":
        return this.parseSizeGroup(n);
      case "url":
        return this.parseUrlGroup(n);
      case "math":
      case "text":
        return this.parseArgumentGroup(n, r);
      case "hbox": {
        var i = this.parseArgumentGroup(n, "text");
        return i != null ? {
          type: "styling",
          mode: i.mode,
          body: [i],
          style: "text"
          // simulate \textstyle
        } : null;
      }
      case "raw": {
        var a = this.parseStringGroup("raw", n);
        return a != null ? {
          type: "raw",
          mode: "text",
          string: a.text
        } : null;
      }
      case "primitive": {
        if (n)
          throw new ot("A primitive argument cannot be optional");
        var s = this.parseGroup(e);
        if (s == null)
          throw new ot("Expected group as " + e, this.fetch());
        return s;
      }
      case "original":
      case null:
      case void 0:
        return this.parseArgumentGroup(n);
      default:
        throw new ot("Unknown group type as " + e, this.fetch());
    }
  }
  /**
   * Discard any space tokens, fetching the next non-space token.
   */
  consumeSpaces() {
    for (; this.fetch().text === " "; )
      this.consume();
  }
  /**
   * Parses a group, essentially returning the string formed by the
   * brace-enclosed tokens plus some position information.
   */
  parseStringGroup(e, r) {
    var n = this.gullet.scanArgument(r);
    if (n == null)
      return null;
    for (var i = "", a; (a = this.fetch()).text !== "EOF"; )
      i += a.text, this.consume();
    return this.consume(), n.text = i, n;
  }
  /**
   * Parses a regex-delimited group: the largest sequence of tokens
   * whose concatenated strings match `regex`. Returns the string
   * formed by the tokens plus some position information.
   */
  parseRegexGroup(e, r) {
    for (var n = this.fetch(), i = n, a = "", s; (s = this.fetch()).text !== "EOF" && e.test(a + s.text); )
      i = s, a += i.text, this.consume();
    if (a === "")
      throw new ot("Invalid " + r + ": '" + n.text + "'", n);
    return n.range(i, a);
  }
  /**
   * Parses a color description.
   */
  parseColorGroup(e) {
    var r = this.parseStringGroup("color", e);
    if (r == null)
      return null;
    var n = /^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);
    if (!n)
      throw new ot("Invalid color: '" + r.text + "'", r);
    var i = n[0];
    return /^[0-9a-f]{6}$/i.test(i) && (i = "#" + i), {
      type: "color-token",
      mode: this.mode,
      color: i
    };
  }
  /**
   * Parses a size specification, consisting of magnitude and unit.
   */
  parseSizeGroup(e) {
    var r, n = !1;
    if (this.gullet.consumeSpaces(), !e && this.gullet.future().text !== "{" ? r = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size") : r = this.parseStringGroup("size", e), !r)
      return null;
    !e && r.text.length === 0 && (r.text = "0pt", n = !0);
    var i = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);
    if (!i)
      throw new ot("Invalid size: '" + r.text + "'", r);
    var a = {
      number: +(i[1] + i[2]),
      // sign + magnitude, cast to number
      unit: i[3]
    };
    if (!f$(a))
      throw new ot("Invalid unit: '" + a.unit + "'", r);
    return {
      type: "size",
      mode: this.mode,
      value: a,
      isBlank: n
    };
  }
  /**
   * Parses an URL, checking escaped letters and allowed protocols,
   * and setting the catcode of % as an active character (as in \hyperref).
   */
  parseUrlGroup(e) {
    this.gullet.lexer.setCatcode("%", 13), this.gullet.lexer.setCatcode("~", 12);
    var r = this.parseStringGroup("url", e);
    if (this.gullet.lexer.setCatcode("%", 14), this.gullet.lexer.setCatcode("~", 13), r == null)
      return null;
    var n = r.text.replace(/\\([#$%&~_^{}])/g, "$1");
    return {
      type: "url",
      mode: this.mode,
      url: n
    };
  }
  /**
   * Parses an argument with the mode specified.
   */
  parseArgumentGroup(e, r) {
    var n = this.gullet.scanArgument(e);
    if (n == null)
      return null;
    var i = this.mode;
    r && this.switchMode(r), this.gullet.beginGroup();
    var a = this.parseExpression(!1, "EOF");
    this.expect("EOF"), this.gullet.endGroup();
    var s = {
      type: "ordgroup",
      mode: this.mode,
      loc: n.loc,
      body: a
    };
    return r && this.switchMode(i), s;
  }
  /**
   * Parses an ordinary group, which is either a single nucleus (like "x")
   * or an expression in braces (like "{x+y}") or an implicit group, a group
   * that starts at the current position, and ends right before a higher explicit
   * group ends, or at EOF.
   */
  parseGroup(e, r) {
    var n = this.fetch(), i = n.text, a;
    if (i === "{" || i === "\\begingroup") {
      this.consume();
      var s = i === "{" ? "}" : "\\endgroup";
      this.gullet.beginGroup();
      var o = this.parseExpression(!1, s), l = this.fetch();
      this.expect(s), this.gullet.endGroup(), a = {
        type: "ordgroup",
        mode: this.mode,
        loc: na.range(n, l),
        body: o,
        // A group formed by \begingroup...\endgroup is a semi-simple group
        // which doesn't affect spacing in math mode, i.e., is transparent.
        // https://tex.stackexchange.com/questions/1930/when-should-one-
        // use-begingroup-instead-of-bgroup
        semisimple: i === "\\begingroup" || void 0
      };
    } else if (a = this.parseFunction(r, e) || this.parseSymbol(), a == null && i[0] === "\\" && !nz.hasOwnProperty(i)) {
      if (this.settings.throwOnError)
        throw new ot("Undefined control sequence: " + i, n);
      a = this.formatUnsupportedCmd(i), this.consume();
    }
    return a;
  }
  /**
   * Form ligature-like combinations of characters for text mode.
   * This includes inputs like "--", "---", "``" and "''".
   * The result will simply replace multiple textord nodes with a single
   * character in each value by a single textord node having multiple
   * characters in its value.  The representation is still ASCII source.
   * The group will be modified in place.
   */
  formLigatures(e) {
    for (var r = e.length - 1, n = 0; n < r; ++n) {
      var i = e[n], a = i.text;
      a === "-" && e[n + 1].text === "-" && (n + 1 < r && e[n + 2].text === "-" ? (e.splice(n, 3, {
        type: "textord",
        mode: "text",
        loc: na.range(i, e[n + 2]),
        text: "---"
      }), r -= 2) : (e.splice(n, 2, {
        type: "textord",
        mode: "text",
        loc: na.range(i, e[n + 1]),
        text: "--"
      }), r -= 1)), (a === "'" || a === "`") && e[n + 1].text === a && (e.splice(n, 2, {
        type: "textord",
        mode: "text",
        loc: na.range(i, e[n + 1]),
        text: a + a
      }), r -= 1);
    }
  }
  /**
   * Parse a single symbol out of the string. Here, we handle single character
   * symbols and special functions like \verb.
   */
  parseSymbol() {
    var e = this.fetch(), r = e.text;
    if (/^\\verb[^a-zA-Z]/.test(r)) {
      this.consume();
      var n = r.slice(5), i = n.charAt(0) === "*";
      if (i && (n = n.slice(1)), n.length < 2 || n.charAt(0) !== n.slice(-1))
        throw new ot(`\\verb assertion failed --
                    please report what input caused this bug`);
      return n = n.slice(1, -1), {
        type: "verb",
        mode: "text",
        body: n,
        star: i
      };
    }
    nA.hasOwnProperty(r[0]) && !Vr[this.mode][r[0]] && (this.settings.strict && this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + r[0] + '" used in math mode', e), r = nA[r[0]] + r.slice(1));
    var a = Hde.exec(r);
    a && (r = r.substring(0, a.index), r === "i" ? r = "ı" : r === "j" && (r = "ȷ"));
    var s;
    if (Vr[this.mode][r]) {
      this.settings.strict && this.mode === "math" && Qw.indexOf(r) >= 0 && this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + r[0] + '" used in math mode', e);
      var o = Vr[this.mode][r].group, l = na.range(e), u;
      if (Bhe.hasOwnProperty(o)) {
        var h = o;
        u = {
          type: "atom",
          mode: this.mode,
          family: h,
          loc: l,
          text: r
        };
      } else
        u = {
          type: o,
          mode: this.mode,
          loc: l,
          text: r
        };
      s = u;
    } else if (r.charCodeAt(0) >= 128)
      this.settings.strict && (h$(r.charCodeAt(0)) ? this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + r[0] + '" used in math mode', e) : this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + r[0] + '"' + (" (" + r.charCodeAt(0) + ")"), e)), s = {
        type: "textord",
        mode: "text",
        loc: na.range(e),
        text: r
      };
    else
      return null;
    if (this.consume(), a)
      for (var d = 0; d < a[0].length; d++) {
        var f = a[0][d];
        if (!y4[f])
          throw new ot("Unknown accent ' " + f + "'", e);
        var p = y4[f][this.mode] || y4[f].text;
        if (!p)
          throw new ot("Accent " + f + " unsupported in " + this.mode + " mode", e);
        s = {
          type: "accent",
          mode: this.mode,
          loc: na.range(e),
          label: p,
          isStretchy: !1,
          isShifty: !0,
          // $FlowFixMe
          base: s
        };
      }
    return s;
  }
};
iz.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
var Tk = function(e, r) {
  if (!(typeof e == "string" || e instanceof String))
    throw new TypeError("KaTeX can only parse string typed expression");
  var n = new iz(e, r);
  delete n.gullet.macros.current["\\df@tag"];
  var i = n.parse();
  if (delete n.gullet.macros.current["\\current@color"], delete n.gullet.macros.current["\\color"], n.gullet.macros.get("\\df@tag")) {
    if (!r.displayMode)
      throw new ot("\\tag works only in display equations");
    i = [{
      type: "tag",
      mode: "text",
      body: i,
      tag: n.subparse([new Aa("\\df@tag")])
    }];
  }
  return i;
}, Ek = function(e, r, n) {
  r.textContent = "";
  var i = bx(e, n).toNode();
  r.appendChild(i);
};
typeof document < "u" && document.compatMode !== "CSS1Compat" && (typeof console < "u" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."), Ek = function() {
  throw new ot("KaTeX doesn't work in quirks mode.");
});
var sz = function(e, r) {
  var n = bx(e, r).toMarkup();
  return n;
}, oz = function(e, r) {
  var n = new ik(r);
  return Tk(e, n);
}, lz = function(e, r, n) {
  if (n.throwOnError || !(e instanceof ot))
    throw e;
  var i = Fe.makeSpan(["katex-error"], [new rs(r)]);
  return i.setAttribute("title", e.toString()), i.setAttribute("style", "color:" + n.errorColor), i;
}, bx = function(e, r) {
  var n = new ik(r);
  try {
    var i = Tk(e, n);
    return sde(i, e, n);
  } catch (a) {
    return lz(a, e, n);
  }
}, cz = function(e, r) {
  var n = new ik(r);
  try {
    var i = Tk(e, n);
    return ode(i, e, n);
  } catch (a) {
    return lz(a, e, n);
  }
}, uz = "0.16.25", hz = {
  Span: Wg,
  Anchor: ok,
  SymbolNode: rs,
  SvgNode: Yo,
  PathNode: zl,
  LineNode: Zw
}, Kde = {
  /**
   * Current KaTeX version
   */
  version: uz,
  /**
   * Renders the given LaTeX into an HTML+MathML combination, and adds
   * it as a child to the specified DOM node.
   */
  render: Ek,
  /**
   * Renders the given LaTeX into an HTML+MathML combination string,
   * for sending to the client.
   */
  renderToString: sz,
  /**
   * KaTeX error, usually during parsing.
   */
  ParseError: ot,
  /**
   * The schema of Settings
   */
  SETTINGS_SCHEMA: Sp,
  /**
   * Parses the given LaTeX into KaTeX's internal parse tree structure,
   * without rendering to HTML or MathML.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __parse: oz,
  /**
   * Renders the given LaTeX into an HTML+MathML internal DOM tree
   * representation, without flattening that representation to a string.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __renderToDomTree: bx,
  /**
   * Renders the given LaTeX into an HTML internal DOM tree representation,
   * without MathML and without flattening that representation to a string.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __renderToHTMLTree: cz,
  /**
   * extends internal font metrics object with a new object
   * each key in the new object represents a font name
  */
  __setFontMetrics: d$,
  /**
   * adds a new symbol to builtin symbols table
   */
  __defineSymbol: V,
  /**
   * adds a new function to builtin function list,
   * which directly produce parse tree elements
   * and have their own html/mathml builders
   */
  __defineFunction: Et,
  /**
   * adds a new macro to builtin macro list
   */
  __defineMacro: le,
  /**
   * Expose the dom tree node types, which can be useful for type checking nodes.
   *
   * NOTE: These methods are not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */
  __domTree: hz
};
const Zde = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ParseError: ot,
  SETTINGS_SCHEMA: Sp,
  __defineFunction: Et,
  __defineMacro: le,
  __defineSymbol: V,
  __domTree: hz,
  __parse: oz,
  __renderToDomTree: bx,
  __renderToHTMLTree: cz,
  __setFontMetrics: d$,
  default: Kde,
  get render() {
    return Ek;
  },
  renderToString: sz,
  version: uz
}, Symbol.toStringTag, { value: "Module" }));
var Qde = "[object Symbol]";
function fu(t) {
  return typeof t == "symbol" || es(t) && rl(t) == Qde;
}
function Jc(t, e) {
  for (var r = -1, n = t == null ? 0 : t.length, i = Array(n); ++r < n; )
    i[r] = e(t[r], r, t);
  return i;
}
var iA = Qa ? Qa.prototype : void 0, aA = iA ? iA.toString : void 0;
function dz(t) {
  if (typeof t == "string")
    return t;
  if (ir(t))
    return Jc(t, dz) + "";
  if (fu(t))
    return aA ? aA.call(t) : "";
  var e = t + "";
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
}
var Jde = /\s/;
function efe(t) {
  for (var e = t.length; e-- && Jde.test(t.charAt(e)); )
    ;
  return e;
}
var tfe = /^\s+/;
function rfe(t) {
  return t && t.slice(0, efe(t) + 1).replace(tfe, "");
}
var sA = NaN, nfe = /^[-+]0x[0-9a-f]+$/i, ife = /^0b[01]+$/i, afe = /^0o[0-7]+$/i, sfe = parseInt;
function ofe(t) {
  if (typeof t == "number")
    return t;
  if (fu(t))
    return sA;
  if (da(t)) {
    var e = typeof t.valueOf == "function" ? t.valueOf() : t;
    t = da(e) ? e + "" : e;
  }
  if (typeof t != "string")
    return t === 0 ? t : +t;
  t = rfe(t);
  var r = ife.test(t);
  return r || afe.test(t) ? sfe(t.slice(2), r ? 2 : 8) : nfe.test(t) ? sA : +t;
}
var oA = 1 / 0, lfe = 17976931348623157e292;
function ev(t) {
  if (!t)
    return t === 0 ? t : 0;
  if (t = ofe(t), t === oA || t === -oA) {
    var e = t < 0 ? -1 : 1;
    return e * lfe;
  }
  return t === t ? t : 0;
}
function wx(t) {
  var e = ev(t), r = e % 1;
  return e === e ? r ? e - r : e : 0;
}
function Nn() {
}
function fz(t, e) {
  for (var r = -1, n = t == null ? 0 : t.length; ++r < n && e(t[r], r, t) !== !1; )
    ;
  return t;
}
function pz(t, e, r, n) {
  for (var i = t.length, a = r + -1; ++a < i; )
    if (e(t[a], a, t))
      return a;
  return -1;
}
function cfe(t) {
  return t !== t;
}
function ufe(t, e, r) {
  for (var n = r - 1, i = t.length; ++n < i; )
    if (t[n] === e)
      return n;
  return -1;
}
function kk(t, e, r) {
  return e === e ? ufe(t, e, r) : pz(t, cfe, r);
}
function gz(t, e) {
  var r = t == null ? 0 : t.length;
  return !!r && kk(t, e, 0) > -1;
}
function On(t) {
  return ao(t) ? HO(t) : TF(t);
}
var hfe = Object.prototype, dfe = hfe.hasOwnProperty, Na = jO(function(t, e) {
  if (Pg(e) || ao(e)) {
    Sf(e, On(e), t);
    return;
  }
  for (var r in e)
    dfe.call(e, r) && Fg(t, r, e[r]);
}), ffe = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, pfe = /^\w*$/;
function Sk(t, e) {
  if (ir(t))
    return !1;
  var r = typeof t;
  return r == "number" || r == "symbol" || r == "boolean" || t == null || fu(t) ? !0 : pfe.test(t) || !ffe.test(t) || e != null && t in Object(e);
}
var gfe = 500;
function mfe(t) {
  var e = kf(t, function(n) {
    return r.size === gfe && r.clear(), n;
  }), r = e.cache;
  return e;
}
var vfe = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, yfe = /\\(\\)?/g, xfe = mfe(function(t) {
  var e = [];
  return t.charCodeAt(0) === 46 && e.push(""), t.replace(vfe, function(r, n, i, a) {
    e.push(i ? a.replace(yfe, "$1") : n || r);
  }), e;
});
function mz(t) {
  return t == null ? "" : dz(t);
}
function Tx(t, e) {
  return ir(t) ? t : Sk(t, e) ? [t] : xfe(mz(t));
}
function qg(t) {
  if (typeof t == "string" || fu(t))
    return t;
  var e = t + "";
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
}
function Ex(t, e) {
  e = Tx(e, t);
  for (var r = 0, n = e.length; t != null && r < n; )
    t = t[qg(e[r++])];
  return r && r == n ? t : void 0;
}
function bfe(t, e, r) {
  var n = t == null ? void 0 : Ex(t, e);
  return n === void 0 ? r : n;
}
function Ck(t, e) {
  for (var r = -1, n = e.length, i = t.length; ++r < n; )
    t[i + r] = e[r];
  return t;
}
var lA = Qa ? Qa.isConcatSpreadable : void 0;
function wfe(t) {
  return ir(t) || Qd(t) || !!(lA && t && t[lA]);
}
function Yg(t, e, r, n, i) {
  var a = -1, s = t.length;
  for (r || (r = wfe), i || (i = []); ++a < s; ) {
    var o = t[a];
    r(o) ? Ck(i, o) : n || (i[i.length] = o);
  }
  return i;
}
function jn(t) {
  var e = t == null ? 0 : t.length;
  return e ? Yg(t) : [];
}
function Tfe(t) {
  return XO(YO(t, void 0, jn), t + "");
}
function vz(t, e, r) {
  var n = -1, i = t.length;
  e < 0 && (e = -e > i ? 0 : i + e), r = r > i ? i : r, r < 0 && (r += i), i = e > r ? 0 : r - e >>> 0, e >>>= 0;
  for (var a = Array(i); ++n < i; )
    a[n] = t[n + e];
  return a;
}
function Efe(t, e, r, n) {
  var i = -1, a = t == null ? 0 : t.length;
  for (n && a && (r = t[++i]); ++i < a; )
    r = e(r, t[i], i, t);
  return r;
}
function kfe(t, e) {
  return t && Sf(e, On(e), t);
}
function Sfe(t, e) {
  return t && Sf(e, Mu(e), t);
}
function Ak(t, e) {
  for (var r = -1, n = t == null ? 0 : t.length, i = 0, a = []; ++r < n; ) {
    var s = t[r];
    e(s, r, t) && (a[i++] = s);
  }
  return a;
}
function yz() {
  return [];
}
var Cfe = Object.prototype, Afe = Cfe.propertyIsEnumerable, cA = Object.getOwnPropertySymbols, _k = cA ? function(t) {
  return t == null ? [] : (t = Object(t), Ak(cA(t), function(e) {
    return Afe.call(t, e);
  }));
} : yz;
function _fe(t, e) {
  return Sf(t, _k(t), e);
}
var Lfe = Object.getOwnPropertySymbols, xz = Lfe ? function(t) {
  for (var e = []; t; )
    Ck(e, _k(t)), t = RE(t);
  return e;
} : yz;
function Rfe(t, e) {
  return Sf(t, xz(t), e);
}
function bz(t, e, r) {
  var n = e(t);
  return ir(t) ? n : Ck(n, r(t));
}
function iT(t) {
  return bz(t, On, _k);
}
function wz(t) {
  return bz(t, Mu, xz);
}
var Nfe = Object.prototype, Mfe = Nfe.hasOwnProperty;
function Dfe(t) {
  var e = t.length, r = new t.constructor(e);
  return e && typeof t[0] == "string" && Mfe.call(t, "index") && (r.index = t.index, r.input = t.input), r;
}
function Ife(t, e) {
  var r = e ? LE(t.buffer) : t.buffer;
  return new t.constructor(r, t.byteOffset, t.byteLength);
}
var Ofe = /\w*$/;
function Pfe(t) {
  var e = new t.constructor(t.source, Ofe.exec(t));
  return e.lastIndex = t.lastIndex, e;
}
var uA = Qa ? Qa.prototype : void 0, hA = uA ? uA.valueOf : void 0;
function Bfe(t) {
  return hA ? Object(hA.call(t)) : {};
}
var Ffe = "[object Boolean]", $fe = "[object Date]", zfe = "[object Map]", Vfe = "[object Number]", Gfe = "[object RegExp]", Ufe = "[object Set]", Wfe = "[object String]", Hfe = "[object Symbol]", qfe = "[object ArrayBuffer]", Yfe = "[object DataView]", Xfe = "[object Float32Array]", jfe = "[object Float64Array]", Kfe = "[object Int8Array]", Zfe = "[object Int16Array]", Qfe = "[object Int32Array]", Jfe = "[object Uint8Array]", e0e = "[object Uint8ClampedArray]", t0e = "[object Uint16Array]", r0e = "[object Uint32Array]";
function n0e(t, e, r) {
  var n = t.constructor;
  switch (e) {
    case qfe:
      return LE(t);
    case Ffe:
    case $fe:
      return new n(+t);
    case Yfe:
      return Ife(t, r);
    case Xfe:
    case jfe:
    case Kfe:
    case Zfe:
    case Qfe:
    case Jfe:
    case e0e:
    case t0e:
    case r0e:
      return BO(t, r);
    case zfe:
      return new n();
    case Vfe:
    case Wfe:
      return new n(t);
    case Gfe:
      return Pfe(t);
    case Ufe:
      return new n();
    case Hfe:
      return Bfe(t);
  }
}
var i0e = "[object Map]";
function a0e(t) {
  return es(t) && Wa(t) == i0e;
}
var dA = Ol && Ol.isMap, s0e = dA ? Bg(dA) : a0e, o0e = "[object Set]";
function l0e(t) {
  return es(t) && Wa(t) == o0e;
}
var fA = Ol && Ol.isSet, c0e = fA ? Bg(fA) : l0e, u0e = 1, h0e = 2, d0e = 4, Tz = "[object Arguments]", f0e = "[object Array]", p0e = "[object Boolean]", g0e = "[object Date]", m0e = "[object Error]", Ez = "[object Function]", v0e = "[object GeneratorFunction]", y0e = "[object Map]", x0e = "[object Number]", kz = "[object Object]", b0e = "[object RegExp]", w0e = "[object Set]", T0e = "[object String]", E0e = "[object Symbol]", k0e = "[object WeakMap]", S0e = "[object ArrayBuffer]", C0e = "[object DataView]", A0e = "[object Float32Array]", _0e = "[object Float64Array]", L0e = "[object Int8Array]", R0e = "[object Int16Array]", N0e = "[object Int32Array]", M0e = "[object Uint8Array]", D0e = "[object Uint8ClampedArray]", I0e = "[object Uint16Array]", O0e = "[object Uint32Array]", zr = {};
zr[Tz] = zr[f0e] = zr[S0e] = zr[C0e] = zr[p0e] = zr[g0e] = zr[A0e] = zr[_0e] = zr[L0e] = zr[R0e] = zr[N0e] = zr[y0e] = zr[x0e] = zr[kz] = zr[b0e] = zr[w0e] = zr[T0e] = zr[E0e] = zr[M0e] = zr[D0e] = zr[I0e] = zr[O0e] = !0;
zr[m0e] = zr[Ez] = zr[k0e] = !1;
function Ap(t, e, r, n, i, a) {
  var s, o = e & u0e, l = e & h0e, u = e & d0e;
  if (s !== void 0)
    return s;
  if (!da(t))
    return t;
  var h = ir(t);
  if (h) {
    if (s = Dfe(t), !o)
      return FO(t, s);
  } else {
    var d = Wa(t), f = d == Ez || d == v0e;
    if (Jd(t))
      return PO(t, o);
    if (d == kz || d == Tz || f && !i) {
      if (s = l || f ? {} : zO(t), !o)
        return l ? Rfe(t, Sfe(s, t)) : _fe(t, kfe(s, t));
    } else {
      if (!zr[d])
        return i ? t : {};
      s = n0e(t, d, o);
    }
  }
  a || (a = new ms());
  var p = a.get(t);
  if (p)
    return p;
  a.set(t, s), c0e(t) ? t.forEach(function(v) {
    s.add(Ap(v, e, r, v, t, a));
  }) : s0e(t) && t.forEach(function(v, y) {
    s.set(y, Ap(v, e, r, y, t, a));
  });
  var g = u ? l ? wz : iT : l ? Mu : On, m = h ? void 0 : g(t);
  return fz(m || t, function(v, y) {
    m && (y = v, v = t[y]), Fg(s, y, Ap(v, e, r, y, t, a));
  }), s;
}
var P0e = 4;
function $n(t) {
  return Ap(t, P0e);
}
var B0e = 1, F0e = 4;
function $0e(t) {
  return Ap(t, B0e | F0e);
}
function Xg(t) {
  for (var e = -1, r = t == null ? 0 : t.length, n = 0, i = []; ++e < r; ) {
    var a = t[e];
    a && (i[n++] = a);
  }
  return i;
}
var z0e = "__lodash_hash_undefined__";
function V0e(t) {
  return this.__data__.set(t, z0e), this;
}
function G0e(t) {
  return this.__data__.has(t);
}
function nf(t) {
  var e = -1, r = t == null ? 0 : t.length;
  for (this.__data__ = new il(); ++e < r; )
    this.add(t[e]);
}
nf.prototype.add = nf.prototype.push = V0e;
nf.prototype.has = G0e;
function Sz(t, e) {
  for (var r = -1, n = t == null ? 0 : t.length; ++r < n; )
    if (e(t[r], r, t))
      return !0;
  return !1;
}
function Lk(t, e) {
  return t.has(e);
}
var U0e = 1, W0e = 2;
function Cz(t, e, r, n, i, a) {
  var s = r & U0e, o = t.length, l = e.length;
  if (o != l && !(s && l > o))
    return !1;
  var u = a.get(t), h = a.get(e);
  if (u && h)
    return u == e && h == t;
  var d = -1, f = !0, p = r & W0e ? new nf() : void 0;
  for (a.set(t, e), a.set(e, t); ++d < o; ) {
    var g = t[d], m = e[d];
    if (n)
      var v = s ? n(m, g, d, e, t, a) : n(g, m, d, t, e, a);
    if (v !== void 0) {
      if (v)
        continue;
      f = !1;
      break;
    }
    if (p) {
      if (!Sz(e, function(y, b) {
        if (!Lk(p, b) && (g === y || i(g, y, r, n, a)))
          return p.push(b);
      })) {
        f = !1;
        break;
      }
    } else if (!(g === m || i(g, m, r, n, a))) {
      f = !1;
      break;
    }
  }
  return a.delete(t), a.delete(e), f;
}
function H0e(t) {
  var e = -1, r = Array(t.size);
  return t.forEach(function(n, i) {
    r[++e] = [i, n];
  }), r;
}
function Rk(t) {
  var e = -1, r = Array(t.size);
  return t.forEach(function(n) {
    r[++e] = n;
  }), r;
}
var q0e = 1, Y0e = 2, X0e = "[object Boolean]", j0e = "[object Date]", K0e = "[object Error]", Z0e = "[object Map]", Q0e = "[object Number]", J0e = "[object RegExp]", epe = "[object Set]", tpe = "[object String]", rpe = "[object Symbol]", npe = "[object ArrayBuffer]", ipe = "[object DataView]", pA = Qa ? Qa.prototype : void 0, x4 = pA ? pA.valueOf : void 0;
function ape(t, e, r, n, i, a, s) {
  switch (r) {
    case ipe:
      if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
        return !1;
      t = t.buffer, e = e.buffer;
    case npe:
      return !(t.byteLength != e.byteLength || !a(new hy(t), new hy(e)));
    case X0e:
    case j0e:
    case Q0e:
      return Ef(+t, +e);
    case K0e:
      return t.name == e.name && t.message == e.message;
    case J0e:
    case tpe:
      return t == e + "";
    case Z0e:
      var o = H0e;
    case epe:
      var l = n & q0e;
      if (o || (o = Rk), t.size != e.size && !l)
        return !1;
      var u = s.get(t);
      if (u)
        return u == e;
      n |= Y0e, s.set(t, e);
      var h = Cz(o(t), o(e), n, i, a, s);
      return s.delete(t), h;
    case rpe:
      if (x4)
        return x4.call(t) == x4.call(e);
  }
  return !1;
}
var spe = 1, ope = Object.prototype, lpe = ope.hasOwnProperty;
function cpe(t, e, r, n, i, a) {
  var s = r & spe, o = iT(t), l = o.length, u = iT(e), h = u.length;
  if (l != h && !s)
    return !1;
  for (var d = l; d--; ) {
    var f = o[d];
    if (!(s ? f in e : lpe.call(e, f)))
      return !1;
  }
  var p = a.get(t), g = a.get(e);
  if (p && g)
    return p == e && g == t;
  var m = !0;
  a.set(t, e), a.set(e, t);
  for (var v = s; ++d < l; ) {
    f = o[d];
    var y = t[f], b = e[f];
    if (n)
      var w = s ? n(b, y, f, e, t, a) : n(y, b, f, t, e, a);
    if (!(w === void 0 ? y === b || i(y, b, r, n, a) : w)) {
      m = !1;
      break;
    }
    v || (v = f == "constructor");
  }
  if (m && !v) {
    var T = t.constructor, E = e.constructor;
    T != E && "constructor" in t && "constructor" in e && !(typeof T == "function" && T instanceof T && typeof E == "function" && E instanceof E) && (m = !1);
  }
  return a.delete(t), a.delete(e), m;
}
var upe = 1, gA = "[object Arguments]", mA = "[object Array]", X1 = "[object Object]", hpe = Object.prototype, vA = hpe.hasOwnProperty;
function dpe(t, e, r, n, i, a) {
  var s = ir(t), o = ir(e), l = s ? mA : Wa(t), u = o ? mA : Wa(e);
  l = l == gA ? X1 : l, u = u == gA ? X1 : u;
  var h = l == X1, d = u == X1, f = l == u;
  if (f && Jd(t)) {
    if (!Jd(e))
      return !1;
    s = !0, h = !1;
  }
  if (f && !h)
    return a || (a = new ms()), s || tx(t) ? Cz(t, e, r, n, i, a) : ape(t, e, l, r, n, i, a);
  if (!(r & upe)) {
    var p = h && vA.call(t, "__wrapped__"), g = d && vA.call(e, "__wrapped__");
    if (p || g) {
      var m = p ? t.value() : t, v = g ? e.value() : e;
      return a || (a = new ms()), i(m, v, r, n, a);
    }
  }
  return f ? (a || (a = new ms()), cpe(t, e, r, n, i, a)) : !1;
}
function Nk(t, e, r, n, i) {
  return t === e ? !0 : t == null || e == null || !es(t) && !es(e) ? t !== t && e !== e : dpe(t, e, r, n, Nk, i);
}
var fpe = 1, ppe = 2;
function gpe(t, e, r, n) {
  var i = r.length, a = i;
  if (t == null)
    return !a;
  for (t = Object(t); i--; ) {
    var s = r[i];
    if (s[2] ? s[1] !== t[s[0]] : !(s[0] in t))
      return !1;
  }
  for (; ++i < a; ) {
    s = r[i];
    var o = s[0], l = t[o], u = s[1];
    if (s[2]) {
      if (l === void 0 && !(o in t))
        return !1;
    } else {
      var h = new ms(), d;
      if (!(d === void 0 ? Nk(u, l, fpe | ppe, n, h) : d))
        return !1;
    }
  }
  return !0;
}
function Az(t) {
  return t === t && !da(t);
}
function mpe(t) {
  for (var e = On(t), r = e.length; r--; ) {
    var n = e[r], i = t[n];
    e[r] = [n, i, Az(i)];
  }
  return e;
}
function _z(t, e) {
  return function(r) {
    return r == null ? !1 : r[t] === e && (e !== void 0 || t in Object(r));
  };
}
function vpe(t) {
  var e = mpe(t);
  return e.length == 1 && e[0][2] ? _z(e[0][0], e[0][1]) : function(r) {
    return r === t || gpe(r, t, e);
  };
}
function ype(t, e) {
  return t != null && e in Object(t);
}
function Lz(t, e, r) {
  e = Tx(e, t);
  for (var n = -1, i = e.length, a = !1; ++n < i; ) {
    var s = qg(e[n]);
    if (!(a = t != null && r(t, s)))
      break;
    t = t[s];
  }
  return a || ++n != i ? a : (i = t == null ? 0 : t.length, !!i && NE(i) && rx(s, i) && (ir(t) || Qd(t)));
}
function Rz(t, e) {
  return t != null && Lz(t, e, ype);
}
var xpe = 1, bpe = 2;
function wpe(t, e) {
  return Sk(t) && Az(e) ? _z(qg(t), e) : function(r) {
    var n = bfe(r, t);
    return n === void 0 && n === e ? Rz(r, t) : Nk(e, n, xpe | bpe);
  };
}
function Tpe(t) {
  return function(e) {
    return e == null ? void 0 : e[t];
  };
}
function Epe(t) {
  return function(e) {
    return Ex(e, t);
  };
}
function kpe(t) {
  return Sk(t) ? Tpe(qg(t)) : Epe(t);
}
function ma(t) {
  return typeof t == "function" ? t : t == null ? qo : typeof t == "object" ? ir(t) ? wpe(t[0], t[1]) : vpe(t) : kpe(t);
}
function Spe(t, e, r, n) {
  for (var i = -1, a = t == null ? 0 : t.length; ++i < a; ) {
    var s = t[i];
    e(n, s, r(s), t);
  }
  return n;
}
function Mk(t, e) {
  return t && _E(t, e, On);
}
function Cpe(t, e) {
  return function(r, n) {
    if (r == null)
      return r;
    if (!ao(r))
      return t(r, n);
    for (var i = r.length, a = -1, s = Object(r); ++a < i && n(s[a], a, s) !== !1; )
      ;
    return r;
  };
}
var Pu = Cpe(Mk);
function Ape(t, e, r, n) {
  return Pu(t, function(i, a, s) {
    e(n, i, r(i), s);
  }), n;
}
function _pe(t, e) {
  return function(r, n) {
    var i = ir(r) ? Spe : Ape, a = e ? e() : {};
    return i(r, t, ma(n), a);
  };
}
var Nz = Object.prototype, Lpe = Nz.hasOwnProperty, kx = $g(function(t, e) {
  t = Object(t);
  var r = -1, n = e.length, i = n > 2 ? e[2] : void 0;
  for (i && jp(e[0], e[1], i) && (n = 1); ++r < n; )
    for (var a = e[r], s = Mu(a), o = -1, l = s.length; ++o < l; ) {
      var u = s[o], h = t[u];
      (h === void 0 || Ef(h, Nz[u]) && !Lpe.call(t, u)) && (t[u] = a[u]);
    }
  return t;
}), Rpe = 200;
function Npe(t, e, r, n) {
  var i = -1, a = gz, s = !0, o = t.length, l = [], u = e.length;
  if (!o)
    return l;
  e.length >= Rpe && (a = Lk, s = !1, e = new nf(e));
  e:
    for (; ++i < o; ) {
      var h = t[i], d = h;
      if (h = h !== 0 ? h : 0, s && d === d) {
        for (var f = u; f--; )
          if (e[f] === d)
            continue e;
        l.push(h);
      } else a(e, d, n) || l.push(h);
    }
  return l;
}
var Sx = $g(function(t, e) {
  return dy(t) ? Npe(t, Yg(e, 1, dy, !0)) : [];
});
function Qs(t) {
  var e = t == null ? 0 : t.length;
  return e ? t[e - 1] : void 0;
}
function ii(t, e, r) {
  var n = t == null ? 0 : t.length;
  return n ? (e = e === void 0 ? 1 : wx(e), vz(t, e < 0 ? 0 : e, n)) : [];
}
function tg(t, e, r) {
  var n = t == null ? 0 : t.length;
  return n ? (e = e === void 0 ? 1 : wx(e), e = n - e, vz(t, 0, e < 0 ? 0 : e)) : [];
}
function Dk(t) {
  return typeof t == "function" ? t : qo;
}
function Ie(t, e) {
  var r = ir(t) ? fz : Pu;
  return r(t, Dk(e));
}
function Mpe(t, e) {
  for (var r = -1, n = t == null ? 0 : t.length; ++r < n; )
    if (!e(t[r], r, t))
      return !1;
  return !0;
}
function Dpe(t, e) {
  var r = !0;
  return Pu(t, function(n, i, a) {
    return r = !!e(n, i, a), r;
  }), r;
}
function ys(t, e, r) {
  var n = ir(t) ? Mpe : Dpe;
  return n(t, ma(e));
}
function Mz(t, e) {
  var r = [];
  return Pu(t, function(n, i, a) {
    e(n, i, a) && r.push(n);
  }), r;
}
function cn(t, e) {
  var r = ir(t) ? Ak : Mz;
  return r(t, ma(e));
}
function Ipe(t) {
  return function(e, r, n) {
    var i = Object(e);
    if (!ao(e)) {
      var a = ma(r);
      e = On(e), r = function(o) {
        return a(i[o], o, i);
      };
    }
    var s = t(e, r, n);
    return s > -1 ? i[a ? e[s] : s] : void 0;
  };
}
var Ope = Math.max;
function Ppe(t, e, r) {
  var n = t == null ? 0 : t.length;
  if (!n)
    return -1;
  var i = r == null ? 0 : wx(r);
  return i < 0 && (i = Ope(n + i, 0)), pz(t, ma(e), i);
}
var Ko = Ipe(Ppe);
function Es(t) {
  return t && t.length ? t[0] : void 0;
}
function Dz(t, e) {
  var r = -1, n = ao(t) ? Array(t.length) : [];
  return Pu(t, function(i, a, s) {
    n[++r] = e(i, a, s);
  }), n;
}
function ft(t, e) {
  var r = ir(t) ? Jc : Dz;
  return r(t, ma(e));
}
function _a(t, e) {
  return Yg(ft(t, e));
}
function Bpe(t, e) {
  return t == null ? t : _E(t, Dk(e), Mu);
}
function Fpe(t, e) {
  return t && Mk(t, Dk(e));
}
var $pe = Object.prototype, zpe = $pe.hasOwnProperty, Vpe = _pe(function(t, e, r) {
  zpe.call(t, r) ? t[r].push(e) : Og(t, r, [e]);
});
function Gpe(t, e) {
  return t > e;
}
var Upe = Object.prototype, Wpe = Upe.hasOwnProperty;
function Hpe(t, e) {
  return t != null && Wpe.call(t, e);
}
function Ft(t, e) {
  return t != null && Lz(t, e, Hpe);
}
var qpe = "[object String]";
function fa(t) {
  return typeof t == "string" || !ir(t) && es(t) && rl(t) == qpe;
}
function Ype(t, e) {
  return Jc(e, function(r) {
    return t[r];
  });
}
function Pr(t) {
  return t == null ? [] : Ype(t, On(t));
}
var Xpe = Math.max;
function Qi(t, e, r, n) {
  t = ao(t) ? t : Pr(t), r = r ? wx(r) : 0;
  var i = t.length;
  return r < 0 && (r = Xpe(i + r, 0)), fa(t) ? r <= i && t.indexOf(e, r) > -1 : !!i && kk(t, e, r) > -1;
}
function yA(t, e, r) {
  var n = t == null ? 0 : t.length;
  if (!n)
    return -1;
  var i = 0;
  return kk(t, e, i);
}
var jpe = "[object RegExp]";
function Kpe(t) {
  return es(t) && rl(t) == jpe;
}
var xA = Ol && Ol.isRegExp, Zo = xA ? Bg(xA) : Kpe;
function Rr(t) {
  return t === void 0;
}
function Iz(t, e) {
  return t < e;
}
function Cx(t, e) {
  var r = {};
  return e = ma(e), Mk(t, function(n, i, a) {
    Og(r, i, e(n, i, a));
  }), r;
}
function Ik(t, e, r) {
  for (var n = -1, i = t.length; ++n < i; ) {
    var a = t[n], s = e(a);
    if (s != null && (o === void 0 ? s === s && !fu(s) : r(s, o)))
      var o = s, l = a;
  }
  return l;
}
function pu(t) {
  return t && t.length ? Ik(t, qo, Gpe) : void 0;
}
function af(t) {
  return t && t.length ? Ik(t, qo, Iz) : void 0;
}
function Ok(t, e) {
  return t && t.length ? Ik(t, ma(e), Iz) : void 0;
}
var Zpe = "Expected a function";
function Qpe(t) {
  if (typeof t != "function")
    throw new TypeError(Zpe);
  return function() {
    var e = arguments;
    switch (e.length) {
      case 0:
        return !t.call(this);
      case 1:
        return !t.call(this, e[0]);
      case 2:
        return !t.call(this, e[0], e[1]);
      case 3:
        return !t.call(this, e[0], e[1], e[2]);
    }
    return !t.apply(this, e);
  };
}
function Jpe(t, e, r, n) {
  if (!da(t))
    return t;
  e = Tx(e, t);
  for (var i = -1, a = e.length, s = a - 1, o = t; o != null && ++i < a; ) {
    var l = qg(e[i]), u = r;
    if (l === "__proto__" || l === "constructor" || l === "prototype")
      return t;
    if (i != s) {
      var h = o[l];
      u = void 0, u === void 0 && (u = da(h) ? h : rx(e[i + 1]) ? [] : {});
    }
    Fg(o, l, u), o = o[l];
  }
  return t;
}
function Oz(t, e, r) {
  for (var n = -1, i = e.length, a = {}; ++n < i; ) {
    var s = e[n], o = Ex(t, s);
    r(o, s) && Jpe(a, Tx(s, t), o);
  }
  return a;
}
function As(t, e) {
  if (t == null)
    return {};
  var r = Jc(wz(t), function(n) {
    return [n];
  });
  return e = ma(e), Oz(t, r, function(n, i) {
    return e(n, i[0]);
  });
}
function ege(t, e) {
  var r = t.length;
  for (t.sort(e); r--; )
    t[r] = t[r].value;
  return t;
}
function tge(t, e) {
  if (t !== e) {
    var r = t !== void 0, n = t === null, i = t === t, a = fu(t), s = e !== void 0, o = e === null, l = e === e, u = fu(e);
    if (!o && !u && !a && t > e || a && s && l && !o && !u || n && s && l || !r && l || !i)
      return 1;
    if (!n && !a && !u && t < e || u && r && i && !n && !a || o && r && i || !s && i || !l)
      return -1;
  }
  return 0;
}
function rge(t, e, r) {
  for (var n = -1, i = t.criteria, a = e.criteria, s = i.length, o = r.length; ++n < s; ) {
    var l = tge(i[n], a[n]);
    if (l) {
      if (n >= o)
        return l;
      var u = r[n];
      return l * (u == "desc" ? -1 : 1);
    }
  }
  return t.index - e.index;
}
function nge(t, e, r) {
  e.length ? e = Jc(e, function(a) {
    return ir(a) ? function(s) {
      return Ex(s, a.length === 1 ? a[0] : a);
    } : a;
  }) : e = [qo];
  var n = -1;
  e = Jc(e, Bg(ma));
  var i = Dz(t, function(a, s, o) {
    var l = Jc(e, function(u) {
      return u(a);
    });
    return { criteria: l, index: ++n, value: a };
  });
  return ege(i, function(a, s) {
    return rge(a, s, r);
  });
}
function ige(t, e) {
  return Oz(t, e, function(r, n) {
    return Rz(t, n);
  });
}
var Ny = Tfe(function(t, e) {
  return t == null ? {} : ige(t, e);
}), age = Math.ceil, sge = Math.max;
function oge(t, e, r, n) {
  for (var i = -1, a = sge(age((e - t) / (r || 1)), 0), s = Array(a); a--; )
    s[++i] = t, t += r;
  return s;
}
function lge(t) {
  return function(e, r, n) {
    return n && typeof n != "number" && jp(e, r, n) && (r = n = void 0), e = ev(e), r === void 0 ? (r = e, e = 0) : r = ev(r), n = n === void 0 ? e < r ? 1 : -1 : ev(n), oge(e, r, n);
  };
}
var sf = lge();
function cge(t, e, r, n, i) {
  return i(t, function(a, s, o) {
    r = n ? (n = !1, a) : e(r, a, s, o);
  }), r;
}
function An(t, e, r) {
  var n = ir(t) ? Efe : cge, i = arguments.length < 3;
  return n(t, ma(e), r, i, Pu);
}
function Ax(t, e) {
  var r = ir(t) ? Ak : Mz;
  return r(t, Qpe(ma(e)));
}
function uge(t, e) {
  var r;
  return Pu(t, function(n, i, a) {
    return r = e(n, i, a), !r;
  }), !!r;
}
function Pz(t, e, r) {
  var n = ir(t) ? Sz : uge;
  return n(t, ma(e));
}
var jg = $g(function(t, e) {
  if (t == null)
    return [];
  var r = e.length;
  return r > 1 && jp(t, e[0], e[1]) ? e = [] : r > 2 && jp(e[0], e[1], e[2]) && (e = [e[0]]), nge(t, Yg(e), []);
}), hge = 1 / 0, dge = Dh && 1 / Rk(new Dh([, -0]))[1] == hge ? function(t) {
  return new Dh(t);
} : Nn, fge = 200;
function Pk(t, e, r) {
  var n = -1, i = gz, a = t.length, s = !0, o = [], l = o;
  if (a >= fge) {
    var u = e ? null : dge(t);
    if (u)
      return Rk(u);
    s = !1, i = Lk, l = new nf();
  } else
    l = e ? [] : o;
  e:
    for (; ++n < a; ) {
      var h = t[n], d = e ? e(h) : h;
      if (h = h !== 0 ? h : 0, s && d === d) {
        for (var f = l.length; f--; )
          if (l[f] === d)
            continue e;
        e && l.push(d), o.push(h);
      } else i(l, d, r) || (l !== o && l.push(d), o.push(h));
    }
  return o;
}
var pge = $g(function(t) {
  return Pk(Yg(t, 1, dy, !0));
});
function Bk(t) {
  return t && t.length ? Pk(t) : [];
}
function gge(t, e) {
  return t && t.length ? Pk(t, ma(e)) : [];
}
var mge = 0;
function Fk(t) {
  var e = ++mge;
  return mz(t) + e;
}
function vge(t, e, r) {
  for (var n = -1, i = t.length, a = e.length, s = {}; ++n < i; ) {
    var o = n < a ? e[n] : void 0;
    r(s, t[n], o);
  }
  return s;
}
function yge(t, e) {
  return vge(t || [], e || [], Fg);
}
var xge = "\0", Ac = "\0", bA = "";
class va {
  constructor(e = {}) {
    this._isDirected = Object.prototype.hasOwnProperty.call(e, "directed") ? e.directed : !0, this._isMultigraph = Object.prototype.hasOwnProperty.call(e, "multigraph") ? e.multigraph : !1, this._isCompound = Object.prototype.hasOwnProperty.call(e, "compound") ? e.compound : !1, this._label = void 0, this._defaultNodeLabelFn = wh(void 0), this._defaultEdgeLabelFn = wh(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[Ac] = {}), 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 Ja(e) || (e = wh(e)), this._defaultNodeLabelFn = e, this;
  }
  nodeCount() {
    return this._nodeCount;
  }
  nodes() {
    return On(this._nodes);
  }
  sources() {
    var e = this;
    return cn(this.nodes(), function(r) {
      return Sr(e._in[r]);
    });
  }
  sinks() {
    var e = this;
    return cn(this.nodes(), function(r) {
      return Sr(e._out[r]);
    });
  }
  setNodes(e, r) {
    var n = arguments, i = this;
    return Ie(e, function(a) {
      n.length > 1 ? i.setNode(a, r) : i.setNode(a);
    }), this;
  }
  setNode(e, r) {
    return Object.prototype.hasOwnProperty.call(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = r), this) : (this._nodes[e] = arguments.length > 1 ? r : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = Ac, this._children[e] = {}, this._children[Ac][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 Object.prototype.hasOwnProperty.call(this._nodes, e);
  }
  removeNode(e) {
    if (Object.prototype.hasOwnProperty.call(this._nodes, e)) {
      var r = (n) => this.removeEdge(this._edgeObjs[n]);
      delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], Ie(this.children(e), (n) => {
        this.setParent(n);
      }), delete this._children[e]), Ie(On(this._in[e]), r), delete this._in[e], delete this._preds[e], Ie(On(this._out[e]), r), delete this._out[e], delete this._sucs[e], --this._nodeCount;
    }
    return this;
  }
  setParent(e, r) {
    if (!this._isCompound)
      throw new Error("Cannot set parent in a non-compound graph");
    if (Rr(r))
      r = Ac;
    else {
      r += "";
      for (var n = r; !Rr(n); n = this.parent(n))
        if (n === e)
          throw new Error("Setting " + r + " as parent of " + e + " would create a cycle");
      this.setNode(r);
    }
    return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = r, this._children[r][e] = !0, this;
  }
  _removeFromParentsChildList(e) {
    delete this._children[this._parent[e]][e];
  }
  parent(e) {
    if (this._isCompound) {
      var r = this._parent[e];
      if (r !== Ac)
        return r;
    }
  }
  children(e) {
    if (Rr(e) && (e = Ac), this._isCompound) {
      var r = this._children[e];
      if (r)
        return On(r);
    } else {
      if (e === Ac)
        return this.nodes();
      if (this.hasNode(e))
        return [];
    }
  }
  predecessors(e) {
    var r = this._preds[e];
    if (r)
      return On(r);
  }
  successors(e) {
    var r = this._sucs[e];
    if (r)
      return On(r);
  }
  neighbors(e) {
    var r = this.predecessors(e);
    if (r)
      return pge(r, this.successors(e));
  }
  isLeaf(e) {
    var r;
    return this.isDirected() ? r = this.successors(e) : r = this.neighbors(e), r.length === 0;
  }
  filterNodes(e) {
    var r = new this.constructor({
      directed: this._isDirected,
      multigraph: this._isMultigraph,
      compound: this._isCompound
    });
    r.setGraph(this.graph());
    var n = this;
    Ie(this._nodes, function(s, o) {
      e(o) && r.setNode(o, s);
    }), Ie(this._edgeObjs, function(s) {
      r.hasNode(s.v) && r.hasNode(s.w) && r.setEdge(s, n.edge(s));
    });
    var i = {};
    function a(s) {
      var o = n.parent(s);
      return o === void 0 || r.hasNode(o) ? (i[s] = o, o) : o in i ? i[o] : a(o);
    }
    return this._isCompound && Ie(r.nodes(), function(s) {
      r.setParent(s, a(s));
    }), r;
  }
  /* === Edge functions ========== */
  setDefaultEdgeLabel(e) {
    return Ja(e) || (e = wh(e)), this._defaultEdgeLabelFn = e, this;
  }
  edgeCount() {
    return this._edgeCount;
  }
  edges() {
    return Pr(this._edgeObjs);
  }
  setPath(e, r) {
    var n = this, i = arguments;
    return An(e, function(a, s) {
      return i.length > 1 ? n.setEdge(a, s, r) : n.setEdge(a, s), s;
    }), this;
  }
  /*
   * setEdge(v, w, [value, [name]])
   * setEdge({ v, w, [name] }, [value])
   */
  setEdge() {
    var e, r, n, i, a = !1, s = arguments[0];
    typeof s == "object" && s !== null && "v" in s ? (e = s.v, r = s.w, n = s.name, arguments.length === 2 && (i = arguments[1], a = !0)) : (e = s, r = arguments[1], n = arguments[3], arguments.length > 2 && (i = arguments[2], a = !0)), e = "" + e, r = "" + r, Rr(n) || (n = "" + n);
    var o = A0(this._isDirected, e, r, n);
    if (Object.prototype.hasOwnProperty.call(this._edgeLabels, o))
      return a && (this._edgeLabels[o] = i), this;
    if (!Rr(n) && !this._isMultigraph)
      throw new Error("Cannot set a named edge when isMultigraph = false");
    this.setNode(e), this.setNode(r), this._edgeLabels[o] = a ? i : this._defaultEdgeLabelFn(e, r, n);
    var l = bge(this._isDirected, e, r, n);
    return e = l.v, r = l.w, Object.freeze(l), this._edgeObjs[o] = l, wA(this._preds[r], e), wA(this._sucs[e], r), this._in[r][o] = l, this._out[e][o] = l, this._edgeCount++, this;
  }
  edge(e, r, n) {
    var i = arguments.length === 1 ? b4(this._isDirected, arguments[0]) : A0(this._isDirected, e, r, n);
    return this._edgeLabels[i];
  }
  hasEdge(e, r, n) {
    var i = arguments.length === 1 ? b4(this._isDirected, arguments[0]) : A0(this._isDirected, e, r, n);
    return Object.prototype.hasOwnProperty.call(this._edgeLabels, i);
  }
  removeEdge(e, r, n) {
    var i = arguments.length === 1 ? b4(this._isDirected, arguments[0]) : A0(this._isDirected, e, r, n), a = this._edgeObjs[i];
    return a && (e = a.v, r = a.w, delete this._edgeLabels[i], delete this._edgeObjs[i], TA(this._preds[r], e), TA(this._sucs[e], r), delete this._in[r][i], delete this._out[e][i], this._edgeCount--), this;
  }
  inEdges(e, r) {
    var n = this._in[e];
    if (n) {
      var i = Pr(n);
      return r ? cn(i, function(a) {
        return a.v === r;
      }) : i;
    }
  }
  outEdges(e, r) {
    var n = this._out[e];
    if (n) {
      var i = Pr(n);
      return r ? cn(i, function(a) {
        return a.w === r;
      }) : i;
    }
  }
  nodeEdges(e, r) {
    var n = this.inEdges(e, r);
    if (n)
      return n.concat(this.outEdges(e, r));
  }
}
va.prototype._nodeCount = 0;
va.prototype._edgeCount = 0;
function wA(t, e) {
  t[e] ? t[e]++ : t[e] = 1;
}
function TA(t, e) {
  --t[e] || delete t[e];
}
function A0(t, e, r, n) {
  var i = "" + e, a = "" + r;
  if (!t && i > a) {
    var s = i;
    i = a, a = s;
  }
  return i + bA + a + bA + (Rr(n) ? xge : n);
}
function bge(t, e, r, n) {
  var i = "" + e, a = "" + r;
  if (!t && i > a) {
    var s = i;
    i = a, a = s;
  }
  var o = { v: i, w: a };
  return n && (o.name = n), o;
}
function b4(t, e) {
  return A0(t, e.v, e.w, e.name);
}
class wge {
  constructor() {
    var e = {};
    e._next = e._prev = e, this._sentinel = e;
  }
  dequeue() {
    var e = this._sentinel, r = e._prev;
    if (r !== e)
      return EA(r), r;
  }
  enqueue(e) {
    var r = this._sentinel;
    e._prev && e._next && EA(e), e._next = r._next, r._next._prev = e, r._next = e, e._prev = r;
  }
  toString() {
    for (var e = [], r = this._sentinel, n = r._prev; n !== r; )
      e.push(JSON.stringify(n, Tge)), n = n._prev;
    return "[" + e.join(", ") + "]";
  }
}
function EA(t) {
  t._prev._next = t._next, t._next._prev = t._prev, delete t._next, delete t._prev;
}
function Tge(t, e) {
  if (t !== "_next" && t !== "_prev")
    return e;
}
var Ege = wh(1);
function kge(t, e) {
  if (t.nodeCount() <= 1)
    return [];
  var r = Cge(t, e || Ege), n = Sge(r.graph, r.buckets, r.zeroIdx);
  return jn(
    ft(n, function(i) {
      return t.outEdges(i.v, i.w);
    })
  );
}
function Sge(t, e, r) {
  for (var n = [], i = e[e.length - 1], a = e[0], s; t.nodeCount(); ) {
    for (; s = a.dequeue(); )
      w4(t, e, r, s);
    for (; s = i.dequeue(); )
      w4(t, e, r, s);
    if (t.nodeCount()) {
      for (var o = e.length - 2; o > 0; --o)
        if (s = e[o].dequeue(), s) {
          n = n.concat(w4(t, e, r, s, !0));
          break;
        }
    }
  }
  return n;
}
function w4(t, e, r, n, i) {
  var a = i ? [] : void 0;
  return Ie(t.inEdges(n.v), function(s) {
    var o = t.edge(s), l = t.node(s.v);
    i && a.push({ v: s.v, w: s.w }), l.out -= o, aT(e, r, l);
  }), Ie(t.outEdges(n.v), function(s) {
    var o = t.edge(s), l = s.w, u = t.node(l);
    u.in -= o, aT(e, r, u);
  }), t.removeNode(n.v), a;
}
function Cge(t, e) {
  var r = new va(), n = 0, i = 0;
  Ie(t.nodes(), function(o) {
    r.setNode(o, { v: o, in: 0, out: 0 });
  }), Ie(t.edges(), function(o) {
    var l = r.edge(o.v, o.w) || 0, u = e(o), h = l + u;
    r.setEdge(o.v, o.w, h), i = Math.max(i, r.node(o.v).out += u), n = Math.max(n, r.node(o.w).in += u);
  });
  var a = sf(i + n + 3).map(function() {
    return new wge();
  }), s = n + 1;
  return Ie(r.nodes(), function(o) {
    aT(a, s, r.node(o));
  }), { graph: r, buckets: a, zeroIdx: s };
}
function aT(t, e, r) {
  r.out ? r.in ? t[r.out - r.in + e].enqueue(r) : t[t.length - 1].enqueue(r) : t[0].enqueue(r);
}
function Age(t) {
  var e = t.graph().acyclicer === "greedy" ? kge(t, r(t)) : _ge(t);
  Ie(e, function(n) {
    var i = t.edge(n);
    t.removeEdge(n), i.forwardName = n.name, i.reversed = !0, t.setEdge(n.w, n.v, i, Fk("rev"));
  });
  function r(n) {
    return function(i) {
      return n.edge(i).weight;
    };
  }
}
function _ge(t) {
  var e = [], r = {}, n = {};
  function i(a) {
    Object.prototype.hasOwnProperty.call(n, a) || (n[a] = !0, r[a] = !0, Ie(t.outEdges(a), function(s) {
      Object.prototype.hasOwnProperty.call(r, s.w) ? e.push(s) : i(s.w);
    }), delete r[a]);
  }
  return Ie(t.nodes(), i), e;
}
function Lge(t) {
  Ie(t.edges(), function(e) {
    var r = t.edge(e);
    if (r.reversed) {
      t.removeEdge(e);
      var n = r.forwardName;
      delete r.reversed, delete r.forwardName, t.setEdge(e.w, e.v, r, n);
    }
  });
}
function Nf(t, e, r, n) {
  var i;
  do
    i = Fk(n);
  while (t.hasNode(i));
  return r.dummy = e, t.setNode(i, r), i;
}
function Rge(t) {
  var e = new va().setGraph(t.graph());
  return Ie(t.nodes(), function(r) {
    e.setNode(r, t.node(r));
  }), Ie(t.edges(), function(r) {
    var n = e.edge(r.v, r.w) || { weight: 0, minlen: 1 }, i = t.edge(r);
    e.setEdge(r.v, r.w, {
      weight: n.weight + i.weight,
      minlen: Math.max(n.minlen, i.minlen)
    });
  }), e;
}
function Bz(t) {
  var e = new va({ multigraph: t.isMultigraph() }).setGraph(t.graph());
  return Ie(t.nodes(), function(r) {
    t.children(r).length || e.setNode(r, t.node(r));
  }), Ie(t.edges(), function(r) {
    e.setEdge(r, t.edge(r));
  }), e;
}
function kA(t, e) {
  var r = t.x, n = t.y, i = e.x - r, a = e.y - n, s = t.width / 2, o = t.height / 2;
  if (!i && !a)
    throw new Error("Not possible to find intersection inside of the rectangle");
  var l, u;
  return Math.abs(a) * s > Math.abs(i) * o ? (a < 0 && (o = -o), l = o * i / a, u = o) : (i < 0 && (s = -s), l = s, u = s * a / i), { x: r + l, y: n + u };
}
function _x(t) {
  var e = ft(sf(Fz(t) + 1), function() {
    return [];
  });
  return Ie(t.nodes(), function(r) {
    var n = t.node(r), i = n.rank;
    Rr(i) || (e[i][n.order] = r);
  }), e;
}
function Nge(t) {
  var e = af(
    ft(t.nodes(), function(r) {
      return t.node(r).rank;
    })
  );
  Ie(t.nodes(), function(r) {
    var n = t.node(r);
    Ft(n, "rank") && (n.rank -= e);
  });
}
function Mge(t) {
  var e = af(
    ft(t.nodes(), function(a) {
      return t.node(a).rank;
    })
  ), r = [];
  Ie(t.nodes(), function(a) {
    var s = t.node(a).rank - e;
    r[s] || (r[s] = []), r[s].push(a);
  });
  var n = 0, i = t.graph().nodeRankFactor;
  Ie(r, function(a, s) {
    Rr(a) && s % i !== 0 ? --n : n && Ie(a, function(o) {
      t.node(o).rank += n;
    });
  });
}
function SA(t, e, r, n) {
  var i = {
    width: 0,
    height: 0
  };
  return arguments.length >= 4 && (i.rank = r, i.order = n), Nf(t, "border", i, e);
}
function Fz(t) {
  return pu(
    ft(t.nodes(), function(e) {
      var r = t.node(e).rank;
      if (!Rr(r))
        return r;
    })
  );
}
function Dge(t, e) {
  var r = { lhs: [], rhs: [] };
  return Ie(t, function(n) {
    e(n) ? r.lhs.push(n) : r.rhs.push(n);
  }), r;
}
function Ige(t, e) {
  return e();
}
function Oge(t) {
  function e(r) {
    var n = t.children(r), i = t.node(r);
    if (n.length && Ie(n, e), Object.prototype.hasOwnProperty.call(i, "minRank")) {
      i.borderLeft = [], i.borderRight = [];
      for (var a = i.minRank, s = i.maxRank + 1; a < s; ++a)
        CA(t, "borderLeft", "_bl", r, i, a), CA(t, "borderRight", "_br", r, i, a);
    }
  }
  Ie(t.children(), e);
}
function CA(t, e, r, n, i, a) {
  var s = { width: 0, height: 0, rank: a, borderType: e }, o = i[e][a - 1], l = Nf(t, "border", s, r);
  i[e][a] = l, t.setParent(l, n), o && t.setEdge(o, l, { weight: 1 });
}
function Pge(t) {
  var e = t.graph().rankdir.toLowerCase();
  (e === "lr" || e === "rl") && $z(t);
}
function Bge(t) {
  var e = t.graph().rankdir.toLowerCase();
  (e === "bt" || e === "rl") && Fge(t), (e === "lr" || e === "rl") && ($ge(t), $z(t));
}
function $z(t) {
  Ie(t.nodes(), function(e) {
    AA(t.node(e));
  }), Ie(t.edges(), function(e) {
    AA(t.edge(e));
  });
}
function AA(t) {
  var e = t.width;
  t.width = t.height, t.height = e;
}
function Fge(t) {
  Ie(t.nodes(), function(e) {
    T4(t.node(e));
  }), Ie(t.edges(), function(e) {
    var r = t.edge(e);
    Ie(r.points, T4), Object.prototype.hasOwnProperty.call(r, "y") && T4(r);
  });
}
function T4(t) {
  t.y = -t.y;
}
function $ge(t) {
  Ie(t.nodes(), function(e) {
    E4(t.node(e));
  }), Ie(t.edges(), function(e) {
    var r = t.edge(e);
    Ie(r.points, E4), Object.prototype.hasOwnProperty.call(r, "x") && E4(r);
  });
}
function E4(t) {
  var e = t.x;
  t.x = t.y, t.y = e;
}
function zge(t) {
  t.graph().dummyChains = [], Ie(t.edges(), function(e) {
    Vge(t, e);
  });
}
function Vge(t, e) {
  var r = e.v, n = t.node(r).rank, i = e.w, a = t.node(i).rank, s = e.name, o = t.edge(e), l = o.labelRank;
  if (a !== n + 1) {
    t.removeEdge(e);
    var u = void 0, h, d;
    for (d = 0, ++n; n < a; ++d, ++n)
      o.points = [], u = {
        width: 0,
        height: 0,
        edgeLabel: o,
        edgeObj: e,
        rank: n
      }, h = Nf(t, "edge", u, "_d"), n === l && (u.width = o.width, u.height = o.height, u.dummy = "edge-label", u.labelpos = o.labelpos), t.setEdge(r, h, { weight: o.weight }, s), d === 0 && t.graph().dummyChains.push(h), r = h;
    t.setEdge(r, i, { weight: o.weight }, s);
  }
}
function Gge(t) {
  Ie(t.graph().dummyChains, function(e) {
    var r = t.node(e), n = r.edgeLabel, i;
    for (t.setEdge(r.edgeObj, n); r.dummy; )
      i = t.successors(e)[0], t.removeNode(e), n.points.push({ x: r.x, y: r.y }), r.dummy === "edge-label" && (n.x = r.x, n.y = r.y, n.width = r.width, n.height = r.height), e = i, r = t.node(e);
  });
}
function $k(t) {
  var e = {};
  function r(n) {
    var i = t.node(n);
    if (Object.prototype.hasOwnProperty.call(e, n))
      return i.rank;
    e[n] = !0;
    var a = af(
      ft(t.outEdges(n), function(s) {
        return r(s.w) - t.edge(s).minlen;
      })
    );
    return (a === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
    a === void 0 || // return value of _.map([]) for Lodash 4
    a === null) && (a = 0), i.rank = a;
  }
  Ie(t.sources(), r);
}
function rg(t, e) {
  return t.node(e.w).rank - t.node(e.v).rank - t.edge(e).minlen;
}
function zz(t) {
  var e = new va({ directed: !1 }), r = t.nodes()[0], n = t.nodeCount();
  e.setNode(r, {});
  for (var i, a; Uge(e, t) < n; )
    i = Wge(e, t), a = e.hasNode(i.v) ? rg(t, i) : -rg(t, i), Hge(e, t, a);
  return e;
}
function Uge(t, e) {
  function r(n) {
    Ie(e.nodeEdges(n), function(i) {
      var a = i.v, s = n === a ? i.w : a;
      !t.hasNode(s) && !rg(e, i) && (t.setNode(s, {}), t.setEdge(n, s, {}), r(s));
    });
  }
  return Ie(t.nodes(), r), t.nodeCount();
}
function Wge(t, e) {
  return Ok(e.edges(), function(r) {
    if (t.hasNode(r.v) !== t.hasNode(r.w))
      return rg(e, r);
  });
}
function Hge(t, e, r) {
  Ie(t.nodes(), function(n) {
    e.node(n).rank += r;
  });
}
function qge() {
}
qge.prototype = new Error();
function Vz(t, e, r) {
  ir(e) || (e = [e]);
  var n = (t.isDirected() ? t.successors : t.neighbors).bind(t), i = [], a = {};
  return Ie(e, function(s) {
    if (!t.hasNode(s))
      throw new Error("Graph does not have node: " + s);
    Gz(t, s, r === "post", a, n, i);
  }), i;
}
function Gz(t, e, r, n, i, a) {
  Object.prototype.hasOwnProperty.call(n, e) || (n[e] = !0, r || a.push(e), Ie(i(e), function(s) {
    Gz(t, s, r, n, i, a);
  }), r && a.push(e));
}
function Yge(t, e) {
  return Vz(t, e, "post");
}
function Xge(t, e) {
  return Vz(t, e, "pre");
}
Bu.initLowLimValues = Vk;
Bu.initCutValues = zk;
Bu.calcCutValue = Uz;
Bu.leaveEdge = Hz;
Bu.enterEdge = qz;
Bu.exchangeEdges = Yz;
function Bu(t) {
  t = Rge(t), $k(t);
  var e = zz(t);
  Vk(e), zk(e, t);
  for (var r, n; r = Hz(e); )
    n = qz(e, t, r), Yz(e, t, r, n);
}
function zk(t, e) {
  var r = Yge(t, t.nodes());
  r = r.slice(0, r.length - 1), Ie(r, function(n) {
    jge(t, e, n);
  });
}
function jge(t, e, r) {
  var n = t.node(r), i = n.parent;
  t.edge(r, i).cutvalue = Uz(t, e, r);
}
function Uz(t, e, r) {
  var n = t.node(r), i = n.parent, a = !0, s = e.edge(r, i), o = 0;
  return s || (a = !1, s = e.edge(i, r)), o = s.weight, Ie(e.nodeEdges(r), function(l) {
    var u = l.v === r, h = u ? l.w : l.v;
    if (h !== i) {
      var d = u === a, f = e.edge(l).weight;
      if (o += d ? f : -f, Zge(t, r, h)) {
        var p = t.edge(r, h).cutvalue;
        o += d ? -p : p;
      }
    }
  }), o;
}
function Vk(t, e) {
  arguments.length < 2 && (e = t.nodes()[0]), Wz(t, {}, 1, e);
}
function Wz(t, e, r, n, i) {
  var a = r, s = t.node(n);
  return e[n] = !0, Ie(t.neighbors(n), function(o) {
    Object.prototype.hasOwnProperty.call(e, o) || (r = Wz(t, e, r, o, n));
  }), s.low = a, s.lim = r++, i ? s.parent = i : delete s.parent, r;
}
function Hz(t) {
  return Ko(t.edges(), function(e) {
    return t.edge(e).cutvalue < 0;
  });
}
function qz(t, e, r) {
  var n = r.v, i = r.w;
  e.hasEdge(n, i) || (n = r.w, i = r.v);
  var a = t.node(n), s = t.node(i), o = a, l = !1;
  a.lim > s.lim && (o = s, l = !0);
  var u = cn(e.edges(), function(h) {
    return l === _A(t, t.node(h.v), o) && l !== _A(t, t.node(h.w), o);
  });
  return Ok(u, function(h) {
    return rg(e, h);
  });
}
function Yz(t, e, r, n) {
  var i = r.v, a = r.w;
  t.removeEdge(i, a), t.setEdge(n.v, n.w, {}), Vk(t), zk(t, e), Kge(t, e);
}
function Kge(t, e) {
  var r = Ko(t.nodes(), function(i) {
    return !e.node(i).parent;
  }), n = Xge(t, r);
  n = n.slice(1), Ie(n, function(i) {
    var a = t.node(i).parent, s = e.edge(i, a), o = !1;
    s || (s = e.edge(a, i), o = !0), e.node(i).rank = e.node(a).rank + (o ? s.minlen : -s.minlen);
  });
}
function Zge(t, e, r) {
  return t.hasEdge(e, r);
}
function _A(t, e, r) {
  return r.low <= e.lim && e.lim <= r.lim;
}
function Qge(t) {
  switch (t.graph().ranker) {
    case "network-simplex":
      LA(t);
      break;
    case "tight-tree":
      e1e(t);
      break;
    case "longest-path":
      Jge(t);
      break;
    default:
      LA(t);
  }
}
var Jge = $k;
function e1e(t) {
  $k(t), zz(t);
}
function LA(t) {
  Bu(t);
}
function t1e(t) {
  var e = Nf(t, "root", {}, "_root"), r = r1e(t), n = pu(Pr(r)) - 1, i = 2 * n + 1;
  t.graph().nestingRoot = e, Ie(t.edges(), function(s) {
    t.edge(s).minlen *= i;
  });
  var a = n1e(t) + 1;
  Ie(t.children(), function(s) {
    Xz(t, e, i, a, n, r, s);
  }), t.graph().nodeRankFactor = i;
}
function Xz(t, e, r, n, i, a, s) {
  var o = t.children(s);
  if (!o.length) {
    s !== e && t.setEdge(e, s, { weight: 0, minlen: r });
    return;
  }
  var l = SA(t, "_bt"), u = SA(t, "_bb"), h = t.node(s);
  t.setParent(l, s), h.borderTop = l, t.setParent(u, s), h.borderBottom = u, Ie(o, function(d) {
    Xz(t, e, r, n, i, a, d);
    var f = t.node(d), p = f.borderTop ? f.borderTop : d, g = f.borderBottom ? f.borderBottom : d, m = f.borderTop ? n : 2 * n, v = p !== g ? 1 : i - a[s] + 1;
    t.setEdge(l, p, {
      weight: m,
      minlen: v,
      nestingEdge: !0
    }), t.setEdge(g, u, {
      weight: m,
      minlen: v,
      nestingEdge: !0
    });
  }), t.parent(s) || t.setEdge(e, l, { weight: 0, minlen: i + a[s] });
}
function r1e(t) {
  var e = {};
  function r(n, i) {
    var a = t.children(n);
    a && a.length && Ie(a, function(s) {
      r(s, i + 1);
    }), e[n] = i;
  }
  return Ie(t.children(), function(n) {
    r(n, 1);
  }), e;
}
function n1e(t) {
  return An(
    t.edges(),
    function(e, r) {
      return e + t.edge(r).weight;
    },
    0
  );
}
function i1e(t) {
  var e = t.graph();
  t.removeNode(e.nestingRoot), delete e.nestingRoot, Ie(t.edges(), function(r) {
    var n = t.edge(r);
    n.nestingEdge && t.removeEdge(r);
  });
}
function a1e(t, e, r) {
  var n = {}, i;
  Ie(r, function(a) {
    for (var s = t.parent(a), o, l; s; ) {
      if (o = t.parent(s), o ? (l = n[o], n[o] = s) : (l = i, i = s), l && l !== s) {
        e.setEdge(l, s);
        return;
      }
      s = o;
    }
  });
}
function s1e(t, e, r) {
  var n = o1e(t), i = new va({ compound: !0 }).setGraph({ root: n }).setDefaultNodeLabel(function(a) {
    return t.node(a);
  });
  return Ie(t.nodes(), function(a) {
    var s = t.node(a), o = t.parent(a);
    (s.rank === e || s.minRank <= e && e <= s.maxRank) && (i.setNode(a), i.setParent(a, o || n), Ie(t[r](a), function(l) {
      var u = l.v === a ? l.w : l.v, h = i.edge(u, a), d = Rr(h) ? 0 : h.weight;
      i.setEdge(u, a, { weight: t.edge(l).weight + d });
    }), Object.prototype.hasOwnProperty.call(s, "minRank") && i.setNode(a, {
      borderLeft: s.borderLeft[e],
      borderRight: s.borderRight[e]
    }));
  }), i;
}
function o1e(t) {
  for (var e; t.hasNode(e = Fk("_root")); ) ;
  return e;
}
function l1e(t, e) {
  for (var r = 0, n = 1; n < e.length; ++n)
    r += c1e(t, e[n - 1], e[n]);
  return r;
}
function c1e(t, e, r) {
  for (var n = yge(
    r,
    ft(r, function(u, h) {
      return h;
    })
  ), i = jn(
    ft(e, function(u) {
      return jg(
        ft(t.outEdges(u), function(h) {
          return { pos: n[h.w], weight: t.edge(h).weight };
        }),
        "pos"
      );
    })
  ), a = 1; a < r.length; ) a <<= 1;
  var s = 2 * a - 1;
  a -= 1;
  var o = ft(new Array(s), function() {
    return 0;
  }), l = 0;
  return Ie(
    // @ts-expect-error
    i.forEach(function(u) {
      var h = u.pos + a;
      o[h] += u.weight;
      for (var d = 0; h > 0; )
        h % 2 && (d += o[h + 1]), h = h - 1 >> 1, o[h] += u.weight;
      l += u.weight * d;
    })
  ), l;
}
function u1e(t) {
  var e = {}, r = cn(t.nodes(), function(o) {
    return !t.children(o).length;
  }), n = pu(
    ft(r, function(o) {
      return t.node(o).rank;
    })
  ), i = ft(sf(n + 1), function() {
    return [];
  });
  function a(o) {
    if (!Ft(e, o)) {
      e[o] = !0;
      var l = t.node(o);
      i[l.rank].push(o), Ie(t.successors(o), a);
    }
  }
  var s = jg(r, function(o) {
    return t.node(o).rank;
  });
  return Ie(s, a), i;
}
function h1e(t, e) {
  return ft(e, function(r) {
    var n = t.inEdges(r);
    if (n.length) {
      var i = An(
        n,
        function(a, s) {
          var o = t.edge(s), l = t.node(s.v);
          return {
            sum: a.sum + o.weight * l.order,
            weight: a.weight + o.weight
          };
        },
        { sum: 0, weight: 0 }
      );
      return {
        v: r,
        barycenter: i.sum / i.weight,
        weight: i.weight
      };
    } else
      return { v: r };
  });
}
function d1e(t, e) {
  var r = {};
  Ie(t, function(i, a) {
    var s = r[i.v] = {
      indegree: 0,
      in: [],
      out: [],
      vs: [i.v],
      i: a
    };
    Rr(i.barycenter) || (s.barycenter = i.barycenter, s.weight = i.weight);
  }), Ie(e.edges(), function(i) {
    var a = r[i.v], s = r[i.w];
    !Rr(a) && !Rr(s) && (s.indegree++, a.out.push(r[i.w]));
  });
  var n = cn(r, function(i) {
    return !i.indegree;
  });
  return f1e(n);
}
function f1e(t) {
  var e = [];
  function r(a) {
    return function(s) {
      s.merged || (Rr(s.barycenter) || Rr(a.barycenter) || s.barycenter >= a.barycenter) && p1e(a, s);
    };
  }
  function n(a) {
    return function(s) {
      s.in.push(a), --s.indegree === 0 && t.push(s);
    };
  }
  for (; t.length; ) {
    var i = t.pop();
    e.push(i), Ie(i.in.reverse(), r(i)), Ie(i.out, n(i));
  }
  return ft(
    cn(e, function(a) {
      return !a.merged;
    }),
    function(a) {
      return Ny(a, ["vs", "i", "barycenter", "weight"]);
    }
  );
}
function p1e(t, e) {
  var r = 0, n = 0;
  t.weight && (r += t.barycenter * t.weight, n += t.weight), e.weight && (r += e.barycenter * e.weight, n += e.weight), t.vs = e.vs.concat(t.vs), t.barycenter = r / n, t.weight = n, t.i = Math.min(e.i, t.i), e.merged = !0;
}
function g1e(t, e) {
  var r = Dge(t, function(h) {
    return Object.prototype.hasOwnProperty.call(h, "barycenter");
  }), n = r.lhs, i = jg(r.rhs, function(h) {
    return -h.i;
  }), a = [], s = 0, o = 0, l = 0;
  n.sort(m1e(!!e)), l = RA(a, i, l), Ie(n, function(h) {
    l += h.vs.length, a.push(h.vs), s += h.barycenter * h.weight, o += h.weight, l = RA(a, i, l);
  });
  var u = { vs: jn(a) };
  return o && (u.barycenter = s / o, u.weight = o), u;
}
function RA(t, e, r) {
  for (var n; e.length && (n = Qs(e)).i <= r; )
    e.pop(), t.push(n.vs), r++;
  return r;
}
function m1e(t) {
  return function(e, r) {
    return e.barycenter < r.barycenter ? -1 : e.barycenter > r.barycenter ? 1 : t ? r.i - e.i : e.i - r.i;
  };
}
function jz(t, e, r, n) {
  var i = t.children(e), a = t.node(e), s = a ? a.borderLeft : void 0, o = a ? a.borderRight : void 0, l = {};
  s && (i = cn(i, function(g) {
    return g !== s && g !== o;
  }));
  var u = h1e(t, i);
  Ie(u, function(g) {
    if (t.children(g.v).length) {
      var m = jz(t, g.v, r, n);
      l[g.v] = m, Object.prototype.hasOwnProperty.call(m, "barycenter") && y1e(g, m);
    }
  });
  var h = d1e(u, r);
  v1e(h, l);
  var d = g1e(h, n);
  if (s && (d.vs = jn([s, d.vs, o]), t.predecessors(s).length)) {
    var f = t.node(t.predecessors(s)[0]), p = t.node(t.predecessors(o)[0]);
    Object.prototype.hasOwnProperty.call(d, "barycenter") || (d.barycenter = 0, d.weight = 0), d.barycenter = (d.barycenter * d.weight + f.order + p.order) / (d.weight + 2), d.weight += 2;
  }
  return d;
}
function v1e(t, e) {
  Ie(t, function(r) {
    r.vs = jn(
      r.vs.map(function(n) {
        return e[n] ? e[n].vs : n;
      })
    );
  });
}
function y1e(t, e) {
  Rr(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 x1e(t) {
  var e = Fz(t), r = NA(t, sf(1, e + 1), "inEdges"), n = NA(t, sf(e - 1, -1, -1), "outEdges"), i = u1e(t);
  MA(t, i);
  for (var a = Number.POSITIVE_INFINITY, s, o = 0, l = 0; l < 4; ++o, ++l) {
    b1e(o % 2 ? r : n, o % 4 >= 2), i = _x(t);
    var u = l1e(t, i);
    u < a && (l = 0, s = $0e(i), a = u);
  }
  MA(t, s);
}
function NA(t, e, r) {
  return ft(e, function(n) {
    return s1e(t, n, r);
  });
}
function b1e(t, e) {
  var r = new va();
  Ie(t, function(n) {
    var i = n.graph().root, a = jz(n, i, r, e);
    Ie(a.vs, function(s, o) {
      n.node(s).order = o;
    }), a1e(n, r, a.vs);
  });
}
function MA(t, e) {
  Ie(e, function(r) {
    Ie(r, function(n, i) {
      t.node(n).order = i;
    });
  });
}
function w1e(t) {
  var e = E1e(t);
  Ie(t.graph().dummyChains, function(r) {
    for (var n = t.node(r), i = n.edgeObj, a = T1e(t, e, i.v, i.w), s = a.path, o = a.lca, l = 0, u = s[l], h = !0; r !== i.w; ) {
      if (n = t.node(r), h) {
        for (; (u = s[l]) !== o && t.node(u).maxRank < n.rank; )
          l++;
        u === o && (h = !1);
      }
      if (!h) {
        for (; l < s.length - 1 && t.node(u = s[l + 1]).minRank <= n.rank; )
          l++;
        u = s[l];
      }
      t.setParent(r, u), r = t.successors(r)[0];
    }
  });
}
function T1e(t, e, r, n) {
  var i = [], a = [], s = Math.min(e[r].low, e[n].low), o = Math.max(e[r].lim, e[n].lim), l, u;
  l = r;
  do
    l = t.parent(l), i.push(l);
  while (l && (e[l].low > s || o > e[l].lim));
  for (u = l, l = n; (l = t.parent(l)) !== u; )
    a.push(l);
  return { path: i.concat(a.reverse()), lca: u };
}
function E1e(t) {
  var e = {}, r = 0;
  function n(i) {
    var a = r;
    Ie(t.children(i), n), e[i] = { low: a, lim: r++ };
  }
  return Ie(t.children(), n), e;
}
function k1e(t, e) {
  var r = {};
  function n(i, a) {
    var s = 0, o = 0, l = i.length, u = Qs(a);
    return Ie(a, function(h, d) {
      var f = C1e(t, h), p = f ? t.node(f).order : l;
      (f || h === u) && (Ie(a.slice(o, d + 1), function(g) {
        Ie(t.predecessors(g), function(m) {
          var v = t.node(m), y = v.order;
          (y < s || p < y) && !(v.dummy && t.node(g).dummy) && Kz(r, m, g);
        });
      }), o = d + 1, s = p);
    }), a;
  }
  return An(e, n), r;
}
function S1e(t, e) {
  var r = {};
  function n(a, s, o, l, u) {
    var h;
    Ie(sf(s, o), function(d) {
      h = a[d], t.node(h).dummy && Ie(t.predecessors(h), function(f) {
        var p = t.node(f);
        p.dummy && (p.order < l || p.order > u) && Kz(r, f, h);
      });
    });
  }
  function i(a, s) {
    var o = -1, l, u = 0;
    return Ie(s, function(h, d) {
      if (t.node(h).dummy === "border") {
        var f = t.predecessors(h);
        f.length && (l = t.node(f[0]).order, n(s, u, d, o, l), u = d, o = l);
      }
      n(s, u, s.length, l, a.length);
    }), s;
  }
  return An(e, i), r;
}
function C1e(t, e) {
  if (t.node(e).dummy)
    return Ko(t.predecessors(e), function(r) {
      return t.node(r).dummy;
    });
}
function Kz(t, e, r) {
  if (e > r) {
    var n = e;
    e = r, r = n;
  }
  Object.prototype.hasOwnProperty.call(t, e) || Object.defineProperty(t, e, {
    enumerable: !0,
    configurable: !0,
    value: {},
    writable: !0
  });
  var i = t[e];
  Object.defineProperty(i, r, {
    enumerable: !0,
    configurable: !0,
    value: !0,
    writable: !0
  });
}
function A1e(t, e, r) {
  if (e > r) {
    var n = e;
    e = r, r = n;
  }
  return !!t[e] && Object.prototype.hasOwnProperty.call(t[e], r);
}
function _1e(t, e, r, n) {
  var i = {}, a = {}, s = {};
  return Ie(e, function(o) {
    Ie(o, function(l, u) {
      i[l] = l, a[l] = l, s[l] = u;
    });
  }), Ie(e, function(o) {
    var l = -1;
    Ie(o, function(u) {
      var h = n(u);
      if (h.length) {
        h = jg(h, function(m) {
          return s[m];
        });
        for (var d = (h.length - 1) / 2, f = Math.floor(d), p = Math.ceil(d); f <= p; ++f) {
          var g = h[f];
          a[u] === u && l < s[g] && !A1e(r, u, g) && (a[g] = u, a[u] = i[u] = i[g], l = s[g]);
        }
      }
    });
  }), { root: i, align: a };
}
function L1e(t, e, r, n, i) {
  var a = {}, s = R1e(t, e, r, i), o = i ? "borderLeft" : "borderRight";
  function l(d, f) {
    for (var p = s.nodes(), g = p.pop(), m = {}; g; )
      m[g] ? d(g) : (m[g] = !0, p.push(g), p = p.concat(f(g))), g = p.pop();
  }
  function u(d) {
    a[d] = s.inEdges(d).reduce(function(f, p) {
      return Math.max(f, a[p.v] + s.edge(p));
    }, 0);
  }
  function h(d) {
    var f = s.outEdges(d).reduce(function(g, m) {
      return Math.min(g, a[m.w] - s.edge(m));
    }, Number.POSITIVE_INFINITY), p = t.node(d);
    f !== Number.POSITIVE_INFINITY && p.borderType !== o && (a[d] = Math.max(a[d], f));
  }
  return l(u, s.predecessors.bind(s)), l(h, s.successors.bind(s)), Ie(n, function(d) {
    a[d] = a[r[d]];
  }), a;
}
function R1e(t, e, r, n) {
  var i = new va(), a = t.graph(), s = O1e(a.nodesep, a.edgesep, n);
  return Ie(e, function(o) {
    var l;
    Ie(o, function(u) {
      var h = r[u];
      if (i.setNode(h), l) {
        var d = r[l], f = i.edge(d, h);
        i.setEdge(d, h, Math.max(s(t, u, l), f || 0));
      }
      l = u;
    });
  }), i;
}
function N1e(t, e) {
  return Ok(Pr(e), function(r) {
    var n = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY;
    return Bpe(r, function(a, s) {
      var o = P1e(t, s) / 2;
      n = Math.max(a + o, n), i = Math.min(a - o, i);
    }), n - i;
  });
}
function M1e(t, e) {
  var r = Pr(e), n = af(r), i = pu(r);
  Ie(["u", "d"], function(a) {
    Ie(["l", "r"], function(s) {
      var o = a + s, l = t[o], u;
      if (l !== e) {
        var h = Pr(l);
        u = s === "l" ? n - af(h) : i - pu(h), u && (t[o] = Cx(l, function(d) {
          return d + u;
        }));
      }
    });
  });
}
function D1e(t, e) {
  return Cx(t.ul, function(r, n) {
    if (e)
      return t[e.toLowerCase()][n];
    var i = jg(ft(t, n));
    return (i[1] + i[2]) / 2;
  });
}
function I1e(t) {
  var e = _x(t), r = fy(k1e(t, e), S1e(t, e)), n = {}, i;
  Ie(["u", "d"], function(s) {
    i = s === "u" ? e : Pr(e).reverse(), Ie(["l", "r"], function(o) {
      o === "r" && (i = ft(i, function(d) {
        return Pr(d).reverse();
      }));
      var l = (s === "u" ? t.predecessors : t.successors).bind(t), u = _1e(t, i, r, l), h = L1e(t, i, u.root, u.align, o === "r");
      o === "r" && (h = Cx(h, function(d) {
        return -d;
      })), n[s + o] = h;
    });
  });
  var a = N1e(t, n);
  return M1e(n, a), D1e(n, t.graph().align);
}
function O1e(t, e, r) {
  return function(n, i, a) {
    var s = n.node(i), o = n.node(a), l = 0, u;
    if (l += s.width / 2, Object.prototype.hasOwnProperty.call(s, "labelpos"))
      switch (s.labelpos.toLowerCase()) {
        case "l":
          u = -s.width / 2;
          break;
        case "r":
          u = s.width / 2;
          break;
      }
    if (u && (l += r ? u : -u), u = 0, l += (s.dummy ? e : t) / 2, l += (o.dummy ? e : t) / 2, l += o.width / 2, Object.prototype.hasOwnProperty.call(o, "labelpos"))
      switch (o.labelpos.toLowerCase()) {
        case "l":
          u = o.width / 2;
          break;
        case "r":
          u = -o.width / 2;
          break;
      }
    return u && (l += r ? u : -u), u = 0, l;
  };
}
function P1e(t, e) {
  return t.node(e).width;
}
function B1e(t) {
  t = Bz(t), F1e(t), Fpe(I1e(t), function(e, r) {
    t.node(r).x = e;
  });
}
function F1e(t) {
  var e = _x(t), r = t.graph().ranksep, n = 0;
  Ie(e, function(i) {
    var a = pu(
      ft(i, function(s) {
        return t.node(s).height;
      })
    );
    Ie(i, function(s) {
      t.node(s).y = n + a / 2;
    }), n += a + r;
  });
}
function Zz(t, e) {
  var r = Ige;
  r("layout", () => {
    var n = r("  buildLayoutGraph", () => j1e(t));
    r("  runLayout", () => $1e(n, r)), r("  updateInputGraph", () => z1e(t, n));
  });
}
function $1e(t, e) {
  e("    makeSpaceForEdgeLabels", () => K1e(t)), e("    removeSelfEdges", () => ame(t)), e("    acyclic", () => Age(t)), e("    nestingGraph.run", () => t1e(t)), e("    rank", () => Qge(Bz(t))), e("    injectEdgeLabelProxies", () => Z1e(t)), e("    removeEmptyRanks", () => Mge(t)), e("    nestingGraph.cleanup", () => i1e(t)), e("    normalizeRanks", () => Nge(t)), e("    assignRankMinMax", () => Q1e(t)), e("    removeEdgeLabelProxies", () => J1e(t)), e("    normalize.run", () => zge(t)), e("    parentDummyChains", () => w1e(t)), e("    addBorderSegments", () => Oge(t)), e("    order", () => x1e(t)), e("    insertSelfEdges", () => sme(t)), e("    adjustCoordinateSystem", () => Pge(t)), e("    position", () => B1e(t)), e("    positionSelfEdges", () => ome(t)), e("    removeBorderNodes", () => ime(t)), e("    normalize.undo", () => Gge(t)), e("    fixupEdgeLabelCoords", () => rme(t)), e("    undoCoordinateSystem", () => Bge(t)), e("    translateGraph", () => eme(t)), e("    assignNodeIntersects", () => tme(t)), e("    reversePoints", () => nme(t)), e("    acyclic.undo", () => Lge(t));
}
function z1e(t, e) {
  Ie(t.nodes(), function(r) {
    var n = t.node(r), i = e.node(r);
    n && (n.x = i.x, n.y = i.y, e.children(r).length && (n.width = i.width, n.height = i.height));
  }), Ie(t.edges(), function(r) {
    var n = t.edge(r), i = e.edge(r);
    n.points = i.points, Object.prototype.hasOwnProperty.call(i, "x") && (n.x = i.x, n.y = i.y);
  }), t.graph().width = e.graph().width, t.graph().height = e.graph().height;
}
var V1e = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], G1e = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, U1e = ["acyclicer", "ranker", "rankdir", "align"], W1e = ["width", "height"], H1e = { width: 0, height: 0 }, q1e = ["minlen", "weight", "width", "height", "labeloffset"], Y1e = {
  minlen: 1,
  weight: 1,
  width: 0,
  height: 0,
  labeloffset: 10,
  labelpos: "r"
}, X1e = ["labelpos"];
function j1e(t) {
  var e = new va({ multigraph: !0, compound: !0 }), r = S4(t.graph());
  return e.setGraph(
    fy({}, G1e, k4(r, V1e), Ny(r, U1e))
  ), Ie(t.nodes(), function(n) {
    var i = S4(t.node(n));
    e.setNode(n, kx(k4(i, W1e), H1e)), e.setParent(n, t.parent(n));
  }), Ie(t.edges(), function(n) {
    var i = S4(t.edge(n));
    e.setEdge(
      n,
      fy({}, Y1e, k4(i, q1e), Ny(i, X1e))
    );
  }), e;
}
function K1e(t) {
  var e = t.graph();
  e.ranksep /= 2, Ie(t.edges(), function(r) {
    var n = t.edge(r);
    n.minlen *= 2, n.labelpos.toLowerCase() !== "c" && (e.rankdir === "TB" || e.rankdir === "BT" ? n.width += n.labeloffset : n.height += n.labeloffset);
  });
}
function Z1e(t) {
  Ie(t.edges(), function(e) {
    var r = t.edge(e);
    if (r.width && r.height) {
      var n = t.node(e.v), i = t.node(e.w), a = { rank: (i.rank - n.rank) / 2 + n.rank, e };
      Nf(t, "edge-proxy", a, "_ep");
    }
  });
}
function Q1e(t) {
  var e = 0;
  Ie(t.nodes(), function(r) {
    var n = t.node(r);
    n.borderTop && (n.minRank = t.node(n.borderTop).rank, n.maxRank = t.node(n.borderBottom).rank, e = pu(e, n.maxRank));
  }), t.graph().maxRank = e;
}
function J1e(t) {
  Ie(t.nodes(), function(e) {
    var r = t.node(e);
    r.dummy === "edge-proxy" && (t.edge(r.e).labelRank = r.rank, t.removeNode(e));
  });
}
function eme(t) {
  var e = Number.POSITIVE_INFINITY, r = 0, n = Number.POSITIVE_INFINITY, i = 0, a = t.graph(), s = a.marginx || 0, o = a.marginy || 0;
  function l(u) {
    var h = u.x, d = u.y, f = u.width, p = u.height;
    e = Math.min(e, h - f / 2), r = Math.max(r, h + f / 2), n = Math.min(n, d - p / 2), i = Math.max(i, d + p / 2);
  }
  Ie(t.nodes(), function(u) {
    l(t.node(u));
  }), Ie(t.edges(), function(u) {
    var h = t.edge(u);
    Object.prototype.hasOwnProperty.call(h, "x") && l(h);
  }), e -= s, n -= o, Ie(t.nodes(), function(u) {
    var h = t.node(u);
    h.x -= e, h.y -= n;
  }), Ie(t.edges(), function(u) {
    var h = t.edge(u);
    Ie(h.points, function(d) {
      d.x -= e, d.y -= n;
    }), Object.prototype.hasOwnProperty.call(h, "x") && (h.x -= e), Object.prototype.hasOwnProperty.call(h, "y") && (h.y -= n);
  }), a.width = r - e + s, a.height = i - n + o;
}
function tme(t) {
  Ie(t.edges(), function(e) {
    var r = t.edge(e), n = t.node(e.v), i = t.node(e.w), a, s;
    r.points ? (a = r.points[0], s = r.points[r.points.length - 1]) : (r.points = [], a = i, s = n), r.points.unshift(kA(n, a)), r.points.push(kA(i, s));
  });
}
function rme(t) {
  Ie(t.edges(), function(e) {
    var r = t.edge(e);
    if (Object.prototype.hasOwnProperty.call(r, "x"))
      switch ((r.labelpos === "l" || r.labelpos === "r") && (r.width -= r.labeloffset), r.labelpos) {
        case "l":
          r.x -= r.width / 2 + r.labeloffset;
          break;
        case "r":
          r.x += r.width / 2 + r.labeloffset;
          break;
      }
  });
}
function nme(t) {
  Ie(t.edges(), function(e) {
    var r = t.edge(e);
    r.reversed && r.points.reverse();
  });
}
function ime(t) {
  Ie(t.nodes(), function(e) {
    if (t.children(e).length) {
      var r = t.node(e), n = t.node(r.borderTop), i = t.node(r.borderBottom), a = t.node(Qs(r.borderLeft)), s = t.node(Qs(r.borderRight));
      r.width = Math.abs(s.x - a.x), r.height = Math.abs(i.y - n.y), r.x = a.x + r.width / 2, r.y = n.y + r.height / 2;
    }
  }), Ie(t.nodes(), function(e) {
    t.node(e).dummy === "border" && t.removeNode(e);
  });
}
function ame(t) {
  Ie(t.edges(), function(e) {
    if (e.v === e.w) {
      var r = t.node(e.v);
      r.selfEdges || (r.selfEdges = []), r.selfEdges.push({ e, label: t.edge(e) }), t.removeEdge(e);
    }
  });
}
function sme(t) {
  var e = _x(t);
  Ie(e, function(r) {
    var n = 0;
    Ie(r, function(i, a) {
      var s = t.node(i);
      s.order = a + n, Ie(s.selfEdges, function(o) {
        Nf(
          t,
          "selfedge",
          {
            width: o.label.width,
            height: o.label.height,
            rank: s.rank,
            order: a + ++n,
            e: o.e,
            label: o.label
          },
          "_se"
        );
      }), delete s.selfEdges;
    });
  });
}
function ome(t) {
  Ie(t.nodes(), function(e) {
    var r = t.node(e);
    if (r.dummy === "selfedge") {
      var n = t.node(r.e.v), i = n.x + n.width / 2, a = n.y, s = r.x - i, o = n.height / 2;
      t.setEdge(r.e, r.label), t.removeNode(e), r.label.points = [
        { x: i + 2 * s / 3, y: a - o },
        { x: i + 5 * s / 6, y: a - o },
        { x: i + s, y: a },
        { x: i + 5 * s / 6, y: a + o },
        { x: i + 2 * s / 3, y: a + o }
      ], r.label.x = r.x, r.label.y = r.y;
    }
  });
}
function k4(t, e) {
  return Cx(Ny(t, e), Number);
}
function S4(t) {
  var e = {};
  return Ie(t, function(r, n) {
    e[n.toLowerCase()] = r;
  }), e;
}
function Ws(t) {
  var e = {
    options: {
      directed: t.isDirected(),
      multigraph: t.isMultigraph(),
      compound: t.isCompound()
    },
    nodes: lme(t),
    edges: cme(t)
  };
  return Rr(t.graph()) || (e.value = $n(t.graph())), e;
}
function lme(t) {
  return ft(t.nodes(), function(e) {
    var r = t.node(e), n = t.parent(e), i = { v: e };
    return Rr(r) || (i.value = r), Rr(n) || (i.parent = n), i;
  });
}
function cme(t) {
  return ft(t.edges(), function(e) {
    var r = t.edge(e), n = { v: e.v, w: e.w };
    return Rr(e.name) || (n.name = e.name), Rr(r) || (n.value = r), n;
  });
}
var er = /* @__PURE__ */ new Map(), Yc = /* @__PURE__ */ new Map(), Qz = /* @__PURE__ */ new Map(), ume = /* @__PURE__ */ x(() => {
  Yc.clear(), Qz.clear(), er.clear();
}, "clear"), My = /* @__PURE__ */ x((t, e) => {
  const r = Yc.get(e) || [];
  return ae.trace("In isDescendant", e, " ", t, " = ", r.includes(t)), r.includes(t);
}, "isDescendant"), hme = /* @__PURE__ */ x((t, e) => {
  const r = Yc.get(e) || [];
  return ae.info("Descendants of ", e, " is ", r), ae.info("Edge is ", t), t.v === e || t.w === e ? !1 : r ? r.includes(t.v) || My(t.v, e) || My(t.w, e) || r.includes(t.w) : (ae.debug("Tilt, ", e, ",not in descendants"), !1);
}, "edgeInCluster"), Jz = /* @__PURE__ */ x((t, e, r, n) => {
  ae.warn(
    "Copying children of ",
    t,
    "root",
    n,
    "data",
    e.node(t),
    n
  );
  const i = e.children(t) || [];
  t !== n && i.push(t), ae.warn("Copying (nodes) clusterId", t, "nodes", i), i.forEach((a) => {
    if (e.children(a).length > 0)
      Jz(a, e, r, n);
    else {
      const s = e.node(a);
      ae.info("cp ", a, " to ", n, " with parent ", t), r.setNode(a, s), n !== e.parent(a) && (ae.warn("Setting parent", a, e.parent(a)), r.setParent(a, e.parent(a))), t !== n && a !== t ? (ae.debug("Setting parent", a, t), r.setParent(a, t)) : (ae.info("In copy ", t, "root", n, "data", e.node(t), n), ae.debug(
        "Not Setting parent for node=",
        a,
        "cluster!==rootId",
        t !== n,
        "node!==clusterId",
        a !== t
      ));
      const o = e.edges(a);
      ae.debug("Copying Edges", o), o.forEach((l) => {
        ae.info("Edge", l);
        const u = e.edge(l.v, l.w, l.name);
        ae.info("Edge data", u, n);
        try {
          hme(l, n) ? (ae.info("Copying as ", l.v, l.w, u, l.name), r.setEdge(l.v, l.w, u, l.name), ae.info("newGraph edges ", r.edges(), r.edge(r.edges()[0]))) : ae.info(
            "Skipping copy of edge ",
            l.v,
            "-->",
            l.w,
            " rootId: ",
            n,
            " clusterId:",
            t
          );
        } catch (h) {
          ae.error(h);
        }
      });
    }
    ae.debug("Removing node", a), e.removeNode(a);
  });
}, "copy"), eV = /* @__PURE__ */ x((t, e) => {
  const r = e.children(t);
  let n = [...r];
  for (const i of r)
    Qz.set(i, t), n = [...n, ...eV(i, e)];
  return n;
}, "extractDescendants"), dme = /* @__PURE__ */ x((t, e, r) => {
  const n = t.edges().filter((l) => l.v === e || l.w === e), i = t.edges().filter((l) => l.v === r || l.w === r), a = n.map((l) => ({ v: l.v === e ? r : l.v, w: l.w === e ? e : l.w })), s = i.map((l) => ({ v: l.v, w: l.w }));
  return a.filter((l) => s.some((u) => l.v === u.v && l.w === u.w));
}, "findCommonEdges"), ng = /* @__PURE__ */ x((t, e, r) => {
  const n = e.children(t);
  if (ae.trace("Searching children of id ", t, n), n.length < 1)
    return t;
  let i;
  for (const a of n) {
    const s = ng(a, e, r), o = dme(e, r, s);
    if (s)
      if (o.length > 0)
        i = s;
      else
        return s;
  }
  return i;
}, "findNonClusterChild"), DA = /* @__PURE__ */ x((t) => !er.has(t) || !er.get(t).externalConnections ? t : er.has(t) ? er.get(t).id : t, "getAnchorId"), fme = /* @__PURE__ */ x((t, e) => {
  if (!t || e > 10) {
    ae.debug("Opting out, no graph ");
    return;
  } else
    ae.debug("Opting in, graph ");
  t.nodes().forEach(function(r) {
    t.children(r).length > 0 && (ae.warn(
      "Cluster identified",
      r,
      " Replacement id in edges: ",
      ng(r, t, r)
    ), Yc.set(r, eV(r, t)), er.set(r, { id: ng(r, t, r), clusterData: t.node(r) }));
  }), t.nodes().forEach(function(r) {
    const n = t.children(r), i = t.edges();
    n.length > 0 ? (ae.debug("Cluster identified", r, Yc), i.forEach((a) => {
      const s = My(a.v, r), o = My(a.w, r);
      s ^ o && (ae.warn("Edge: ", a, " leaves cluster ", r), ae.warn("Descendants of XXX ", r, ": ", Yc.get(r)), er.get(r).externalConnections = !0);
    })) : ae.debug("Not a cluster ", r, Yc);
  });
  for (let r of er.keys()) {
    const n = er.get(r).id, i = t.parent(n);
    i !== r && er.has(i) && !er.get(i).externalConnections && (er.get(r).id = i);
  }
  t.edges().forEach(function(r) {
    const n = t.edge(r);
    ae.warn("Edge " + r.v + " -> " + r.w + ": " + JSON.stringify(r)), ae.warn("Edge " + r.v + " -> " + r.w + ": " + JSON.stringify(t.edge(r)));
    let i = r.v, a = r.w;
    if (ae.warn(
      "Fix XXX",
      er,
      "ids:",
      r.v,
      r.w,
      "Translating: ",
      er.get(r.v),
      " --- ",
      er.get(r.w)
    ), er.get(r.v) || er.get(r.w)) {
      if (ae.warn("Fixing and trying - removing XXX", r.v, r.w, r.name), i = DA(r.v), a = DA(r.w), t.removeEdge(r.v, r.w, r.name), i !== r.v) {
        const s = t.parent(i);
        er.get(s).externalConnections = !0, n.fromCluster = r.v;
      }
      if (a !== r.w) {
        const s = t.parent(a);
        er.get(s).externalConnections = !0, n.toCluster = r.w;
      }
      ae.warn("Fix Replacing with XXX", i, a, r.name), t.setEdge(i, a, n, r.name);
    }
  }), ae.warn("Adjusted Graph", Ws(t)), tV(t, 0), ae.trace(er);
}, "adjustClustersAndEdges"), tV = /* @__PURE__ */ x((t, e) => {
  var i, a;
  if (ae.warn("extractor - ", e, Ws(t), t.children("D")), e > 10) {
    ae.error("Bailing out");
    return;
  }
  let r = t.nodes(), n = !1;
  for (const s of r) {
    const o = t.children(s);
    n = n || o.length > 0;
  }
  if (!n) {
    ae.debug("Done, no node has children", t.nodes());
    return;
  }
  ae.debug("Nodes = ", r, e);
  for (const s of r)
    if (ae.debug(
      "Extracting node",
      s,
      er,
      er.has(s) && !er.get(s).externalConnections,
      !t.parent(s),
      t.node(s),
      t.children("D"),
      " Depth ",
      e
    ), !er.has(s))
      ae.debug("Not a cluster", s, e);
    else if (!er.get(s).externalConnections && t.children(s) && t.children(s).length > 0) {
      ae.warn(
        "Cluster without external connections, without a parent and with children",
        s,
        e
      );
      let l = t.graph().rankdir === "TB" ? "LR" : "TB";
      (a = (i = er.get(s)) == null ? void 0 : i.clusterData) != null && a.dir && (l = er.get(s).clusterData.dir, ae.warn("Fixing dir", er.get(s).clusterData.dir, l));
      const u = new va({
        multigraph: !0,
        compound: !0
      }).setGraph({
        rankdir: l,
        nodesep: 50,
        ranksep: 50,
        marginx: 8,
        marginy: 8
      }).setDefaultEdgeLabel(function() {
        return {};
      });
      ae.warn("Old graph before copy", Ws(t)), Jz(s, t, u, s), t.setNode(s, {
        clusterNode: !0,
        id: s,
        clusterData: er.get(s).clusterData,
        label: er.get(s).label,
        graph: u
      }), ae.warn("New graph after copy node: (", s, ")", Ws(u)), ae.debug("Old graph after copy", Ws(t));
    } else
      ae.warn(
        "Cluster ** ",
        s,
        " **not meeting the criteria !externalConnections:",
        !er.get(s).externalConnections,
        " no parent: ",
        !t.parent(s),
        " children ",
        t.children(s) && t.children(s).length > 0,
        t.children("D"),
        e
      ), ae.debug(er);
  r = t.nodes(), ae.warn("New list of nodes", r);
  for (const s of r) {
    const o = t.node(s);
    ae.warn(" Now next level", s, o), o != null && o.clusterNode && tV(o.graph, e + 1);
  }
}, "extractor"), rV = /* @__PURE__ */ x((t, e) => {
  if (e.length === 0)
    return [];
  let r = Object.assign([], e);
  return e.forEach((n) => {
    const i = t.children(n), a = rV(t, i);
    r = [...r, ...a];
  }), r;
}, "sorter"), pme = /* @__PURE__ */ x((t) => rV(t, t.children()), "sortNodesByHierarchy"), nV = /* @__PURE__ */ x(async (t, e, r, n, i, a) => {
  ae.warn("Graph in recursive render:XAX", Ws(e), i);
  const s = e.graph().rankdir;
  ae.trace("Dir in recursive render - dir:", s);
  const o = t.insert("g").attr("class", "root");
  e.nodes() ? ae.info("Recursive render XXX", e.nodes()) : ae.info("No nodes found for", e), e.edges().length > 0 && ae.info("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"), d = o.insert("g").attr("class", "nodes");
  await Promise.all(
    e.nodes().map(async function(m) {
      const v = e.node(m);
      if (i !== void 0) {
        const y = JSON.parse(JSON.stringify(i.clusterData));
        ae.trace(
          `Setting data for parent cluster XXX
 Node.id = `,
          m,
          `
 data=`,
          y.height,
          `
Parent cluster`,
          i.height
        ), e.setNode(i.id, y), e.parent(m) || (ae.trace("Setting parent", m, i.id), e.setParent(m, i.id, y));
      }
      if (ae.info("(Insert) Node XXX" + m + ": " + JSON.stringify(e.node(m))), v != null && v.clusterNode) {
        ae.info("Cluster identified XBX", m, v.width, e.node(m));
        const { ranksep: y, nodesep: b } = e.graph();
        v.graph.setGraph({
          ...v.graph.graph(),
          ranksep: y + 25,
          nodesep: b
        });
        const w = await nV(
          d,
          v.graph,
          r,
          n,
          e.node(m),
          a
        ), T = w.elem;
        Mt(v, T), v.diff = w.diff || 0, ae.info(
          "New compound node after recursive render XAX",
          m,
          "width",
          // node,
          v.width,
          "height",
          v.height
          // node.x,
          // node.y
        ), xoe(T, v);
      } else
        e.children(m).length > 0 ? (ae.trace(
          "Cluster - the non recursive path XBX",
          m,
          v.id,
          v,
          v.width,
          "Graph:",
          e
        ), ae.trace(ng(v.id, e)), er.set(v.id, { id: ng(v.id, e), node: v })) : (ae.trace("Node - the non recursive path XAX", m, d, e.node(m), s), await ux(d, e.node(m), { config: a, dir: s }));
    })
  ), await (/* @__PURE__ */ x(async () => {
    const m = e.edges().map(async function(v) {
      const y = e.edge(v.v, v.w, v.name);
      ae.info("Edge " + v.v + " -> " + v.w + ": " + JSON.stringify(v)), ae.info("Edge " + v.v + " -> " + v.w + ": ", v, " ", JSON.stringify(e.edge(v))), ae.info(
        "Fix",
        er,
        "ids:",
        v.v,
        v.w,
        "Translating: ",
        er.get(v.v),
        er.get(v.w)
      ), await lF(h, y);
    });
    await Promise.all(m);
  }, "processEdges"))(), ae.info("Graph before layout:", JSON.stringify(Ws(e))), ae.info("############################################# XXX"), ae.info("###                Layout                 ### XXX"), ae.info("############################################# XXX"), Zz(e), ae.info("Graph after layout:", JSON.stringify(Ws(e)));
  let p = 0, { subGraphTitleTotalMargin: g } = Ig(a);
  return await Promise.all(
    pme(e).map(async function(m) {
      var y;
      const v = e.node(m);
      if (ae.info(
        "Position XBX => " + m + ": (" + v.x,
        "," + v.y,
        ") width: ",
        v.width,
        " height: ",
        v.height
      ), v != null && v.clusterNode)
        v.y += g, ae.info(
          "A tainted cluster node XBX1",
          m,
          v.id,
          v.width,
          v.height,
          v.x,
          v.y,
          e.parent(m)
        ), er.get(v.id).node = v, zw(v);
      else if (e.children(m).length > 0) {
        ae.info(
          "A pure cluster node XBX1",
          m,
          v.id,
          v.x,
          v.y,
          v.width,
          v.height,
          e.parent(m)
        ), v.height += g, e.node(v.parentId);
        const b = (v == null ? void 0 : v.padding) / 2 || 0, w = ((y = v == null ? void 0 : v.labelBBox) == null ? void 0 : y.height) || 0, T = w - b || 0;
        ae.debug("OffsetY", T, "labelHeight", w, "halfPadding", b), await ZE(l, v), er.get(v.id).node = v;
      } else {
        const b = e.node(v.parentId);
        v.y += g / 2, ae.info(
          "A regular node XBX1 - using the padding",
          v.id,
          "parent",
          v.parentId,
          v.width,
          v.height,
          v.x,
          v.y,
          "offsetY",
          v.offsetY,
          "parent",
          b,
          b == null ? void 0 : b.offsetY,
          v
        ), zw(v);
      }
    })
  ), e.edges().forEach(function(m) {
    const v = e.edge(m);
    ae.info("Edge " + m.v + " -> " + m.w + ": " + JSON.stringify(v), v), v.points.forEach((T) => T.y += g / 2);
    const y = e.node(m.v);
    var b = e.node(m.w);
    const w = hF(u, v, er, r, y, b, n);
    cF(v, w);
  }), e.nodes().forEach(function(m) {
    const v = e.node(m);
    ae.info(m, v.type, v.diff), v.isGroup && (p = v.diff);
  }), ae.warn("Returning from recursive render XAX", o, p), { elem: o, diff: p };
}, "recursiveRender"), gme = /* @__PURE__ */ x(async (t, e) => {
  var a, s, o, l, u, h;
  const r = new va({
    multigraph: !0,
    compound: !0
  }).setGraph({
    rankdir: t.direction,
    nodesep: ((a = t.config) == null ? void 0 : a.nodeSpacing) || ((o = (s = t.config) == null ? void 0 : s.flowchart) == null ? void 0 : o.nodeSpacing) || t.nodeSpacing,
    ranksep: ((l = t.config) == null ? void 0 : l.rankSpacing) || ((h = (u = t.config) == null ? void 0 : u.flowchart) == null ? void 0 : h.rankSpacing) || t.rankSpacing,
    marginx: 8,
    marginy: 8
  }).setDefaultEdgeLabel(function() {
    return {};
  }), n = e.select("g");
  pF(n, t.markers, t.type, t.diagramId), boe(), Eoe(), toe(), ume(), t.nodes.forEach((d) => {
    r.setNode(d.id, { ...d }), d.parentId && r.setParent(d.id, d.parentId);
  }), ae.debug("Edges:", t.edges), t.edges.forEach((d) => {
    if (d.start === d.end) {
      const f = d.start, p = f + "---" + f + "---1", g = f + "---" + f + "---2", m = r.node(f);
      r.setNode(p, {
        domId: p,
        id: p,
        parentId: m.parentId,
        labelStyle: "",
        label: "",
        padding: 0,
        shape: "labelRect",
        // shape: 'rect',
        style: "",
        width: 10,
        height: 10
      }), r.setParent(p, m.parentId), r.setNode(g, {
        domId: g,
        id: g,
        parentId: m.parentId,
        labelStyle: "",
        padding: 0,
        // shape: 'rect',
        shape: "labelRect",
        label: "",
        style: "",
        width: 10,
        height: 10
      }), r.setParent(g, m.parentId);
      const v = structuredClone(d), y = structuredClone(d), b = structuredClone(d);
      v.label = "", v.arrowTypeEnd = "none", v.id = f + "-cyclic-special-1", y.arrowTypeStart = "none", y.arrowTypeEnd = "none", y.id = f + "-cyclic-special-mid", b.label = "", m.isGroup && (v.fromCluster = f, b.toCluster = f), b.id = f + "-cyclic-special-2", b.arrowTypeStart = "none", r.setEdge(f, p, v, f + "-cyclic-special-0"), r.setEdge(p, g, y, f + "-cyclic-special-1"), r.setEdge(g, f, b, f + "-cyc<lic-special-2");
    } else
      r.setEdge(d.start, d.end, { ...d }, d.id);
  }), ae.warn("Graph at first:", JSON.stringify(Ws(r))), fme(r), ae.warn("Graph after XAX:", JSON.stringify(Ws(r)));
  const i = we();
  await nV(
    n,
    r,
    t.type,
    t.diagramId,
    void 0,
    i
  );
}, "render");
const mme = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  render: gme
}, Symbol.toStringTag, { value: "Module" }));
function sT(t, e) {
  (e == null || e > t.length) && (e = t.length);
  for (var r = 0, n = Array(e); r < e; r++) n[r] = t[r];
  return n;
}
function vme(t) {
  if (Array.isArray(t)) return t;
}
function yme(t) {
  if (Array.isArray(t)) return sT(t);
}
function sc(t, e) {
  if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function");
}
function xme(t, e) {
  for (var r = 0; r < e.length; r++) {
    var n = e[r];
    n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, aV(n.key), n);
  }
}
function oc(t, e, r) {
  return e && xme(t.prototype, e), Object.defineProperty(t, "prototype", {
    writable: !1
  }), t;
}
function ca(t, e) {
  var r = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
  if (!r) {
    if (Array.isArray(t) || (r = Gk(t)) || e) {
      r && (t = r);
      var n = 0, i = function() {
      };
      return {
        s: i,
        n: function() {
          return n >= t.length ? {
            done: !0
          } : {
            done: !1,
            value: t[n++]
          };
        },
        e: function(l) {
          throw l;
        },
        f: i
      };
    }
    throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
  }
  var a, s = !0, o = !1;
  return {
    s: function() {
      r = r.call(t);
    },
    n: function() {
      var l = r.next();
      return s = l.done, l;
    },
    e: function(l) {
      o = !0, a = l;
    },
    f: function() {
      try {
        s || r.return == null || r.return();
      } finally {
        if (o) throw a;
      }
    }
  };
}
function iV(t, e, r) {
  return (e = aV(e)) in t ? Object.defineProperty(t, e, {
    value: r,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : t[e] = r, t;
}
function bme(t) {
  if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
}
function wme(t, e) {
  var r = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
  if (r != null) {
    var n, i, a, s, o = [], l = !0, u = !1;
    try {
      if (a = (r = r.call(t)).next, e === 0) {
        if (Object(r) !== r) return;
        l = !1;
      } else for (; !(l = (n = a.call(r)).done) && (o.push(n.value), o.length !== e); l = !0) ;
    } catch (h) {
      u = !0, i = h;
    } finally {
      try {
        if (!l && r.return != null && (s = r.return(), Object(s) !== s)) return;
      } finally {
        if (u) throw i;
      }
    }
    return o;
  }
}
function Tme() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Eme() {
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Tn(t, e) {
  return vme(t) || wme(t, e) || Gk(t, e) || Tme();
}
function Dy(t) {
  return yme(t) || bme(t) || Gk(t) || Eme();
}
function kme(t, e) {
  if (typeof t != "object" || !t) return t;
  var r = t[Symbol.toPrimitive];
  if (r !== void 0) {
    var n = r.call(t, e);
    if (typeof n != "object") return n;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return String(t);
}
function aV(t) {
  var e = kme(t, "string");
  return typeof e == "symbol" ? e : e + "";
}
function zn(t) {
  "@babel/helpers - typeof";
  return zn = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
    return typeof e;
  } : function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, zn(t);
}
function Gk(t, e) {
  if (t) {
    if (typeof t == "string") return sT(t, e);
    var r = {}.toString.call(t).slice(8, -1);
    return r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set" ? Array.from(t) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? sT(t, e) : void 0;
  }
}
var Dn = typeof window > "u" ? null : window, IA = Dn ? Dn.navigator : null;
Dn && Dn.document;
var Sme = zn(""), sV = zn({}), Cme = zn(function() {
}), Ame = typeof HTMLElement > "u" ? "undefined" : zn(HTMLElement), Kg = function(e) {
  return e && e.instanceString && nn(e.instanceString) ? e.instanceString() : null;
}, Bt = function(e) {
  return e != null && zn(e) == Sme;
}, nn = function(e) {
  return e != null && zn(e) === Cme;
}, Br = function(e) {
  return !La(e) && (Array.isArray ? Array.isArray(e) : e != null && e instanceof Array);
}, vr = function(e) {
  return e != null && zn(e) === sV && !Br(e) && e.constructor === Object;
}, _me = function(e) {
  return e != null && zn(e) === sV;
}, vt = function(e) {
  return e != null && zn(e) === zn(1) && !isNaN(e);
}, Lme = function(e) {
  return vt(e) && Math.floor(e) === e;
}, Iy = function(e) {
  if (Ame !== "undefined")
    return e != null && e instanceof HTMLElement;
}, La = function(e) {
  return Zg(e) || oV(e);
}, Zg = function(e) {
  return Kg(e) === "collection" && e._private.single;
}, oV = function(e) {
  return Kg(e) === "collection" && !e._private.single;
}, Uk = function(e) {
  return Kg(e) === "core";
}, lV = function(e) {
  return Kg(e) === "stylesheet";
}, Rme = function(e) {
  return Kg(e) === "event";
}, Gl = function(e) {
  return e == null ? !0 : !!(e === "" || e.match(/^\s+$/));
}, Nme = function(e) {
  return typeof HTMLElement > "u" ? !1 : e instanceof HTMLElement;
}, Mme = function(e) {
  return vr(e) && vt(e.x1) && vt(e.x2) && vt(e.y1) && vt(e.y2);
}, Dme = function(e) {
  return _me(e) && nn(e.then);
}, Ime = function() {
  return IA && IA.userAgent.match(/msie|trident|edge/i);
}, of = function(e, r) {
  r || (r = function() {
    if (arguments.length === 1)
      return arguments[0];
    if (arguments.length === 0)
      return "undefined";
    for (var a = [], s = 0; s < arguments.length; s++)
      a.push(arguments[s]);
    return a.join("$");
  });
  var n = function() {
    var a = this, s = arguments, o, l = r.apply(a, s), u = n.cache;
    return (o = u[l]) || (o = u[l] = e.apply(a, s)), o;
  };
  return n.cache = {}, n;
}, Wk = of(function(t) {
  return t.replace(/([A-Z])/g, function(e) {
    return "-" + e.toLowerCase();
  });
}), Lx = of(function(t) {
  return t.replace(/(-\w)/g, function(e) {
    return e[1].toUpperCase();
  });
}), cV = of(function(t, e) {
  return t + e[0].toUpperCase() + e.substring(1);
}, function(t, e) {
  return t + "$" + e;
}), OA = function(e) {
  return Gl(e) ? e : e.charAt(0).toUpperCase() + e.substring(1);
}, El = function(e, r) {
  return e.slice(-1 * r.length) === r;
}, Bn = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))", Ome = "rgb[a]?\\((" + Bn + "[%]?)\\s*,\\s*(" + Bn + "[%]?)\\s*,\\s*(" + Bn + "[%]?)(?:\\s*,\\s*(" + Bn + "))?\\)", Pme = "rgb[a]?\\((?:" + Bn + "[%]?)\\s*,\\s*(?:" + Bn + "[%]?)\\s*,\\s*(?:" + Bn + "[%]?)(?:\\s*,\\s*(?:" + Bn + "))?\\)", Bme = "hsl[a]?\\((" + Bn + ")\\s*,\\s*(" + Bn + "[%])\\s*,\\s*(" + Bn + "[%])(?:\\s*,\\s*(" + Bn + "))?\\)", Fme = "hsl[a]?\\((?:" + Bn + ")\\s*,\\s*(?:" + Bn + "[%])\\s*,\\s*(?:" + Bn + "[%])(?:\\s*,\\s*(?:" + Bn + "))?\\)", $me = "\\#[0-9a-fA-F]{3}", zme = "\\#[0-9a-fA-F]{6}", uV = function(e, r) {
  return e < r ? -1 : e > r ? 1 : 0;
}, Vme = function(e, r) {
  return -1 * uV(e, r);
}, Gt = Object.assign != null ? Object.assign.bind(Object) : function(t) {
  for (var e = arguments, r = 1; r < e.length; r++) {
    var n = e[r];
    if (n != null)
      for (var i = Object.keys(n), a = 0; a < i.length; a++) {
        var s = i[a];
        t[s] = n[s];
      }
  }
  return t;
}, Gme = function(e) {
  if (!(!(e.length === 4 || e.length === 7) || e[0] !== "#")) {
    var r = e.length === 4, n, i, a, s = 16;
    return r ? (n = parseInt(e[1] + e[1], s), i = parseInt(e[2] + e[2], s), a = parseInt(e[3] + e[3], s)) : (n = parseInt(e[1] + e[2], s), i = parseInt(e[3] + e[4], s), a = parseInt(e[5] + e[6], s)), [n, i, a];
  }
}, Ume = function(e) {
  var r, n, i, a, s, o, l, u;
  function h(g, m, v) {
    return v < 0 && (v += 1), v > 1 && (v -= 1), v < 1 / 6 ? g + (m - g) * 6 * v : v < 1 / 2 ? m : v < 2 / 3 ? g + (m - g) * (2 / 3 - v) * 6 : g;
  }
  var d = new RegExp("^" + Bme + "$").exec(e);
  if (d) {
    if (n = parseInt(d[1]), n < 0 ? n = (360 - -1 * n % 360) % 360 : n > 360 && (n = n % 360), n /= 360, i = parseFloat(d[2]), i < 0 || i > 100 || (i = i / 100, a = parseFloat(d[3]), a < 0 || a > 100) || (a = a / 100, s = d[4], s !== void 0 && (s = parseFloat(s), s < 0 || s > 1)))
      return;
    if (i === 0)
      o = l = u = Math.round(a * 255);
    else {
      var f = a < 0.5 ? a * (1 + i) : a + i - a * i, p = 2 * a - f;
      o = Math.round(255 * h(p, f, n + 1 / 3)), l = Math.round(255 * h(p, f, n)), u = Math.round(255 * h(p, f, n - 1 / 3));
    }
    r = [o, l, u, s];
  }
  return r;
}, Wme = function(e) {
  var r, n = new RegExp("^" + Ome + "$").exec(e);
  if (n) {
    r = [];
    for (var i = [], a = 1; a <= 3; a++) {
      var s = n[a];
      if (s[s.length - 1] === "%" && (i[a] = !0), s = parseFloat(s), i[a] && (s = s / 100 * 255), s < 0 || s > 255)
        return;
      r.push(Math.floor(s));
    }
    var o = i[1] || i[2] || i[3], l = i[1] && i[2] && i[3];
    if (o && !l)
      return;
    var u = n[4];
    if (u !== void 0) {
      if (u = parseFloat(u), u < 0 || u > 1)
        return;
      r.push(u);
    }
  }
  return r;
}, Hme = function(e) {
  return qme[e.toLowerCase()];
}, hV = function(e) {
  return (Br(e) ? e : null) || Hme(e) || Gme(e) || Wme(e) || Ume(e);
}, qme = {
  // special colour names
  transparent: [0, 0, 0, 0],
  // NB alpha === 0
  // regular colours
  aliceblue: [240, 248, 255],
  antiquewhite: [250, 235, 215],
  aqua: [0, 255, 255],
  aquamarine: [127, 255, 212],
  azure: [240, 255, 255],
  beige: [245, 245, 220],
  bisque: [255, 228, 196],
  black: [0, 0, 0],
  blanchedalmond: [255, 235, 205],
  blue: [0, 0, 255],
  blueviolet: [138, 43, 226],
  brown: [165, 42, 42],
  burlywood: [222, 184, 135],
  cadetblue: [95, 158, 160],
  chartreuse: [127, 255, 0],
  chocolate: [210, 105, 30],
  coral: [255, 127, 80],
  cornflowerblue: [100, 149, 237],
  cornsilk: [255, 248, 220],
  crimson: [220, 20, 60],
  cyan: [0, 255, 255],
  darkblue: [0, 0, 139],
  darkcyan: [0, 139, 139],
  darkgoldenrod: [184, 134, 11],
  darkgray: [169, 169, 169],
  darkgreen: [0, 100, 0],
  darkgrey: [169, 169, 169],
  darkkhaki: [189, 183, 107],
  darkmagenta: [139, 0, 139],
  darkolivegreen: [85, 107, 47],
  darkorange: [255, 140, 0],
  darkorchid: [153, 50, 204],
  darkred: [139, 0, 0],
  darksalmon: [233, 150, 122],
  darkseagreen: [143, 188, 143],
  darkslateblue: [72, 61, 139],
  darkslategray: [47, 79, 79],
  darkslategrey: [47, 79, 79],
  darkturquoise: [0, 206, 209],
  darkviolet: [148, 0, 211],
  deeppink: [255, 20, 147],
  deepskyblue: [0, 191, 255],
  dimgray: [105, 105, 105],
  dimgrey: [105, 105, 105],
  dodgerblue: [30, 144, 255],
  firebrick: [178, 34, 34],
  floralwhite: [255, 250, 240],
  forestgreen: [34, 139, 34],
  fuchsia: [255, 0, 255],
  gainsboro: [220, 220, 220],
  ghostwhite: [248, 248, 255],
  gold: [255, 215, 0],
  goldenrod: [218, 165, 32],
  gray: [128, 128, 128],
  grey: [128, 128, 128],
  green: [0, 128, 0],
  greenyellow: [173, 255, 47],
  honeydew: [240, 255, 240],
  hotpink: [255, 105, 180],
  indianred: [205, 92, 92],
  indigo: [75, 0, 130],
  ivory: [255, 255, 240],
  khaki: [240, 230, 140],
  lavender: [230, 230, 250],
  lavenderblush: [255, 240, 245],
  lawngreen: [124, 252, 0],
  lemonchiffon: [255, 250, 205],
  lightblue: [173, 216, 230],
  lightcoral: [240, 128, 128],
  lightcyan: [224, 255, 255],
  lightgoldenrodyellow: [250, 250, 210],
  lightgray: [211, 211, 211],
  lightgreen: [144, 238, 144],
  lightgrey: [211, 211, 211],
  lightpink: [255, 182, 193],
  lightsalmon: [255, 160, 122],
  lightseagreen: [32, 178, 170],
  lightskyblue: [135, 206, 250],
  lightslategray: [119, 136, 153],
  lightslategrey: [119, 136, 153],
  lightsteelblue: [176, 196, 222],
  lightyellow: [255, 255, 224],
  lime: [0, 255, 0],
  limegreen: [50, 205, 50],
  linen: [250, 240, 230],
  magenta: [255, 0, 255],
  maroon: [128, 0, 0],
  mediumaquamarine: [102, 205, 170],
  mediumblue: [0, 0, 205],
  mediumorchid: [186, 85, 211],
  mediumpurple: [147, 112, 219],
  mediumseagreen: [60, 179, 113],
  mediumslateblue: [123, 104, 238],
  mediumspringgreen: [0, 250, 154],
  mediumturquoise: [72, 209, 204],
  mediumvioletred: [199, 21, 133],
  midnightblue: [25, 25, 112],
  mintcream: [245, 255, 250],
  mistyrose: [255, 228, 225],
  moccasin: [255, 228, 181],
  navajowhite: [255, 222, 173],
  navy: [0, 0, 128],
  oldlace: [253, 245, 230],
  olive: [128, 128, 0],
  olivedrab: [107, 142, 35],
  orange: [255, 165, 0],
  orangered: [255, 69, 0],
  orchid: [218, 112, 214],
  palegoldenrod: [238, 232, 170],
  palegreen: [152, 251, 152],
  paleturquoise: [175, 238, 238],
  palevioletred: [219, 112, 147],
  papayawhip: [255, 239, 213],
  peachpuff: [255, 218, 185],
  peru: [205, 133, 63],
  pink: [255, 192, 203],
  plum: [221, 160, 221],
  powderblue: [176, 224, 230],
  purple: [128, 0, 128],
  red: [255, 0, 0],
  rosybrown: [188, 143, 143],
  royalblue: [65, 105, 225],
  saddlebrown: [139, 69, 19],
  salmon: [250, 128, 114],
  sandybrown: [244, 164, 96],
  seagreen: [46, 139, 87],
  seashell: [255, 245, 238],
  sienna: [160, 82, 45],
  silver: [192, 192, 192],
  skyblue: [135, 206, 235],
  slateblue: [106, 90, 205],
  slategray: [112, 128, 144],
  slategrey: [112, 128, 144],
  snow: [255, 250, 250],
  springgreen: [0, 255, 127],
  steelblue: [70, 130, 180],
  tan: [210, 180, 140],
  teal: [0, 128, 128],
  thistle: [216, 191, 216],
  tomato: [255, 99, 71],
  turquoise: [64, 224, 208],
  violet: [238, 130, 238],
  wheat: [245, 222, 179],
  white: [255, 255, 255],
  whitesmoke: [245, 245, 245],
  yellow: [255, 255, 0],
  yellowgreen: [154, 205, 50]
}, dV = function(e) {
  for (var r = e.map, n = e.keys, i = n.length, a = 0; a < i; a++) {
    var s = n[a];
    if (vr(s))
      throw Error("Tried to set map with object key");
    a < n.length - 1 ? (r[s] == null && (r[s] = {}), r = r[s]) : r[s] = e.value;
  }
}, fV = function(e) {
  for (var r = e.map, n = e.keys, i = n.length, a = 0; a < i; a++) {
    var s = n[a];
    if (vr(s))
      throw Error("Tried to get map with object key");
    if (r = r[s], r == null)
      return r;
  }
  return r;
}, j1 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Qg(t) {
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var C4, PA;
function Jg() {
  if (PA) return C4;
  PA = 1;
  function t(e) {
    var r = typeof e;
    return e != null && (r == "object" || r == "function");
  }
  return C4 = t, C4;
}
var A4, BA;
function Yme() {
  if (BA) return A4;
  BA = 1;
  var t = typeof j1 == "object" && j1 && j1.Object === Object && j1;
  return A4 = t, A4;
}
var _4, FA;
function Rx() {
  if (FA) return _4;
  FA = 1;
  var t = Yme(), e = typeof self == "object" && self && self.Object === Object && self, r = t || e || Function("return this")();
  return _4 = r, _4;
}
var L4, $A;
function Xme() {
  if ($A) return L4;
  $A = 1;
  var t = Rx(), e = function() {
    return t.Date.now();
  };
  return L4 = e, L4;
}
var R4, zA;
function jme() {
  if (zA) return R4;
  zA = 1;
  var t = /\s/;
  function e(r) {
    for (var n = r.length; n-- && t.test(r.charAt(n)); )
      ;
    return n;
  }
  return R4 = e, R4;
}
var N4, VA;
function Kme() {
  if (VA) return N4;
  VA = 1;
  var t = jme(), e = /^\s+/;
  function r(n) {
    return n && n.slice(0, t(n) + 1).replace(e, "");
  }
  return N4 = r, N4;
}
var M4, GA;
function Hk() {
  if (GA) return M4;
  GA = 1;
  var t = Rx(), e = t.Symbol;
  return M4 = e, M4;
}
var D4, UA;
function Zme() {
  if (UA) return D4;
  UA = 1;
  var t = Hk(), e = Object.prototype, r = e.hasOwnProperty, n = e.toString, i = t ? t.toStringTag : void 0;
  function a(s) {
    var o = r.call(s, i), l = s[i];
    try {
      s[i] = void 0;
      var u = !0;
    } catch {
    }
    var h = n.call(s);
    return u && (o ? s[i] = l : delete s[i]), h;
  }
  return D4 = a, D4;
}
var I4, WA;
function Qme() {
  if (WA) return I4;
  WA = 1;
  var t = Object.prototype, e = t.toString;
  function r(n) {
    return e.call(n);
  }
  return I4 = r, I4;
}
var O4, HA;
function pV() {
  if (HA) return O4;
  HA = 1;
  var t = Hk(), e = Zme(), r = Qme(), n = "[object Null]", i = "[object Undefined]", a = t ? t.toStringTag : void 0;
  function s(o) {
    return o == null ? o === void 0 ? i : n : a && a in Object(o) ? e(o) : r(o);
  }
  return O4 = s, O4;
}
var P4, qA;
function Jme() {
  if (qA) return P4;
  qA = 1;
  function t(e) {
    return e != null && typeof e == "object";
  }
  return P4 = t, P4;
}
var B4, YA;
function e1() {
  if (YA) return B4;
  YA = 1;
  var t = pV(), e = Jme(), r = "[object Symbol]";
  function n(i) {
    return typeof i == "symbol" || e(i) && t(i) == r;
  }
  return B4 = n, B4;
}
var F4, XA;
function eve() {
  if (XA) return F4;
  XA = 1;
  var t = Kme(), e = Jg(), r = e1(), n = NaN, i = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, s = /^0o[0-7]+$/i, o = parseInt;
  function l(u) {
    if (typeof u == "number")
      return u;
    if (r(u))
      return n;
    if (e(u)) {
      var h = typeof u.valueOf == "function" ? u.valueOf() : u;
      u = e(h) ? h + "" : h;
    }
    if (typeof u != "string")
      return u === 0 ? u : +u;
    u = t(u);
    var d = a.test(u);
    return d || s.test(u) ? o(u.slice(2), d ? 2 : 8) : i.test(u) ? n : +u;
  }
  return F4 = l, F4;
}
var $4, jA;
function tve() {
  if (jA) return $4;
  jA = 1;
  var t = Jg(), e = Xme(), r = eve(), n = "Expected a function", i = Math.max, a = Math.min;
  function s(o, l, u) {
    var h, d, f, p, g, m, v = 0, y = !1, b = !1, w = !0;
    if (typeof o != "function")
      throw new TypeError(n);
    l = r(l) || 0, t(u) && (y = !!u.leading, b = "maxWait" in u, f = b ? i(r(u.maxWait) || 0, l) : f, w = "trailing" in u ? !!u.trailing : w);
    function T(P) {
      var S = h, R = d;
      return h = d = void 0, v = P, p = o.apply(R, S), p;
    }
    function E(P) {
      return v = P, g = setTimeout(_, l), y ? T(P) : p;
    }
    function C(P) {
      var S = P - m, R = P - v, I = l - S;
      return b ? a(I, f - R) : I;
    }
    function k(P) {
      var S = P - m, R = P - v;
      return m === void 0 || S >= l || S < 0 || b && R >= f;
    }
    function _() {
      var P = e();
      if (k(P))
        return L(P);
      g = setTimeout(_, C(P));
    }
    function L(P) {
      return g = void 0, w && h ? T(P) : (h = d = void 0, p);
    }
    function N() {
      g !== void 0 && clearTimeout(g), v = 0, h = m = d = g = void 0;
    }
    function A() {
      return g === void 0 ? p : L(e());
    }
    function O() {
      var P = e(), S = k(P);
      if (h = arguments, d = this, m = P, S) {
        if (g === void 0)
          return E(m);
        if (b)
          return clearTimeout(g), g = setTimeout(_, l), T(m);
      }
      return g === void 0 && (g = setTimeout(_, l)), p;
    }
    return O.cancel = N, O.flush = A, O;
  }
  return $4 = s, $4;
}
var rve = tve(), t1 = /* @__PURE__ */ Qg(rve), z4 = Dn ? Dn.performance : null, gV = z4 && z4.now ? function() {
  return z4.now();
} : function() {
  return Date.now();
}, nve = function() {
  if (Dn) {
    if (Dn.requestAnimationFrame)
      return function(t) {
        Dn.requestAnimationFrame(t);
      };
    if (Dn.mozRequestAnimationFrame)
      return function(t) {
        Dn.mozRequestAnimationFrame(t);
      };
    if (Dn.webkitRequestAnimationFrame)
      return function(t) {
        Dn.webkitRequestAnimationFrame(t);
      };
    if (Dn.msRequestAnimationFrame)
      return function(t) {
        Dn.msRequestAnimationFrame(t);
      };
  }
  return function(t) {
    t && setTimeout(function() {
      t(gV());
    }, 1e3 / 60);
  };
}(), Oy = function(e) {
  return nve(e);
}, Qo = gV, Bc = 9261, mV = 65599, fh = 5381, vV = function(e) {
  for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Bc, n = r, i; i = e.next(), !i.done; )
    n = n * mV + i.value | 0;
  return n;
}, ig = function(e) {
  var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Bc;
  return r * mV + e | 0;
}, ag = function(e) {
  var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : fh;
  return (r << 5) + r + e | 0;
}, ive = function(e, r) {
  return e * 2097152 + r;
}, dl = function(e) {
  return e[0] * 2097152 + e[1];
}, K1 = function(e, r) {
  return [ig(e[0], r[0]), ag(e[1], r[1])];
}, KA = function(e, r) {
  var n = {
    value: 0,
    done: !1
  }, i = 0, a = e.length, s = {
    next: function() {
      return i < a ? n.value = e[i++] : n.done = !0, n;
    }
  };
  return vV(s, r);
}, gu = function(e, r) {
  var n = {
    value: 0,
    done: !1
  }, i = 0, a = e.length, s = {
    next: function() {
      return i < a ? n.value = e.charCodeAt(i++) : n.done = !0, n;
    }
  };
  return vV(s, r);
}, yV = function() {
  return ave(arguments);
}, ave = function(e) {
  for (var r, n = 0; n < e.length; n++) {
    var i = e[n];
    n === 0 ? r = gu(i) : r = gu(i, r);
  }
  return r;
};
function sve(t, e, r, n, i) {
  var a = i * Math.PI / 180, s = Math.cos(a) * (t - r) - Math.sin(a) * (e - n) + r, o = Math.sin(a) * (t - r) + Math.cos(a) * (e - n) + n;
  return {
    x: s,
    y: o
  };
}
var ove = function(e, r, n, i, a, s) {
  return {
    x: (e - n) * a + n,
    y: (r - i) * s + i
  };
};
function lve(t, e, r) {
  if (r === 0) return t;
  var n = (e.x1 + e.x2) / 2, i = (e.y1 + e.y2) / 2, a = e.w / e.h, s = 1 / a, o = sve(t.x, t.y, n, i, r), l = ove(o.x, o.y, n, i, a, s);
  return {
    x: l.x,
    y: l.y
  };
}
var ZA = !0, cve = console.warn != null, uve = console.trace != null, qk = Number.MAX_SAFE_INTEGER || 9007199254740991, xV = function() {
  return !0;
}, Py = function() {
  return !1;
}, QA = function() {
  return 0;
}, Yk = function() {
}, Kr = function(e) {
  throw new Error(e);
}, bV = function(e) {
  if (e !== void 0)
    ZA = !!e;
  else
    return ZA;
}, Nr = function(e) {
  bV() && (cve ? console.warn(e) : (console.log(e), uve && console.trace()));
}, hve = function(e) {
  return Gt({}, e);
}, Hs = function(e) {
  return e == null ? e : Br(e) ? e.slice() : vr(e) ? hve(e) : e;
}, dve = function(e) {
  return e.slice();
}, wV = function(e, r) {
  for (
    // loop :)
    r = e = "";
    // b - result , a - numeric letiable
    e++ < 36;
    //
    r += e * 51 & 52 ? (
      //  return a random number or 4
      (e ^ 15 ? (
        // generate a random number from 0 to 15
        8 ^ Math.random() * (e ^ 20 ? 16 : 4)
      ) : 4).toString(16)
    ) : "-"
  ) ;
  return r;
}, fve = {}, TV = function() {
  return fve;
}, di = function(e) {
  var r = Object.keys(e);
  return function(n) {
    for (var i = {}, a = 0; a < r.length; a++) {
      var s = r[a], o = n == null ? void 0 : n[s];
      i[s] = o === void 0 ? e[s] : o;
    }
    return i;
  };
}, Ul = function(e, r, n) {
  for (var i = e.length - 1; i >= 0; i--)
    e[i] === r && e.splice(i, 1);
}, Xk = function(e) {
  e.splice(0, e.length);
}, pve = function(e, r) {
  for (var n = 0; n < r.length; n++) {
    var i = r[n];
    e.push(i);
  }
}, aa = function(e, r, n) {
  return n && (r = cV(n, r)), e[r];
}, Ao = function(e, r, n, i) {
  n && (r = cV(n, r)), e[r] = i;
}, gve = /* @__PURE__ */ function() {
  function t() {
    sc(this, t), this._obj = {};
  }
  return oc(t, [{
    key: "set",
    value: function(r, n) {
      return this._obj[r] = n, this;
    }
  }, {
    key: "delete",
    value: function(r) {
      return this._obj[r] = void 0, this;
    }
  }, {
    key: "clear",
    value: function() {
      this._obj = {};
    }
  }, {
    key: "has",
    value: function(r) {
      return this._obj[r] !== void 0;
    }
  }, {
    key: "get",
    value: function(r) {
      return this._obj[r];
    }
  }]);
}(), Io = typeof Map < "u" ? Map : gve, mve = "undefined", vve = /* @__PURE__ */ function() {
  function t(e) {
    if (sc(this, t), this._obj = /* @__PURE__ */ Object.create(null), this.size = 0, e != null) {
      var r;
      e.instanceString != null && e.instanceString() === this.instanceString() ? r = e.toArray() : r = e;
      for (var n = 0; n < r.length; n++)
        this.add(r[n]);
    }
  }
  return oc(t, [{
    key: "instanceString",
    value: function() {
      return "set";
    }
  }, {
    key: "add",
    value: function(r) {
      var n = this._obj;
      n[r] !== 1 && (n[r] = 1, this.size++);
    }
  }, {
    key: "delete",
    value: function(r) {
      var n = this._obj;
      n[r] === 1 && (n[r] = 0, this.size--);
    }
  }, {
    key: "clear",
    value: function() {
      this._obj = /* @__PURE__ */ Object.create(null);
    }
  }, {
    key: "has",
    value: function(r) {
      return this._obj[r] === 1;
    }
  }, {
    key: "toArray",
    value: function() {
      var r = this;
      return Object.keys(this._obj).filter(function(n) {
        return r.has(n);
      });
    }
  }, {
    key: "forEach",
    value: function(r, n) {
      return this.toArray().forEach(r, n);
    }
  }]);
}(), Mf = (typeof Set > "u" ? "undefined" : zn(Set)) !== mve ? Set : vve, Nx = function(e, r) {
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0;
  if (e === void 0 || r === void 0 || !Uk(e)) {
    Kr("An element must have a core reference and parameters set");
    return;
  }
  var i = r.group;
  if (i == null && (r.data && r.data.source != null && r.data.target != null ? i = "edges" : i = "nodes"), i !== "nodes" && i !== "edges") {
    Kr("An element must be of type `nodes` or `edges`; you specified `" + i + "`");
    return;
  }
  this.length = 1, this[0] = this;
  var a = this._private = {
    cy: e,
    single: !0,
    // indicates this is an element
    data: r.data || {},
    // data object
    position: r.position || {
      x: 0,
      y: 0
    },
    // (x, y) position pair
    autoWidth: void 0,
    // width and height of nodes calculated by the renderer when set to special 'auto' value
    autoHeight: void 0,
    autoPadding: void 0,
    compoundBoundsClean: !1,
    // whether the compound dimensions need to be recalculated the next time dimensions are read
    listeners: [],
    // array of bound listeners
    group: i,
    // string; 'nodes' or 'edges'
    style: {},
    // properties as set by the style
    rstyle: {},
    // properties for style sent from the renderer to the core
    styleCxts: [],
    // applied style contexts from the styler
    styleKeys: {},
    // per-group keys of style property values
    removed: !0,
    // whether it's inside the vis; true if removed (set true here since we call restore)
    selected: !!r.selected,
    // whether it's selected
    selectable: r.selectable === void 0 ? !0 : !!r.selectable,
    // whether it's selectable
    locked: !!r.locked,
    // whether the element is locked (cannot be moved)
    grabbed: !1,
    // whether the element is grabbed by the mouse; renderer sets this privately
    grabbable: r.grabbable === void 0 ? !0 : !!r.grabbable,
    // whether the element can be grabbed
    pannable: r.pannable === void 0 ? i === "edges" : !!r.pannable,
    // whether the element has passthrough panning enabled
    active: !1,
    // whether the element is active from user interaction
    classes: new Mf(),
    // map ( className => true )
    animation: {
      // object for currently-running animations
      current: [],
      queue: []
    },
    rscratch: {},
    // object in which the renderer can store information
    scratch: r.scratch || {},
    // scratch objects
    edges: [],
    // array of connected edges
    children: [],
    // array of children
    parent: r.parent && r.parent.isNode() ? r.parent : null,
    // parent ref
    traversalCache: {},
    // cache of output of traversal functions
    backgrounding: !1,
    // whether background images are loading
    bbCache: null,
    // cache of the current bounding box
    bbCacheShift: {
      x: 0,
      y: 0
    },
    // shift applied to cached bb to be applied on next get
    bodyBounds: null,
    // bounds cache of element body, w/o overlay
    overlayBounds: null,
    // bounds cache of element body, including overlay
    labelBounds: {
      // bounds cache of labels
      all: null,
      source: null,
      target: null,
      main: null
    },
    arrowBounds: {
      // bounds cache of edge arrows
      source: null,
      target: null,
      "mid-source": null,
      "mid-target": null
    }
  };
  if (a.position.x == null && (a.position.x = 0), a.position.y == null && (a.position.y = 0), r.renderedPosition) {
    var s = r.renderedPosition, o = e.pan(), l = e.zoom();
    a.position = {
      x: (s.x - o.x) / l,
      y: (s.y - o.y) / l
    };
  }
  var u = [];
  Br(r.classes) ? u = r.classes : Bt(r.classes) && (u = r.classes.split(/\s+/));
  for (var h = 0, d = u.length; h < d; h++) {
    var f = u[h];
    !f || f === "" || a.classes.add(f);
  }
  this.createEmitter(), (n === void 0 || n) && this.restore();
  var p = r.style || r.css;
  p && (Nr("Setting a `style` bypass at element creation should be done only when absolutely necessary.  Try to use the stylesheet instead."), this.style(p));
}, JA = function(e) {
  return e = {
    bfs: e.bfs || !e.dfs,
    dfs: e.dfs || !e.bfs
  }, function(n, i, a) {
    var s;
    vr(n) && !La(n) && (s = n, n = s.roots || s.root, i = s.visit, a = s.directed), a = arguments.length === 2 && !nn(i) ? i : a, i = nn(i) ? i : function() {
    };
    for (var o = this._private.cy, l = n = Bt(n) ? this.filter(n) : n, u = [], h = [], d = {}, f = {}, p = {}, g = 0, m, v = this.byGroup(), y = v.nodes, b = v.edges, w = 0; w < l.length; w++) {
      var T = l[w], E = T.id();
      T.isNode() && (u.unshift(T), e.bfs && (p[E] = !0, h.push(T)), f[E] = 0);
    }
    for (var C = function() {
      var P = e.bfs ? u.shift() : u.pop(), S = P.id();
      if (e.dfs) {
        if (p[S])
          return 0;
        p[S] = !0, h.push(P);
      }
      var R = f[S], I = d[S], D = I != null ? I.source() : null, M = I != null ? I.target() : null, B = I == null ? void 0 : P.same(D) ? M[0] : D[0], $;
      if ($ = i(P, I, B, g++, R), $ === !0)
        return m = P, 1;
      if ($ === !1)
        return 1;
      for (var F = P.connectedEdges().filter(function(re) {
        return (!a || re.source().same(P)) && b.has(re);
      }), G = 0; G < F.length; G++) {
        var H = F[G], ee = H.connectedNodes().filter(function(re) {
          return !re.same(P) && y.has(re);
        }), Y = ee.id();
        ee.length !== 0 && !p[Y] && (ee = ee[0], u.push(ee), e.bfs && (p[Y] = !0, h.push(ee)), d[Y] = H, f[Y] = f[S] + 1);
      }
    }, k; u.length !== 0 && (k = C(), !(k !== 0 && k === 1)); )
      ;
    for (var _ = o.collection(), L = 0; L < h.length; L++) {
      var N = h[L], A = d[N.id()];
      A != null && _.push(A), _.push(N);
    }
    return {
      path: o.collection(_),
      found: o.collection(m)
    };
  };
}, sg = {
  breadthFirstSearch: JA({
    bfs: !0
  }),
  depthFirstSearch: JA({
    dfs: !0
  })
};
sg.bfs = sg.breadthFirstSearch;
sg.dfs = sg.depthFirstSearch;
var tv = { exports: {} }, yve = tv.exports, e_;
function xve() {
  return e_ || (e_ = 1, function(t, e) {
    (function() {
      var r, n, i, a, s, o, l, u, h, d, f, p, g, m, v;
      i = Math.floor, d = Math.min, n = function(y, b) {
        return y < b ? -1 : y > b ? 1 : 0;
      }, h = function(y, b, w, T, E) {
        var C;
        if (w == null && (w = 0), E == null && (E = n), w < 0)
          throw new Error("lo must be non-negative");
        for (T == null && (T = y.length); w < T; )
          C = i((w + T) / 2), E(b, y[C]) < 0 ? T = C : w = C + 1;
        return [].splice.apply(y, [w, w - w].concat(b)), b;
      }, o = function(y, b, w) {
        return w == null && (w = n), y.push(b), m(y, 0, y.length - 1, w);
      }, s = function(y, b) {
        var w, T;
        return b == null && (b = n), w = y.pop(), y.length ? (T = y[0], y[0] = w, v(y, 0, b)) : T = w, T;
      }, u = function(y, b, w) {
        var T;
        return w == null && (w = n), T = y[0], y[0] = b, v(y, 0, w), T;
      }, l = function(y, b, w) {
        var T;
        return w == null && (w = n), y.length && w(y[0], b) < 0 && (T = [y[0], b], b = T[0], y[0] = T[1], v(y, 0, w)), b;
      }, a = function(y, b) {
        var w, T, E, C, k, _;
        for (b == null && (b = n), C = (function() {
          _ = [];
          for (var L = 0, N = i(y.length / 2); 0 <= N ? L < N : L > N; 0 <= N ? L++ : L--)
            _.push(L);
          return _;
        }).apply(this).reverse(), k = [], T = 0, E = C.length; T < E; T++)
          w = C[T], k.push(v(y, w, b));
        return k;
      }, g = function(y, b, w) {
        var T;
        if (w == null && (w = n), T = y.indexOf(b), T !== -1)
          return m(y, 0, T, w), v(y, T, w);
      }, f = function(y, b, w) {
        var T, E, C, k, _;
        if (w == null && (w = n), E = y.slice(0, b), !E.length)
          return E;
        for (a(E, w), _ = y.slice(b), C = 0, k = _.length; C < k; C++)
          T = _[C], l(E, T, w);
        return E.sort(w).reverse();
      }, p = function(y, b, w) {
        var T, E, C, k, _, L, N, A, O;
        if (w == null && (w = n), b * 10 <= y.length) {
          if (C = y.slice(0, b).sort(w), !C.length)
            return C;
          for (E = C[C.length - 1], N = y.slice(b), k = 0, L = N.length; k < L; k++)
            T = N[k], w(T, E) < 0 && (h(C, T, 0, null, w), C.pop(), E = C[C.length - 1]);
          return C;
        }
        for (a(y, w), O = [], _ = 0, A = d(b, y.length); 0 <= A ? _ < A : _ > A; 0 <= A ? ++_ : --_)
          O.push(s(y, w));
        return O;
      }, m = function(y, b, w, T) {
        var E, C, k;
        for (T == null && (T = n), E = y[w]; w > b; ) {
          if (k = w - 1 >> 1, C = y[k], T(E, C) < 0) {
            y[w] = C, w = k;
            continue;
          }
          break;
        }
        return y[w] = E;
      }, v = function(y, b, w) {
        var T, E, C, k, _;
        for (w == null && (w = n), E = y.length, _ = b, C = y[b], T = 2 * b + 1; T < E; )
          k = T + 1, k < E && !(w(y[T], y[k]) < 0) && (T = k), y[b] = y[T], b = T, T = 2 * b + 1;
        return y[b] = C, m(y, _, b, w);
      }, r = function() {
        y.push = o, y.pop = s, y.replace = u, y.pushpop = l, y.heapify = a, y.updateItem = g, y.nlargest = f, y.nsmallest = p;
        function y(b) {
          this.cmp = b ?? n, this.nodes = [];
        }
        return y.prototype.push = function(b) {
          return o(this.nodes, b, this.cmp);
        }, y.prototype.pop = function() {
          return s(this.nodes, this.cmp);
        }, y.prototype.peek = function() {
          return this.nodes[0];
        }, y.prototype.contains = function(b) {
          return this.nodes.indexOf(b) !== -1;
        }, y.prototype.replace = function(b) {
          return u(this.nodes, b, this.cmp);
        }, y.prototype.pushpop = function(b) {
          return l(this.nodes, b, this.cmp);
        }, y.prototype.heapify = function() {
          return a(this.nodes, this.cmp);
        }, y.prototype.updateItem = function(b) {
          return g(this.nodes, b, this.cmp);
        }, y.prototype.clear = function() {
          return this.nodes = [];
        }, y.prototype.empty = function() {
          return this.nodes.length === 0;
        }, y.prototype.size = function() {
          return this.nodes.length;
        }, y.prototype.clone = function() {
          var b;
          return b = new y(), b.nodes = this.nodes.slice(0), b;
        }, y.prototype.toArray = function() {
          return this.nodes.slice(0);
        }, y.prototype.insert = y.prototype.push, y.prototype.top = y.prototype.peek, y.prototype.front = y.prototype.peek, y.prototype.has = y.prototype.contains, y.prototype.copy = y.prototype.clone, y;
      }(), function(y, b) {
        return t.exports = b();
      }(this, function() {
        return r;
      });
    }).call(yve);
  }(tv)), tv.exports;
}
var V4, t_;
function bve() {
  return t_ || (t_ = 1, V4 = xve()), V4;
}
var wve = bve(), r1 = /* @__PURE__ */ Qg(wve), Tve = di({
  root: null,
  weight: function(e) {
    return 1;
  },
  directed: !1
}), Eve = {
  dijkstra: function(e) {
    if (!vr(e)) {
      var r = arguments;
      e = {
        root: r[0],
        weight: r[1],
        directed: r[2]
      };
    }
    var n = Tve(e), i = n.root, a = n.weight, s = n.directed, o = this, l = a, u = Bt(i) ? this.filter(i)[0] : i[0], h = {}, d = {}, f = {}, p = this.byGroup(), g = p.nodes, m = p.edges;
    m.unmergeBy(function(R) {
      return R.isLoop();
    });
    for (var v = function(I) {
      return h[I.id()];
    }, y = function(I, D) {
      h[I.id()] = D, b.updateItem(I);
    }, b = new r1(function(R, I) {
      return v(R) - v(I);
    }), w = 0; w < g.length; w++) {
      var T = g[w];
      h[T.id()] = T.same(u) ? 0 : 1 / 0, b.push(T);
    }
    for (var E = function(I, D) {
      for (var M = (s ? I.edgesTo(D) : I.edgesWith(D)).intersect(m), B = 1 / 0, $, F = 0; F < M.length; F++) {
        var G = M[F], H = l(G);
        (H < B || !$) && (B = H, $ = G);
      }
      return {
        edge: $,
        dist: B
      };
    }; b.size() > 0; ) {
      var C = b.pop(), k = v(C), _ = C.id();
      if (f[_] = k, k !== 1 / 0)
        for (var L = C.neighborhood().intersect(g), N = 0; N < L.length; N++) {
          var A = L[N], O = A.id(), P = E(C, A), S = k + P.dist;
          S < v(A) && (y(A, S), d[O] = {
            node: C,
            edge: P.edge
          });
        }
    }
    return {
      distanceTo: function(I) {
        var D = Bt(I) ? g.filter(I)[0] : I[0];
        return f[D.id()];
      },
      pathTo: function(I) {
        var D = Bt(I) ? g.filter(I)[0] : I[0], M = [], B = D, $ = B.id();
        if (D.length > 0)
          for (M.unshift(D); d[$]; ) {
            var F = d[$];
            M.unshift(F.edge), M.unshift(F.node), B = F.node, $ = B.id();
          }
        return o.spawn(M);
      }
    };
  }
}, kve = {
  // kruskal's algorithm (finds min spanning tree, assuming undirected graph)
  // implemented from pseudocode from wikipedia
  kruskal: function(e) {
    e = e || function(w) {
      return 1;
    };
    for (var r = this.byGroup(), n = r.nodes, i = r.edges, a = n.length, s = new Array(a), o = n, l = function(T) {
      for (var E = 0; E < s.length; E++) {
        var C = s[E];
        if (C.has(T))
          return E;
      }
    }, u = 0; u < a; u++)
      s[u] = this.spawn(n[u]);
    for (var h = i.sort(function(w, T) {
      return e(w) - e(T);
    }), d = 0; d < h.length; d++) {
      var f = h[d], p = f.source()[0], g = f.target()[0], m = l(p), v = l(g), y = s[m], b = s[v];
      m !== v && (o.merge(f), y.merge(b), s.splice(v, 1));
    }
    return o;
  }
}, Sve = di({
  root: null,
  goal: null,
  weight: function(e) {
    return 1;
  },
  heuristic: function(e) {
    return 0;
  },
  directed: !1
}), Cve = {
  // Implemented from pseudocode from wikipedia
  aStar: function(e) {
    var r = this.cy(), n = Sve(e), i = n.root, a = n.goal, s = n.heuristic, o = n.directed, l = n.weight;
    i = r.collection(i)[0], a = r.collection(a)[0];
    var u = i.id(), h = a.id(), d = {}, f = {}, p = {}, g = new r1(function($, F) {
      return f[$.id()] - f[F.id()];
    }), m = new Mf(), v = {}, y = {}, b = function(F, G) {
      g.push(F), m.add(G);
    }, w, T, E = function() {
      w = g.pop(), T = w.id(), m.delete(T);
    }, C = function(F) {
      return m.has(F);
    };
    b(i, u), d[u] = 0, f[u] = s(i);
    for (var k = 0; g.size() > 0; ) {
      if (E(), k++, T === h) {
        for (var _ = [], L = a, N = h, A = y[N]; _.unshift(L), A != null && _.unshift(A), L = v[N], L != null; )
          N = L.id(), A = y[N];
        return {
          found: !0,
          distance: d[T],
          path: this.spawn(_),
          steps: k
        };
      }
      p[T] = !0;
      for (var O = w._private.edges, P = 0; P < O.length; P++) {
        var S = O[P];
        if (this.hasElementWithId(S.id()) && !(o && S.data("source") !== T)) {
          var R = S.source(), I = S.target(), D = R.id() !== T ? R : I, M = D.id();
          if (this.hasElementWithId(M) && !p[M]) {
            var B = d[T] + l(S);
            if (!C(M)) {
              d[M] = B, f[M] = B + s(D), b(D, M), v[M] = w, y[M] = S;
              continue;
            }
            B < d[M] && (d[M] = B, f[M] = B + s(D), v[M] = w, y[M] = S);
          }
        }
      }
    }
    return {
      found: !1,
      distance: void 0,
      path: void 0,
      steps: k
    };
  }
}, Ave = di({
  weight: function(e) {
    return 1;
  },
  directed: !1
}), _ve = {
  // Implemented from pseudocode from wikipedia
  floydWarshall: function(e) {
    for (var r = this.cy(), n = Ave(e), i = n.weight, a = n.directed, s = i, o = this.byGroup(), l = o.nodes, u = o.edges, h = l.length, d = h * h, f = function(H) {
      return l.indexOf(H);
    }, p = function(H) {
      return l[H];
    }, g = new Array(d), m = 0; m < d; m++) {
      var v = m % h, y = (m - v) / h;
      y === v ? g[m] = 0 : g[m] = 1 / 0;
    }
    for (var b = new Array(d), w = new Array(d), T = 0; T < u.length; T++) {
      var E = u[T], C = E.source()[0], k = E.target()[0];
      if (C !== k) {
        var _ = f(C), L = f(k), N = _ * h + L, A = s(E);
        if (g[N] > A && (g[N] = A, b[N] = L, w[N] = E), !a) {
          var O = L * h + _;
          !a && g[O] > A && (g[O] = A, b[O] = _, w[O] = E);
        }
      }
    }
    for (var P = 0; P < h; P++)
      for (var S = 0; S < h; S++)
        for (var R = S * h + P, I = 0; I < h; I++) {
          var D = S * h + I, M = P * h + I;
          g[R] + g[M] < g[D] && (g[D] = g[R] + g[M], b[D] = b[R]);
        }
    var B = function(H) {
      return (Bt(H) ? r.filter(H) : H)[0];
    }, $ = function(H) {
      return f(B(H));
    }, F = {
      distance: function(H, ee) {
        var Y = $(H), re = $(ee);
        return g[Y * h + re];
      },
      path: function(H, ee) {
        var Y = $(H), re = $(ee), ne = p(Y);
        if (Y === re)
          return ne.collection();
        if (b[Y * h + re] == null)
          return r.collection();
        var he = r.collection(), K = Y, Z;
        for (he.merge(ne); Y !== re; )
          K = Y, Y = b[Y * h + re], Z = w[K * h + Y], he.merge(Z), he.merge(p(Y));
        return he;
      }
    };
    return F;
  }
  // floydWarshall
}, Lve = di({
  weight: function(e) {
    return 1;
  },
  directed: !1,
  root: null
}), Rve = {
  // Implemented from pseudocode from wikipedia
  bellmanFord: function(e) {
    var r = this, n = Lve(e), i = n.weight, a = n.directed, s = n.root, o = i, l = this, u = this.cy(), h = this.byGroup(), d = h.edges, f = h.nodes, p = f.length, g = new Io(), m = !1, v = [];
    s = u.collection(s)[0], d.unmergeBy(function(Ae) {
      return Ae.isLoop();
    });
    for (var y = d.length, b = function(W) {
      var Oe = g.get(W.id());
      return Oe || (Oe = {}, g.set(W.id(), Oe)), Oe;
    }, w = function(W) {
      return (Bt(W) ? u.$(W) : W)[0];
    }, T = function(W) {
      return b(w(W)).dist;
    }, E = function(W) {
      for (var Oe = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : s, ue = w(W), Ve = [], Ge = ue; ; ) {
        if (Ge == null)
          return r.spawn();
        var Ue = b(Ge), ke = Ue.edge, Pe = Ue.pred;
        if (Ve.unshift(Ge[0]), Ge.same(Oe) && Ve.length > 0)
          break;
        ke != null && Ve.unshift(ke), Ge = Pe;
      }
      return l.spawn(Ve);
    }, C = 0; C < p; C++) {
      var k = f[C], _ = b(k);
      k.same(s) ? _.dist = 0 : _.dist = 1 / 0, _.pred = null, _.edge = null;
    }
    for (var L = !1, N = function(W, Oe, ue, Ve, Ge, Ue) {
      var ke = Ve.dist + Ue;
      ke < Ge.dist && !ue.same(Ve.edge) && (Ge.dist = ke, Ge.pred = W, Ge.edge = ue, L = !0);
    }, A = 1; A < p; A++) {
      L = !1;
      for (var O = 0; O < y; O++) {
        var P = d[O], S = P.source(), R = P.target(), I = o(P), D = b(S), M = b(R);
        N(S, R, P, D, M, I), a || N(R, S, P, M, D, I);
      }
      if (!L)
        break;
    }
    if (L)
      for (var B = [], $ = 0; $ < y; $++) {
        var F = d[$], G = F.source(), H = F.target(), ee = o(F), Y = b(G).dist, re = b(H).dist;
        if (Y + ee < re || !a && re + ee < Y)
          if (m || (Nr("Graph contains a negative weight cycle for Bellman-Ford"), m = !0), e.findNegativeWeightCycles !== !1) {
            var ne = [];
            Y + ee < re && ne.push(G), !a && re + ee < Y && ne.push(H);
            for (var he = ne.length, K = 0; K < he; K++) {
              var Z = ne[K], X = [Z];
              X.push(b(Z).edge);
              for (var q = b(Z).pred; X.indexOf(q) === -1; )
                X.push(q), X.push(b(q).edge), q = b(q).pred;
              X = X.slice(X.indexOf(q));
              for (var J = X[0].id(), j = 0, pe = 2; pe < X.length; pe += 2)
                X[pe].id() < J && (J = X[pe].id(), j = pe);
              X = X.slice(j).concat(X.slice(0, j)), X.push(X[0]);
              var te = X.map(function(Ae) {
                return Ae.id();
              }).join(",");
              B.indexOf(te) === -1 && (v.push(l.spawn(X)), B.push(te));
            }
          } else
            break;
      }
    return {
      distanceTo: T,
      pathTo: E,
      hasNegativeWeightCycle: m,
      negativeWeightCycles: v
    };
  }
  // bellmanFord
}, Nve = Math.sqrt(2), Mve = function(e, r, n) {
  n.length === 0 && Kr("Karger-Stein must be run on a connected (sub)graph");
  for (var i = n[e], a = i[1], s = i[2], o = r[a], l = r[s], u = n, h = u.length - 1; h >= 0; h--) {
    var d = u[h], f = d[1], p = d[2];
    (r[f] === o && r[p] === l || r[f] === l && r[p] === o) && u.splice(h, 1);
  }
  for (var g = 0; g < u.length; g++) {
    var m = u[g];
    m[1] === l ? (u[g] = m.slice(), u[g][1] = o) : m[2] === l && (u[g] = m.slice(), u[g][2] = o);
  }
  for (var v = 0; v < r.length; v++)
    r[v] === l && (r[v] = o);
  return u;
}, G4 = function(e, r, n, i) {
  for (; n > i; ) {
    var a = Math.floor(Math.random() * r.length);
    r = Mve(a, e, r), n--;
  }
  return r;
}, Dve = {
  // Computes the minimum cut of an undirected graph
  // Returns the correct answer with high probability
  kargerStein: function() {
    var e = this, r = this.byGroup(), n = r.nodes, i = r.edges;
    i.unmergeBy(function(M) {
      return M.isLoop();
    });
    var a = n.length, s = i.length, o = Math.ceil(Math.pow(Math.log(a) / Math.LN2, 2)), l = Math.floor(a / Nve);
    if (a < 2) {
      Kr("At least 2 nodes are required for Karger-Stein algorithm");
      return;
    }
    for (var u = [], h = 0; h < s; h++) {
      var d = i[h];
      u.push([h, n.indexOf(d.source()), n.indexOf(d.target())]);
    }
    for (var f = 1 / 0, p = [], g = new Array(a), m = new Array(a), v = new Array(a), y = function(B, $) {
      for (var F = 0; F < a; F++)
        $[F] = B[F];
    }, b = 0; b <= o; b++) {
      for (var w = 0; w < a; w++)
        m[w] = w;
      var T = G4(m, u.slice(), a, l), E = T.slice();
      y(m, v);
      var C = G4(m, T, l, 2), k = G4(v, E, l, 2);
      C.length <= k.length && C.length < f ? (f = C.length, p = C, y(m, g)) : k.length <= C.length && k.length < f && (f = k.length, p = k, y(v, g));
    }
    for (var _ = this.spawn(p.map(function(M) {
      return i[M[0]];
    })), L = this.spawn(), N = this.spawn(), A = g[0], O = 0; O < g.length; O++) {
      var P = g[O], S = n[O];
      P === A ? L.merge(S) : N.merge(S);
    }
    var R = function(B) {
      var $ = e.spawn();
      return B.forEach(function(F) {
        $.merge(F), F.connectedEdges().forEach(function(G) {
          e.contains(G) && !_.contains(G) && $.merge(G);
        });
      }), $;
    }, I = [R(L), R(N)], D = {
      cut: _,
      components: I,
      // n.b. partitions are included to be compatible with the old api spec
      // (could be removed in a future major version)
      partition1: L,
      partition2: N
    };
    return D;
  }
}, U4, Ive = function(e) {
  return {
    x: e.x,
    y: e.y
  };
}, Mx = function(e, r, n) {
  return {
    x: e.x * r + n.x,
    y: e.y * r + n.y
  };
}, EV = function(e, r, n) {
  return {
    x: (e.x - n.x) / r,
    y: (e.y - n.y) / r
  };
}, Th = function(e) {
  return {
    x: e[0],
    y: e[1]
  };
}, Ove = function(e) {
  for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, i = 1 / 0, a = r; a < n; a++) {
    var s = e[a];
    isFinite(s) && (i = Math.min(s, i));
  }
  return i;
}, Pve = function(e) {
  for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, i = -1 / 0, a = r; a < n; a++) {
    var s = e[a];
    isFinite(s) && (i = Math.max(s, i));
  }
  return i;
}, Bve = function(e) {
  for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, i = 0, a = 0, s = r; s < n; s++) {
    var o = e[s];
    isFinite(o) && (i += o, a++);
  }
  return i / a;
}, Fve = function(e) {
  var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0;
  i ? e = e.slice(r, n) : (n < e.length && e.splice(n, e.length - n), r > 0 && e.splice(0, r));
  for (var o = 0, l = e.length - 1; l >= 0; l--) {
    var u = e[l];
    s ? isFinite(u) || (e[l] = -1 / 0, o++) : e.splice(l, 1);
  }
  a && e.sort(function(f, p) {
    return f - p;
  });
  var h = e.length, d = Math.floor(h / 2);
  return h % 2 !== 0 ? e[d + 1 + o] : (e[d - 1 + o] + e[d + o]) / 2;
}, $ve = function(e) {
  return Math.PI * e / 180;
}, Z1 = function(e, r) {
  return Math.atan2(r, e) - Math.PI / 2;
}, jk = Math.log2 || function(t) {
  return Math.log(t) / Math.log(2);
}, Kk = function(e) {
  return e > 0 ? 1 : e < 0 ? -1 : 0;
}, mu = function(e, r) {
  return Math.sqrt(Dc(e, r));
}, Dc = function(e, r) {
  var n = r.x - e.x, i = r.y - e.y;
  return n * n + i * i;
}, zve = function(e) {
  for (var r = e.length, n = 0, i = 0; i < r; i++)
    n += e[i];
  for (var a = 0; a < r; a++)
    e[a] = e[a] / n;
  return e;
}, Yn = function(e, r, n, i) {
  return (1 - i) * (1 - i) * e + 2 * (1 - i) * i * r + i * i * n;
}, Oh = function(e, r, n, i) {
  return {
    x: Yn(e.x, r.x, n.x, i),
    y: Yn(e.y, r.y, n.y, i)
  };
}, Vve = function(e, r, n, i) {
  var a = {
    x: r.x - e.x,
    y: r.y - e.y
  }, s = mu(e, r), o = {
    x: a.x / s,
    y: a.y / s
  };
  return n = n ?? 0, i = i ?? n * s, {
    x: e.x + o.x * i,
    y: e.y + o.y * i
  };
}, og = function(e, r, n) {
  return Math.max(e, Math.min(n, r));
}, Yi = function(e) {
  if (e == null)
    return {
      x1: 1 / 0,
      y1: 1 / 0,
      x2: -1 / 0,
      y2: -1 / 0,
      w: 0,
      h: 0
    };
  if (e.x1 != null && e.y1 != null) {
    if (e.x2 != null && e.y2 != null && e.x2 >= e.x1 && e.y2 >= e.y1)
      return {
        x1: e.x1,
        y1: e.y1,
        x2: e.x2,
        y2: e.y2,
        w: e.x2 - e.x1,
        h: e.y2 - e.y1
      };
    if (e.w != null && e.h != null && e.w >= 0 && e.h >= 0)
      return {
        x1: e.x1,
        y1: e.y1,
        x2: e.x1 + e.w,
        y2: e.y1 + e.h,
        w: e.w,
        h: e.h
      };
  }
}, Gve = function(e) {
  return {
    x1: e.x1,
    x2: e.x2,
    w: e.w,
    y1: e.y1,
    y2: e.y2,
    h: e.h
  };
}, Uve = function(e) {
  e.x1 = 1 / 0, e.y1 = 1 / 0, e.x2 = -1 / 0, e.y2 = -1 / 0, e.w = 0, e.h = 0;
}, Wve = function(e, r) {
  e.x1 = Math.min(e.x1, r.x1), e.x2 = Math.max(e.x2, r.x2), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, r.y1), e.y2 = Math.max(e.y2, r.y2), e.h = e.y2 - e.y1;
}, kV = function(e, r, n) {
  e.x1 = Math.min(e.x1, r), e.x2 = Math.max(e.x2, r), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, n), e.y2 = Math.max(e.y2, n), e.h = e.y2 - e.y1;
}, rv = function(e) {
  var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  return e.x1 -= r, e.x2 += r, e.y1 -= r, e.y2 += r, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e;
}, nv = function(e) {
  var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0], n, i, a, s;
  if (r.length === 1)
    n = i = a = s = r[0];
  else if (r.length === 2)
    n = a = r[0], s = i = r[1];
  else if (r.length === 4) {
    var o = Tn(r, 4);
    n = o[0], i = o[1], a = o[2], s = o[3];
  }
  return e.x1 -= s, e.x2 += i, e.y1 -= n, e.y2 += a, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e;
}, r_ = function(e, r) {
  e.x1 = r.x1, e.y1 = r.y1, e.x2 = r.x2, e.y2 = r.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1;
}, Zk = function(e, r) {
  return !(e.x1 > r.x2 || r.x1 > e.x2 || e.x2 < r.x1 || r.x2 < e.x1 || e.y2 < r.y1 || r.y2 < e.y1 || e.y1 > r.y2 || r.y1 > e.y2);
}, kl = function(e, r, n) {
  return e.x1 <= r && r <= e.x2 && e.y1 <= n && n <= e.y2;
}, n_ = function(e, r) {
  return kl(e, r.x, r.y);
}, SV = function(e, r) {
  return kl(e, r.x1, r.y1) && kl(e, r.x2, r.y2);
}, Hve = (U4 = Math.hypot) !== null && U4 !== void 0 ? U4 : function(t, e) {
  return Math.sqrt(t * t + e * e);
};
function qve(t, e) {
  if (t.length < 3)
    throw new Error("Need at least 3 vertices");
  var r = function(_, L) {
    return {
      x: _.x + L.x,
      y: _.y + L.y
    };
  }, n = function(_, L) {
    return {
      x: _.x - L.x,
      y: _.y - L.y
    };
  }, i = function(_, L) {
    return {
      x: _.x * L,
      y: _.y * L
    };
  }, a = function(_, L) {
    return _.x * L.y - _.y * L.x;
  }, s = function(_) {
    var L = Hve(_.x, _.y);
    return L === 0 ? {
      x: 0,
      y: 0
    } : {
      x: _.x / L,
      y: _.y / L
    };
  }, o = function(_) {
    for (var L = 0, N = 0; N < _.length; N++) {
      var A = _[N], O = _[(N + 1) % _.length];
      L += A.x * O.y - O.x * A.y;
    }
    return L / 2;
  }, l = function(_, L, N, A) {
    var O = n(L, _), P = n(A, N), S = a(O, P);
    if (Math.abs(S) < 1e-9)
      return r(_, i(O, 0.5));
    var R = a(n(N, _), P) / S;
    return r(_, i(O, R));
  }, u = t.map(function(k) {
    return {
      x: k.x,
      y: k.y
    };
  });
  o(u) < 0 && u.reverse();
  for (var h = u.length, d = [], f = 0; f < h; f++) {
    var p = u[f], g = u[(f + 1) % h], m = n(g, p), v = s({
      x: m.y,
      y: -m.x
    });
    d.push(v);
  }
  for (var y = d.map(function(k, _) {
    var L = r(u[_], i(k, e)), N = r(u[(_ + 1) % h], i(k, e));
    return {
      p1: L,
      p2: N
    };
  }), b = [], w = 0; w < h; w++) {
    var T = y[(w - 1 + h) % h], E = y[w], C = l(T.p1, T.p2, E.p1, E.p2);
    b.push(C);
  }
  return b;
}
function Yve(t, e, r, n, i, a) {
  var s = rye(t, e, r, n, i), o = qve(s, a), l = Yi();
  return o.forEach(function(u) {
    return kV(l, u.x, u.y);
  }), l;
}
var CV = function(e, r, n, i, a, s, o) {
  var l = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : "auto", u = l === "auto" ? Wl(a, s) : l, h = a / 2, d = s / 2;
  u = Math.min(u, h, d);
  var f = u !== h, p = u !== d, g;
  if (f) {
    var m = n - h + u - o, v = i - d - o, y = n + h - u + o, b = v;
    if (g = Sl(e, r, n, i, m, v, y, b, !1), g.length > 0)
      return g;
  }
  if (p) {
    var w = n + h + o, T = i - d + u - o, E = w, C = i + d - u + o;
    if (g = Sl(e, r, n, i, w, T, E, C, !1), g.length > 0)
      return g;
  }
  if (f) {
    var k = n - h + u - o, _ = i + d + o, L = n + h - u + o, N = _;
    if (g = Sl(e, r, n, i, k, _, L, N, !1), g.length > 0)
      return g;
  }
  if (p) {
    var A = n - h - o, O = i - d + u - o, P = A, S = i + d - u + o;
    if (g = Sl(e, r, n, i, A, O, P, S, !1), g.length > 0)
      return g;
  }
  var R;
  {
    var I = n - h + u, D = i - d + u;
    if (R = _0(e, r, n, i, I, D, u + o), R.length > 0 && R[0] <= I && R[1] <= D)
      return [R[0], R[1]];
  }
  {
    var M = n + h - u, B = i - d + u;
    if (R = _0(e, r, n, i, M, B, u + o), R.length > 0 && R[0] >= M && R[1] <= B)
      return [R[0], R[1]];
  }
  {
    var $ = n + h - u, F = i + d - u;
    if (R = _0(e, r, n, i, $, F, u + o), R.length > 0 && R[0] >= $ && R[1] >= F)
      return [R[0], R[1]];
  }
  {
    var G = n - h + u, H = i + d - u;
    if (R = _0(e, r, n, i, G, H, u + o), R.length > 0 && R[0] <= G && R[1] >= H)
      return [R[0], R[1]];
  }
  return [];
}, Xve = function(e, r, n, i, a, s, o) {
  var l = o, u = Math.min(n, a), h = Math.max(n, a), d = Math.min(i, s), f = Math.max(i, s);
  return u - l <= e && e <= h + l && d - l <= r && r <= f + l;
}, jve = function(e, r, n, i, a, s, o, l, u) {
  var h = {
    x1: Math.min(n, o, a) - u,
    x2: Math.max(n, o, a) + u,
    y1: Math.min(i, l, s) - u,
    y2: Math.max(i, l, s) + u
  };
  return !(e < h.x1 || e > h.x2 || r < h.y1 || r > h.y2);
}, Kve = function(e, r, n, i) {
  n -= i;
  var a = r * r - 4 * e * n;
  if (a < 0)
    return [];
  var s = Math.sqrt(a), o = 2 * e, l = (-r + s) / o, u = (-r - s) / o;
  return [l, u];
}, Zve = function(e, r, n, i, a) {
  var s = 1e-5;
  e === 0 && (e = s), r /= e, n /= e, i /= e;
  var o, l, u, h, d, f, p, g;
  if (l = (3 * n - r * r) / 9, u = -(27 * i) + r * (9 * n - 2 * (r * r)), u /= 54, o = l * l * l + u * u, a[1] = 0, p = r / 3, o > 0) {
    d = u + Math.sqrt(o), d = d < 0 ? -Math.pow(-d, 1 / 3) : Math.pow(d, 1 / 3), f = u - Math.sqrt(o), f = f < 0 ? -Math.pow(-f, 1 / 3) : Math.pow(f, 1 / 3), a[0] = -p + d + f, p += (d + f) / 2, a[4] = a[2] = -p, p = Math.sqrt(3) * (-f + d) / 2, a[3] = p, a[5] = -p;
    return;
  }
  if (a[5] = a[3] = 0, o === 0) {
    g = u < 0 ? -Math.pow(-u, 1 / 3) : Math.pow(u, 1 / 3), a[0] = -p + 2 * g, a[4] = a[2] = -(g + p);
    return;
  }
  l = -l, h = l * l * l, h = Math.acos(u / Math.sqrt(h)), g = 2 * Math.sqrt(l), a[0] = -p + g * Math.cos(h / 3), a[2] = -p + g * Math.cos((h + 2 * Math.PI) / 3), a[4] = -p + g * Math.cos((h + 4 * Math.PI) / 3);
}, Qve = function(e, r, n, i, a, s, o, l) {
  var u = 1 * n * n - 4 * n * a + 2 * n * o + 4 * a * a - 4 * a * o + o * o + i * i - 4 * i * s + 2 * i * l + 4 * s * s - 4 * s * l + l * l, h = 1 * 9 * n * a - 3 * n * n - 3 * n * o - 6 * a * a + 3 * a * o + 9 * i * s - 3 * i * i - 3 * i * l - 6 * s * s + 3 * s * l, d = 1 * 3 * n * n - 6 * n * a + n * o - n * e + 2 * a * a + 2 * a * e - o * e + 3 * i * i - 6 * i * s + i * l - i * r + 2 * s * s + 2 * s * r - l * r, f = 1 * n * a - n * n + n * e - a * e + i * s - i * i + i * r - s * r, p = [];
  Zve(u, h, d, f, p);
  for (var g = 1e-7, m = [], v = 0; v < 6; v += 2)
    Math.abs(p[v + 1]) < g && p[v] >= 0 && p[v] <= 1 && m.push(p[v]);
  m.push(1), m.push(0);
  for (var y = -1, b, w, T, E = 0; E < m.length; E++)
    b = Math.pow(1 - m[E], 2) * n + 2 * (1 - m[E]) * m[E] * a + m[E] * m[E] * o, w = Math.pow(1 - m[E], 2) * i + 2 * (1 - m[E]) * m[E] * s + m[E] * m[E] * l, T = Math.pow(b - e, 2) + Math.pow(w - r, 2), y >= 0 ? T < y && (y = T) : y = T;
  return y;
}, Jve = function(e, r, n, i, a, s) {
  var o = [e - n, r - i], l = [a - n, s - i], u = l[0] * l[0] + l[1] * l[1], h = o[0] * o[0] + o[1] * o[1], d = o[0] * l[0] + o[1] * l[1], f = d * d / u;
  return d < 0 ? h : f > u ? (e - a) * (e - a) + (r - s) * (r - s) : h - f;
}, sa = function(e, r, n) {
  for (var i, a, s, o, l, u = 0, h = 0; h < n.length / 2; h++)
    if (i = n[h * 2], a = n[h * 2 + 1], h + 1 < n.length / 2 ? (s = n[(h + 1) * 2], o = n[(h + 1) * 2 + 1]) : (s = n[(h + 1 - n.length / 2) * 2], o = n[(h + 1 - n.length / 2) * 2 + 1]), !(i == e && s == e)) if (i >= e && e >= s || i <= e && e <= s)
      l = (e - i) / (s - i) * (o - a) + a, l > r && u++;
    else
      continue;
  return u % 2 !== 0;
}, Jo = function(e, r, n, i, a, s, o, l, u) {
  var h = new Array(n.length), d;
  l[0] != null ? (d = Math.atan(l[1] / l[0]), l[0] < 0 ? d = d + Math.PI / 2 : d = -d - Math.PI / 2) : d = l;
  for (var f = Math.cos(-d), p = Math.sin(-d), g = 0; g < h.length / 2; g++)
    h[g * 2] = s / 2 * (n[g * 2] * f - n[g * 2 + 1] * p), h[g * 2 + 1] = o / 2 * (n[g * 2 + 1] * f + n[g * 2] * p), h[g * 2] += i, h[g * 2 + 1] += a;
  var m;
  if (u > 0) {
    var v = Fy(h, -u);
    m = By(v);
  } else
    m = h;
  return sa(e, r, m);
}, eye = function(e, r, n, i, a, s, o, l) {
  for (var u = new Array(n.length * 2), h = 0; h < l.length; h++) {
    var d = l[h];
    u[h * 4 + 0] = d.startX, u[h * 4 + 1] = d.startY, u[h * 4 + 2] = d.stopX, u[h * 4 + 3] = d.stopY;
    var f = Math.pow(d.cx - e, 2) + Math.pow(d.cy - r, 2);
    if (f <= Math.pow(d.radius, 2))
      return !0;
  }
  return sa(e, r, u);
}, By = function(e) {
  for (var r = new Array(e.length / 2), n, i, a, s, o, l, u, h, d = 0; d < e.length / 4; d++) {
    n = e[d * 4], i = e[d * 4 + 1], a = e[d * 4 + 2], s = e[d * 4 + 3], d < e.length / 4 - 1 ? (o = e[(d + 1) * 4], l = e[(d + 1) * 4 + 1], u = e[(d + 1) * 4 + 2], h = e[(d + 1) * 4 + 3]) : (o = e[0], l = e[1], u = e[2], h = e[3]);
    var f = Sl(n, i, a, s, o, l, u, h, !0);
    r[d * 2] = f[0], r[d * 2 + 1] = f[1];
  }
  return r;
}, Fy = function(e, r) {
  for (var n = new Array(e.length * 2), i, a, s, o, l = 0; l < e.length / 2; l++) {
    i = e[l * 2], a = e[l * 2 + 1], l < e.length / 2 - 1 ? (s = e[(l + 1) * 2], o = e[(l + 1) * 2 + 1]) : (s = e[0], o = e[1]);
    var u = o - a, h = -(s - i), d = Math.sqrt(u * u + h * h), f = u / d, p = h / d;
    n[l * 4] = i + f * r, n[l * 4 + 1] = a + p * r, n[l * 4 + 2] = s + f * r, n[l * 4 + 3] = o + p * r;
  }
  return n;
}, tye = function(e, r, n, i, a, s) {
  var o = n - e, l = i - r;
  o /= a, l /= s;
  var u = Math.sqrt(o * o + l * l), h = u - 1;
  if (h < 0)
    return [];
  var d = h / u;
  return [(n - e) * d + e, (i - r) * d + r];
}, Xc = function(e, r, n, i, a, s, o) {
  return e -= a, r -= s, e /= n / 2 + o, r /= i / 2 + o, e * e + r * r <= 1;
}, _0 = function(e, r, n, i, a, s, o) {
  var l = [n - e, i - r], u = [e - a, r - s], h = l[0] * l[0] + l[1] * l[1], d = 2 * (u[0] * l[0] + u[1] * l[1]), f = u[0] * u[0] + u[1] * u[1] - o * o, p = d * d - 4 * h * f;
  if (p < 0)
    return [];
  var g = (-d + Math.sqrt(p)) / (2 * h), m = (-d - Math.sqrt(p)) / (2 * h), v = Math.min(g, m), y = Math.max(g, m), b = [];
  if (v >= 0 && v <= 1 && b.push(v), y >= 0 && y <= 1 && b.push(y), b.length === 0)
    return [];
  var w = b[0] * l[0] + e, T = b[0] * l[1] + r;
  if (b.length > 1) {
    if (b[0] == b[1])
      return [w, T];
    var E = b[1] * l[0] + e, C = b[1] * l[1] + r;
    return [w, T, E, C];
  } else
    return [w, T];
}, W4 = function(e, r, n) {
  return r <= e && e <= n || n <= e && e <= r ? e : e <= r && r <= n || n <= r && r <= e ? r : n;
}, Sl = function(e, r, n, i, a, s, o, l, u) {
  var h = e - a, d = n - e, f = o - a, p = r - s, g = i - r, m = l - s, v = f * p - m * h, y = d * p - g * h, b = m * d - f * g;
  if (b !== 0) {
    var w = v / b, T = y / b, E = 1e-3, C = 0 - E, k = 1 + E;
    return C <= w && w <= k && C <= T && T <= k ? [e + w * d, r + w * g] : u ? [e + w * d, r + w * g] : [];
  } else
    return v === 0 || y === 0 ? W4(e, n, o) === o ? [o, l] : W4(e, n, a) === a ? [a, s] : W4(a, o, n) === n ? [n, i] : [] : [];
}, rye = function(e, r, n, i, a) {
  var s = [], o = i / 2, l = a / 2, u = r, h = n;
  s.push({
    x: u + o * e[0],
    y: h + l * e[1]
  });
  for (var d = 1; d < e.length / 2; d++)
    s.push({
      x: u + o * e[d * 2],
      y: h + l * e[d * 2 + 1]
    });
  return s;
}, lg = function(e, r, n, i, a, s, o, l) {
  var u = [], h, d = new Array(n.length), f = !0;
  s == null && (f = !1);
  var p;
  if (f) {
    for (var g = 0; g < d.length / 2; g++)
      d[g * 2] = n[g * 2] * s + i, d[g * 2 + 1] = n[g * 2 + 1] * o + a;
    if (l > 0) {
      var m = Fy(d, -l);
      p = By(m);
    } else
      p = d;
  } else
    p = n;
  for (var v, y, b, w, T = 0; T < p.length / 2; T++)
    v = p[T * 2], y = p[T * 2 + 1], T < p.length / 2 - 1 ? (b = p[(T + 1) * 2], w = p[(T + 1) * 2 + 1]) : (b = p[0], w = p[1]), h = Sl(e, r, i, a, v, y, b, w), h.length !== 0 && u.push(h[0], h[1]);
  return u;
}, nye = function(e, r, n, i, a, s, o, l, u) {
  var h = [], d, f = new Array(n.length * 2);
  u.forEach(function(b, w) {
    w === 0 ? (f[f.length - 2] = b.startX, f[f.length - 1] = b.startY) : (f[w * 4 - 2] = b.startX, f[w * 4 - 1] = b.startY), f[w * 4] = b.stopX, f[w * 4 + 1] = b.stopY, d = _0(e, r, i, a, b.cx, b.cy, b.radius), d.length !== 0 && h.push(d[0], d[1]);
  });
  for (var p = 0; p < f.length / 4; p++)
    d = Sl(e, r, i, a, f[p * 4], f[p * 4 + 1], f[p * 4 + 2], f[p * 4 + 3], !1), d.length !== 0 && h.push(d[0], d[1]);
  if (h.length > 2) {
    for (var g = [h[0], h[1]], m = Math.pow(g[0] - e, 2) + Math.pow(g[1] - r, 2), v = 1; v < h.length / 2; v++) {
      var y = Math.pow(h[v * 2] - e, 2) + Math.pow(h[v * 2 + 1] - r, 2);
      y <= m && (g[0] = h[v * 2], g[1] = h[v * 2 + 1], m = y);
    }
    return g;
  }
  return h;
}, Q1 = function(e, r, n) {
  var i = [e[0] - r[0], e[1] - r[1]], a = Math.sqrt(i[0] * i[0] + i[1] * i[1]), s = (a - n) / a;
  return s < 0 && (s = 1e-5), [r[0] + s * i[0], r[1] + s * i[1]];
}, Pi = function(e, r) {
  var n = oT(e, r);
  return n = AV(n), n;
}, AV = function(e) {
  for (var r, n, i = e.length / 2, a = 1 / 0, s = 1 / 0, o = -1 / 0, l = -1 / 0, u = 0; u < i; u++)
    r = e[2 * u], n = e[2 * u + 1], a = Math.min(a, r), o = Math.max(o, r), s = Math.min(s, n), l = Math.max(l, n);
  for (var h = 2 / (o - a), d = 2 / (l - s), f = 0; f < i; f++)
    r = e[2 * f] = e[2 * f] * h, n = e[2 * f + 1] = e[2 * f + 1] * d, a = Math.min(a, r), o = Math.max(o, r), s = Math.min(s, n), l = Math.max(l, n);
  if (s < -1)
    for (var p = 0; p < i; p++)
      n = e[2 * p + 1] = e[2 * p + 1] + (-1 - s);
  return e;
}, oT = function(e, r) {
  var n = 1 / e * 2 * Math.PI, i = e % 2 === 0 ? Math.PI / 2 + n / 2 : Math.PI / 2;
  i += r;
  for (var a = new Array(e * 2), s, o = 0; o < e; o++)
    s = o * n + i, a[2 * o] = Math.cos(s), a[2 * o + 1] = Math.sin(-s);
  return a;
}, Wl = function(e, r) {
  return Math.min(e / 4, r / 4, 8);
}, _V = function(e, r) {
  return Math.min(e / 10, r / 10, 8);
}, Qk = function() {
  return 8;
}, iye = function(e, r, n) {
  return [e - 2 * r + n, 2 * (r - e), e];
}, lT = function(e, r) {
  return {
    heightOffset: Math.min(15, 0.05 * r),
    widthOffset: Math.min(100, 0.25 * e),
    ctrlPtOffsetPct: 0.05
  };
};
function H4(t, e) {
  function r(d) {
    for (var f = [], p = 0; p < d.length; p++) {
      var g = d[p], m = d[(p + 1) % d.length], v = {
        x: m.x - g.x,
        y: m.y - g.y
      }, y = {
        x: -v.y,
        y: v.x
      }, b = Math.sqrt(y.x * y.x + y.y * y.y);
      f.push({
        x: y.x / b,
        y: y.y / b
      });
    }
    return f;
  }
  function n(d, f) {
    var p = 1 / 0, g = -1 / 0, m = ca(d), v;
    try {
      for (m.s(); !(v = m.n()).done; ) {
        var y = v.value, b = y.x * f.x + y.y * f.y;
        p = Math.min(p, b), g = Math.max(g, b);
      }
    } catch (w) {
      m.e(w);
    } finally {
      m.f();
    }
    return {
      min: p,
      max: g
    };
  }
  function i(d, f) {
    return !(d.max < f.min || f.max < d.min);
  }
  var a = [].concat(Dy(r(t)), Dy(r(e))), s = ca(a), o;
  try {
    for (s.s(); !(o = s.n()).done; ) {
      var l = o.value, u = n(t, l), h = n(e, l);
      if (!i(u, h))
        return !1;
    }
  } catch (d) {
    s.e(d);
  } finally {
    s.f();
  }
  return !0;
}
var aye = di({
  dampingFactor: 0.8,
  precision: 1e-6,
  iterations: 200,
  weight: function(e) {
    return 1;
  }
}), sye = {
  pageRank: function(e) {
    for (var r = aye(e), n = r.dampingFactor, i = r.precision, a = r.iterations, s = r.weight, o = this._private.cy, l = this.byGroup(), u = l.nodes, h = l.edges, d = u.length, f = d * d, p = h.length, g = new Array(f), m = new Array(d), v = (1 - n) / d, y = 0; y < d; y++) {
      for (var b = 0; b < d; b++) {
        var w = y * d + b;
        g[w] = 0;
      }
      m[y] = 0;
    }
    for (var T = 0; T < p; T++) {
      var E = h[T], C = E.data("source"), k = E.data("target");
      if (C !== k) {
        var _ = u.indexOfId(C), L = u.indexOfId(k), N = s(E), A = L * d + _;
        g[A] += N, m[_] += N;
      }
    }
    for (var O = 1 / d + v, P = 0; P < d; P++)
      if (m[P] === 0)
        for (var S = 0; S < d; S++) {
          var R = S * d + P;
          g[R] = O;
        }
      else
        for (var I = 0; I < d; I++) {
          var D = I * d + P;
          g[D] = g[D] / m[P] + v;
        }
    for (var M = new Array(d), B = new Array(d), $, F = 0; F < d; F++)
      M[F] = 1;
    for (var G = 0; G < a; G++) {
      for (var H = 0; H < d; H++)
        B[H] = 0;
      for (var ee = 0; ee < d; ee++)
        for (var Y = 0; Y < d; Y++) {
          var re = ee * d + Y;
          B[ee] += g[re] * M[Y];
        }
      zve(B), $ = M, M = B, B = $;
      for (var ne = 0, he = 0; he < d; he++) {
        var K = $[he] - M[he];
        ne += K * K;
      }
      if (ne < i)
        break;
    }
    var Z = {
      rank: function(q) {
        return q = o.collection(q)[0], M[u.indexOf(q)];
      }
    };
    return Z;
  }
  // pageRank
}, i_ = di({
  root: null,
  weight: function(e) {
    return 1;
  },
  directed: !1,
  alpha: 0
}), Ph = {
  degreeCentralityNormalized: function(e) {
    e = i_(e);
    var r = this.cy(), n = this.nodes(), i = n.length;
    if (e.directed) {
      for (var h = {}, d = {}, f = 0, p = 0, g = 0; g < i; g++) {
        var m = n[g], v = m.id();
        e.root = m;
        var y = this.degreeCentrality(e);
        f < y.indegree && (f = y.indegree), p < y.outdegree && (p = y.outdegree), h[v] = y.indegree, d[v] = y.outdegree;
      }
      return {
        indegree: function(w) {
          return f == 0 ? 0 : (Bt(w) && (w = r.filter(w)), h[w.id()] / f);
        },
        outdegree: function(w) {
          return p === 0 ? 0 : (Bt(w) && (w = r.filter(w)), d[w.id()] / p);
        }
      };
    } else {
      for (var a = {}, s = 0, o = 0; o < i; o++) {
        var l = n[o];
        e.root = l;
        var u = this.degreeCentrality(e);
        s < u.degree && (s = u.degree), a[l.id()] = u.degree;
      }
      return {
        degree: function(w) {
          return s === 0 ? 0 : (Bt(w) && (w = r.filter(w)), a[w.id()] / s);
        }
      };
    }
  },
  // degreeCentralityNormalized
  // Implemented from the algorithm in Opsahl's paper
  // "Node centrality in weighted networks: Generalizing degree and shortest paths"
  // check the heading 2 "Degree"
  degreeCentrality: function(e) {
    e = i_(e);
    var r = this.cy(), n = this, i = e, a = i.root, s = i.weight, o = i.directed, l = i.alpha;
    if (a = r.collection(a)[0], o) {
      for (var p = a.connectedEdges(), g = p.filter(function(C) {
        return C.target().same(a) && n.has(C);
      }), m = p.filter(function(C) {
        return C.source().same(a) && n.has(C);
      }), v = g.length, y = m.length, b = 0, w = 0, T = 0; T < g.length; T++)
        b += s(g[T]);
      for (var E = 0; E < m.length; E++)
        w += s(m[E]);
      return {
        indegree: Math.pow(v, 1 - l) * Math.pow(b, l),
        outdegree: Math.pow(y, 1 - l) * Math.pow(w, l)
      };
    } else {
      for (var u = a.connectedEdges().intersection(n), h = u.length, d = 0, f = 0; f < u.length; f++)
        d += s(u[f]);
      return {
        degree: Math.pow(h, 1 - l) * Math.pow(d, l)
      };
    }
  }
  // degreeCentrality
};
Ph.dc = Ph.degreeCentrality;
Ph.dcn = Ph.degreeCentralityNormalised = Ph.degreeCentralityNormalized;
var a_ = di({
  harmonic: !0,
  weight: function() {
    return 1;
  },
  directed: !1,
  root: null
}), Bh = {
  closenessCentralityNormalized: function(e) {
    for (var r = a_(e), n = r.harmonic, i = r.weight, a = r.directed, s = this.cy(), o = {}, l = 0, u = this.nodes(), h = this.floydWarshall({
      weight: i,
      directed: a
    }), d = 0; d < u.length; d++) {
      for (var f = 0, p = u[d], g = 0; g < u.length; g++)
        if (d !== g) {
          var m = h.distance(p, u[g]);
          n ? f += 1 / m : f += m;
        }
      n || (f = 1 / f), l < f && (l = f), o[p.id()] = f;
    }
    return {
      closeness: function(y) {
        return l == 0 ? 0 : (Bt(y) ? y = s.filter(y)[0].id() : y = y.id(), o[y] / l);
      }
    };
  },
  // Implemented from pseudocode from wikipedia
  closenessCentrality: function(e) {
    var r = a_(e), n = r.root, i = r.weight, a = r.directed, s = r.harmonic;
    n = this.filter(n)[0];
    for (var o = this.dijkstra({
      root: n,
      weight: i,
      directed: a
    }), l = 0, u = this.nodes(), h = 0; h < u.length; h++) {
      var d = u[h];
      if (!d.same(n)) {
        var f = o.distanceTo(d);
        s ? l += 1 / f : l += f;
      }
    }
    return s ? l : 1 / l;
  }
  // closenessCentrality
};
Bh.cc = Bh.closenessCentrality;
Bh.ccn = Bh.closenessCentralityNormalised = Bh.closenessCentralityNormalized;
var oye = di({
  weight: null,
  directed: !1
}), cT = {
  // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes
  betweennessCentrality: function(e) {
    for (var r = oye(e), n = r.directed, i = r.weight, a = i != null, s = this.cy(), o = this.nodes(), l = {}, u = {}, h = 0, d = {
      set: function(w, T) {
        u[w] = T, T > h && (h = T);
      },
      get: function(w) {
        return u[w];
      }
    }, f = 0; f < o.length; f++) {
      var p = o[f], g = p.id();
      n ? l[g] = p.outgoers().nodes() : l[g] = p.openNeighborhood().nodes(), d.set(g, 0);
    }
    for (var m = function() {
      for (var w = o[v].id(), T = [], E = {}, C = {}, k = {}, _ = new r1(function(ee, Y) {
        return k[ee] - k[Y];
      }), L = 0; L < o.length; L++) {
        var N = o[L].id();
        E[N] = [], C[N] = 0, k[N] = 1 / 0;
      }
      for (C[w] = 1, k[w] = 0, _.push(w); !_.empty(); ) {
        var A = _.pop();
        if (T.push(A), a)
          for (var O = 0; O < l[A].length; O++) {
            var P = l[A][O], S = s.getElementById(A), R = void 0;
            S.edgesTo(P).length > 0 ? R = S.edgesTo(P)[0] : R = P.edgesTo(S)[0];
            var I = i(R);
            P = P.id(), k[P] > k[A] + I && (k[P] = k[A] + I, _.nodes.indexOf(P) < 0 ? _.push(P) : _.updateItem(P), C[P] = 0, E[P] = []), k[P] == k[A] + I && (C[P] = C[P] + C[A], E[P].push(A));
          }
        else
          for (var D = 0; D < l[A].length; D++) {
            var M = l[A][D].id();
            k[M] == 1 / 0 && (_.push(M), k[M] = k[A] + 1), k[M] == k[A] + 1 && (C[M] = C[M] + C[A], E[M].push(A));
          }
      }
      for (var B = {}, $ = 0; $ < o.length; $++)
        B[o[$].id()] = 0;
      for (; T.length > 0; ) {
        for (var F = T.pop(), G = 0; G < E[F].length; G++) {
          var H = E[F][G];
          B[H] = B[H] + C[H] / C[F] * (1 + B[F]);
        }
        F != o[v].id() && d.set(F, d.get(F) + B[F]);
      }
    }, v = 0; v < o.length; v++)
      m();
    var y = {
      betweenness: function(w) {
        var T = s.collection(w).id();
        return d.get(T);
      },
      betweennessNormalized: function(w) {
        if (h == 0)
          return 0;
        var T = s.collection(w).id();
        return d.get(T) / h;
      }
    };
    return y.betweennessNormalised = y.betweennessNormalized, y;
  }
  // betweennessCentrality
};
cT.bc = cT.betweennessCentrality;
var lye = di({
  expandFactor: 2,
  // affects time of computation and cluster granularity to some extent: M * M
  inflateFactor: 2,
  // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j)
  multFactor: 1,
  // optional self loops for each node. Use a neutral value to improve cluster computations.
  maxIterations: 20,
  // maximum number of iterations of the MCL algorithm in a single run
  attributes: [
    // attributes/features used to group nodes, ie. similarity values between nodes
    function(t) {
      return 1;
    }
  ]
}), cye = function(e) {
  return lye(e);
}, uye = function(e, r) {
  for (var n = 0, i = 0; i < r.length; i++)
    n += r[i](e);
  return n;
}, hye = function(e, r, n) {
  for (var i = 0; i < r; i++)
    e[i * r + i] = n;
}, LV = function(e, r) {
  for (var n, i = 0; i < r; i++) {
    n = 0;
    for (var a = 0; a < r; a++)
      n += e[a * r + i];
    for (var s = 0; s < r; s++)
      e[s * r + i] = e[s * r + i] / n;
  }
}, dye = function(e, r, n) {
  for (var i = new Array(n * n), a = 0; a < n; a++) {
    for (var s = 0; s < n; s++)
      i[a * n + s] = 0;
    for (var o = 0; o < n; o++)
      for (var l = 0; l < n; l++)
        i[a * n + l] += e[a * n + o] * r[o * n + l];
  }
  return i;
}, fye = function(e, r, n) {
  for (var i = e.slice(0), a = 1; a < n; a++)
    e = dye(e, i, r);
  return e;
}, pye = function(e, r, n) {
  for (var i = new Array(r * r), a = 0; a < r * r; a++)
    i[a] = Math.pow(e[a], n);
  return LV(i, r), i;
}, gye = function(e, r, n, i) {
  for (var a = 0; a < n; a++) {
    var s = Math.round(e[a] * Math.pow(10, i)) / Math.pow(10, i), o = Math.round(r[a] * Math.pow(10, i)) / Math.pow(10, i);
    if (s !== o)
      return !1;
  }
  return !0;
}, mye = function(e, r, n, i) {
  for (var a = [], s = 0; s < r; s++) {
    for (var o = [], l = 0; l < r; l++)
      Math.round(e[s * r + l] * 1e3) / 1e3 > 0 && o.push(n[l]);
    o.length !== 0 && a.push(i.collection(o));
  }
  return a;
}, vye = function(e, r) {
  for (var n = 0; n < e.length; n++)
    if (!r[n] || e[n].id() !== r[n].id())
      return !1;
  return !0;
}, yye = function(e) {
  for (var r = 0; r < e.length; r++)
    for (var n = 0; n < e.length; n++)
      r != n && vye(e[r], e[n]) && e.splice(n, 1);
  return e;
}, s_ = function(e) {
  for (var r = this.nodes(), n = this.edges(), i = this.cy(), a = cye(e), s = {}, o = 0; o < r.length; o++)
    s[r[o].id()] = o;
  for (var l = r.length, u = l * l, h = new Array(u), d, f = 0; f < u; f++)
    h[f] = 0;
  for (var p = 0; p < n.length; p++) {
    var g = n[p], m = s[g.source().id()], v = s[g.target().id()], y = uye(g, a.attributes);
    h[m * l + v] += y, h[v * l + m] += y;
  }
  hye(h, l, a.multFactor), LV(h, l);
  for (var b = !0, w = 0; b && w < a.maxIterations; )
    b = !1, d = fye(h, l, a.expandFactor), h = pye(d, l, a.inflateFactor), gye(h, d, u, 4) || (b = !0), w++;
  var T = mye(h, l, r, i);
  return T = yye(T), T;
}, xye = {
  markovClustering: s_,
  mcl: s_
}, bye = function(e) {
  return e;
}, RV = function(e, r) {
  return Math.abs(r - e);
}, o_ = function(e, r, n) {
  return e + RV(r, n);
}, l_ = function(e, r, n) {
  return e + Math.pow(n - r, 2);
}, wye = function(e) {
  return Math.sqrt(e);
}, Tye = function(e, r, n) {
  return Math.max(e, RV(r, n));
}, a0 = function(e, r, n, i, a) {
  for (var s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : bye, o = i, l, u, h = 0; h < e; h++)
    l = r(h), u = n(h), o = a(o, l, u);
  return s(o);
}, lf = {
  euclidean: function(e, r, n) {
    return e >= 2 ? a0(e, r, n, 0, l_, wye) : a0(e, r, n, 0, o_);
  },
  squaredEuclidean: function(e, r, n) {
    return a0(e, r, n, 0, l_);
  },
  manhattan: function(e, r, n) {
    return a0(e, r, n, 0, o_);
  },
  max: function(e, r, n) {
    return a0(e, r, n, -1 / 0, Tye);
  }
};
lf["squared-euclidean"] = lf.squaredEuclidean;
lf.squaredeuclidean = lf.squaredEuclidean;
function Dx(t, e, r, n, i, a) {
  var s;
  return nn(t) ? s = t : s = lf[t] || lf.euclidean, e === 0 && nn(t) ? s(i, a) : s(e, r, n, i, a);
}
var Eye = di({
  k: 2,
  m: 2,
  sensitivityThreshold: 1e-4,
  distance: "euclidean",
  maxIterations: 10,
  attributes: [],
  testMode: !1,
  testCentroids: null
}), Jk = function(e) {
  return Eye(e);
}, $y = function(e, r, n, i, a) {
  var s = a !== "kMedoids", o = s ? function(d) {
    return n[d];
  } : function(d) {
    return i[d](n);
  }, l = function(f) {
    return i[f](r);
  }, u = n, h = r;
  return Dx(e, i.length, o, l, u, h);
}, q4 = function(e, r, n) {
  for (var i = n.length, a = new Array(i), s = new Array(i), o = new Array(r), l = null, u = 0; u < i; u++)
    a[u] = e.min(n[u]).value, s[u] = e.max(n[u]).value;
  for (var h = 0; h < r; h++) {
    l = [];
    for (var d = 0; d < i; d++)
      l[d] = Math.random() * (s[d] - a[d]) + a[d];
    o[h] = l;
  }
  return o;
}, NV = function(e, r, n, i, a) {
  for (var s = 1 / 0, o = 0, l = 0; l < r.length; l++) {
    var u = $y(n, e, r[l], i, a);
    u < s && (s = u, o = l);
  }
  return o;
}, MV = function(e, r, n) {
  for (var i = [], a = null, s = 0; s < r.length; s++)
    a = r[s], n[a.id()] === e && i.push(a);
  return i;
}, kye = function(e, r, n) {
  return Math.abs(r - e) <= n;
}, Sye = function(e, r, n) {
  for (var i = 0; i < e.length; i++)
    for (var a = 0; a < e[i].length; a++) {
      var s = Math.abs(e[i][a] - r[i][a]);
      if (s > n)
        return !1;
    }
  return !0;
}, Cye = function(e, r, n) {
  for (var i = 0; i < n; i++)
    if (e === r[i]) return !0;
  return !1;
}, c_ = function(e, r) {
  var n = new Array(r);
  if (e.length < 50)
    for (var i = 0; i < r; i++) {
      for (var a = e[Math.floor(Math.random() * e.length)]; Cye(a, n, i); )
        a = e[Math.floor(Math.random() * e.length)];
      n[i] = a;
    }
  else
    for (var s = 0; s < r; s++)
      n[s] = e[Math.floor(Math.random() * e.length)];
  return n;
}, u_ = function(e, r, n) {
  for (var i = 0, a = 0; a < r.length; a++)
    i += $y("manhattan", r[a], e, n, "kMedoids");
  return i;
}, Aye = function(e) {
  var r = this.cy(), n = this.nodes(), i = null, a = Jk(e), s = new Array(a.k), o = {}, l;
  a.testMode ? typeof a.testCentroids == "number" ? (a.testCentroids, l = q4(n, a.k, a.attributes)) : zn(a.testCentroids) === "object" ? l = a.testCentroids : l = q4(n, a.k, a.attributes) : l = q4(n, a.k, a.attributes);
  for (var u = !0, h = 0; u && h < a.maxIterations; ) {
    for (var d = 0; d < n.length; d++)
      i = n[d], o[i.id()] = NV(i, l, a.distance, a.attributes, "kMeans");
    u = !1;
    for (var f = 0; f < a.k; f++) {
      var p = MV(f, n, o);
      if (p.length !== 0) {
        for (var g = a.attributes.length, m = l[f], v = new Array(g), y = new Array(g), b = 0; b < g; b++) {
          y[b] = 0;
          for (var w = 0; w < p.length; w++)
            i = p[w], y[b] += a.attributes[b](i);
          v[b] = y[b] / p.length, kye(v[b], m[b], a.sensitivityThreshold) || (u = !0);
        }
        l[f] = v, s[f] = r.collection(p);
      }
    }
    h++;
  }
  return s;
}, _ye = function(e) {
  var r = this.cy(), n = this.nodes(), i = null, a = Jk(e), s = new Array(a.k), o, l = {}, u, h = new Array(a.k);
  a.testMode ? typeof a.testCentroids == "number" || (zn(a.testCentroids) === "object" ? o = a.testCentroids : o = c_(n, a.k)) : o = c_(n, a.k);
  for (var d = !0, f = 0; d && f < a.maxIterations; ) {
    for (var p = 0; p < n.length; p++)
      i = n[p], l[i.id()] = NV(i, o, a.distance, a.attributes, "kMedoids");
    d = !1;
    for (var g = 0; g < o.length; g++) {
      var m = MV(g, n, l);
      if (m.length !== 0) {
        h[g] = u_(o[g], m, a.attributes);
        for (var v = 0; v < m.length; v++)
          u = u_(m[v], m, a.attributes), u < h[g] && (h[g] = u, o[g] = m[v], d = !0);
        s[g] = r.collection(m);
      }
    }
    f++;
  }
  return s;
}, Lye = function(e, r, n, i, a) {
  for (var s, o, l = 0; l < r.length; l++)
    for (var u = 0; u < e.length; u++)
      i[l][u] = Math.pow(n[l][u], a.m);
  for (var h = 0; h < e.length; h++)
    for (var d = 0; d < a.attributes.length; d++) {
      s = 0, o = 0;
      for (var f = 0; f < r.length; f++)
        s += i[f][h] * a.attributes[d](r[f]), o += i[f][h];
      e[h][d] = s / o;
    }
}, Rye = function(e, r, n, i, a) {
  for (var s = 0; s < e.length; s++)
    r[s] = e[s].slice();
  for (var o, l, u, h = 2 / (a.m - 1), d = 0; d < n.length; d++)
    for (var f = 0; f < i.length; f++) {
      o = 0;
      for (var p = 0; p < n.length; p++)
        l = $y(a.distance, i[f], n[d], a.attributes, "cmeans"), u = $y(a.distance, i[f], n[p], a.attributes, "cmeans"), o += Math.pow(l / u, h);
      e[f][d] = 1 / o;
    }
}, Nye = function(e, r, n, i) {
  for (var a = new Array(n.k), s = 0; s < a.length; s++)
    a[s] = [];
  for (var o, l, u = 0; u < r.length; u++) {
    o = -1 / 0, l = -1;
    for (var h = 0; h < r[0].length; h++)
      r[u][h] > o && (o = r[u][h], l = h);
    a[l].push(e[u]);
  }
  for (var d = 0; d < a.length; d++)
    a[d] = i.collection(a[d]);
  return a;
}, h_ = function(e) {
  var r = this.cy(), n = this.nodes(), i = Jk(e), a, s, o, l, u;
  l = new Array(n.length);
  for (var h = 0; h < n.length; h++)
    l[h] = new Array(i.k);
  o = new Array(n.length);
  for (var d = 0; d < n.length; d++)
    o[d] = new Array(i.k);
  for (var f = 0; f < n.length; f++) {
    for (var p = 0, g = 0; g < i.k; g++)
      o[f][g] = Math.random(), p += o[f][g];
    for (var m = 0; m < i.k; m++)
      o[f][m] = o[f][m] / p;
  }
  s = new Array(i.k);
  for (var v = 0; v < i.k; v++)
    s[v] = new Array(i.attributes.length);
  u = new Array(n.length);
  for (var y = 0; y < n.length; y++)
    u[y] = new Array(i.k);
  for (var b = !0, w = 0; b && w < i.maxIterations; )
    b = !1, Lye(s, n, o, u, i), Rye(o, l, s, n, i), Sye(o, l, i.sensitivityThreshold) || (b = !0), w++;
  return a = Nye(n, o, i, r), {
    clusters: a,
    degreeOfMembership: o
  };
}, Mye = {
  kMeans: Aye,
  kMedoids: _ye,
  fuzzyCMeans: h_,
  fcm: h_
}, Dye = di({
  distance: "euclidean",
  // distance metric to compare nodes
  linkage: "min",
  // linkage criterion : how to determine the distance between clusters of nodes
  mode: "threshold",
  // mode:'threshold' => clusters must be threshold distance apart
  threshold: 1 / 0,
  // the distance threshold
  // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters
  addDendrogram: !1,
  // whether to add the dendrogram to the graph for viz
  dendrogramDepth: 0,
  // depth at which dendrogram branches are merged into the returned clusters
  attributes: []
  // array of attr functions
}), Iye = {
  single: "min",
  complete: "max"
}, Oye = function(e) {
  var r = Dye(e), n = Iye[r.linkage];
  return n != null && (r.linkage = n), r;
}, d_ = function(e, r, n, i, a) {
  for (var s = 0, o = 1 / 0, l, u = a.attributes, h = function(L, N) {
    return Dx(a.distance, u.length, function(A) {
      return u[A](L);
    }, function(A) {
      return u[A](N);
    }, L, N);
  }, d = 0; d < e.length; d++) {
    var f = e[d].key, p = n[f][i[f]];
    p < o && (s = f, o = p);
  }
  if (a.mode === "threshold" && o >= a.threshold || a.mode === "dendrogram" && e.length === 1)
    return !1;
  var g = r[s], m = r[i[s]], v;
  a.mode === "dendrogram" ? v = {
    left: g,
    right: m,
    key: g.key
  } : v = {
    value: g.value.concat(m.value),
    key: g.key
  }, e[g.index] = v, e.splice(m.index, 1), r[g.key] = v;
  for (var y = 0; y < e.length; y++) {
    var b = e[y];
    g.key === b.key ? l = 1 / 0 : a.linkage === "min" ? (l = n[g.key][b.key], n[g.key][b.key] > n[m.key][b.key] && (l = n[m.key][b.key])) : a.linkage === "max" ? (l = n[g.key][b.key], n[g.key][b.key] < n[m.key][b.key] && (l = n[m.key][b.key])) : a.linkage === "mean" ? l = (n[g.key][b.key] * g.size + n[m.key][b.key] * m.size) / (g.size + m.size) : a.mode === "dendrogram" ? l = h(b.value, g.value) : l = h(b.value[0], g.value[0]), n[g.key][b.key] = n[b.key][g.key] = l;
  }
  for (var w = 0; w < e.length; w++) {
    var T = e[w].key;
    if (i[T] === g.key || i[T] === m.key) {
      for (var E = T, C = 0; C < e.length; C++) {
        var k = e[C].key;
        n[T][k] < n[T][E] && (E = k);
      }
      i[T] = E;
    }
    e[w].index = w;
  }
  return g.key = m.key = g.index = m.index = null, !0;
}, Eh = function(e, r, n) {
  e && (e.value ? r.push(e.value) : (e.left && Eh(e.left, r), e.right && Eh(e.right, r)));
}, uT = function(e, r) {
  if (!e) return "";
  if (e.left && e.right) {
    var n = uT(e.left, r), i = uT(e.right, r), a = r.add({
      group: "nodes",
      data: {
        id: n + "," + i
      }
    });
    return r.add({
      group: "edges",
      data: {
        source: n,
        target: a.id()
      }
    }), r.add({
      group: "edges",
      data: {
        source: i,
        target: a.id()
      }
    }), a.id();
  } else if (e.value)
    return e.value.id();
}, hT = function(e, r, n) {
  if (!e) return [];
  var i = [], a = [], s = [];
  return r === 0 ? (e.left && Eh(e.left, i), e.right && Eh(e.right, a), s = i.concat(a), [n.collection(s)]) : r === 1 ? e.value ? [n.collection(e.value)] : (e.left && Eh(e.left, i), e.right && Eh(e.right, a), [n.collection(i), n.collection(a)]) : e.value ? [n.collection(e.value)] : (e.left && (i = hT(e.left, r - 1, n)), e.right && (a = hT(e.right, r - 1, n)), i.concat(a));
}, f_ = function(e) {
  for (var r = this.cy(), n = this.nodes(), i = Oye(e), a = i.attributes, s = function(w, T) {
    return Dx(i.distance, a.length, function(E) {
      return a[E](w);
    }, function(E) {
      return a[E](T);
    }, w, T);
  }, o = [], l = [], u = [], h = [], d = 0; d < n.length; d++) {
    var f = {
      value: i.mode === "dendrogram" ? n[d] : [n[d]],
      key: d,
      index: d
    };
    o[d] = f, h[d] = f, l[d] = [], u[d] = 0;
  }
  for (var p = 0; p < o.length; p++)
    for (var g = 0; g <= p; g++) {
      var m = void 0;
      i.mode === "dendrogram" ? m = p === g ? 1 / 0 : s(o[p].value, o[g].value) : m = p === g ? 1 / 0 : s(o[p].value[0], o[g].value[0]), l[p][g] = m, l[g][p] = m, m < l[p][u[p]] && (u[p] = g);
    }
  for (var v = d_(o, h, l, u, i); v; )
    v = d_(o, h, l, u, i);
  var y;
  return i.mode === "dendrogram" ? (y = hT(o[0], i.dendrogramDepth, r), i.addDendrogram && uT(o[0], r)) : (y = new Array(o.length), o.forEach(function(b, w) {
    b.key = b.index = null, y[w] = r.collection(b.value);
  })), y;
}, Pye = {
  hierarchicalClustering: f_,
  hca: f_
}, Bye = di({
  distance: "euclidean",
  // distance metric to compare attributes between two nodes
  preference: "median",
  // suitability of a data point to serve as an exemplar
  damping: 0.8,
  // damping factor between [0.5, 1)
  maxIterations: 1e3,
  // max number of iterations to run
  minIterations: 100,
  // min number of iterations to run in order for clustering to stop
  attributes: [
    // functions to quantify the similarity between any two points
    // e.g. node => node.data('weight')
  ]
}), Fye = function(e) {
  var r = e.damping, n = e.preference;
  0.5 <= r && r < 1 || Kr("Damping must range on [0.5, 1).  Got: ".concat(r));
  var i = ["median", "mean", "min", "max"];
  return i.some(function(a) {
    return a === n;
  }) || vt(n) || Kr("Preference must be one of [".concat(i.map(function(a) {
    return "'".concat(a, "'");
  }).join(", "), "] or a number.  Got: ").concat(n)), Bye(e);
}, $ye = function(e, r, n, i) {
  var a = function(o, l) {
    return i[l](o);
  };
  return -Dx(e, i.length, function(s) {
    return a(r, s);
  }, function(s) {
    return a(n, s);
  }, r, n);
}, zye = function(e, r) {
  var n = null;
  return r === "median" ? n = Fve(e) : r === "mean" ? n = Bve(e) : r === "min" ? n = Ove(e) : r === "max" ? n = Pve(e) : n = r, n;
}, Vye = function(e, r, n) {
  for (var i = [], a = 0; a < e; a++)
    r[a * e + a] + n[a * e + a] > 0 && i.push(a);
  return i;
}, p_ = function(e, r, n) {
  for (var i = [], a = 0; a < e; a++) {
    for (var s = -1, o = -1 / 0, l = 0; l < n.length; l++) {
      var u = n[l];
      r[a * e + u] > o && (s = u, o = r[a * e + u]);
    }
    s > 0 && i.push(s);
  }
  for (var h = 0; h < n.length; h++)
    i[n[h]] = n[h];
  return i;
}, Gye = function(e, r, n) {
  for (var i = p_(e, r, n), a = 0; a < n.length; a++) {
    for (var s = [], o = 0; o < i.length; o++)
      i[o] === n[a] && s.push(o);
    for (var l = -1, u = -1 / 0, h = 0; h < s.length; h++) {
      for (var d = 0, f = 0; f < s.length; f++)
        d += r[s[f] * e + s[h]];
      d > u && (l = h, u = d);
    }
    n[a] = s[l];
  }
  return i = p_(e, r, n), i;
}, g_ = function(e) {
  for (var r = this.cy(), n = this.nodes(), i = Fye(e), a = {}, s = 0; s < n.length; s++)
    a[n[s].id()] = s;
  var o, l, u, h, d, f;
  o = n.length, l = o * o, u = new Array(l);
  for (var p = 0; p < l; p++)
    u[p] = -1 / 0;
  for (var g = 0; g < o; g++)
    for (var m = 0; m < o; m++)
      g !== m && (u[g * o + m] = $ye(i.distance, n[g], n[m], i.attributes));
  h = zye(u, i.preference);
  for (var v = 0; v < o; v++)
    u[v * o + v] = h;
  d = new Array(l);
  for (var y = 0; y < l; y++)
    d[y] = 0;
  f = new Array(l);
  for (var b = 0; b < l; b++)
    f[b] = 0;
  for (var w = new Array(o), T = new Array(o), E = new Array(o), C = 0; C < o; C++)
    w[C] = 0, T[C] = 0, E[C] = 0;
  for (var k = new Array(o * i.minIterations), _ = 0; _ < k.length; _++)
    k[_] = 0;
  var L;
  for (L = 0; L < i.maxIterations; L++) {
    for (var N = 0; N < o; N++) {
      for (var A = -1 / 0, O = -1 / 0, P = -1, S = 0, R = 0; R < o; R++)
        w[R] = d[N * o + R], S = f[N * o + R] + u[N * o + R], S >= A ? (O = A, A = S, P = R) : S > O && (O = S);
      for (var I = 0; I < o; I++)
        d[N * o + I] = (1 - i.damping) * (u[N * o + I] - A) + i.damping * w[I];
      d[N * o + P] = (1 - i.damping) * (u[N * o + P] - O) + i.damping * w[P];
    }
    for (var D = 0; D < o; D++) {
      for (var M = 0, B = 0; B < o; B++)
        w[B] = f[B * o + D], T[B] = Math.max(0, d[B * o + D]), M += T[B];
      M -= T[D], T[D] = d[D * o + D], M += T[D];
      for (var $ = 0; $ < o; $++)
        f[$ * o + D] = (1 - i.damping) * Math.min(0, M - T[$]) + i.damping * w[$];
      f[D * o + D] = (1 - i.damping) * (M - T[D]) + i.damping * w[D];
    }
    for (var F = 0, G = 0; G < o; G++) {
      var H = f[G * o + G] + d[G * o + G] > 0 ? 1 : 0;
      k[L % i.minIterations * o + G] = H, F += H;
    }
    if (F > 0 && (L >= i.minIterations - 1 || L == i.maxIterations - 1)) {
      for (var ee = 0, Y = 0; Y < o; Y++) {
        E[Y] = 0;
        for (var re = 0; re < i.minIterations; re++)
          E[Y] += k[re * o + Y];
        (E[Y] === 0 || E[Y] === i.minIterations) && ee++;
      }
      if (ee === o)
        break;
    }
  }
  for (var ne = Vye(o, d, f), he = Gye(o, u, ne), K = {}, Z = 0; Z < ne.length; Z++)
    K[ne[Z]] = [];
  for (var X = 0; X < n.length; X++) {
    var q = a[n[X].id()], J = he[q];
    J != null && K[J].push(n[X]);
  }
  for (var j = new Array(ne.length), pe = 0; pe < ne.length; pe++)
    j[pe] = r.collection(K[ne[pe]]);
  return j;
}, Uye = {
  affinityPropagation: g_,
  ap: g_
}, Wye = di({
  root: void 0,
  directed: !1
}), Hye = {
  hierholzer: function(e) {
    if (!vr(e)) {
      var r = arguments;
      e = {
        root: r[0],
        directed: r[1]
      };
    }
    var n = Wye(e), i = n.root, a = n.directed, s = this, o = !1, l, u, h;
    i && (h = Bt(i) ? this.filter(i)[0].id() : i[0].id());
    var d = {}, f = {};
    a ? s.forEach(function(b) {
      var w = b.id();
      if (b.isNode()) {
        var T = b.indegree(!0), E = b.outdegree(!0), C = T - E, k = E - T;
        C == 1 ? l ? o = !0 : l = w : k == 1 ? u ? o = !0 : u = w : (k > 1 || C > 1) && (o = !0), d[w] = [], b.outgoers().forEach(function(_) {
          _.isEdge() && d[w].push(_.id());
        });
      } else
        f[w] = [void 0, b.target().id()];
    }) : s.forEach(function(b) {
      var w = b.id();
      if (b.isNode()) {
        var T = b.degree(!0);
        T % 2 && (l ? u ? o = !0 : u = w : l = w), d[w] = [], b.connectedEdges().forEach(function(E) {
          return d[w].push(E.id());
        });
      } else
        f[w] = [b.source().id(), b.target().id()];
    });
    var p = {
      found: !1,
      trail: void 0
    };
    if (o) return p;
    if (u && l)
      if (a) {
        if (h && u != h)
          return p;
        h = u;
      } else {
        if (h && u != h && l != h)
          return p;
        h || (h = u);
      }
    else
      h || (h = s[0].id());
    var g = function(w) {
      for (var T = w, E = [w], C, k, _; d[T].length; )
        C = d[T].shift(), k = f[C][0], _ = f[C][1], T != _ ? (d[_] = d[_].filter(function(L) {
          return L != C;
        }), T = _) : !a && T != k && (d[k] = d[k].filter(function(L) {
          return L != C;
        }), T = k), E.unshift(C), E.unshift(T);
      return E;
    }, m = [], v = [];
    for (v = g(h); v.length != 1; )
      d[v[0]].length == 0 ? (m.unshift(s.getElementById(v.shift())), m.unshift(s.getElementById(v.shift()))) : v = g(v.shift()).concat(v);
    m.unshift(s.getElementById(v.shift()));
    for (var y in d)
      if (d[y].length)
        return p;
    return p.found = !0, p.trail = this.spawn(m, !0), p;
  }
}, J1 = function() {
  var e = this, r = {}, n = 0, i = 0, a = [], s = [], o = {}, l = function(f, p) {
    for (var g = s.length - 1, m = [], v = e.spawn(); s[g].x != f || s[g].y != p; )
      m.push(s.pop().edge), g--;
    m.push(s.pop().edge), m.forEach(function(y) {
      var b = y.connectedNodes().intersection(e);
      v.merge(y), b.forEach(function(w) {
        var T = w.id(), E = w.connectedEdges().intersection(e);
        v.merge(w), r[T].cutVertex ? v.merge(E.filter(function(C) {
          return C.isLoop();
        })) : v.merge(E);
      });
    }), a.push(v);
  }, u = function(f, p, g) {
    f === g && (i += 1), r[p] = {
      id: n,
      low: n++,
      cutVertex: !1
    };
    var m = e.getElementById(p).connectedEdges().intersection(e);
    if (m.size() === 0)
      a.push(e.spawn(e.getElementById(p)));
    else {
      var v, y, b, w;
      m.forEach(function(T) {
        v = T.source().id(), y = T.target().id(), b = v === p ? y : v, b !== g && (w = T.id(), o[w] || (o[w] = !0, s.push({
          x: p,
          y: b,
          edge: T
        })), b in r ? r[p].low = Math.min(r[p].low, r[b].id) : (u(f, b, p), r[p].low = Math.min(r[p].low, r[b].low), r[p].id <= r[b].low && (r[p].cutVertex = !0, l(p, b))));
      });
    }
  };
  e.forEach(function(d) {
    if (d.isNode()) {
      var f = d.id();
      f in r || (i = 0, u(f, f), r[f].cutVertex = i > 1);
    }
  });
  var h = Object.keys(r).filter(function(d) {
    return r[d].cutVertex;
  }).map(function(d) {
    return e.getElementById(d);
  });
  return {
    cut: e.spawn(h),
    components: a
  };
}, qye = {
  hopcroftTarjanBiconnected: J1,
  htbc: J1,
  htb: J1,
  hopcroftTarjanBiconnectedComponents: J1
}, em = function() {
  var e = this, r = {}, n = 0, i = [], a = [], s = e.spawn(e), o = function(u) {
    a.push(u), r[u] = {
      index: n,
      low: n++,
      explored: !1
    };
    var h = e.getElementById(u).connectedEdges().intersection(e);
    if (h.forEach(function(m) {
      var v = m.target().id();
      v !== u && (v in r || o(v), r[v].explored || (r[u].low = Math.min(r[u].low, r[v].low)));
    }), r[u].index === r[u].low) {
      for (var d = e.spawn(); ; ) {
        var f = a.pop();
        if (d.merge(e.getElementById(f)), r[f].low = r[u].index, r[f].explored = !0, f === u)
          break;
      }
      var p = d.edgesWith(d), g = d.merge(p);
      i.push(g), s = s.difference(g);
    }
  };
  return e.forEach(function(l) {
    if (l.isNode()) {
      var u = l.id();
      u in r || o(u);
    }
  }), {
    cut: s,
    components: i
  };
}, Yye = {
  tarjanStronglyConnected: em,
  tsc: em,
  tscc: em,
  tarjanStronglyConnectedComponents: em
}, DV = {};
[sg, Eve, kve, Cve, _ve, Rve, Dve, sye, Ph, Bh, cT, xye, Mye, Pye, Uye, Hye, qye, Yye].forEach(function(t) {
  Gt(DV, t);
});
/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/
var IV = 0, OV = 1, PV = 2, ks = function(e) {
  if (!(this instanceof ks)) return new ks(e);
  this.id = "Thenable/1.0.7", this.state = IV, this.fulfillValue = void 0, this.rejectReason = void 0, this.onFulfilled = [], this.onRejected = [], this.proxy = {
    then: this.then.bind(this)
  }, typeof e == "function" && e.call(this, this.fulfill.bind(this), this.reject.bind(this));
};
ks.prototype = {
  /*  promise resolving methods  */
  fulfill: function(e) {
    return m_(this, OV, "fulfillValue", e);
  },
  reject: function(e) {
    return m_(this, PV, "rejectReason", e);
  },
  /*  "The then Method" [Promises/A+ 1.1, 1.2, 2.2]  */
  then: function(e, r) {
    var n = this, i = new ks();
    return n.onFulfilled.push(y_(e, i, "fulfill")), n.onRejected.push(y_(r, i, "reject")), BV(n), i.proxy;
  }
};
var m_ = function(e, r, n, i) {
  return e.state === IV && (e.state = r, e[n] = i, BV(e)), e;
}, BV = function(e) {
  e.state === OV ? v_(e, "onFulfilled", e.fulfillValue) : e.state === PV && v_(e, "onRejected", e.rejectReason);
}, v_ = function(e, r, n) {
  if (e[r].length !== 0) {
    var i = e[r];
    e[r] = [];
    var a = function() {
      for (var o = 0; o < i.length; o++) i[o](n);
    };
    typeof setImmediate == "function" ? setImmediate(a) : setTimeout(a, 0);
  }
}, y_ = function(e, r, n) {
  return function(i) {
    if (typeof e != "function")
      r[n].call(r, i);
    else {
      var a;
      try {
        a = e(i);
      } catch (s) {
        r.reject(s);
        return;
      }
      FV(r, a);
    }
  };
}, FV = function(e, r) {
  if (e === r || e.proxy === r) {
    e.reject(new TypeError("cannot resolve promise with itself"));
    return;
  }
  var n;
  if (zn(r) === "object" && r !== null || typeof r == "function")
    try {
      n = r.then;
    } catch (a) {
      e.reject(a);
      return;
    }
  if (typeof n == "function") {
    var i = !1;
    try {
      n.call(
        r,
        /*  resolvePromise  */
        /*  [Promises/A+ 2.3.3.3.1]  */
        function(a) {
          i || (i = !0, a === r ? e.reject(new TypeError("circular thenable chain")) : FV(e, a));
        },
        /*  rejectPromise  */
        /*  [Promises/A+ 2.3.3.3.2]  */
        function(a) {
          i || (i = !0, e.reject(a));
        }
      );
    } catch (a) {
      i || e.reject(a);
    }
    return;
  }
  e.fulfill(r);
};
ks.all = function(t) {
  return new ks(function(e, r) {
    for (var n = new Array(t.length), i = 0, a = function(l, u) {
      n[l] = u, i++, i === t.length && e(n);
    }, s = 0; s < t.length; s++)
      (function(o) {
        var l = t[o], u = l != null && l.then != null;
        if (u)
          l.then(function(d) {
            a(o, d);
          }, function(d) {
            r(d);
          });
        else {
          var h = l;
          a(o, h);
        }
      })(s);
  });
};
ks.resolve = function(t) {
  return new ks(function(e, r) {
    e(t);
  });
};
ks.reject = function(t) {
  return new ks(function(e, r) {
    r(t);
  });
};
var Df = typeof Promise < "u" ? Promise : ks, dT = function(e, r, n) {
  var i = Uk(e), a = !i, s = this._private = Gt({
    duration: 1e3
  }, r, n);
  if (s.target = e, s.style = s.style || s.css, s.started = !1, s.playing = !1, s.hooked = !1, s.applying = !1, s.progress = 0, s.completes = [], s.frames = [], s.complete && nn(s.complete) && s.completes.push(s.complete), a) {
    var o = e.position();
    s.startPosition = s.startPosition || {
      x: o.x,
      y: o.y
    }, s.startStyle = s.startStyle || e.cy().style().getAnimationStartStyle(e, s.style);
  }
  if (i) {
    var l = e.pan();
    s.startPan = {
      x: l.x,
      y: l.y
    }, s.startZoom = e.zoom();
  }
  this.length = 1, this[0] = this;
}, vu = dT.prototype;
Gt(vu, {
  instanceString: function() {
    return "animation";
  },
  hook: function() {
    var e = this._private;
    if (!e.hooked) {
      var r, n = e.target._private.animation;
      e.queue ? r = n.queue : r = n.current, r.push(this), La(e.target) && e.target.cy().addToAnimationPool(e.target), e.hooked = !0;
    }
    return this;
  },
  play: function() {
    var e = this._private;
    return e.progress === 1 && (e.progress = 0), e.playing = !0, e.started = !1, e.stopped = !1, this.hook(), this;
  },
  playing: function() {
    return this._private.playing;
  },
  apply: function() {
    var e = this._private;
    return e.applying = !0, e.started = !1, e.stopped = !1, this.hook(), this;
  },
  applying: function() {
    return this._private.applying;
  },
  pause: function() {
    var e = this._private;
    return e.playing = !1, e.started = !1, this;
  },
  stop: function() {
    var e = this._private;
    return e.playing = !1, e.started = !1, e.stopped = !0, this;
  },
  rewind: function() {
    return this.progress(0);
  },
  fastforward: function() {
    return this.progress(1);
  },
  time: function(e) {
    var r = this._private;
    return e === void 0 ? r.progress * r.duration : this.progress(e / r.duration);
  },
  progress: function(e) {
    var r = this._private, n = r.playing;
    return e === void 0 ? r.progress : (n && this.pause(), r.progress = e, r.started = !1, n && this.play(), this);
  },
  completed: function() {
    return this._private.progress === 1;
  },
  reverse: function() {
    var e = this._private, r = e.playing;
    r && this.pause(), e.progress = 1 - e.progress, e.started = !1;
    var n = function(u, h) {
      var d = e[u];
      d != null && (e[u] = e[h], e[h] = d);
    };
    if (n("zoom", "startZoom"), n("pan", "startPan"), n("position", "startPosition"), e.style)
      for (var i = 0; i < e.style.length; i++) {
        var a = e.style[i], s = a.name, o = e.startStyle[s];
        e.startStyle[s] = a, e.style[i] = o;
      }
    return r && this.play(), this;
  },
  promise: function(e) {
    var r = this._private, n;
    switch (e) {
      case "frame":
        n = r.frames;
        break;
      default:
      case "complete":
      case "completed":
        n = r.completes;
    }
    return new Df(function(i, a) {
      n.push(function() {
        i();
      });
    });
  }
});
vu.complete = vu.completed;
vu.run = vu.play;
vu.running = vu.playing;
var Xye = {
  animated: function() {
    return function() {
      var r = this, n = r.length !== void 0, i = n ? r : [r], a = this._private.cy || this;
      if (!a.styleEnabled())
        return !1;
      var s = i[0];
      if (s)
        return s._private.animation.current.length > 0;
    };
  },
  // animated
  clearQueue: function() {
    return function() {
      var r = this, n = r.length !== void 0, i = n ? r : [r], a = this._private.cy || this;
      if (!a.styleEnabled())
        return this;
      for (var s = 0; s < i.length; s++) {
        var o = i[s];
        o._private.animation.queue = [];
      }
      return this;
    };
  },
  // clearQueue
  delay: function() {
    return function(r, n) {
      var i = this._private.cy || this;
      return i.styleEnabled() ? this.animate({
        delay: r,
        duration: r,
        complete: n
      }) : this;
    };
  },
  // delay
  delayAnimation: function() {
    return function(r, n) {
      var i = this._private.cy || this;
      return i.styleEnabled() ? this.animation({
        delay: r,
        duration: r,
        complete: n
      }) : this;
    };
  },
  // delay
  animation: function() {
    return function(r, n) {
      var i = this, a = i.length !== void 0, s = a ? i : [i], o = this._private.cy || this, l = !a, u = !l;
      if (!o.styleEnabled())
        return this;
      var h = o.style();
      r = Gt({}, r, n);
      var d = Object.keys(r).length === 0;
      if (d)
        return new dT(s[0], r);
      switch (r.duration === void 0 && (r.duration = 400), r.duration) {
        case "slow":
          r.duration = 600;
          break;
        case "fast":
          r.duration = 200;
          break;
      }
      if (u && (r.style = h.getPropsList(r.style || r.css), r.css = void 0), u && r.renderedPosition != null) {
        var f = r.renderedPosition, p = o.pan(), g = o.zoom();
        r.position = EV(f, g, p);
      }
      if (l && r.panBy != null) {
        var m = r.panBy, v = o.pan();
        r.pan = {
          x: v.x + m.x,
          y: v.y + m.y
        };
      }
      var y = r.center || r.centre;
      if (l && y != null) {
        var b = o.getCenterPan(y.eles, r.zoom);
        b != null && (r.pan = b);
      }
      if (l && r.fit != null) {
        var w = r.fit, T = o.getFitViewport(w.eles || w.boundingBox, w.padding);
        T != null && (r.pan = T.pan, r.zoom = T.zoom);
      }
      if (l && vr(r.zoom)) {
        var E = o.getZoomedViewport(r.zoom);
        E != null ? (E.zoomed && (r.zoom = E.zoom), E.panned && (r.pan = E.pan)) : r.zoom = null;
      }
      return new dT(s[0], r);
    };
  },
  // animate
  animate: function() {
    return function(r, n) {
      var i = this, a = i.length !== void 0, s = a ? i : [i], o = this._private.cy || this;
      if (!o.styleEnabled())
        return this;
      n && (r = Gt({}, r, n));
      for (var l = 0; l < s.length; l++) {
        var u = s[l], h = u.animated() && (r.queue === void 0 || r.queue), d = u.animation(r, h ? {
          queue: !0
        } : void 0);
        d.play();
      }
      return this;
    };
  },
  // animate
  stop: function() {
    return function(r, n) {
      var i = this, a = i.length !== void 0, s = a ? i : [i], o = this._private.cy || this;
      if (!o.styleEnabled())
        return this;
      for (var l = 0; l < s.length; l++) {
        for (var u = s[l], h = u._private, d = h.animation.current, f = 0; f < d.length; f++) {
          var p = d[f], g = p._private;
          n && (g.duration = 0);
        }
        r && (h.animation.queue = []), n || (h.animation.current = []);
      }
      return o.notify("draw"), this;
    };
  }
  // stop
}, Y4, x_;
function Ix() {
  if (x_) return Y4;
  x_ = 1;
  var t = Array.isArray;
  return Y4 = t, Y4;
}
var X4, b_;
function jye() {
  if (b_) return X4;
  b_ = 1;
  var t = Ix(), e = e1(), r = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, n = /^\w*$/;
  function i(a, s) {
    if (t(a))
      return !1;
    var o = typeof a;
    return o == "number" || o == "symbol" || o == "boolean" || a == null || e(a) ? !0 : n.test(a) || !r.test(a) || s != null && a in Object(s);
  }
  return X4 = i, X4;
}
var j4, w_;
function Kye() {
  if (w_) return j4;
  w_ = 1;
  var t = pV(), e = Jg(), r = "[object AsyncFunction]", n = "[object Function]", i = "[object GeneratorFunction]", a = "[object Proxy]";
  function s(o) {
    if (!e(o))
      return !1;
    var l = t(o);
    return l == n || l == i || l == r || l == a;
  }
  return j4 = s, j4;
}
var K4, T_;
function Zye() {
  if (T_) return K4;
  T_ = 1;
  var t = Rx(), e = t["__core-js_shared__"];
  return K4 = e, K4;
}
var Z4, E_;
function Qye() {
  if (E_) return Z4;
  E_ = 1;
  var t = Zye(), e = function() {
    var n = /[^.]+$/.exec(t && t.keys && t.keys.IE_PROTO || "");
    return n ? "Symbol(src)_1." + n : "";
  }();
  function r(n) {
    return !!e && e in n;
  }
  return Z4 = r, Z4;
}
var Q4, k_;
function Jye() {
  if (k_) return Q4;
  k_ = 1;
  var t = Function.prototype, e = t.toString;
  function r(n) {
    if (n != null) {
      try {
        return e.call(n);
      } catch {
      }
      try {
        return n + "";
      } catch {
      }
    }
    return "";
  }
  return Q4 = r, Q4;
}
var J4, S_;
function e2e() {
  if (S_) return J4;
  S_ = 1;
  var t = Kye(), e = Qye(), r = Jg(), n = Jye(), i = /[\\^$.*+?()[\]{}|]/g, a = /^\[object .+?Constructor\]$/, s = Function.prototype, o = Object.prototype, l = s.toString, u = o.hasOwnProperty, h = RegExp(
    "^" + l.call(u).replace(i, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  );
  function d(f) {
    if (!r(f) || e(f))
      return !1;
    var p = t(f) ? h : a;
    return p.test(n(f));
  }
  return J4 = d, J4;
}
var e3, C_;
function t2e() {
  if (C_) return e3;
  C_ = 1;
  function t(e, r) {
    return e == null ? void 0 : e[r];
  }
  return e3 = t, e3;
}
var t3, A_;
function eS() {
  if (A_) return t3;
  A_ = 1;
  var t = e2e(), e = t2e();
  function r(n, i) {
    var a = e(n, i);
    return t(a) ? a : void 0;
  }
  return t3 = r, t3;
}
var r3, __;
function Ox() {
  if (__) return r3;
  __ = 1;
  var t = eS(), e = t(Object, "create");
  return r3 = e, r3;
}
var n3, L_;
function r2e() {
  if (L_) return n3;
  L_ = 1;
  var t = Ox();
  function e() {
    this.__data__ = t ? t(null) : {}, this.size = 0;
  }
  return n3 = e, n3;
}
var i3, R_;
function n2e() {
  if (R_) return i3;
  R_ = 1;
  function t(e) {
    var r = this.has(e) && delete this.__data__[e];
    return this.size -= r ? 1 : 0, r;
  }
  return i3 = t, i3;
}
var a3, N_;
function i2e() {
  if (N_) return a3;
  N_ = 1;
  var t = Ox(), e = "__lodash_hash_undefined__", r = Object.prototype, n = r.hasOwnProperty;
  function i(a) {
    var s = this.__data__;
    if (t) {
      var o = s[a];
      return o === e ? void 0 : o;
    }
    return n.call(s, a) ? s[a] : void 0;
  }
  return a3 = i, a3;
}
var s3, M_;
function a2e() {
  if (M_) return s3;
  M_ = 1;
  var t = Ox(), e = Object.prototype, r = e.hasOwnProperty;
  function n(i) {
    var a = this.__data__;
    return t ? a[i] !== void 0 : r.call(a, i);
  }
  return s3 = n, s3;
}
var o3, D_;
function s2e() {
  if (D_) return o3;
  D_ = 1;
  var t = Ox(), e = "__lodash_hash_undefined__";
  function r(n, i) {
    var a = this.__data__;
    return this.size += this.has(n) ? 0 : 1, a[n] = t && i === void 0 ? e : i, this;
  }
  return o3 = r, o3;
}
var l3, I_;
function o2e() {
  if (I_) return l3;
  I_ = 1;
  var t = r2e(), e = n2e(), r = i2e(), n = a2e(), i = s2e();
  function a(s) {
    var o = -1, l = s == null ? 0 : s.length;
    for (this.clear(); ++o < l; ) {
      var u = s[o];
      this.set(u[0], u[1]);
    }
  }
  return a.prototype.clear = t, a.prototype.delete = e, a.prototype.get = r, a.prototype.has = n, a.prototype.set = i, l3 = a, l3;
}
var c3, O_;
function l2e() {
  if (O_) return c3;
  O_ = 1;
  function t() {
    this.__data__ = [], this.size = 0;
  }
  return c3 = t, c3;
}
var u3, P_;
function $V() {
  if (P_) return u3;
  P_ = 1;
  function t(e, r) {
    return e === r || e !== e && r !== r;
  }
  return u3 = t, u3;
}
var h3, B_;
function Px() {
  if (B_) return h3;
  B_ = 1;
  var t = $V();
  function e(r, n) {
    for (var i = r.length; i--; )
      if (t(r[i][0], n))
        return i;
    return -1;
  }
  return h3 = e, h3;
}
var d3, F_;
function c2e() {
  if (F_) return d3;
  F_ = 1;
  var t = Px(), e = Array.prototype, r = e.splice;
  function n(i) {
    var a = this.__data__, s = t(a, i);
    if (s < 0)
      return !1;
    var o = a.length - 1;
    return s == o ? a.pop() : r.call(a, s, 1), --this.size, !0;
  }
  return d3 = n, d3;
}
var f3, $_;
function u2e() {
  if ($_) return f3;
  $_ = 1;
  var t = Px();
  function e(r) {
    var n = this.__data__, i = t(n, r);
    return i < 0 ? void 0 : n[i][1];
  }
  return f3 = e, f3;
}
var p3, z_;
function h2e() {
  if (z_) return p3;
  z_ = 1;
  var t = Px();
  function e(r) {
    return t(this.__data__, r) > -1;
  }
  return p3 = e, p3;
}
var g3, V_;
function d2e() {
  if (V_) return g3;
  V_ = 1;
  var t = Px();
  function e(r, n) {
    var i = this.__data__, a = t(i, r);
    return a < 0 ? (++this.size, i.push([r, n])) : i[a][1] = n, this;
  }
  return g3 = e, g3;
}
var m3, G_;
function f2e() {
  if (G_) return m3;
  G_ = 1;
  var t = l2e(), e = c2e(), r = u2e(), n = h2e(), i = d2e();
  function a(s) {
    var o = -1, l = s == null ? 0 : s.length;
    for (this.clear(); ++o < l; ) {
      var u = s[o];
      this.set(u[0], u[1]);
    }
  }
  return a.prototype.clear = t, a.prototype.delete = e, a.prototype.get = r, a.prototype.has = n, a.prototype.set = i, m3 = a, m3;
}
var v3, U_;
function p2e() {
  if (U_) return v3;
  U_ = 1;
  var t = eS(), e = Rx(), r = t(e, "Map");
  return v3 = r, v3;
}
var y3, W_;
function g2e() {
  if (W_) return y3;
  W_ = 1;
  var t = o2e(), e = f2e(), r = p2e();
  function n() {
    this.size = 0, this.__data__ = {
      hash: new t(),
      map: new (r || e)(),
      string: new t()
    };
  }
  return y3 = n, y3;
}
var x3, H_;
function m2e() {
  if (H_) return x3;
  H_ = 1;
  function t(e) {
    var r = typeof e;
    return r == "string" || r == "number" || r == "symbol" || r == "boolean" ? e !== "__proto__" : e === null;
  }
  return x3 = t, x3;
}
var b3, q_;
function Bx() {
  if (q_) return b3;
  q_ = 1;
  var t = m2e();
  function e(r, n) {
    var i = r.__data__;
    return t(n) ? i[typeof n == "string" ? "string" : "hash"] : i.map;
  }
  return b3 = e, b3;
}
var w3, Y_;
function v2e() {
  if (Y_) return w3;
  Y_ = 1;
  var t = Bx();
  function e(r) {
    var n = t(this, r).delete(r);
    return this.size -= n ? 1 : 0, n;
  }
  return w3 = e, w3;
}
var T3, X_;
function y2e() {
  if (X_) return T3;
  X_ = 1;
  var t = Bx();
  function e(r) {
    return t(this, r).get(r);
  }
  return T3 = e, T3;
}
var E3, j_;
function x2e() {
  if (j_) return E3;
  j_ = 1;
  var t = Bx();
  function e(r) {
    return t(this, r).has(r);
  }
  return E3 = e, E3;
}
var k3, K_;
function b2e() {
  if (K_) return k3;
  K_ = 1;
  var t = Bx();
  function e(r, n) {
    var i = t(this, r), a = i.size;
    return i.set(r, n), this.size += i.size == a ? 0 : 1, this;
  }
  return k3 = e, k3;
}
var S3, Z_;
function w2e() {
  if (Z_) return S3;
  Z_ = 1;
  var t = g2e(), e = v2e(), r = y2e(), n = x2e(), i = b2e();
  function a(s) {
    var o = -1, l = s == null ? 0 : s.length;
    for (this.clear(); ++o < l; ) {
      var u = s[o];
      this.set(u[0], u[1]);
    }
  }
  return a.prototype.clear = t, a.prototype.delete = e, a.prototype.get = r, a.prototype.has = n, a.prototype.set = i, S3 = a, S3;
}
var C3, Q_;
function T2e() {
  if (Q_) return C3;
  Q_ = 1;
  var t = w2e(), e = "Expected a function";
  function r(n, i) {
    if (typeof n != "function" || i != null && typeof i != "function")
      throw new TypeError(e);
    var a = function() {
      var s = arguments, o = i ? i.apply(this, s) : s[0], l = a.cache;
      if (l.has(o))
        return l.get(o);
      var u = n.apply(this, s);
      return a.cache = l.set(o, u) || l, u;
    };
    return a.cache = new (r.Cache || t)(), a;
  }
  return r.Cache = t, C3 = r, C3;
}
var A3, J_;
function E2e() {
  if (J_) return A3;
  J_ = 1;
  var t = T2e(), e = 500;
  function r(n) {
    var i = t(n, function(s) {
      return a.size === e && a.clear(), s;
    }), a = i.cache;
    return i;
  }
  return A3 = r, A3;
}
var _3, e9;
function zV() {
  if (e9) return _3;
  e9 = 1;
  var t = E2e(), e = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, r = /\\(\\)?/g, n = t(function(i) {
    var a = [];
    return i.charCodeAt(0) === 46 && a.push(""), i.replace(e, function(s, o, l, u) {
      a.push(l ? u.replace(r, "$1") : o || s);
    }), a;
  });
  return _3 = n, _3;
}
var L3, t9;
function VV() {
  if (t9) return L3;
  t9 = 1;
  function t(e, r) {
    for (var n = -1, i = e == null ? 0 : e.length, a = Array(i); ++n < i; )
      a[n] = r(e[n], n, e);
    return a;
  }
  return L3 = t, L3;
}
var R3, r9;
function k2e() {
  if (r9) return R3;
  r9 = 1;
  var t = Hk(), e = VV(), r = Ix(), n = e1(), i = t ? t.prototype : void 0, a = i ? i.toString : void 0;
  function s(o) {
    if (typeof o == "string")
      return o;
    if (r(o))
      return e(o, s) + "";
    if (n(o))
      return a ? a.call(o) : "";
    var l = o + "";
    return l == "0" && 1 / o == -1 / 0 ? "-0" : l;
  }
  return R3 = s, R3;
}
var N3, n9;
function GV() {
  if (n9) return N3;
  n9 = 1;
  var t = k2e();
  function e(r) {
    return r == null ? "" : t(r);
  }
  return N3 = e, N3;
}
var M3, i9;
function UV() {
  if (i9) return M3;
  i9 = 1;
  var t = Ix(), e = jye(), r = zV(), n = GV();
  function i(a, s) {
    return t(a) ? a : e(a, s) ? [a] : r(n(a));
  }
  return M3 = i, M3;
}
var D3, a9;
function tS() {
  if (a9) return D3;
  a9 = 1;
  var t = e1();
  function e(r) {
    if (typeof r == "string" || t(r))
      return r;
    var n = r + "";
    return n == "0" && 1 / r == -1 / 0 ? "-0" : n;
  }
  return D3 = e, D3;
}
var I3, s9;
function S2e() {
  if (s9) return I3;
  s9 = 1;
  var t = UV(), e = tS();
  function r(n, i) {
    i = t(i, n);
    for (var a = 0, s = i.length; n != null && a < s; )
      n = n[e(i[a++])];
    return a && a == s ? n : void 0;
  }
  return I3 = r, I3;
}
var O3, o9;
function C2e() {
  if (o9) return O3;
  o9 = 1;
  var t = S2e();
  function e(r, n, i) {
    var a = r == null ? void 0 : t(r, n);
    return a === void 0 ? i : a;
  }
  return O3 = e, O3;
}
var A2e = C2e(), _2e = /* @__PURE__ */ Qg(A2e), P3, l9;
function L2e() {
  if (l9) return P3;
  l9 = 1;
  var t = eS(), e = function() {
    try {
      var r = t(Object, "defineProperty");
      return r({}, "", {}), r;
    } catch {
    }
  }();
  return P3 = e, P3;
}
var B3, c9;
function R2e() {
  if (c9) return B3;
  c9 = 1;
  var t = L2e();
  function e(r, n, i) {
    n == "__proto__" && t ? t(r, n, {
      configurable: !0,
      enumerable: !0,
      value: i,
      writable: !0
    }) : r[n] = i;
  }
  return B3 = e, B3;
}
var F3, u9;
function N2e() {
  if (u9) return F3;
  u9 = 1;
  var t = R2e(), e = $V(), r = Object.prototype, n = r.hasOwnProperty;
  function i(a, s, o) {
    var l = a[s];
    (!(n.call(a, s) && e(l, o)) || o === void 0 && !(s in a)) && t(a, s, o);
  }
  return F3 = i, F3;
}
var $3, h9;
function M2e() {
  if (h9) return $3;
  h9 = 1;
  var t = 9007199254740991, e = /^(?:0|[1-9]\d*)$/;
  function r(n, i) {
    var a = typeof n;
    return i = i ?? t, !!i && (a == "number" || a != "symbol" && e.test(n)) && n > -1 && n % 1 == 0 && n < i;
  }
  return $3 = r, $3;
}
var z3, d9;
function D2e() {
  if (d9) return z3;
  d9 = 1;
  var t = N2e(), e = UV(), r = M2e(), n = Jg(), i = tS();
  function a(s, o, l, u) {
    if (!n(s))
      return s;
    o = e(o, s);
    for (var h = -1, d = o.length, f = d - 1, p = s; p != null && ++h < d; ) {
      var g = i(o[h]), m = l;
      if (g === "__proto__" || g === "constructor" || g === "prototype")
        return s;
      if (h != f) {
        var v = p[g];
        m = u ? u(v, g, p) : void 0, m === void 0 && (m = n(v) ? v : r(o[h + 1]) ? [] : {});
      }
      t(p, g, m), p = p[g];
    }
    return s;
  }
  return z3 = a, z3;
}
var V3, f9;
function I2e() {
  if (f9) return V3;
  f9 = 1;
  var t = D2e();
  function e(r, n, i) {
    return r == null ? r : t(r, n, i);
  }
  return V3 = e, V3;
}
var O2e = I2e(), P2e = /* @__PURE__ */ Qg(O2e), G3, p9;
function B2e() {
  if (p9) return G3;
  p9 = 1;
  function t(e, r) {
    var n = -1, i = e.length;
    for (r || (r = Array(i)); ++n < i; )
      r[n] = e[n];
    return r;
  }
  return G3 = t, G3;
}
var U3, g9;
function F2e() {
  if (g9) return U3;
  g9 = 1;
  var t = VV(), e = B2e(), r = Ix(), n = e1(), i = zV(), a = tS(), s = GV();
  function o(l) {
    return r(l) ? t(l, a) : n(l) ? [l] : e(i(s(l)));
  }
  return U3 = o, U3;
}
var $2e = F2e(), z2e = /* @__PURE__ */ Qg($2e), V2e = {
  // access data field
  data: function(e) {
    var r = {
      field: "data",
      bindingEvent: "data",
      allowBinding: !1,
      allowSetting: !1,
      allowGetting: !1,
      settingEvent: "data",
      settingTriggersEvent: !1,
      triggerFnName: "trigger",
      immutableKeys: {},
      // key => true if immutable
      updateStyle: !1,
      beforeGet: function(i) {
      },
      beforeSet: function(i, a) {
      },
      onSet: function(i) {
      },
      canSet: function(i) {
        return !0;
      }
    };
    return e = Gt({}, r, e), function(i, a) {
      var s = e, o = this, l = o.length !== void 0, u = l ? o : [o], h = l ? o[0] : o;
      if (Bt(i)) {
        var d = i.indexOf(".") !== -1, f = d && z2e(i);
        if (s.allowGetting && a === void 0) {
          var p;
          return h && (s.beforeGet(h), f && h._private[s.field][i] === void 0 ? p = _2e(h._private[s.field], f) : p = h._private[s.field][i]), p;
        } else if (s.allowSetting && a !== void 0) {
          var g = !s.immutableKeys[i];
          if (g) {
            var m = iV({}, i, a);
            s.beforeSet(o, m);
            for (var v = 0, y = u.length; v < y; v++) {
              var b = u[v];
              s.canSet(b) && (f && h._private[s.field][i] === void 0 ? P2e(b._private[s.field], f, a) : b._private[s.field][i] = a);
            }
            s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent);
          }
        }
      } else if (s.allowSetting && vr(i)) {
        var w = i, T, E, C = Object.keys(w);
        s.beforeSet(o, w);
        for (var k = 0; k < C.length; k++) {
          T = C[k], E = w[T];
          var _ = !s.immutableKeys[T];
          if (_)
            for (var L = 0; L < u.length; L++) {
              var N = u[L];
              s.canSet(N) && (N._private[s.field][T] = E);
            }
        }
        s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent);
      } else if (s.allowBinding && nn(i)) {
        var A = i;
        o.on(s.bindingEvent, A);
      } else if (s.allowGetting && i === void 0) {
        var O;
        return h && (s.beforeGet(h), O = h._private[s.field]), O;
      }
      return o;
    };
  },
  // data
  // remove data field
  removeData: function(e) {
    var r = {
      field: "data",
      event: "data",
      triggerFnName: "trigger",
      triggerEvent: !1,
      immutableKeys: {}
      // key => true if immutable
    };
    return e = Gt({}, r, e), function(i) {
      var a = e, s = this, o = s.length !== void 0, l = o ? s : [s];
      if (Bt(i)) {
        for (var u = i.split(/\s+/), h = u.length, d = 0; d < h; d++) {
          var f = u[d];
          if (!Gl(f)) {
            var p = !a.immutableKeys[f];
            if (p)
              for (var g = 0, m = l.length; g < m; g++)
                l[g]._private[a.field][f] = void 0;
          }
        }
        a.triggerEvent && s[a.triggerFnName](a.event);
      } else if (i === void 0) {
        for (var v = 0, y = l.length; v < y; v++)
          for (var b = l[v]._private[a.field], w = Object.keys(b), T = 0; T < w.length; T++) {
            var E = w[T], C = !a.immutableKeys[E];
            C && (b[E] = void 0);
          }
        a.triggerEvent && s[a.triggerFnName](a.event);
      }
      return s;
    };
  }
  // removeData
}, G2e = {
  eventAliasesOn: function(e) {
    var r = e;
    r.addListener = r.listen = r.bind = r.on, r.unlisten = r.unbind = r.off = r.removeListener, r.trigger = r.emit, r.pon = r.promiseOn = function(n, i) {
      var a = this, s = Array.prototype.slice.call(arguments, 0);
      return new Df(function(o, l) {
        var u = function(p) {
          a.off.apply(a, d), o(p);
        }, h = s.concat([u]), d = h.concat([]);
        a.on.apply(a, h);
      });
    };
  }
}, _r = {};
[Xye, V2e, G2e].forEach(function(t) {
  Gt(_r, t);
});
var U2e = {
  animate: _r.animate(),
  animation: _r.animation(),
  animated: _r.animated(),
  clearQueue: _r.clearQueue(),
  delay: _r.delay(),
  delayAnimation: _r.delayAnimation(),
  stop: _r.stop()
}, iv = {
  classes: function(e) {
    var r = this;
    if (e === void 0) {
      var n = [];
      return r[0]._private.classes.forEach(function(g) {
        return n.push(g);
      }), n;
    } else Br(e) || (e = (e || "").match(/\S+/g) || []);
    for (var i = [], a = new Mf(e), s = 0; s < r.length; s++) {
      for (var o = r[s], l = o._private, u = l.classes, h = !1, d = 0; d < e.length; d++) {
        var f = e[d], p = u.has(f);
        if (!p) {
          h = !0;
          break;
        }
      }
      h || (h = u.size !== e.length), h && (l.classes = a, i.push(o));
    }
    return i.length > 0 && this.spawn(i).updateStyle().emit("class"), r;
  },
  addClass: function(e) {
    return this.toggleClass(e, !0);
  },
  hasClass: function(e) {
    var r = this[0];
    return r != null && r._private.classes.has(e);
  },
  toggleClass: function(e, r) {
    Br(e) || (e = e.match(/\S+/g) || []);
    for (var n = this, i = r === void 0, a = [], s = 0, o = n.length; s < o; s++)
      for (var l = n[s], u = l._private.classes, h = !1, d = 0; d < e.length; d++) {
        var f = e[d], p = u.has(f), g = !1;
        r || i && !p ? (u.add(f), g = !0) : (!r || i && p) && (u.delete(f), g = !0), !h && g && (a.push(l), h = !0);
      }
    return a.length > 0 && this.spawn(a).updateStyle().emit("class"), n;
  },
  removeClass: function(e) {
    return this.toggleClass(e, !1);
  },
  flashClass: function(e, r) {
    var n = this;
    if (r == null)
      r = 250;
    else if (r === 0)
      return n;
    return n.addClass(e), setTimeout(function() {
      n.removeClass(e);
    }, r), n;
  }
};
iv.className = iv.classNames = iv.classes;
var mr = {
  metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",
  // chars we need to escape in let names, etc
  comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",
  // binary comparison op (used in data selectors)
  boolOp: "\\?|\\!|\\^",
  // boolean (unary) operators (used in data selectors)
  string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,
  // string literals (used in data selectors) -- doublequotes | singlequotes
  number: Bn,
  // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123
  meta: "degree|indegree|outdegree",
  // allowed metadata fields (i.e. allowed functions to use from Collection)
  separator: "\\s*,\\s*",
  // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass
  descendant: "\\s+",
  child: "\\s+>\\s+",
  subject: "\\$",
  group: "node|edge|\\*",
  directedEdge: "\\s+->\\s+",
  undirectedEdge: "\\s+<->\\s+"
};
mr.variable = "(?:[\\w-.]|(?:\\\\" + mr.metaChar + "))+";
mr.className = "(?:[\\w-]|(?:\\\\" + mr.metaChar + "))+";
mr.value = mr.string + "|" + mr.number;
mr.id = mr.variable;
(function() {
  var t, e, r;
  for (t = mr.comparatorOp.split("|"), r = 0; r < t.length; r++)
    e = t[r], mr.comparatorOp += "|@" + e;
  for (t = mr.comparatorOp.split("|"), r = 0; r < t.length; r++)
    e = t[r], !(e.indexOf("!") >= 0) && e !== "=" && (mr.comparatorOp += "|\\!" + e);
})();
var Or = function() {
  return {
    checks: []
  };
}, Lt = {
  /** E.g. node */
  GROUP: 0,
  /** A collection of elements */
  COLLECTION: 1,
  /** A filter(ele) function */
  FILTER: 2,
  /** E.g. [foo > 1] */
  DATA_COMPARE: 3,
  /** E.g. [foo] */
  DATA_EXIST: 4,
  /** E.g. [?foo] */
  DATA_BOOL: 5,
  /** E.g. [[degree > 2]] */
  META_COMPARE: 6,
  /** E.g. :selected */
  STATE: 7,
  /** E.g. #foo */
  ID: 8,
  /** E.g. .foo */
  CLASS: 9,
  /** E.g. #foo <-> #bar */
  UNDIRECTED_EDGE: 10,
  /** E.g. #foo -> #bar */
  DIRECTED_EDGE: 11,
  /** E.g. $#foo -> #bar */
  NODE_SOURCE: 12,
  /** E.g. #foo -> $#bar */
  NODE_TARGET: 13,
  /** E.g. $#foo <-> #bar */
  NODE_NEIGHBOR: 14,
  /** E.g. #foo > #bar */
  CHILD: 15,
  /** E.g. #foo #bar */
  DESCENDANT: 16,
  /** E.g. $#foo > #bar */
  PARENT: 17,
  /** E.g. $#foo #bar */
  ANCESTOR: 18,
  /** E.g. #foo > $bar > #baz */
  COMPOUND_SPLIT: 19,
  /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */
  TRUE: 20
}, fT = [{
  selector: ":selected",
  matches: function(e) {
    return e.selected();
  }
}, {
  selector: ":unselected",
  matches: function(e) {
    return !e.selected();
  }
}, {
  selector: ":selectable",
  matches: function(e) {
    return e.selectable();
  }
}, {
  selector: ":unselectable",
  matches: function(e) {
    return !e.selectable();
  }
}, {
  selector: ":locked",
  matches: function(e) {
    return e.locked();
  }
}, {
  selector: ":unlocked",
  matches: function(e) {
    return !e.locked();
  }
}, {
  selector: ":visible",
  matches: function(e) {
    return e.visible();
  }
}, {
  selector: ":hidden",
  matches: function(e) {
    return !e.visible();
  }
}, {
  selector: ":transparent",
  matches: function(e) {
    return e.transparent();
  }
}, {
  selector: ":grabbed",
  matches: function(e) {
    return e.grabbed();
  }
}, {
  selector: ":free",
  matches: function(e) {
    return !e.grabbed();
  }
}, {
  selector: ":removed",
  matches: function(e) {
    return e.removed();
  }
}, {
  selector: ":inside",
  matches: function(e) {
    return !e.removed();
  }
}, {
  selector: ":grabbable",
  matches: function(e) {
    return e.grabbable();
  }
}, {
  selector: ":ungrabbable",
  matches: function(e) {
    return !e.grabbable();
  }
}, {
  selector: ":animated",
  matches: function(e) {
    return e.animated();
  }
}, {
  selector: ":unanimated",
  matches: function(e) {
    return !e.animated();
  }
}, {
  selector: ":parent",
  matches: function(e) {
    return e.isParent();
  }
}, {
  selector: ":childless",
  matches: function(e) {
    return e.isChildless();
  }
}, {
  selector: ":child",
  matches: function(e) {
    return e.isChild();
  }
}, {
  selector: ":orphan",
  matches: function(e) {
    return e.isOrphan();
  }
}, {
  selector: ":nonorphan",
  matches: function(e) {
    return e.isChild();
  }
}, {
  selector: ":compound",
  matches: function(e) {
    return e.isNode() ? e.isParent() : e.source().isParent() || e.target().isParent();
  }
}, {
  selector: ":loop",
  matches: function(e) {
    return e.isLoop();
  }
}, {
  selector: ":simple",
  matches: function(e) {
    return e.isSimple();
  }
}, {
  selector: ":active",
  matches: function(e) {
    return e.active();
  }
}, {
  selector: ":inactive",
  matches: function(e) {
    return !e.active();
  }
}, {
  selector: ":backgrounding",
  matches: function(e) {
    return e.backgrounding();
  }
}, {
  selector: ":nonbackgrounding",
  matches: function(e) {
    return !e.backgrounding();
  }
}].sort(function(t, e) {
  return Vme(t.selector, e.selector);
}), W2e = function() {
  for (var t = {}, e, r = 0; r < fT.length; r++)
    e = fT[r], t[e.selector] = e.matches;
  return t;
}(), H2e = function(e, r) {
  return W2e[e](r);
}, q2e = "(" + fT.map(function(t) {
  return t.selector;
}).join("|") + ")", Ju = function(e) {
  return e.replace(new RegExp("\\\\(" + mr.metaChar + ")", "g"), function(r, n) {
    return n;
  });
}, fl = function(e, r, n) {
  e[e.length - 1] = n;
}, pT = [{
  name: "group",
  // just used for identifying when debugging
  query: !0,
  regex: "(" + mr.group + ")",
  populate: function(e, r, n) {
    var i = Tn(n, 1), a = i[0];
    r.checks.push({
      type: Lt.GROUP,
      value: a === "*" ? a : a + "s"
    });
  }
}, {
  name: "state",
  query: !0,
  regex: q2e,
  populate: function(e, r, n) {
    var i = Tn(n, 1), a = i[0];
    r.checks.push({
      type: Lt.STATE,
      value: a
    });
  }
}, {
  name: "id",
  query: !0,
  regex: "\\#(" + mr.id + ")",
  populate: function(e, r, n) {
    var i = Tn(n, 1), a = i[0];
    r.checks.push({
      type: Lt.ID,
      value: Ju(a)
    });
  }
}, {
  name: "className",
  query: !0,
  regex: "\\.(" + mr.className + ")",
  populate: function(e, r, n) {
    var i = Tn(n, 1), a = i[0];
    r.checks.push({
      type: Lt.CLASS,
      value: Ju(a)
    });
  }
}, {
  name: "dataExists",
  query: !0,
  regex: "\\[\\s*(" + mr.variable + ")\\s*\\]",
  populate: function(e, r, n) {
    var i = Tn(n, 1), a = i[0];
    r.checks.push({
      type: Lt.DATA_EXIST,
      field: Ju(a)
    });
  }
}, {
  name: "dataCompare",
  query: !0,
  regex: "\\[\\s*(" + mr.variable + ")\\s*(" + mr.comparatorOp + ")\\s*(" + mr.value + ")\\s*\\]",
  populate: function(e, r, n) {
    var i = Tn(n, 3), a = i[0], s = i[1], o = i[2], l = new RegExp("^" + mr.string + "$").exec(o) != null;
    l ? o = o.substring(1, o.length - 1) : o = parseFloat(o), r.checks.push({
      type: Lt.DATA_COMPARE,
      field: Ju(a),
      operator: s,
      value: o
    });
  }
}, {
  name: "dataBool",
  query: !0,
  regex: "\\[\\s*(" + mr.boolOp + ")\\s*(" + mr.variable + ")\\s*\\]",
  populate: function(e, r, n) {
    var i = Tn(n, 2), a = i[0], s = i[1];
    r.checks.push({
      type: Lt.DATA_BOOL,
      field: Ju(s),
      operator: a
    });
  }
}, {
  name: "metaCompare",
  query: !0,
  regex: "\\[\\[\\s*(" + mr.meta + ")\\s*(" + mr.comparatorOp + ")\\s*(" + mr.number + ")\\s*\\]\\]",
  populate: function(e, r, n) {
    var i = Tn(n, 3), a = i[0], s = i[1], o = i[2];
    r.checks.push({
      type: Lt.META_COMPARE,
      field: Ju(a),
      operator: s,
      value: parseFloat(o)
    });
  }
}, {
  name: "nextQuery",
  separator: !0,
  regex: mr.separator,
  populate: function(e, r) {
    var n = e.currentSubject, i = e.edgeCount, a = e.compoundCount, s = e[e.length - 1];
    n != null && (s.subject = n, e.currentSubject = null), s.edgeCount = i, s.compoundCount = a, e.edgeCount = 0, e.compoundCount = 0;
    var o = e[e.length++] = Or();
    return o;
  }
}, {
  name: "directedEdge",
  separator: !0,
  regex: mr.directedEdge,
  populate: function(e, r) {
    if (e.currentSubject == null) {
      var n = Or(), i = r, a = Or();
      return n.checks.push({
        type: Lt.DIRECTED_EDGE,
        source: i,
        target: a
      }), fl(e, r, n), e.edgeCount++, a;
    } else {
      var s = Or(), o = r, l = Or();
      return s.checks.push({
        type: Lt.NODE_SOURCE,
        source: o,
        target: l
      }), fl(e, r, s), e.edgeCount++, l;
    }
  }
}, {
  name: "undirectedEdge",
  separator: !0,
  regex: mr.undirectedEdge,
  populate: function(e, r) {
    if (e.currentSubject == null) {
      var n = Or(), i = r, a = Or();
      return n.checks.push({
        type: Lt.UNDIRECTED_EDGE,
        nodes: [i, a]
      }), fl(e, r, n), e.edgeCount++, a;
    } else {
      var s = Or(), o = r, l = Or();
      return s.checks.push({
        type: Lt.NODE_NEIGHBOR,
        node: o,
        neighbor: l
      }), fl(e, r, s), l;
    }
  }
}, {
  name: "child",
  separator: !0,
  regex: mr.child,
  populate: function(e, r) {
    if (e.currentSubject == null) {
      var n = Or(), i = Or(), a = e[e.length - 1];
      return n.checks.push({
        type: Lt.CHILD,
        parent: a,
        child: i
      }), fl(e, r, n), e.compoundCount++, i;
    } else if (e.currentSubject === r) {
      var s = Or(), o = e[e.length - 1], l = Or(), u = Or(), h = Or(), d = Or();
      return s.checks.push({
        type: Lt.COMPOUND_SPLIT,
        left: o,
        right: l,
        subject: u
      }), u.checks = r.checks, r.checks = [{
        type: Lt.TRUE
      }], d.checks.push({
        type: Lt.TRUE
      }), l.checks.push({
        type: Lt.PARENT,
        // type is swapped on right side queries
        parent: d,
        child: h
        // empty for now
      }), fl(e, o, s), e.currentSubject = u, e.compoundCount++, h;
    } else {
      var f = Or(), p = Or(), g = [{
        type: Lt.PARENT,
        parent: f,
        child: p
      }];
      return f.checks = r.checks, r.checks = g, e.compoundCount++, p;
    }
  }
}, {
  name: "descendant",
  separator: !0,
  regex: mr.descendant,
  populate: function(e, r) {
    if (e.currentSubject == null) {
      var n = Or(), i = Or(), a = e[e.length - 1];
      return n.checks.push({
        type: Lt.DESCENDANT,
        ancestor: a,
        descendant: i
      }), fl(e, r, n), e.compoundCount++, i;
    } else if (e.currentSubject === r) {
      var s = Or(), o = e[e.length - 1], l = Or(), u = Or(), h = Or(), d = Or();
      return s.checks.push({
        type: Lt.COMPOUND_SPLIT,
        left: o,
        right: l,
        subject: u
      }), u.checks = r.checks, r.checks = [{
        type: Lt.TRUE
      }], d.checks.push({
        type: Lt.TRUE
      }), l.checks.push({
        type: Lt.ANCESTOR,
        // type is swapped on right side queries
        ancestor: d,
        descendant: h
        // empty for now
      }), fl(e, o, s), e.currentSubject = u, e.compoundCount++, h;
    } else {
      var f = Or(), p = Or(), g = [{
        type: Lt.ANCESTOR,
        ancestor: f,
        descendant: p
      }];
      return f.checks = r.checks, r.checks = g, e.compoundCount++, p;
    }
  }
}, {
  name: "subject",
  modifier: !0,
  regex: mr.subject,
  populate: function(e, r) {
    if (e.currentSubject != null && e.currentSubject !== r)
      return Nr("Redefinition of subject in selector `" + e.toString() + "`"), !1;
    e.currentSubject = r;
    var n = e[e.length - 1], i = n.checks[0], a = i == null ? null : i.type;
    a === Lt.DIRECTED_EDGE ? i.type = Lt.NODE_TARGET : a === Lt.UNDIRECTED_EDGE && (i.type = Lt.NODE_NEIGHBOR, i.node = i.nodes[1], i.neighbor = i.nodes[0], i.nodes = null);
  }
}];
pT.forEach(function(t) {
  return t.regexObj = new RegExp("^" + t.regex);
});
var Y2e = function(e) {
  for (var r, n, i, a = 0; a < pT.length; a++) {
    var s = pT[a], o = s.name, l = e.match(s.regexObj);
    if (l != null) {
      n = l, r = s, i = o;
      var u = l[0];
      e = e.substring(u.length);
      break;
    }
  }
  return {
    expr: r,
    match: n,
    name: i,
    remaining: e
  };
}, X2e = function(e) {
  var r = e.match(/^\s+/);
  if (r) {
    var n = r[0];
    e = e.substring(n.length);
  }
  return e;
}, j2e = function(e) {
  var r = this, n = r.inputText = e, i = r[0] = Or();
  for (r.length = 1, n = X2e(n); ; ) {
    var a = Y2e(n);
    if (a.expr == null)
      return Nr("The selector `" + e + "`is invalid"), !1;
    var s = a.match.slice(1), o = a.expr.populate(r, i, s);
    if (o === !1)
      return !1;
    if (o != null && (i = o), n = a.remaining, n.match(/^\s*$/))
      break;
  }
  var l = r[r.length - 1];
  r.currentSubject != null && (l.subject = r.currentSubject), l.edgeCount = r.edgeCount, l.compoundCount = r.compoundCount;
  for (var u = 0; u < r.length; u++) {
    var h = r[u];
    if (h.compoundCount > 0 && h.edgeCount > 0)
      return Nr("The selector `" + e + "` is invalid because it uses both a compound selector and an edge selector"), !1;
    if (h.edgeCount > 1)
      return Nr("The selector `" + e + "` is invalid because it uses multiple edge selectors"), !1;
    h.edgeCount === 1 && Nr("The selector `" + e + "` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.");
  }
  return !0;
}, K2e = function() {
  if (this.toStringCache != null)
    return this.toStringCache;
  for (var e = function(h) {
    return h ?? "";
  }, r = function(h) {
    return Bt(h) ? '"' + h + '"' : e(h);
  }, n = function(h) {
    return " " + h + " ";
  }, i = function(h, d) {
    var f = h.type, p = h.value;
    switch (f) {
      case Lt.GROUP: {
        var g = e(p);
        return g.substring(0, g.length - 1);
      }
      case Lt.DATA_COMPARE: {
        var m = h.field, v = h.operator;
        return "[" + m + n(e(v)) + r(p) + "]";
      }
      case Lt.DATA_BOOL: {
        var y = h.operator, b = h.field;
        return "[" + e(y) + b + "]";
      }
      case Lt.DATA_EXIST: {
        var w = h.field;
        return "[" + w + "]";
      }
      case Lt.META_COMPARE: {
        var T = h.operator, E = h.field;
        return "[[" + E + n(e(T)) + r(p) + "]]";
      }
      case Lt.STATE:
        return p;
      case Lt.ID:
        return "#" + p;
      case Lt.CLASS:
        return "." + p;
      case Lt.PARENT:
      case Lt.CHILD:
        return a(h.parent, d) + n(">") + a(h.child, d);
      case Lt.ANCESTOR:
      case Lt.DESCENDANT:
        return a(h.ancestor, d) + " " + a(h.descendant, d);
      case Lt.COMPOUND_SPLIT: {
        var C = a(h.left, d), k = a(h.subject, d), _ = a(h.right, d);
        return C + (C.length > 0 ? " " : "") + k + _;
      }
      case Lt.TRUE:
        return "";
    }
  }, a = function(h, d) {
    return h.checks.reduce(function(f, p, g) {
      return f + (d === h && g === 0 ? "$" : "") + i(p, d);
    }, "");
  }, s = "", o = 0; o < this.length; o++) {
    var l = this[o];
    s += a(l, l.subject), this.length > 1 && o < this.length - 1 && (s += ", ");
  }
  return this.toStringCache = s, s;
}, Z2e = {
  parse: j2e,
  toString: K2e
}, WV = function(e, r, n) {
  var i, a = Bt(e), s = vt(e), o = Bt(n), l, u, h = !1, d = !1, f = !1;
  switch (r.indexOf("!") >= 0 && (r = r.replace("!", ""), d = !0), r.indexOf("@") >= 0 && (r = r.replace("@", ""), h = !0), (a || o || h) && (l = !a && !s ? "" : "" + e, u = "" + n), h && (e = l = l.toLowerCase(), n = u = u.toLowerCase()), r) {
    case "*=":
      i = l.indexOf(u) >= 0;
      break;
    case "$=":
      i = l.indexOf(u, l.length - u.length) >= 0;
      break;
    case "^=":
      i = l.indexOf(u) === 0;
      break;
    case "=":
      i = e === n;
      break;
    case ">":
      f = !0, i = e > n;
      break;
    case ">=":
      f = !0, i = e >= n;
      break;
    case "<":
      f = !0, i = e < n;
      break;
    case "<=":
      f = !0, i = e <= n;
      break;
    default:
      i = !1;
      break;
  }
  return d && (e != null || !f) && (i = !i), i;
}, Q2e = function(e, r) {
  switch (r) {
    case "?":
      return !!e;
    case "!":
      return !e;
    case "^":
      return e === void 0;
  }
}, J2e = function(e) {
  return e !== void 0;
}, rS = function(e, r) {
  return e.data(r);
}, exe = function(e, r) {
  return e[r]();
}, hn = [], Hr = function(e, r) {
  return e.checks.every(function(n) {
    return hn[n.type](n, r);
  });
};
hn[Lt.GROUP] = function(t, e) {
  var r = t.value;
  return r === "*" || r === e.group();
};
hn[Lt.STATE] = function(t, e) {
  var r = t.value;
  return H2e(r, e);
};
hn[Lt.ID] = function(t, e) {
  var r = t.value;
  return e.id() === r;
};
hn[Lt.CLASS] = function(t, e) {
  var r = t.value;
  return e.hasClass(r);
};
hn[Lt.META_COMPARE] = function(t, e) {
  var r = t.field, n = t.operator, i = t.value;
  return WV(exe(e, r), n, i);
};
hn[Lt.DATA_COMPARE] = function(t, e) {
  var r = t.field, n = t.operator, i = t.value;
  return WV(rS(e, r), n, i);
};
hn[Lt.DATA_BOOL] = function(t, e) {
  var r = t.field, n = t.operator;
  return Q2e(rS(e, r), n);
};
hn[Lt.DATA_EXIST] = function(t, e) {
  var r = t.field;
  return t.operator, J2e(rS(e, r));
};
hn[Lt.UNDIRECTED_EDGE] = function(t, e) {
  var r = t.nodes[0], n = t.nodes[1], i = e.source(), a = e.target();
  return Hr(r, i) && Hr(n, a) || Hr(n, i) && Hr(r, a);
};
hn[Lt.NODE_NEIGHBOR] = function(t, e) {
  return Hr(t.node, e) && e.neighborhood().some(function(r) {
    return r.isNode() && Hr(t.neighbor, r);
  });
};
hn[Lt.DIRECTED_EDGE] = function(t, e) {
  return Hr(t.source, e.source()) && Hr(t.target, e.target());
};
hn[Lt.NODE_SOURCE] = function(t, e) {
  return Hr(t.source, e) && e.outgoers().some(function(r) {
    return r.isNode() && Hr(t.target, r);
  });
};
hn[Lt.NODE_TARGET] = function(t, e) {
  return Hr(t.target, e) && e.incomers().some(function(r) {
    return r.isNode() && Hr(t.source, r);
  });
};
hn[Lt.CHILD] = function(t, e) {
  return Hr(t.child, e) && Hr(t.parent, e.parent());
};
hn[Lt.PARENT] = function(t, e) {
  return Hr(t.parent, e) && e.children().some(function(r) {
    return Hr(t.child, r);
  });
};
hn[Lt.DESCENDANT] = function(t, e) {
  return Hr(t.descendant, e) && e.ancestors().some(function(r) {
    return Hr(t.ancestor, r);
  });
};
hn[Lt.ANCESTOR] = function(t, e) {
  return Hr(t.ancestor, e) && e.descendants().some(function(r) {
    return Hr(t.descendant, r);
  });
};
hn[Lt.COMPOUND_SPLIT] = function(t, e) {
  return Hr(t.subject, e) && Hr(t.left, e) && Hr(t.right, e);
};
hn[Lt.TRUE] = function() {
  return !0;
};
hn[Lt.COLLECTION] = function(t, e) {
  var r = t.value;
  return r.has(e);
};
hn[Lt.FILTER] = function(t, e) {
  var r = t.value;
  return r(e);
};
var txe = function(e) {
  var r = this;
  if (r.length === 1 && r[0].checks.length === 1 && r[0].checks[0].type === Lt.ID)
    return e.getElementById(r[0].checks[0].value).collection();
  var n = function(a) {
    for (var s = 0; s < r.length; s++) {
      var o = r[s];
      if (Hr(o, a))
        return !0;
    }
    return !1;
  };
  return r.text() == null && (n = function() {
    return !0;
  }), e.filter(n);
}, rxe = function(e) {
  for (var r = this, n = 0; n < r.length; n++) {
    var i = r[n];
    if (Hr(i, e))
      return !0;
  }
  return !1;
}, nxe = {
  matches: rxe,
  filter: txe
}, Hl = function(e) {
  this.inputText = e, this.currentSubject = null, this.compoundCount = 0, this.edgeCount = 0, this.length = 0, e == null || Bt(e) && e.match(/^\s*$/) || (La(e) ? this.addQuery({
    checks: [{
      type: Lt.COLLECTION,
      value: e.collection()
    }]
  }) : nn(e) ? this.addQuery({
    checks: [{
      type: Lt.FILTER,
      value: e
    }]
  }) : Bt(e) ? this.parse(e) || (this.invalid = !0) : Kr("A selector must be created from a string; found "));
}, ql = Hl.prototype;
[Z2e, nxe].forEach(function(t) {
  return Gt(ql, t);
});
ql.text = function() {
  return this.inputText;
};
ql.size = function() {
  return this.length;
};
ql.eq = function(t) {
  return this[t];
};
ql.sameText = function(t) {
  return !this.invalid && !t.invalid && this.text() === t.text();
};
ql.addQuery = function(t) {
  this[this.length++] = t;
};
ql.selector = ql.toString;
var Rl = {
  allAre: function(e) {
    var r = new Hl(e);
    return this.every(function(n) {
      return r.matches(n);
    });
  },
  is: function(e) {
    var r = new Hl(e);
    return this.some(function(n) {
      return r.matches(n);
    });
  },
  some: function(e, r) {
    for (var n = 0; n < this.length; n++) {
      var i = r ? e.apply(r, [this[n], n, this]) : e(this[n], n, this);
      if (i)
        return !0;
    }
    return !1;
  },
  every: function(e, r) {
    for (var n = 0; n < this.length; n++) {
      var i = r ? e.apply(r, [this[n], n, this]) : e(this[n], n, this);
      if (!i)
        return !1;
    }
    return !0;
  },
  same: function(e) {
    if (this === e)
      return !0;
    e = this.cy().collection(e);
    var r = this.length, n = e.length;
    return r !== n ? !1 : r === 1 ? this[0] === e[0] : this.every(function(i) {
      return e.hasElementWithId(i.id());
    });
  },
  anySame: function(e) {
    return e = this.cy().collection(e), this.some(function(r) {
      return e.hasElementWithId(r.id());
    });
  },
  allAreNeighbors: function(e) {
    e = this.cy().collection(e);
    var r = this.neighborhood();
    return e.every(function(n) {
      return r.hasElementWithId(n.id());
    });
  },
  contains: function(e) {
    e = this.cy().collection(e);
    var r = this;
    return e.every(function(n) {
      return r.hasElementWithId(n.id());
    });
  }
};
Rl.allAreNeighbours = Rl.allAreNeighbors;
Rl.has = Rl.contains;
Rl.equal = Rl.equals = Rl.same;
var ja = function(e, r) {
  return function(i, a, s, o) {
    var l = i, u = this, h;
    if (l == null ? h = "" : La(l) && l.length === 1 && (h = l.id()), u.length === 1 && h) {
      var d = u[0]._private, f = d.traversalCache = d.traversalCache || {}, p = f[r] = f[r] || [], g = gu(h), m = p[g];
      return m || (p[g] = e.call(u, i, a, s, o));
    } else
      return e.call(u, i, a, s, o);
  };
}, cf = {
  parent: function(e) {
    var r = [];
    if (this.length === 1) {
      var n = this[0]._private.parent;
      if (n)
        return n;
    }
    for (var i = 0; i < this.length; i++) {
      var a = this[i], s = a._private.parent;
      s && r.push(s);
    }
    return this.spawn(r, !0).filter(e);
  },
  parents: function(e) {
    for (var r = [], n = this.parent(); n.nonempty(); ) {
      for (var i = 0; i < n.length; i++) {
        var a = n[i];
        r.push(a);
      }
      n = n.parent();
    }
    return this.spawn(r, !0).filter(e);
  },
  commonAncestors: function(e) {
    for (var r, n = 0; n < this.length; n++) {
      var i = this[n], a = i.parents();
      r = r || a, r = r.intersect(a);
    }
    return r.filter(e);
  },
  orphans: function(e) {
    return this.stdFilter(function(r) {
      return r.isOrphan();
    }).filter(e);
  },
  nonorphans: function(e) {
    return this.stdFilter(function(r) {
      return r.isChild();
    }).filter(e);
  },
  children: ja(function(t) {
    for (var e = [], r = 0; r < this.length; r++)
      for (var n = this[r], i = n._private.children, a = 0; a < i.length; a++)
        e.push(i[a]);
    return this.spawn(e, !0).filter(t);
  }, "children"),
  siblings: function(e) {
    return this.parent().children().not(this).filter(e);
  },
  isParent: function() {
    var e = this[0];
    if (e)
      return e.isNode() && e._private.children.length !== 0;
  },
  isChildless: function() {
    var e = this[0];
    if (e)
      return e.isNode() && e._private.children.length === 0;
  },
  isChild: function() {
    var e = this[0];
    if (e)
      return e.isNode() && e._private.parent != null;
  },
  isOrphan: function() {
    var e = this[0];
    if (e)
      return e.isNode() && e._private.parent == null;
  },
  descendants: function(e) {
    var r = [];
    function n(i) {
      for (var a = 0; a < i.length; a++) {
        var s = i[a];
        r.push(s), s.children().nonempty() && n(s.children());
      }
    }
    return n(this.children()), this.spawn(r, !0).filter(e);
  }
};
function nS(t, e, r, n) {
  for (var i = [], a = new Mf(), s = t.cy(), o = s.hasCompoundNodes(), l = 0; l < t.length; l++) {
    var u = t[l];
    r ? i.push(u) : o && n(i, a, u);
  }
  for (; i.length > 0; ) {
    var h = i.shift();
    e(h), a.add(h.id()), o && n(i, a, h);
  }
  return t;
}
function HV(t, e, r) {
  if (r.isParent())
    for (var n = r._private.children, i = 0; i < n.length; i++) {
      var a = n[i];
      e.has(a.id()) || t.push(a);
    }
}
cf.forEachDown = function(t) {
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
  return nS(this, t, e, HV);
};
function qV(t, e, r) {
  if (r.isChild()) {
    var n = r._private.parent;
    e.has(n.id()) || t.push(n);
  }
}
cf.forEachUp = function(t) {
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
  return nS(this, t, e, qV);
};
function ixe(t, e, r) {
  qV(t, e, r), HV(t, e, r);
}
cf.forEachUpAndDown = function(t) {
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
  return nS(this, t, e, ixe);
};
cf.ancestors = cf.parents;
var cg, YV;
cg = YV = {
  data: _r.data({
    field: "data",
    bindingEvent: "data",
    allowBinding: !0,
    allowSetting: !0,
    settingEvent: "data",
    settingTriggersEvent: !0,
    triggerFnName: "trigger",
    allowGetting: !0,
    immutableKeys: {
      id: !0,
      source: !0,
      target: !0,
      parent: !0
    },
    updateStyle: !0
  }),
  removeData: _r.removeData({
    field: "data",
    event: "data",
    triggerFnName: "trigger",
    triggerEvent: !0,
    immutableKeys: {
      id: !0,
      source: !0,
      target: !0,
      parent: !0
    },
    updateStyle: !0
  }),
  scratch: _r.data({
    field: "scratch",
    bindingEvent: "scratch",
    allowBinding: !0,
    allowSetting: !0,
    settingEvent: "scratch",
    settingTriggersEvent: !0,
    triggerFnName: "trigger",
    allowGetting: !0,
    updateStyle: !0
  }),
  removeScratch: _r.removeData({
    field: "scratch",
    event: "scratch",
    triggerFnName: "trigger",
    triggerEvent: !0,
    updateStyle: !0
  }),
  rscratch: _r.data({
    field: "rscratch",
    allowBinding: !1,
    allowSetting: !0,
    settingTriggersEvent: !1,
    allowGetting: !0
  }),
  removeRscratch: _r.removeData({
    field: "rscratch",
    triggerEvent: !1
  }),
  id: function() {
    var e = this[0];
    if (e)
      return e._private.data.id;
  }
};
cg.attr = cg.data;
cg.removeAttr = cg.removeData;
var axe = YV, Fx = {};
function W3(t) {
  return function(e) {
    var r = this;
    if (e === void 0 && (e = !0), r.length !== 0)
      if (r.isNode() && !r.removed()) {
        for (var n = 0, i = r[0], a = i._private.edges, s = 0; s < a.length; s++) {
          var o = a[s];
          !e && o.isLoop() || (n += t(i, o));
        }
        return n;
      } else
        return;
  };
}
Gt(Fx, {
  degree: W3(function(t, e) {
    return e.source().same(e.target()) ? 2 : 1;
  }),
  indegree: W3(function(t, e) {
    return e.target().same(t) ? 1 : 0;
  }),
  outdegree: W3(function(t, e) {
    return e.source().same(t) ? 1 : 0;
  })
});
function eh(t, e) {
  return function(r) {
    for (var n, i = this.nodes(), a = 0; a < i.length; a++) {
      var s = i[a], o = s[t](r);
      o !== void 0 && (n === void 0 || e(o, n)) && (n = o);
    }
    return n;
  };
}
Gt(Fx, {
  minDegree: eh("degree", function(t, e) {
    return t < e;
  }),
  maxDegree: eh("degree", function(t, e) {
    return t > e;
  }),
  minIndegree: eh("indegree", function(t, e) {
    return t < e;
  }),
  maxIndegree: eh("indegree", function(t, e) {
    return t > e;
  }),
  minOutdegree: eh("outdegree", function(t, e) {
    return t < e;
  }),
  maxOutdegree: eh("outdegree", function(t, e) {
    return t > e;
  })
});
Gt(Fx, {
  totalDegree: function(e) {
    for (var r = 0, n = this.nodes(), i = 0; i < n.length; i++)
      r += n[i].degree(e);
    return r;
  }
});
var xs, XV, jV = function(e, r, n) {
  for (var i = 0; i < e.length; i++) {
    var a = e[i];
    if (!a.locked()) {
      var s = a._private.position, o = {
        x: r.x != null ? r.x - s.x : 0,
        y: r.y != null ? r.y - s.y : 0
      };
      a.isParent() && !(o.x === 0 && o.y === 0) && a.children().shift(o, n), a.dirtyBoundingBoxCache();
    }
  }
}, m9 = {
  field: "position",
  bindingEvent: "position",
  allowBinding: !0,
  allowSetting: !0,
  settingEvent: "position",
  settingTriggersEvent: !0,
  triggerFnName: "emitAndNotify",
  allowGetting: !0,
  validKeys: ["x", "y"],
  beforeGet: function(e) {
    e.updateCompoundBounds();
  },
  beforeSet: function(e, r) {
    jV(e, r, !1);
  },
  onSet: function(e) {
    e.dirtyCompoundBoundsCache();
  },
  canSet: function(e) {
    return !e.locked();
  }
};
xs = XV = {
  position: _r.data(m9),
  // position but no notification to renderer
  silentPosition: _r.data(Gt({}, m9, {
    allowBinding: !1,
    allowSetting: !0,
    settingTriggersEvent: !1,
    allowGetting: !1,
    beforeSet: function(e, r) {
      jV(e, r, !0);
    },
    onSet: function(e) {
      e.dirtyCompoundBoundsCache();
    }
  })),
  positions: function(e, r) {
    if (vr(e))
      r ? this.silentPosition(e) : this.position(e);
    else if (nn(e)) {
      var n = e, i = this.cy();
      i.startBatch();
      for (var a = 0; a < this.length; a++) {
        var s = this[a], o = void 0;
        (o = n(s, a)) && (r ? s.silentPosition(o) : s.position(o));
      }
      i.endBatch();
    }
    return this;
  },
  silentPositions: function(e) {
    return this.positions(e, !0);
  },
  shift: function(e, r, n) {
    var i;
    if (vr(e) ? (i = {
      x: vt(e.x) ? e.x : 0,
      y: vt(e.y) ? e.y : 0
    }, n = r) : Bt(e) && vt(r) && (i = {
      x: 0,
      y: 0
    }, i[e] = r), i != null) {
      var a = this.cy();
      a.startBatch();
      for (var s = 0; s < this.length; s++) {
        var o = this[s];
        if (!(a.hasCompoundNodes() && o.isChild() && o.ancestors().anySame(this))) {
          var l = o.position(), u = {
            x: l.x + i.x,
            y: l.y + i.y
          };
          n ? o.silentPosition(u) : o.position(u);
        }
      }
      a.endBatch();
    }
    return this;
  },
  silentShift: function(e, r) {
    return vr(e) ? this.shift(e, !0) : Bt(e) && vt(r) && this.shift(e, r, !0), this;
  },
  // get/set the rendered (i.e. on screen) positon of the element
  renderedPosition: function(e, r) {
    var n = this[0], i = this.cy(), a = i.zoom(), s = i.pan(), o = vr(e) ? e : void 0, l = o !== void 0 || r !== void 0 && Bt(e);
    if (n && n.isNode())
      if (l)
        for (var u = 0; u < this.length; u++) {
          var h = this[u];
          r !== void 0 ? h.position(e, (r - s[e]) / a) : o !== void 0 && h.position(EV(o, a, s));
        }
      else {
        var d = n.position();
        return o = Mx(d, a, s), e === void 0 ? o : o[e];
      }
    else if (!l)
      return;
    return this;
  },
  // get/set the position relative to the parent
  relativePosition: function(e, r) {
    var n = this[0], i = this.cy(), a = vr(e) ? e : void 0, s = a !== void 0 || r !== void 0 && Bt(e), o = i.hasCompoundNodes();
    if (n && n.isNode())
      if (s)
        for (var l = 0; l < this.length; l++) {
          var u = this[l], h = o ? u.parent() : null, d = h && h.length > 0, f = d;
          d && (h = h[0]);
          var p = f ? h.position() : {
            x: 0,
            y: 0
          };
          r !== void 0 ? u.position(e, r + p[e]) : a !== void 0 && u.position({
            x: a.x + p.x,
            y: a.y + p.y
          });
        }
      else {
        var g = n.position(), m = o ? n.parent() : null, v = m && m.length > 0, y = v;
        v && (m = m[0]);
        var b = y ? m.position() : {
          x: 0,
          y: 0
        };
        return a = {
          x: g.x - b.x,
          y: g.y - b.y
        }, e === void 0 ? a : a[e];
      }
    else if (!s)
      return;
    return this;
  }
};
xs.modelPosition = xs.point = xs.position;
xs.modelPositions = xs.points = xs.positions;
xs.renderedPoint = xs.renderedPosition;
xs.relativePoint = xs.relativePosition;
var sxe = XV, Fh, lc;
Fh = lc = {};
lc.renderedBoundingBox = function(t) {
  var e = this.boundingBox(t), r = this.cy(), n = r.zoom(), i = r.pan(), a = e.x1 * n + i.x, s = e.x2 * n + i.x, o = e.y1 * n + i.y, l = e.y2 * n + i.y;
  return {
    x1: a,
    x2: s,
    y1: o,
    y2: l,
    w: s - a,
    h: l - o
  };
};
lc.dirtyCompoundBoundsCache = function() {
  var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy();
  return !e.styleEnabled() || !e.hasCompoundNodes() ? this : (this.forEachUp(function(r) {
    if (r.isParent()) {
      var n = r._private;
      n.compoundBoundsClean = !1, n.bbCache = null, t || r.emitAndNotify("bounds");
    }
  }), this);
};
lc.updateCompoundBounds = function() {
  var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy();
  if (!e.styleEnabled() || !e.hasCompoundNodes())
    return this;
  if (!t && e.batching())
    return this;
  function r(s) {
    if (!s.isParent())
      return;
    var o = s._private, l = s.children(), u = s.pstyle("compound-sizing-wrt-labels").value === "include", h = {
      width: {
        val: s.pstyle("min-width").pfValue,
        left: s.pstyle("min-width-bias-left"),
        right: s.pstyle("min-width-bias-right")
      },
      height: {
        val: s.pstyle("min-height").pfValue,
        top: s.pstyle("min-height-bias-top"),
        bottom: s.pstyle("min-height-bias-bottom")
      }
    }, d = l.boundingBox({
      includeLabels: u,
      includeOverlays: !1,
      // updating the compound bounds happens outside of the regular
      // cache cycle (i.e. before fired events)
      useCache: !1
    }), f = o.position;
    (d.w === 0 || d.h === 0) && (d = {
      w: s.pstyle("width").pfValue,
      h: s.pstyle("height").pfValue
    }, d.x1 = f.x - d.w / 2, d.x2 = f.x + d.w / 2, d.y1 = f.y - d.h / 2, d.y2 = f.y + d.h / 2);
    function p(L, N, A) {
      var O = 0, P = 0, S = N + A;
      return L > 0 && S > 0 && (O = N / S * L, P = A / S * L), {
        biasDiff: O,
        biasComplementDiff: P
      };
    }
    function g(L, N, A, O) {
      if (A.units === "%")
        switch (O) {
          case "width":
            return L > 0 ? A.pfValue * L : 0;
          case "height":
            return N > 0 ? A.pfValue * N : 0;
          case "average":
            return L > 0 && N > 0 ? A.pfValue * (L + N) / 2 : 0;
          case "min":
            return L > 0 && N > 0 ? L > N ? A.pfValue * N : A.pfValue * L : 0;
          case "max":
            return L > 0 && N > 0 ? L > N ? A.pfValue * L : A.pfValue * N : 0;
          default:
            return 0;
        }
      else return A.units === "px" ? A.pfValue : 0;
    }
    var m = h.width.left.value;
    h.width.left.units === "px" && h.width.val > 0 && (m = m * 100 / h.width.val);
    var v = h.width.right.value;
    h.width.right.units === "px" && h.width.val > 0 && (v = v * 100 / h.width.val);
    var y = h.height.top.value;
    h.height.top.units === "px" && h.height.val > 0 && (y = y * 100 / h.height.val);
    var b = h.height.bottom.value;
    h.height.bottom.units === "px" && h.height.val > 0 && (b = b * 100 / h.height.val);
    var w = p(h.width.val - d.w, m, v), T = w.biasDiff, E = w.biasComplementDiff, C = p(h.height.val - d.h, y, b), k = C.biasDiff, _ = C.biasComplementDiff;
    o.autoPadding = g(d.w, d.h, s.pstyle("padding"), s.pstyle("padding-relative-to").value), o.autoWidth = Math.max(d.w, h.width.val), f.x = (-T + d.x1 + d.x2 + E) / 2, o.autoHeight = Math.max(d.h, h.height.val), f.y = (-k + d.y1 + d.y2 + _) / 2;
  }
  for (var n = 0; n < this.length; n++) {
    var i = this[n], a = i._private;
    (!a.compoundBoundsClean || t) && (r(i), e.batching() || (a.compoundBoundsClean = !0));
  }
  return this;
};
var Ha = function(e) {
  return e === 1 / 0 || e === -1 / 0 ? 0 : e;
}, cs = function(e, r, n, i, a) {
  i - r === 0 || a - n === 0 || r == null || n == null || i == null || a == null || (e.x1 = r < e.x1 ? r : e.x1, e.x2 = i > e.x2 ? i : e.x2, e.y1 = n < e.y1 ? n : e.y1, e.y2 = a > e.y2 ? a : e.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1);
}, ml = function(e, r) {
  return r == null ? e : cs(e, r.x1, r.y1, r.x2, r.y2);
}, s0 = function(e, r, n) {
  return aa(e, r, n);
}, tm = function(e, r, n) {
  if (!r.cy().headless()) {
    var i = r._private, a = i.rstyle, s = a.arrowWidth / 2, o = r.pstyle(n + "-arrow-shape").value, l, u;
    if (o !== "none") {
      n === "source" ? (l = a.srcX, u = a.srcY) : n === "target" ? (l = a.tgtX, u = a.tgtY) : (l = a.midX, u = a.midY);
      var h = i.arrowBounds = i.arrowBounds || {}, d = h[n] = h[n] || {};
      d.x1 = l - s, d.y1 = u - s, d.x2 = l + s, d.y2 = u + s, d.w = d.x2 - d.x1, d.h = d.y2 - d.y1, rv(d, 1), cs(e, d.x1, d.y1, d.x2, d.y2);
    }
  }
}, H3 = function(e, r, n) {
  if (!r.cy().headless()) {
    var i;
    n ? i = n + "-" : i = "";
    var a = r._private, s = a.rstyle, o = r.pstyle(i + "label").strValue;
    if (o) {
      var l = r.pstyle("text-halign"), u = r.pstyle("text-valign"), h = s0(s, "labelWidth", n), d = s0(s, "labelHeight", n), f = s0(s, "labelX", n), p = s0(s, "labelY", n), g = r.pstyle(i + "text-margin-x").pfValue, m = r.pstyle(i + "text-margin-y").pfValue, v = r.isEdge(), y = r.pstyle(i + "text-rotation"), b = r.pstyle("text-outline-width").pfValue, w = r.pstyle("text-border-width").pfValue, T = w / 2, E = r.pstyle("text-background-padding").pfValue, C = 2, k = d, _ = h, L = _ / 2, N = k / 2, A, O, P, S;
      if (v)
        A = f - L, O = f + L, P = p - N, S = p + N;
      else {
        switch (l.value) {
          case "left":
            A = f - _, O = f;
            break;
          case "center":
            A = f - L, O = f + L;
            break;
          case "right":
            A = f, O = f + _;
            break;
        }
        switch (u.value) {
          case "top":
            P = p - k, S = p;
            break;
          case "center":
            P = p - N, S = p + N;
            break;
          case "bottom":
            P = p, S = p + k;
            break;
        }
      }
      var R = g - Math.max(b, T) - E - C, I = g + Math.max(b, T) + E + C, D = m - Math.max(b, T) - E - C, M = m + Math.max(b, T) + E + C;
      A += R, O += I, P += D, S += M;
      var B = n || "main", $ = a.labelBounds, F = $[B] = $[B] || {};
      F.x1 = A, F.y1 = P, F.x2 = O, F.y2 = S, F.w = O - A, F.h = S - P, F.leftPad = R, F.rightPad = I, F.topPad = D, F.botPad = M;
      var G = v && y.strValue === "autorotate", H = y.pfValue != null && y.pfValue !== 0;
      if (G || H) {
        var ee = G ? s0(a.rstyle, "labelAngle", n) : y.pfValue, Y = Math.cos(ee), re = Math.sin(ee), ne = (A + O) / 2, he = (P + S) / 2;
        if (!v) {
          switch (l.value) {
            case "left":
              ne = O;
              break;
            case "right":
              ne = A;
              break;
          }
          switch (u.value) {
            case "top":
              he = S;
              break;
            case "bottom":
              he = P;
              break;
          }
        }
        var K = function(Ae, W) {
          return Ae = Ae - ne, W = W - he, {
            x: Ae * Y - W * re + ne,
            y: Ae * re + W * Y + he
          };
        }, Z = K(A, P), X = K(A, S), q = K(O, P), J = K(O, S);
        A = Math.min(Z.x, X.x, q.x, J.x), O = Math.max(Z.x, X.x, q.x, J.x), P = Math.min(Z.y, X.y, q.y, J.y), S = Math.max(Z.y, X.y, q.y, J.y);
      }
      var j = B + "Rot", pe = $[j] = $[j] || {};
      pe.x1 = A, pe.y1 = P, pe.x2 = O, pe.y2 = S, pe.w = O - A, pe.h = S - P, cs(e, A, P, O, S), cs(a.labelBounds.all, A, P, O, S);
    }
    return e;
  }
}, v9 = function(e, r) {
  if (!r.cy().headless()) {
    var n = r.pstyle("outline-opacity").value, i = r.pstyle("outline-width").value, a = r.pstyle("outline-offset").value, s = i + a;
    KV(e, r, n, s, "outside", s / 2);
  }
}, KV = function(e, r, n, i, a, s) {
  if (!(n === 0 || i <= 0 || a === "inside")) {
    var o = r.cy(), l = r.pstyle("shape").value, u = o.renderer().nodeShapes[l], h = r.position(), d = h.x, f = h.y, p = r.width(), g = r.height();
    if (u.hasMiterBounds) {
      a === "center" && (i /= 2);
      var m = u.miterBounds(d, f, p, g, i);
      ml(e, m);
    } else s != null && s > 0 && nv(e, [s, s, s, s]);
  }
}, oxe = function(e, r) {
  if (!r.cy().headless()) {
    var n = r.pstyle("border-opacity").value, i = r.pstyle("border-width").pfValue, a = r.pstyle("border-position").value;
    KV(e, r, n, i, a);
  }
}, lxe = function(e, r) {
  var n = e._private.cy, i = n.styleEnabled(), a = n.headless(), s = Yi(), o = e._private, l = e.isNode(), u = e.isEdge(), h, d, f, p, g, m, v = o.rstyle, y = l && i ? e.pstyle("bounds-expansion").pfValue : [0], b = function(te) {
    return te.pstyle("display").value !== "none";
  }, w = !i || b(e) && (!u || b(e.source()) && b(e.target()));
  if (w) {
    var T = 0, E = 0;
    i && r.includeOverlays && (T = e.pstyle("overlay-opacity").value, T !== 0 && (E = e.pstyle("overlay-padding").value));
    var C = 0, k = 0;
    i && r.includeUnderlays && (C = e.pstyle("underlay-opacity").value, C !== 0 && (k = e.pstyle("underlay-padding").value));
    var _ = Math.max(E, k), L = 0, N = 0;
    if (i && (L = e.pstyle("width").pfValue, N = L / 2), l && r.includeNodes) {
      var A = e.position();
      g = A.x, m = A.y;
      var O = e.outerWidth(), P = O / 2, S = e.outerHeight(), R = S / 2;
      h = g - P, d = g + P, f = m - R, p = m + R, cs(s, h, f, d, p), i && v9(s, e), i && r.includeOutlines && !a && v9(s, e), i && oxe(s, e);
    } else if (u && r.includeEdges)
      if (i && !a) {
        var I = e.pstyle("curve-style").strValue;
        if (h = Math.min(v.srcX, v.midX, v.tgtX), d = Math.max(v.srcX, v.midX, v.tgtX), f = Math.min(v.srcY, v.midY, v.tgtY), p = Math.max(v.srcY, v.midY, v.tgtY), h -= N, d += N, f -= N, p += N, cs(s, h, f, d, p), I === "haystack") {
          var D = v.haystackPts;
          if (D && D.length === 2) {
            if (h = D[0].x, f = D[0].y, d = D[1].x, p = D[1].y, h > d) {
              var M = h;
              h = d, d = M;
            }
            if (f > p) {
              var B = f;
              f = p, p = B;
            }
            cs(s, h - N, f - N, d + N, p + N);
          }
        } else if (I === "bezier" || I === "unbundled-bezier" || El(I, "segments") || El(I, "taxi")) {
          var $;
          switch (I) {
            case "bezier":
            case "unbundled-bezier":
              $ = v.bezierPts;
              break;
            case "segments":
            case "taxi":
            case "round-segments":
            case "round-taxi":
              $ = v.linePts;
              break;
          }
          if ($ != null)
            for (var F = 0; F < $.length; F++) {
              var G = $[F];
              h = G.x - N, d = G.x + N, f = G.y - N, p = G.y + N, cs(s, h, f, d, p);
            }
        }
      } else {
        var H = e.source(), ee = H.position(), Y = e.target(), re = Y.position();
        if (h = ee.x, d = re.x, f = ee.y, p = re.y, h > d) {
          var ne = h;
          h = d, d = ne;
        }
        if (f > p) {
          var he = f;
          f = p, p = he;
        }
        h -= N, d += N, f -= N, p += N, cs(s, h, f, d, p);
      }
    if (i && r.includeEdges && u && (tm(s, e, "mid-source"), tm(s, e, "mid-target"), tm(s, e, "source"), tm(s, e, "target")), i) {
      var K = e.pstyle("ghost").value === "yes";
      if (K) {
        var Z = e.pstyle("ghost-offset-x").pfValue, X = e.pstyle("ghost-offset-y").pfValue;
        cs(s, s.x1 + Z, s.y1 + X, s.x2 + Z, s.y2 + X);
      }
    }
    var q = o.bodyBounds = o.bodyBounds || {};
    r_(q, s), nv(q, y), rv(q, 1), i && (h = s.x1, d = s.x2, f = s.y1, p = s.y2, cs(s, h - _, f - _, d + _, p + _));
    var J = o.overlayBounds = o.overlayBounds || {};
    r_(J, s), nv(J, y), rv(J, 1);
    var j = o.labelBounds = o.labelBounds || {};
    j.all != null ? Uve(j.all) : j.all = Yi(), i && r.includeLabels && (r.includeMainLabels && H3(s, e, null), u && (r.includeSourceLabels && H3(s, e, "source"), r.includeTargetLabels && H3(s, e, "target")));
  }
  return s.x1 = Ha(s.x1), s.y1 = Ha(s.y1), s.x2 = Ha(s.x2), s.y2 = Ha(s.y2), s.w = Ha(s.x2 - s.x1), s.h = Ha(s.y2 - s.y1), s.w > 0 && s.h > 0 && w && (nv(s, y), rv(s, 1)), s;
}, ZV = function(e) {
  var r = 0, n = function(s) {
    return (s ? 1 : 0) << r++;
  }, i = 0;
  return i += n(e.incudeNodes), i += n(e.includeEdges), i += n(e.includeLabels), i += n(e.includeMainLabels), i += n(e.includeSourceLabels), i += n(e.includeTargetLabels), i += n(e.includeOverlays), i += n(e.includeOutlines), i;
}, QV = function(e) {
  var r = function(o) {
    return Math.round(o);
  };
  if (e.isEdge()) {
    var n = e.source().position(), i = e.target().position();
    return KA([r(n.x), r(n.y), r(i.x), r(i.y)]);
  } else {
    var a = e.position();
    return KA([r(a.x), r(a.y)]);
  }
}, y9 = function(e, r) {
  var n = e._private, i, a = e.isEdge(), s = r == null ? x9 : ZV(r), o = s === x9;
  if (n.bbCache == null ? (i = lxe(e, ug), n.bbCache = i, n.bbCachePosKey = QV(e)) : i = n.bbCache, !o) {
    var l = e.isNode();
    i = Yi(), (r.includeNodes && l || r.includeEdges && !l) && (r.includeOverlays ? ml(i, n.overlayBounds) : ml(i, n.bodyBounds)), r.includeLabels && (r.includeMainLabels && (!a || r.includeSourceLabels && r.includeTargetLabels) ? ml(i, n.labelBounds.all) : (r.includeMainLabels && ml(i, n.labelBounds.mainRot), r.includeSourceLabels && ml(i, n.labelBounds.sourceRot), r.includeTargetLabels && ml(i, n.labelBounds.targetRot))), i.w = i.x2 - i.x1, i.h = i.y2 - i.y1;
  }
  return i;
}, ug = {
  includeNodes: !0,
  includeEdges: !0,
  includeLabels: !0,
  includeMainLabels: !0,
  includeSourceLabels: !0,
  includeTargetLabels: !0,
  includeOverlays: !0,
  includeUnderlays: !0,
  includeOutlines: !0,
  useCache: !0
}, x9 = ZV(ug), b9 = di(ug);
lc.boundingBox = function(t) {
  var e, r = t === void 0 || t.useCache === void 0 || t.useCache === !0, n = of(function(h) {
    var d = h._private;
    return d.bbCache == null || d.styleDirty || d.bbCachePosKey !== QV(h);
  }, function(h) {
    return h.id();
  });
  if (r && this.length === 1 && !n(this[0]))
    t === void 0 ? t = ug : t = b9(t), e = y9(this[0], t);
  else {
    e = Yi(), t = t || ug;
    var i = b9(t), a = this, s = a.cy(), o = s.styleEnabled();
    this.edges().forEach(n), this.nodes().forEach(n), o && this.recalculateRenderedStyle(r), this.updateCompoundBounds(!r);
    for (var l = 0; l < a.length; l++) {
      var u = a[l];
      n(u) && u.dirtyBoundingBoxCache(), ml(e, y9(u, i));
    }
  }
  return e.x1 = Ha(e.x1), e.y1 = Ha(e.y1), e.x2 = Ha(e.x2), e.y2 = Ha(e.y2), e.w = Ha(e.x2 - e.x1), e.h = Ha(e.y2 - e.y1), e;
};
lc.dirtyBoundingBoxCache = function() {
  for (var t = 0; t < this.length; t++) {
    var e = this[t]._private;
    e.bbCache = null, e.bbCachePosKey = null, e.bodyBounds = null, e.overlayBounds = null, e.labelBounds.all = null, e.labelBounds.source = null, e.labelBounds.target = null, e.labelBounds.main = null, e.labelBounds.sourceRot = null, e.labelBounds.targetRot = null, e.labelBounds.mainRot = null, e.arrowBounds.source = null, e.arrowBounds.target = null, e.arrowBounds["mid-source"] = null, e.arrowBounds["mid-target"] = null;
  }
  return this.emitAndNotify("bounds"), this;
};
lc.boundingBoxAt = function(t) {
  var e = this.nodes(), r = this.cy(), n = r.hasCompoundNodes(), i = r.collection();
  if (n && (i = e.filter(function(u) {
    return u.isParent();
  }), e = e.not(i)), vr(t)) {
    var a = t;
    t = function() {
      return a;
    };
  }
  var s = function(h, d) {
    return h._private.bbAtOldPos = t(h, d);
  }, o = function(h) {
    return h._private.bbAtOldPos;
  };
  r.startBatch(), e.forEach(s).silentPositions(t), n && (i.dirtyCompoundBoundsCache(), i.dirtyBoundingBoxCache(), i.updateCompoundBounds(!0));
  var l = Gve(this.boundingBox({
    useCache: !1
  }));
  return e.silentPositions(o), n && (i.dirtyCompoundBoundsCache(), i.dirtyBoundingBoxCache(), i.updateCompoundBounds(!0)), r.endBatch(), l;
};
Fh.boundingbox = Fh.bb = Fh.boundingBox;
Fh.renderedBoundingbox = Fh.renderedBoundingBox;
var cxe = lc, L0, n1;
L0 = n1 = {};
var JV = function(e) {
  e.uppercaseName = OA(e.name), e.autoName = "auto" + e.uppercaseName, e.labelName = "label" + e.uppercaseName, e.outerName = "outer" + e.uppercaseName, e.uppercaseOuterName = OA(e.outerName), L0[e.name] = function() {
    var n = this[0], i = n._private, a = i.cy, s = a._private.styleEnabled;
    if (n)
      if (s) {
        if (n.isParent())
          return n.updateCompoundBounds(), i[e.autoName] || 0;
        var o = n.pstyle(e.name);
        switch (o.strValue) {
          case "label":
            return n.recalculateRenderedStyle(), i.rstyle[e.labelName] || 0;
          default:
            return o.pfValue;
        }
      } else
        return 1;
  }, L0["outer" + e.uppercaseName] = function() {
    var n = this[0], i = n._private, a = i.cy, s = a._private.styleEnabled;
    if (n)
      if (s) {
        var o = n[e.name](), l = n.pstyle("border-position").value, u;
        l === "center" ? u = n.pstyle("border-width").pfValue : l === "outside" ? u = 2 * n.pstyle("border-width").pfValue : u = 0;
        var h = 2 * n.padding();
        return o + u + h;
      } else
        return 1;
  }, L0["rendered" + e.uppercaseName] = function() {
    var n = this[0];
    if (n) {
      var i = n[e.name]();
      return i * this.cy().zoom();
    }
  }, L0["rendered" + e.uppercaseOuterName] = function() {
    var n = this[0];
    if (n) {
      var i = n[e.outerName]();
      return i * this.cy().zoom();
    }
  };
};
JV({
  name: "width"
});
JV({
  name: "height"
});
n1.padding = function() {
  var t = this[0], e = t._private;
  return t.isParent() ? (t.updateCompoundBounds(), e.autoPadding !== void 0 ? e.autoPadding : t.pstyle("padding").pfValue) : t.pstyle("padding").pfValue;
};
n1.paddedHeight = function() {
  var t = this[0];
  return t.height() + 2 * t.padding();
};
n1.paddedWidth = function() {
  var t = this[0];
  return t.width() + 2 * t.padding();
};
var uxe = n1, hxe = function(e, r) {
  if (e.isEdge() && e.takesUpSpace())
    return r(e);
}, dxe = function(e, r) {
  if (e.isEdge() && e.takesUpSpace()) {
    var n = e.cy();
    return Mx(r(e), n.zoom(), n.pan());
  }
}, fxe = function(e, r) {
  if (e.isEdge() && e.takesUpSpace()) {
    var n = e.cy(), i = n.pan(), a = n.zoom();
    return r(e).map(function(s) {
      return Mx(s, a, i);
    });
  }
}, pxe = function(e) {
  return e.renderer().getControlPoints(e);
}, gxe = function(e) {
  return e.renderer().getSegmentPoints(e);
}, mxe = function(e) {
  return e.renderer().getSourceEndpoint(e);
}, vxe = function(e) {
  return e.renderer().getTargetEndpoint(e);
}, yxe = function(e) {
  return e.renderer().getEdgeMidpoint(e);
}, w9 = {
  controlPoints: {
    get: pxe,
    mult: !0
  },
  segmentPoints: {
    get: gxe,
    mult: !0
  },
  sourceEndpoint: {
    get: mxe
  },
  targetEndpoint: {
    get: vxe
  },
  midpoint: {
    get: yxe
  }
}, xxe = function(e) {
  return "rendered" + e[0].toUpperCase() + e.substr(1);
}, bxe = Object.keys(w9).reduce(function(t, e) {
  var r = w9[e], n = xxe(e);
  return t[e] = function() {
    return hxe(this, r.get);
  }, r.mult ? t[n] = function() {
    return fxe(this, r.get);
  } : t[n] = function() {
    return dxe(this, r.get);
  }, t;
}, {}), wxe = Gt({}, sxe, cxe, uxe, bxe);
/*!
Event object based on jQuery events, MIT license

https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*/
var eG = function(e, r) {
  this.recycle(e, r);
};
function o0() {
  return !1;
}
function rm() {
  return !0;
}
eG.prototype = {
  instanceString: function() {
    return "event";
  },
  recycle: function(e, r) {
    if (this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = o0, e != null && e.preventDefault ? (this.type = e.type, this.isDefaultPrevented = e.defaultPrevented ? rm : o0) : e != null && e.type ? r = e : this.type = e, r != null && (this.originalEvent = r.originalEvent, this.type = r.type != null ? r.type : this.type, this.cy = r.cy, this.target = r.target, this.position = r.position, this.renderedPosition = r.renderedPosition, this.namespace = r.namespace, this.layout = r.layout), this.cy != null && this.position != null && this.renderedPosition == null) {
      var n = this.position, i = this.cy.zoom(), a = this.cy.pan();
      this.renderedPosition = {
        x: n.x * i + a.x,
        y: n.y * i + a.y
      };
    }
    this.timeStamp = e && e.timeStamp || Date.now();
  },
  preventDefault: function() {
    this.isDefaultPrevented = rm;
    var e = this.originalEvent;
    e && e.preventDefault && e.preventDefault();
  },
  stopPropagation: function() {
    this.isPropagationStopped = rm;
    var e = this.originalEvent;
    e && e.stopPropagation && e.stopPropagation();
  },
  stopImmediatePropagation: function() {
    this.isImmediatePropagationStopped = rm, this.stopPropagation();
  },
  isDefaultPrevented: o0,
  isPropagationStopped: o0,
  isImmediatePropagationStopped: o0
};
var tG = /^([^.]+)(\.(?:[^.]+))?$/, Txe = ".*", rG = {
  qualifierCompare: function(e, r) {
    return e === r;
  },
  eventMatches: function() {
    return !0;
  },
  addEventFields: function() {
  },
  callbackContext: function(e) {
    return e;
  },
  beforeEmit: function() {
  },
  afterEmit: function() {
  },
  bubble: function() {
    return !1;
  },
  parent: function() {
    return null;
  },
  context: null
}, T9 = Object.keys(rG), Exe = {};
function $x() {
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Exe, e = arguments.length > 1 ? arguments[1] : void 0, r = 0; r < T9.length; r++) {
    var n = T9[r];
    this[n] = t[n] || rG[n];
  }
  this.context = e || this.context, this.listeners = [], this.emitting = 0;
}
var Yl = $x.prototype, nG = function(e, r, n, i, a, s, o) {
  nn(i) && (a = i, i = null), o && (s == null ? s = o : s = Gt({}, s, o));
  for (var l = Br(n) ? n : n.split(/\s+/), u = 0; u < l.length; u++) {
    var h = l[u];
    if (!Gl(h)) {
      var d = h.match(tG);
      if (d) {
        var f = d[1], p = d[2] ? d[2] : null, g = r(e, h, f, p, i, a, s);
        if (g === !1)
          break;
      }
    }
  }
}, E9 = function(e, r) {
  return e.addEventFields(e.context, r), new eG(r.type, r);
}, kxe = function(e, r, n) {
  if (Rme(n)) {
    r(e, n);
    return;
  } else if (vr(n)) {
    r(e, E9(e, n));
    return;
  }
  for (var i = Br(n) ? n : n.split(/\s+/), a = 0; a < i.length; a++) {
    var s = i[a];
    if (!Gl(s)) {
      var o = s.match(tG);
      if (o) {
        var l = o[1], u = o[2] ? o[2] : null, h = E9(e, {
          type: l,
          namespace: u,
          target: e.context
        });
        r(e, h);
      }
    }
  }
};
Yl.on = Yl.addListener = function(t, e, r, n, i) {
  return nG(this, function(a, s, o, l, u, h, d) {
    nn(h) && a.listeners.push({
      event: s,
      // full event string
      callback: h,
      // callback to run
      type: o,
      // the event type (e.g. 'click')
      namespace: l,
      // the event namespace (e.g. ".foo")
      qualifier: u,
      // a restriction on whether to match this emitter
      conf: d
      // additional configuration
    });
  }, t, e, r, n, i), this;
};
Yl.one = function(t, e, r, n) {
  return this.on(t, e, r, n, {
    one: !0
  });
};
Yl.removeListener = Yl.off = function(t, e, r, n) {
  var i = this;
  this.emitting !== 0 && (this.listeners = dve(this.listeners));
  for (var a = this.listeners, s = function(u) {
    var h = a[u];
    nG(i, function(d, f, p, g, m, v) {
      if ((h.type === p || t === "*") && (!g && h.namespace !== ".*" || h.namespace === g) && (!m || d.qualifierCompare(h.qualifier, m)) && (!v || h.callback === v))
        return a.splice(u, 1), !1;
    }, t, e, r, n);
  }, o = a.length - 1; o >= 0; o--)
    s(o);
  return this;
};
Yl.removeAllListeners = function() {
  return this.removeListener("*");
};
Yl.emit = Yl.trigger = function(t, e, r) {
  var n = this.listeners, i = n.length;
  return this.emitting++, Br(e) || (e = [e]), kxe(this, function(a, s) {
    r != null && (n = [{
      event: s.event,
      type: s.type,
      namespace: s.namespace,
      callback: r
    }], i = n.length);
    for (var o = function() {
      var h = n[l];
      if (h.type === s.type && (!h.namespace || h.namespace === s.namespace || h.namespace === Txe) && a.eventMatches(a.context, h, s)) {
        var d = [s];
        e != null && pve(d, e), a.beforeEmit(a.context, h, s), h.conf && h.conf.one && (a.listeners = a.listeners.filter(function(g) {
          return g !== h;
        }));
        var f = a.callbackContext(a.context, h, s), p = h.callback.apply(f, d);
        a.afterEmit(a.context, h, s), p === !1 && (s.stopPropagation(), s.preventDefault());
      }
    }, l = 0; l < i; l++)
      o();
    a.bubble(a.context) && !s.isPropagationStopped() && a.parent(a.context).emit(s, e);
  }, t), this.emitting--, this;
};
var Sxe = {
  qualifierCompare: function(e, r) {
    return e == null || r == null ? e == null && r == null : e.sameText(r);
  },
  eventMatches: function(e, r, n) {
    var i = r.qualifier;
    return i != null ? e !== n.target && Zg(n.target) && i.matches(n.target) : !0;
  },
  addEventFields: function(e, r) {
    r.cy = e.cy(), r.target = e;
  },
  callbackContext: function(e, r, n) {
    return r.qualifier != null ? n.target : e;
  },
  beforeEmit: function(e, r) {
    r.conf && r.conf.once && r.conf.onceCollection.removeListener(r.event, r.qualifier, r.callback);
  },
  bubble: function() {
    return !0;
  },
  parent: function(e) {
    return e.isChild() ? e.parent() : e.cy();
  }
}, nm = function(e) {
  return Bt(e) ? new Hl(e) : e;
}, iG = {
  createEmitter: function() {
    for (var e = 0; e < this.length; e++) {
      var r = this[e], n = r._private;
      n.emitter || (n.emitter = new $x(Sxe, r));
    }
    return this;
  },
  emitter: function() {
    return this._private.emitter;
  },
  on: function(e, r, n) {
    for (var i = nm(r), a = 0; a < this.length; a++) {
      var s = this[a];
      s.emitter().on(e, i, n);
    }
    return this;
  },
  removeListener: function(e, r, n) {
    for (var i = nm(r), a = 0; a < this.length; a++) {
      var s = this[a];
      s.emitter().removeListener(e, i, n);
    }
    return this;
  },
  removeAllListeners: function() {
    for (var e = 0; e < this.length; e++) {
      var r = this[e];
      r.emitter().removeAllListeners();
    }
    return this;
  },
  one: function(e, r, n) {
    for (var i = nm(r), a = 0; a < this.length; a++) {
      var s = this[a];
      s.emitter().one(e, i, n);
    }
    return this;
  },
  once: function(e, r, n) {
    for (var i = nm(r), a = 0; a < this.length; a++) {
      var s = this[a];
      s.emitter().on(e, i, n, {
        once: !0,
        onceCollection: this
      });
    }
  },
  emit: function(e, r) {
    for (var n = 0; n < this.length; n++) {
      var i = this[n];
      i.emitter().emit(e, r);
    }
    return this;
  },
  emitAndNotify: function(e, r) {
    if (this.length !== 0)
      return this.cy().notify(e, this), this.emit(e, r), this;
  }
};
_r.eventAliasesOn(iG);
var aG = {
  nodes: function(e) {
    return this.filter(function(r) {
      return r.isNode();
    }).filter(e);
  },
  edges: function(e) {
    return this.filter(function(r) {
      return r.isEdge();
    }).filter(e);
  },
  // internal helper to get nodes and edges as separate collections with single iteration over elements
  byGroup: function() {
    for (var e = this.spawn(), r = this.spawn(), n = 0; n < this.length; n++) {
      var i = this[n];
      i.isNode() ? e.push(i) : r.push(i);
    }
    return {
      nodes: e,
      edges: r
    };
  },
  filter: function(e, r) {
    if (e === void 0)
      return this;
    if (Bt(e) || La(e))
      return new Hl(e).filter(this);
    if (nn(e)) {
      for (var n = this.spawn(), i = this, a = 0; a < i.length; a++) {
        var s = i[a], o = r ? e.apply(r, [s, a, i]) : e(s, a, i);
        o && n.push(s);
      }
      return n;
    }
    return this.spawn();
  },
  not: function(e) {
    if (e) {
      Bt(e) && (e = this.filter(e));
      for (var r = this.spawn(), n = 0; n < this.length; n++) {
        var i = this[n], a = e.has(i);
        a || r.push(i);
      }
      return r;
    } else
      return this;
  },
  absoluteComplement: function() {
    var e = this.cy();
    return e.mutableElements().not(this);
  },
  intersect: function(e) {
    if (Bt(e)) {
      var r = e;
      return this.filter(r);
    }
    for (var n = this.spawn(), i = this, a = e, s = this.length < e.length, o = s ? i : a, l = s ? a : i, u = 0; u < o.length; u++) {
      var h = o[u];
      l.has(h) && n.push(h);
    }
    return n;
  },
  xor: function(e) {
    var r = this._private.cy;
    Bt(e) && (e = r.$(e));
    var n = this.spawn(), i = this, a = e, s = function(l, u) {
      for (var h = 0; h < l.length; h++) {
        var d = l[h], f = d._private.data.id, p = u.hasElementWithId(f);
        p || n.push(d);
      }
    };
    return s(i, a), s(a, i), n;
  },
  diff: function(e) {
    var r = this._private.cy;
    Bt(e) && (e = r.$(e));
    var n = this.spawn(), i = this.spawn(), a = this.spawn(), s = this, o = e, l = function(h, d, f) {
      for (var p = 0; p < h.length; p++) {
        var g = h[p], m = g._private.data.id, v = d.hasElementWithId(m);
        v ? a.merge(g) : f.push(g);
      }
    };
    return l(s, o, n), l(o, s, i), {
      left: n,
      right: i,
      both: a
    };
  },
  add: function(e) {
    var r = this._private.cy;
    if (!e)
      return this;
    if (Bt(e)) {
      var n = e;
      e = r.mutableElements().filter(n);
    }
    for (var i = this.spawnSelf(), a = 0; a < e.length; a++) {
      var s = e[a], o = !this.has(s);
      o && i.push(s);
    }
    return i;
  },
  // in place merge on calling collection
  merge: function(e) {
    var r = this._private, n = r.cy;
    if (!e)
      return this;
    if (e && Bt(e)) {
      var i = e;
      e = n.mutableElements().filter(i);
    }
    for (var a = r.map, s = 0; s < e.length; s++) {
      var o = e[s], l = o._private.data.id, u = !a.has(l);
      if (u) {
        var h = this.length++;
        this[h] = o, a.set(l, {
          ele: o,
          index: h
        });
      }
    }
    return this;
  },
  unmergeAt: function(e) {
    var r = this[e], n = r.id(), i = this._private, a = i.map;
    this[e] = void 0, a.delete(n);
    var s = e === this.length - 1;
    if (this.length > 1 && !s) {
      var o = this.length - 1, l = this[o], u = l._private.data.id;
      this[o] = void 0, this[e] = l, a.set(u, {
        ele: l,
        index: e
      });
    }
    return this.length--, this;
  },
  // remove single ele in place in calling collection
  unmergeOne: function(e) {
    e = e[0];
    var r = this._private, n = e._private.data.id, i = r.map, a = i.get(n);
    if (!a)
      return this;
    var s = a.index;
    return this.unmergeAt(s), this;
  },
  // remove eles in place on calling collection
  unmerge: function(e) {
    var r = this._private.cy;
    if (!e)
      return this;
    if (e && Bt(e)) {
      var n = e;
      e = r.mutableElements().filter(n);
    }
    for (var i = 0; i < e.length; i++)
      this.unmergeOne(e[i]);
    return this;
  },
  unmergeBy: function(e) {
    for (var r = this.length - 1; r >= 0; r--) {
      var n = this[r];
      e(n) && this.unmergeAt(r);
    }
    return this;
  },
  map: function(e, r) {
    for (var n = [], i = this, a = 0; a < i.length; a++) {
      var s = i[a], o = r ? e.apply(r, [s, a, i]) : e(s, a, i);
      n.push(o);
    }
    return n;
  },
  reduce: function(e, r) {
    for (var n = r, i = this, a = 0; a < i.length; a++)
      n = e(n, i[a], a, i);
    return n;
  },
  max: function(e, r) {
    for (var n = -1 / 0, i, a = this, s = 0; s < a.length; s++) {
      var o = a[s], l = r ? e.apply(r, [o, s, a]) : e(o, s, a);
      l > n && (n = l, i = o);
    }
    return {
      value: n,
      ele: i
    };
  },
  min: function(e, r) {
    for (var n = 1 / 0, i, a = this, s = 0; s < a.length; s++) {
      var o = a[s], l = r ? e.apply(r, [o, s, a]) : e(o, s, a);
      l < n && (n = l, i = o);
    }
    return {
      value: n,
      ele: i
    };
  }
}, wr = aG;
wr.u = wr["|"] = wr["+"] = wr.union = wr.or = wr.add;
wr["\\"] = wr["!"] = wr["-"] = wr.difference = wr.relativeComplement = wr.subtract = wr.not;
wr.n = wr["&"] = wr["."] = wr.and = wr.intersection = wr.intersect;
wr["^"] = wr["(+)"] = wr["(-)"] = wr.symmetricDifference = wr.symdiff = wr.xor;
wr.fnFilter = wr.filterFn = wr.stdFilter = wr.filter;
wr.complement = wr.abscomp = wr.absoluteComplement;
var Cxe = {
  isNode: function() {
    return this.group() === "nodes";
  },
  isEdge: function() {
    return this.group() === "edges";
  },
  isLoop: function() {
    return this.isEdge() && this.source()[0] === this.target()[0];
  },
  isSimple: function() {
    return this.isEdge() && this.source()[0] !== this.target()[0];
  },
  group: function() {
    var e = this[0];
    if (e)
      return e._private.group;
  }
}, sG = function(e, r) {
  var n = e.cy(), i = n.hasCompoundNodes();
  function a(h) {
    var d = h.pstyle("z-compound-depth");
    return d.value === "auto" ? i ? h.zDepth() : 0 : d.value === "bottom" ? -1 : d.value === "top" ? qk : 0;
  }
  var s = a(e) - a(r);
  if (s !== 0)
    return s;
  function o(h) {
    var d = h.pstyle("z-index-compare");
    return d.value === "auto" && h.isNode() ? 1 : 0;
  }
  var l = o(e) - o(r);
  if (l !== 0)
    return l;
  var u = e.pstyle("z-index").value - r.pstyle("z-index").value;
  return u !== 0 ? u : e.poolIndex() - r.poolIndex();
}, zy = {
  forEach: function(e, r) {
    if (nn(e))
      for (var n = this.length, i = 0; i < n; i++) {
        var a = this[i], s = r ? e.apply(r, [a, i, this]) : e(a, i, this);
        if (s === !1)
          break;
      }
    return this;
  },
  toArray: function() {
    for (var e = [], r = 0; r < this.length; r++)
      e.push(this[r]);
    return e;
  },
  slice: function(e, r) {
    var n = [], i = this.length;
    r == null && (r = i), e == null && (e = 0), e < 0 && (e = i + e), r < 0 && (r = i + r);
    for (var a = e; a >= 0 && a < r && a < i; a++)
      n.push(this[a]);
    return this.spawn(n);
  },
  size: function() {
    return this.length;
  },
  eq: function(e) {
    return this[e] || this.spawn();
  },
  first: function() {
    return this[0] || this.spawn();
  },
  last: function() {
    return this[this.length - 1] || this.spawn();
  },
  empty: function() {
    return this.length === 0;
  },
  nonempty: function() {
    return !this.empty();
  },
  sort: function(e) {
    if (!nn(e))
      return this;
    var r = this.toArray().sort(e);
    return this.spawn(r);
  },
  sortByZIndex: function() {
    return this.sort(sG);
  },
  zDepth: function() {
    var e = this[0];
    if (e) {
      var r = e._private, n = r.group;
      if (n === "nodes") {
        var i = r.data.parent ? e.parents().size() : 0;
        return e.isParent() ? i : qk - 1;
      } else {
        var a = r.source, s = r.target, o = a.zDepth(), l = s.zDepth();
        return Math.max(o, l, 0);
      }
    }
  }
};
zy.each = zy.forEach;
var Axe = function() {
  var e = "undefined", r = (typeof Symbol > "u" ? "undefined" : zn(Symbol)) != e && zn(Symbol.iterator) != e;
  r && (zy[Symbol.iterator] = function() {
    var n = this, i = {
      value: void 0,
      done: !1
    }, a = 0, s = this.length;
    return iV({
      next: function() {
        return a < s ? i.value = n[a++] : (i.value = void 0, i.done = !0), i;
      }
    }, Symbol.iterator, function() {
      return this;
    });
  });
};
Axe();
var _xe = di({
  nodeDimensionsIncludeLabels: !1
}), av = {
  // Calculates and returns node dimensions { x, y } based on options given
  layoutDimensions: function(e) {
    e = _xe(e);
    var r;
    if (!this.takesUpSpace())
      r = {
        w: 0,
        h: 0
      };
    else if (e.nodeDimensionsIncludeLabels) {
      var n = this.boundingBox();
      r = {
        w: n.w,
        h: n.h
      };
    } else
      r = {
        w: this.outerWidth(),
        h: this.outerHeight()
      };
    return (r.w === 0 || r.h === 0) && (r.w = r.h = 1), r;
  },
  // using standard layout options, apply position function (w/ or w/o animation)
  layoutPositions: function(e, r, n) {
    var i = this.nodes().filter(function(E) {
      return !E.isParent();
    }), a = this.cy(), s = r.eles, o = function(C) {
      return C.id();
    }, l = of(n, o);
    e.emit({
      type: "layoutstart",
      layout: e
    }), e.animations = [];
    var u = function(C, k, _) {
      var L = {
        x: k.x1 + k.w / 2,
        y: k.y1 + k.h / 2
      }, N = {
        // scale from center of bounding box (not necessarily 0,0)
        x: (_.x - L.x) * C,
        y: (_.y - L.y) * C
      };
      return {
        x: L.x + N.x,
        y: L.y + N.y
      };
    }, h = r.spacingFactor && r.spacingFactor !== 1, d = function() {
      if (!h)
        return null;
      for (var C = Yi(), k = 0; k < i.length; k++) {
        var _ = i[k], L = l(_, k);
        kV(C, L.x, L.y);
      }
      return C;
    }, f = d(), p = of(function(E, C) {
      var k = l(E, C);
      if (h) {
        var _ = Math.abs(r.spacingFactor);
        k = u(_, f, k);
      }
      return r.transform != null && (k = r.transform(E, k)), k;
    }, o);
    if (r.animate) {
      for (var g = 0; g < i.length; g++) {
        var m = i[g], v = p(m, g), y = r.animateFilter == null || r.animateFilter(m, g);
        if (y) {
          var b = m.animation({
            position: v,
            duration: r.animationDuration,
            easing: r.animationEasing
          });
          e.animations.push(b);
        } else
          m.position(v);
      }
      if (r.fit) {
        var w = a.animation({
          fit: {
            boundingBox: s.boundingBoxAt(p),
            padding: r.padding
          },
          duration: r.animationDuration,
          easing: r.animationEasing
        });
        e.animations.push(w);
      } else if (r.zoom !== void 0 && r.pan !== void 0) {
        var T = a.animation({
          zoom: r.zoom,
          pan: r.pan,
          duration: r.animationDuration,
          easing: r.animationEasing
        });
        e.animations.push(T);
      }
      e.animations.forEach(function(E) {
        return E.play();
      }), e.one("layoutready", r.ready), e.emit({
        type: "layoutready",
        layout: e
      }), Df.all(e.animations.map(function(E) {
        return E.promise();
      })).then(function() {
        e.one("layoutstop", r.stop), e.emit({
          type: "layoutstop",
          layout: e
        });
      });
    } else
      i.positions(p), r.fit && a.fit(r.eles, r.padding), r.zoom != null && a.zoom(r.zoom), r.pan && a.pan(r.pan), e.one("layoutready", r.ready), e.emit({
        type: "layoutready",
        layout: e
      }), e.one("layoutstop", r.stop), e.emit({
        type: "layoutstop",
        layout: e
      });
    return this;
  },
  layout: function(e) {
    var r = this.cy();
    return r.makeLayout(Gt({}, e, {
      eles: this
    }));
  }
};
av.createLayout = av.makeLayout = av.layout;
function oG(t, e, r) {
  var n = r._private, i = n.styleCache = n.styleCache || [], a;
  return (a = i[t]) != null || (a = i[t] = e(r)), a;
}
function zx(t, e) {
  return t = gu(t), function(n) {
    return oG(t, e, n);
  };
}
function Vx(t, e) {
  t = gu(t);
  var r = function(i) {
    return e.call(i);
  };
  return function() {
    var i = this[0];
    if (i)
      return oG(t, r, i);
  };
}
var ci = {
  recalculateRenderedStyle: function(e) {
    var r = this.cy(), n = r.renderer(), i = r.styleEnabled();
    return n && i && n.recalculateRenderedStyle(this, e), this;
  },
  dirtyStyleCache: function() {
    var e = this.cy(), r = function(a) {
      return a._private.styleCache = null;
    };
    if (e.hasCompoundNodes()) {
      var n;
      n = this.spawnSelf().merge(this.descendants()).merge(this.parents()), n.merge(n.connectedEdges()), n.forEach(r);
    } else
      this.forEach(function(i) {
        r(i), i.connectedEdges().forEach(r);
      });
    return this;
  },
  // fully updates (recalculates) the style for the elements
  updateStyle: function(e) {
    var r = this._private.cy;
    if (!r.styleEnabled())
      return this;
    if (r.batching()) {
      var n = r._private.batchStyleEles;
      return n.merge(this), this;
    }
    var i = r.hasCompoundNodes(), a = this;
    e = !!(e || e === void 0), i && (a = this.spawnSelf().merge(this.descendants()).merge(this.parents()));
    var s = a;
    return e ? s.emitAndNotify("style") : s.emit("style"), a.forEach(function(o) {
      return o._private.styleDirty = !0;
    }), this;
  },
  // private: clears dirty flag and recalculates style
  cleanStyle: function() {
    var e = this.cy();
    if (e.styleEnabled())
      for (var r = 0; r < this.length; r++) {
        var n = this[r];
        n._private.styleDirty && (n._private.styleDirty = !1, e.style().apply(n));
      }
  },
  // get the internal parsed style object for the specified property
  parsedStyle: function(e) {
    var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, n = this[0], i = n.cy();
    if (i.styleEnabled() && n) {
      n._private.styleDirty && (n._private.styleDirty = !1, i.style().apply(n));
      var a = n._private.style[e];
      return a ?? (r ? i.style().getDefaultProperty(e) : null);
    }
  },
  numericStyle: function(e) {
    var r = this[0];
    if (r.cy().styleEnabled() && r) {
      var n = r.pstyle(e);
      return n.pfValue !== void 0 ? n.pfValue : n.value;
    }
  },
  numericStyleUnits: function(e) {
    var r = this[0];
    if (r.cy().styleEnabled() && r)
      return r.pstyle(e).units;
  },
  // get the specified css property as a rendered value (i.e. on-screen value)
  // or get the whole rendered style if no property specified (NB doesn't allow setting)
  renderedStyle: function(e) {
    var r = this.cy();
    if (!r.styleEnabled())
      return this;
    var n = this[0];
    if (n)
      return r.style().getRenderedStyle(n, e);
  },
  // read the calculated css style of the element or override the style (via a bypass)
  style: function(e, r) {
    var n = this.cy();
    if (!n.styleEnabled())
      return this;
    var i = !1, a = n.style();
    if (vr(e)) {
      var s = e;
      a.applyBypass(this, s, i), this.emitAndNotify("style");
    } else if (Bt(e))
      if (r === void 0) {
        var o = this[0];
        return o ? a.getStylePropertyValue(o, e) : void 0;
      } else
        a.applyBypass(this, e, r, i), this.emitAndNotify("style");
    else if (e === void 0) {
      var l = this[0];
      return l ? a.getRawStyle(l) : void 0;
    }
    return this;
  },
  removeStyle: function(e) {
    var r = this.cy();
    if (!r.styleEnabled())
      return this;
    var n = !1, i = r.style(), a = this;
    if (e === void 0)
      for (var s = 0; s < a.length; s++) {
        var o = a[s];
        i.removeAllBypasses(o, n);
      }
    else {
      e = e.split(/\s+/);
      for (var l = 0; l < a.length; l++) {
        var u = a[l];
        i.removeBypasses(u, e, n);
      }
    }
    return this.emitAndNotify("style"), this;
  },
  show: function() {
    return this.css("display", "element"), this;
  },
  hide: function() {
    return this.css("display", "none"), this;
  },
  effectiveOpacity: function() {
    var e = this.cy();
    if (!e.styleEnabled())
      return 1;
    var r = e.hasCompoundNodes(), n = this[0];
    if (n) {
      var i = n._private, a = n.pstyle("opacity").value;
      if (!r)
        return a;
      var s = i.data.parent ? n.parents() : null;
      if (s)
        for (var o = 0; o < s.length; o++) {
          var l = s[o], u = l.pstyle("opacity").value;
          a = u * a;
        }
      return a;
    }
  },
  transparent: function() {
    var e = this.cy();
    if (!e.styleEnabled())
      return !1;
    var r = this[0], n = r.cy().hasCompoundNodes();
    if (r)
      return n ? r.effectiveOpacity() === 0 : r.pstyle("opacity").value === 0;
  },
  backgrounding: function() {
    var e = this.cy();
    if (!e.styleEnabled())
      return !1;
    var r = this[0];
    return !!r._private.backgrounding;
  }
};
function q3(t, e) {
  var r = t._private, n = r.data.parent ? t.parents() : null;
  if (n)
    for (var i = 0; i < n.length; i++) {
      var a = n[i];
      if (!e(a))
        return !1;
    }
  return !0;
}
function iS(t) {
  var e = t.ok, r = t.edgeOkViaNode || t.ok, n = t.parentOk || t.ok;
  return function() {
    var i = this.cy();
    if (!i.styleEnabled())
      return !0;
    var a = this[0], s = i.hasCompoundNodes();
    if (a) {
      var o = a._private;
      if (!e(a))
        return !1;
      if (a.isNode())
        return !s || q3(a, n);
      var l = o.source, u = o.target;
      return r(l) && (!s || q3(l, r)) && (l === u || r(u) && (!s || q3(u, r)));
    }
  };
}
var If = zx("eleTakesUpSpace", function(t) {
  return t.pstyle("display").value === "element" && t.width() !== 0 && (t.isNode() ? t.height() !== 0 : !0);
});
ci.takesUpSpace = Vx("takesUpSpace", iS({
  ok: If
}));
var Lxe = zx("eleInteractive", function(t) {
  return t.pstyle("events").value === "yes" && t.pstyle("visibility").value === "visible" && If(t);
}), Rxe = zx("parentInteractive", function(t) {
  return t.pstyle("visibility").value === "visible" && If(t);
});
ci.interactive = Vx("interactive", iS({
  ok: Lxe,
  parentOk: Rxe,
  edgeOkViaNode: If
}));
ci.noninteractive = function() {
  var t = this[0];
  if (t)
    return !t.interactive();
};
var Nxe = zx("eleVisible", function(t) {
  return t.pstyle("visibility").value === "visible" && t.pstyle("opacity").pfValue !== 0 && If(t);
}), Mxe = If;
ci.visible = Vx("visible", iS({
  ok: Nxe,
  edgeOkViaNode: Mxe
}));
ci.hidden = function() {
  var t = this[0];
  if (t)
    return !t.visible();
};
ci.isBundledBezier = Vx("isBundledBezier", function() {
  return this.cy().styleEnabled() ? !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace() : !1;
});
ci.bypass = ci.css = ci.style;
ci.renderedCss = ci.renderedStyle;
ci.removeBypass = ci.removeCss = ci.removeStyle;
ci.pstyle = ci.parsedStyle;
var Nl = {};
function k9(t) {
  return function() {
    var e = arguments, r = [];
    if (e.length === 2) {
      var n = e[0], i = e[1];
      this.on(t.event, n, i);
    } else if (e.length === 1 && nn(e[0])) {
      var a = e[0];
      this.on(t.event, a);
    } else if (e.length === 0 || e.length === 1 && Br(e[0])) {
      for (var s = e.length === 1 ? e[0] : null, o = 0; o < this.length; o++) {
        var l = this[o], u = !t.ableField || l._private[t.ableField], h = l._private[t.field] != t.value;
        if (t.overrideAble) {
          var d = t.overrideAble(l);
          if (d !== void 0 && (u = d, !d))
            return this;
        }
        u && (l._private[t.field] = t.value, h && r.push(l));
      }
      var f = this.spawn(r);
      f.updateStyle(), f.emit(t.event), s && f.emit(s);
    }
    return this;
  };
}
function Of(t) {
  Nl[t.field] = function() {
    var e = this[0];
    if (e) {
      if (t.overrideField) {
        var r = t.overrideField(e);
        if (r !== void 0)
          return r;
      }
      return e._private[t.field];
    }
  }, Nl[t.on] = k9({
    event: t.on,
    field: t.field,
    ableField: t.ableField,
    overrideAble: t.overrideAble,
    value: !0
  }), Nl[t.off] = k9({
    event: t.off,
    field: t.field,
    ableField: t.ableField,
    overrideAble: t.overrideAble,
    value: !1
  });
}
Of({
  field: "locked",
  overrideField: function(e) {
    return e.cy().autolock() ? !0 : void 0;
  },
  on: "lock",
  off: "unlock"
});
Of({
  field: "grabbable",
  overrideField: function(e) {
    return e.cy().autoungrabify() || e.pannable() ? !1 : void 0;
  },
  on: "grabify",
  off: "ungrabify"
});
Of({
  field: "selected",
  ableField: "selectable",
  overrideAble: function(e) {
    return e.cy().autounselectify() ? !1 : void 0;
  },
  on: "select",
  off: "unselect"
});
Of({
  field: "selectable",
  overrideField: function(e) {
    return e.cy().autounselectify() ? !1 : void 0;
  },
  on: "selectify",
  off: "unselectify"
});
Nl.deselect = Nl.unselect;
Nl.grabbed = function() {
  var t = this[0];
  if (t)
    return t._private.grabbed;
};
Of({
  field: "active",
  on: "activate",
  off: "unactivate"
});
Of({
  field: "pannable",
  on: "panify",
  off: "unpanify"
});
Nl.inactive = function() {
  var t = this[0];
  if (t)
    return !t._private.active;
};
var Ai = {}, S9 = function(e) {
  return function(n) {
    for (var i = this, a = [], s = 0; s < i.length; s++) {
      var o = i[s];
      if (o.isNode()) {
        for (var l = !1, u = o.connectedEdges(), h = 0; h < u.length; h++) {
          var d = u[h], f = d.source(), p = d.target();
          if (e.noIncomingEdges && p === o && f !== o || e.noOutgoingEdges && f === o && p !== o) {
            l = !0;
            break;
          }
        }
        l || a.push(o);
      }
    }
    return this.spawn(a, !0).filter(n);
  };
}, C9 = function(e) {
  return function(r) {
    for (var n = this, i = [], a = 0; a < n.length; a++) {
      var s = n[a];
      if (s.isNode())
        for (var o = s.connectedEdges(), l = 0; l < o.length; l++) {
          var u = o[l], h = u.source(), d = u.target();
          e.outgoing && h === s ? (i.push(u), i.push(d)) : e.incoming && d === s && (i.push(u), i.push(h));
        }
    }
    return this.spawn(i, !0).filter(r);
  };
}, A9 = function(e) {
  return function(r) {
    for (var n = this, i = [], a = {}; ; ) {
      var s = e.outgoing ? n.outgoers() : n.incomers();
      if (s.length === 0)
        break;
      for (var o = !1, l = 0; l < s.length; l++) {
        var u = s[l], h = u.id();
        a[h] || (a[h] = !0, i.push(u), o = !0);
      }
      if (!o)
        break;
      n = s;
    }
    return this.spawn(i, !0).filter(r);
  };
};
Ai.clearTraversalCache = function() {
  for (var t = 0; t < this.length; t++)
    this[t]._private.traversalCache = null;
};
Gt(Ai, {
  // get the root nodes in the DAG
  roots: S9({
    noIncomingEdges: !0
  }),
  // get the leaf nodes in the DAG
  leaves: S9({
    noOutgoingEdges: !0
  }),
  // normally called children in graph theory
  // these nodes =edges=> outgoing nodes
  outgoers: ja(C9({
    outgoing: !0
  }), "outgoers"),
  // aka DAG descendants
  successors: A9({
    outgoing: !0
  }),
  // normally called parents in graph theory
  // these nodes <=edges= incoming nodes
  incomers: ja(C9({
    incoming: !0
  }), "incomers"),
  // aka DAG ancestors
  predecessors: A9({})
});
Gt(Ai, {
  neighborhood: ja(function(t) {
    for (var e = [], r = this.nodes(), n = 0; n < r.length; n++)
      for (var i = r[n], a = i.connectedEdges(), s = 0; s < a.length; s++) {
        var o = a[s], l = o.source(), u = o.target(), h = i === l ? u : l;
        h.length > 0 && e.push(h[0]), e.push(o[0]);
      }
    return this.spawn(e, !0).filter(t);
  }, "neighborhood"),
  closedNeighborhood: function(e) {
    return this.neighborhood().add(this).filter(e);
  },
  openNeighborhood: function(e) {
    return this.neighborhood(e);
  }
});
Ai.neighbourhood = Ai.neighborhood;
Ai.closedNeighbourhood = Ai.closedNeighborhood;
Ai.openNeighbourhood = Ai.openNeighborhood;
Gt(Ai, {
  source: ja(function(e) {
    var r = this[0], n;
    return r && (n = r._private.source || r.cy().collection()), n && e ? n.filter(e) : n;
  }, "source"),
  target: ja(function(e) {
    var r = this[0], n;
    return r && (n = r._private.target || r.cy().collection()), n && e ? n.filter(e) : n;
  }, "target"),
  sources: _9({
    attr: "source"
  }),
  targets: _9({
    attr: "target"
  })
});
function _9(t) {
  return function(r) {
    for (var n = [], i = 0; i < this.length; i++) {
      var a = this[i], s = a._private[t.attr];
      s && n.push(s);
    }
    return this.spawn(n, !0).filter(r);
  };
}
Gt(Ai, {
  edgesWith: ja(L9(), "edgesWith"),
  edgesTo: ja(L9({
    thisIsSrc: !0
  }), "edgesTo")
});
function L9(t) {
  return function(r) {
    var n = [], i = this._private.cy, a = t || {};
    Bt(r) && (r = i.$(r));
    for (var s = 0; s < r.length; s++)
      for (var o = r[s]._private.edges, l = 0; l < o.length; l++) {
        var u = o[l], h = u._private.data, d = this.hasElementWithId(h.source) && r.hasElementWithId(h.target), f = r.hasElementWithId(h.source) && this.hasElementWithId(h.target), p = d || f;
        p && ((a.thisIsSrc || a.thisIsTgt) && (a.thisIsSrc && !d || a.thisIsTgt && !f) || n.push(u));
      }
    return this.spawn(n, !0);
  };
}
Gt(Ai, {
  connectedEdges: ja(function(t) {
    for (var e = [], r = this, n = 0; n < r.length; n++) {
      var i = r[n];
      if (i.isNode())
        for (var a = i._private.edges, s = 0; s < a.length; s++) {
          var o = a[s];
          e.push(o);
        }
    }
    return this.spawn(e, !0).filter(t);
  }, "connectedEdges"),
  connectedNodes: ja(function(t) {
    for (var e = [], r = this, n = 0; n < r.length; n++) {
      var i = r[n];
      i.isEdge() && (e.push(i.source()[0]), e.push(i.target()[0]));
    }
    return this.spawn(e, !0).filter(t);
  }, "connectedNodes"),
  parallelEdges: ja(R9(), "parallelEdges"),
  codirectedEdges: ja(R9({
    codirected: !0
  }), "codirectedEdges")
});
function R9(t) {
  var e = {
    codirected: !1
  };
  return t = Gt({}, e, t), function(n) {
    for (var i = [], a = this.edges(), s = t, o = 0; o < a.length; o++)
      for (var l = a[o], u = l._private, h = u.source, d = h._private.data.id, f = u.data.target, p = h._private.edges, g = 0; g < p.length; g++) {
        var m = p[g], v = m._private.data, y = v.target, b = v.source, w = y === f && b === d, T = d === y && f === b;
        (s.codirected && w || !s.codirected && (w || T)) && i.push(m);
      }
    return this.spawn(i, !0).filter(n);
  };
}
Gt(Ai, {
  components: function(e) {
    var r = this, n = r.cy(), i = n.collection(), a = e == null ? r.nodes() : e.nodes(), s = [];
    e != null && a.empty() && (a = e.sources());
    var o = function(h, d) {
      i.merge(h), a.unmerge(h), d.merge(h);
    };
    if (a.empty())
      return r.spawn();
    var l = function() {
      var h = n.collection();
      s.push(h);
      var d = a[0];
      o(d, h), r.bfs({
        directed: !1,
        roots: d,
        visit: function(p) {
          return o(p, h);
        }
      }), h.forEach(function(f) {
        f.connectedEdges().forEach(function(p) {
          r.has(p) && h.has(p.source()) && h.has(p.target()) && h.merge(p);
        });
      });
    };
    do
      l();
    while (a.length > 0);
    return s;
  },
  component: function() {
    var e = this[0];
    return e.cy().mutableElements().components(e)[0];
  }
});
Ai.componentsOf = Ai.components;
var ui = function(e, r) {
  var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
  if (e === void 0) {
    Kr("A collection must have a reference to the core");
    return;
  }
  var a = new Io(), s = !1;
  if (!r)
    r = [];
  else if (r.length > 0 && vr(r[0]) && !Zg(r[0])) {
    s = !0;
    for (var o = [], l = new Mf(), u = 0, h = r.length; u < h; u++) {
      var d = r[u];
      d.data == null && (d.data = {});
      var f = d.data;
      if (f.id == null)
        f.id = wV();
      else if (e.hasElementWithId(f.id) || l.has(f.id))
        continue;
      var p = new Nx(e, d, !1);
      o.push(p), l.add(f.id);
    }
    r = o;
  }
  this.length = 0;
  for (var g = 0, m = r.length; g < m; g++) {
    var v = r[g][0];
    if (v != null) {
      var y = v._private.data.id;
      (!n || !a.has(y)) && (n && a.set(y, {
        index: this.length,
        ele: v
      }), this[this.length] = v, this.length++);
    }
  }
  this._private = {
    eles: this,
    cy: e,
    get map() {
      return this.lazyMap == null && this.rebuildMap(), this.lazyMap;
    },
    set map(b) {
      this.lazyMap = b;
    },
    rebuildMap: function() {
      for (var w = this.lazyMap = new Io(), T = this.eles, E = 0; E < T.length; E++) {
        var C = T[E];
        w.set(C.id(), {
          index: E,
          ele: C
        });
      }
    }
  }, n && (this._private.map = a), s && !i && this.restore();
}, Gr = Nx.prototype = ui.prototype = Object.create(Array.prototype);
Gr.instanceString = function() {
  return "collection";
};
Gr.spawn = function(t, e) {
  return new ui(this.cy(), t, e);
};
Gr.spawnSelf = function() {
  return this.spawn(this);
};
Gr.cy = function() {
  return this._private.cy;
};
Gr.renderer = function() {
  return this._private.cy.renderer();
};
Gr.element = function() {
  return this[0];
};
Gr.collection = function() {
  return oV(this) ? this : new ui(this._private.cy, [this]);
};
Gr.unique = function() {
  return new ui(this._private.cy, this, !0);
};
Gr.hasElementWithId = function(t) {
  return t = "" + t, this._private.map.has(t);
};
Gr.getElementById = function(t) {
  t = "" + t;
  var e = this._private.cy, r = this._private.map.get(t);
  return r ? r.ele : new ui(e);
};
Gr.$id = Gr.getElementById;
Gr.poolIndex = function() {
  var t = this._private.cy, e = t._private.elements, r = this[0]._private.data.id;
  return e._private.map.get(r).index;
};
Gr.indexOf = function(t) {
  var e = t[0]._private.data.id;
  return this._private.map.get(e).index;
};
Gr.indexOfId = function(t) {
  return t = "" + t, this._private.map.get(t).index;
};
Gr.json = function(t) {
  var e = this.element(), r = this.cy();
  if (e == null && t)
    return this;
  if (e != null) {
    var n = e._private;
    if (vr(t)) {
      if (r.startBatch(), t.data) {
        e.data(t.data);
        var i = n.data;
        if (e.isEdge()) {
          var a = !1, s = {}, o = t.data.source, l = t.data.target;
          o != null && o != i.source && (s.source = "" + o, a = !0), l != null && l != i.target && (s.target = "" + l, a = !0), a && (e = e.move(s));
        } else {
          var u = "parent" in t.data, h = t.data.parent;
          u && (h != null || i.parent != null) && h != i.parent && (h === void 0 && (h = null), h != null && (h = "" + h), e = e.move({
            parent: h
          }));
        }
      }
      t.position && e.position(t.position);
      var d = function(m, v, y) {
        var b = t[m];
        b != null && b !== n[m] && (b ? e[v]() : e[y]());
      };
      return d("removed", "remove", "restore"), d("selected", "select", "unselect"), d("selectable", "selectify", "unselectify"), d("locked", "lock", "unlock"), d("grabbable", "grabify", "ungrabify"), d("pannable", "panify", "unpanify"), t.classes != null && e.classes(t.classes), r.endBatch(), this;
    } else if (t === void 0) {
      var f = {
        data: Hs(n.data),
        position: Hs(n.position),
        group: n.group,
        removed: n.removed,
        selected: n.selected,
        selectable: n.selectable,
        locked: n.locked,
        grabbable: n.grabbable,
        pannable: n.pannable,
        classes: null
      };
      f.classes = "";
      var p = 0;
      return n.classes.forEach(function(g) {
        return f.classes += p++ === 0 ? g : " " + g;
      }), f;
    }
  }
};
Gr.jsons = function() {
  for (var t = [], e = 0; e < this.length; e++) {
    var r = this[e], n = r.json();
    t.push(n);
  }
  return t;
};
Gr.clone = function() {
  for (var t = this.cy(), e = [], r = 0; r < this.length; r++) {
    var n = this[r], i = n.json(), a = new Nx(t, i, !1);
    e.push(a);
  }
  return new ui(t, e);
};
Gr.copy = Gr.clone;
Gr.restore = function() {
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, r = this, n = r.cy(), i = n._private, a = [], s = [], o, l = 0, u = r.length; l < u; l++) {
    var h = r[l];
    e && !h.removed() || (h.isNode() ? a.push(h) : s.push(h));
  }
  o = a.concat(s);
  var d, f = function() {
    o.splice(d, 1), d--;
  };
  for (d = 0; d < o.length; d++) {
    var p = o[d], g = p._private, m = g.data;
    if (p.clearTraversalCache(), !(!e && !g.removed)) {
      if (m.id === void 0)
        m.id = wV();
      else if (vt(m.id))
        m.id = "" + m.id;
      else if (Gl(m.id) || !Bt(m.id)) {
        Kr("Can not create element with invalid string ID `" + m.id + "`"), f();
        continue;
      } else if (n.hasElementWithId(m.id)) {
        Kr("Can not create second element with ID `" + m.id + "`"), f();
        continue;
      }
    }
    var v = m.id;
    if (p.isNode()) {
      var y = g.position;
      y.x == null && (y.x = 0), y.y == null && (y.y = 0);
    }
    if (p.isEdge()) {
      for (var b = p, w = ["source", "target"], T = w.length, E = !1, C = 0; C < T; C++) {
        var k = w[C], _ = m[k];
        vt(_) && (_ = m[k] = "" + m[k]), _ == null || _ === "" ? (Kr("Can not create edge `" + v + "` with unspecified " + k), E = !0) : n.hasElementWithId(_) || (Kr("Can not create edge `" + v + "` with nonexistant " + k + " `" + _ + "`"), E = !0);
      }
      if (E) {
        f();
        continue;
      }
      var L = n.getElementById(m.source), N = n.getElementById(m.target);
      L.same(N) ? L._private.edges.push(b) : (L._private.edges.push(b), N._private.edges.push(b)), b._private.source = L, b._private.target = N;
    }
    g.map = new Io(), g.map.set(v, {
      ele: p,
      index: 0
    }), g.removed = !1, e && n.addToPool(p);
  }
  for (var A = 0; A < a.length; A++) {
    var O = a[A], P = O._private.data;
    vt(P.parent) && (P.parent = "" + P.parent);
    var S = P.parent, R = S != null;
    if (R || O._private.parent) {
      var I = O._private.parent ? n.collection().merge(O._private.parent) : n.getElementById(S);
      if (I.empty())
        P.parent = void 0;
      else if (I[0].removed())
        Nr("Node added with missing parent, reference to parent removed"), P.parent = void 0, O._private.parent = null;
      else {
        for (var D = !1, M = I; !M.empty(); ) {
          if (O.same(M)) {
            D = !0, P.parent = void 0;
            break;
          }
          M = M.parent();
        }
        D || (I[0]._private.children.push(O), O._private.parent = I[0], i.hasCompoundNodes = !0);
      }
    }
  }
  if (o.length > 0) {
    for (var B = o.length === r.length ? r : new ui(n, o), $ = 0; $ < B.length; $++) {
      var F = B[$];
      F.isNode() || (F.parallelEdges().clearTraversalCache(), F.source().clearTraversalCache(), F.target().clearTraversalCache());
    }
    var G;
    i.hasCompoundNodes ? G = n.collection().merge(B).merge(B.connectedNodes()).merge(B.parent()) : G = B, G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t), t ? B.emitAndNotify("add") : e && B.emit("add");
  }
  return r;
};
Gr.removed = function() {
  var t = this[0];
  return t && t._private.removed;
};
Gr.inside = function() {
  var t = this[0];
  return t && !t._private.removed;
};
Gr.remove = function() {
  var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, r = this, n = [], i = {}, a = r._private.cy;
  function s(S) {
    for (var R = S._private.edges, I = 0; I < R.length; I++)
      l(R[I]);
  }
  function o(S) {
    for (var R = S._private.children, I = 0; I < R.length; I++)
      l(R[I]);
  }
  function l(S) {
    var R = i[S.id()];
    e && S.removed() || R || (i[S.id()] = !0, S.isNode() ? (n.push(S), s(S), o(S)) : n.unshift(S));
  }
  for (var u = 0, h = r.length; u < h; u++) {
    var d = r[u];
    l(d);
  }
  function f(S, R) {
    var I = S._private.edges;
    Ul(I, R), S.clearTraversalCache();
  }
  function p(S) {
    S.clearTraversalCache();
  }
  var g = [];
  g.ids = {};
  function m(S, R) {
    R = R[0], S = S[0];
    var I = S._private.children, D = S.id();
    Ul(I, R), R._private.parent = null, g.ids[D] || (g.ids[D] = !0, g.push(S));
  }
  r.dirtyCompoundBoundsCache(), e && a.removeFromPool(n);
  for (var v = 0; v < n.length; v++) {
    var y = n[v];
    if (y.isEdge()) {
      var b = y.source()[0], w = y.target()[0];
      f(b, y), f(w, y);
      for (var T = y.parallelEdges(), E = 0; E < T.length; E++) {
        var C = T[E];
        p(C), C.isBundledBezier() && C.dirtyBoundingBoxCache();
      }
    } else {
      var k = y.parent();
      k.length !== 0 && m(k, y);
    }
    e && (y._private.removed = !0);
  }
  var _ = a._private.elements;
  a._private.hasCompoundNodes = !1;
  for (var L = 0; L < _.length; L++) {
    var N = _[L];
    if (N.isParent()) {
      a._private.hasCompoundNodes = !0;
      break;
    }
  }
  var A = new ui(this.cy(), n);
  A.size() > 0 && (t ? A.emitAndNotify("remove") : e && A.emit("remove"));
  for (var O = 0; O < g.length; O++) {
    var P = g[O];
    (!e || !P.removed()) && P.updateStyle();
  }
  return A;
};
Gr.move = function(t) {
  var e = this._private.cy, r = this, n = !1, i = !1, a = function(g) {
    return g == null ? g : "" + g;
  };
  if (t.source !== void 0 || t.target !== void 0) {
    var s = a(t.source), o = a(t.target), l = s != null && e.hasElementWithId(s), u = o != null && e.hasElementWithId(o);
    (l || u) && (e.batch(function() {
      r.remove(n, i), r.emitAndNotify("moveout");
      for (var p = 0; p < r.length; p++) {
        var g = r[p], m = g._private.data;
        g.isEdge() && (l && (m.source = s), u && (m.target = o));
      }
      r.restore(n, i);
    }), r.emitAndNotify("move"));
  } else if (t.parent !== void 0) {
    var h = a(t.parent), d = h === null || e.hasElementWithId(h);
    if (d) {
      var f = h === null ? void 0 : h;
      e.batch(function() {
        var p = r.remove(n, i);
        p.emitAndNotify("moveout");
        for (var g = 0; g < r.length; g++) {
          var m = r[g], v = m._private.data;
          m.isNode() && (v.parent = f);
        }
        p.restore(n, i);
      }), r.emitAndNotify("move");
    }
  }
  return this;
};
[DV, U2e, iv, Rl, cf, axe, Fx, wxe, iG, aG, Cxe, zy, av, ci, Nl, Ai].forEach(function(t) {
  Gt(Gr, t);
});
var Dxe = {
  add: function(e) {
    var r, n = this;
    if (La(e)) {
      var i = e;
      if (i._private.cy === n)
        r = i.restore();
      else {
        for (var a = [], s = 0; s < i.length; s++) {
          var o = i[s];
          a.push(o.json());
        }
        r = new ui(n, a);
      }
    } else if (Br(e)) {
      var l = e;
      r = new ui(n, l);
    } else if (vr(e) && (Br(e.nodes) || Br(e.edges))) {
      for (var u = e, h = [], d = ["nodes", "edges"], f = 0, p = d.length; f < p; f++) {
        var g = d[f], m = u[g];
        if (Br(m))
          for (var v = 0, y = m.length; v < y; v++) {
            var b = Gt({
              group: g
            }, m[v]);
            h.push(b);
          }
      }
      r = new ui(n, h);
    } else {
      var w = e;
      r = new Nx(n, w).collection();
    }
    return r;
  },
  remove: function(e) {
    if (!La(e)) {
      if (Bt(e)) {
        var r = e;
        e = this.$(r);
      }
    }
    return e.remove();
  }
};
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */
function Ixe(t, e, r, n) {
  var i = 4, a = 1e-3, s = 1e-7, o = 10, l = 11, u = 1 / (l - 1), h = typeof Float32Array < "u";
  if (arguments.length !== 4)
    return !1;
  for (var d = 0; d < 4; ++d)
    if (typeof arguments[d] != "number" || isNaN(arguments[d]) || !isFinite(arguments[d]))
      return !1;
  t = Math.min(t, 1), r = Math.min(r, 1), t = Math.max(t, 0), r = Math.max(r, 0);
  var f = h ? new Float32Array(l) : new Array(l);
  function p(N, A) {
    return 1 - 3 * A + 3 * N;
  }
  function g(N, A) {
    return 3 * A - 6 * N;
  }
  function m(N) {
    return 3 * N;
  }
  function v(N, A, O) {
    return ((p(A, O) * N + g(A, O)) * N + m(A)) * N;
  }
  function y(N, A, O) {
    return 3 * p(A, O) * N * N + 2 * g(A, O) * N + m(A);
  }
  function b(N, A) {
    for (var O = 0; O < i; ++O) {
      var P = y(A, t, r);
      if (P === 0)
        return A;
      var S = v(A, t, r) - N;
      A -= S / P;
    }
    return A;
  }
  function w() {
    for (var N = 0; N < l; ++N)
      f[N] = v(N * u, t, r);
  }
  function T(N, A, O) {
    var P, S, R = 0;
    do
      S = A + (O - A) / 2, P = v(S, t, r) - N, P > 0 ? O = S : A = S;
    while (Math.abs(P) > s && ++R < o);
    return S;
  }
  function E(N) {
    for (var A = 0, O = 1, P = l - 1; O !== P && f[O] <= N; ++O)
      A += u;
    --O;
    var S = (N - f[O]) / (f[O + 1] - f[O]), R = A + S * u, I = y(R, t, r);
    return I >= a ? b(N, R) : I === 0 ? R : T(N, A, A + u);
  }
  var C = !1;
  function k() {
    C = !0, (t !== e || r !== n) && w();
  }
  var _ = function(A) {
    return C || k(), t === e && r === n ? A : A === 0 ? 0 : A === 1 ? 1 : v(E(A), e, n);
  };
  _.getControlPoints = function() {
    return [{
      x: t,
      y: e
    }, {
      x: r,
      y: n
    }];
  };
  var L = "generateBezier(" + [t, e, r, n] + ")";
  return _.toString = function() {
    return L;
  }, _;
}
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */
var Oxe = /* @__PURE__ */ function() {
  function t(n) {
    return -n.tension * n.x - n.friction * n.v;
  }
  function e(n, i, a) {
    var s = {
      x: n.x + a.dx * i,
      v: n.v + a.dv * i,
      tension: n.tension,
      friction: n.friction
    };
    return {
      dx: s.v,
      dv: t(s)
    };
  }
  function r(n, i) {
    var a = {
      dx: n.v,
      dv: t(n)
    }, s = e(n, i * 0.5, a), o = e(n, i * 0.5, s), l = e(n, i, o), u = 1 / 6 * (a.dx + 2 * (s.dx + o.dx) + l.dx), h = 1 / 6 * (a.dv + 2 * (s.dv + o.dv) + l.dv);
    return n.x = n.x + u * i, n.v = n.v + h * i, n;
  }
  return function n(i, a, s) {
    var o = {
      x: -1,
      v: 0,
      tension: null,
      friction: null
    }, l = [0], u = 0, h = 1 / 1e4, d = 16 / 1e3, f, p, g;
    for (i = parseFloat(i) || 500, a = parseFloat(a) || 20, s = s || null, o.tension = i, o.friction = a, f = s !== null, f ? (u = n(i, a), p = u / s * d) : p = d; g = r(g || o, p), l.push(1 + g.x), u += 16, Math.abs(g.x) > h && Math.abs(g.v) > h; )
      ;
    return f ? function(m) {
      return l[m * (l.length - 1) | 0];
    } : u;
  };
}(), $r = function(e, r, n, i) {
  var a = Ixe(e, r, n, i);
  return function(s, o, l) {
    return s + (o - s) * a(l);
  };
}, sv = {
  linear: function(e, r, n) {
    return e + (r - e) * n;
  },
  // default easings
  ease: $r(0.25, 0.1, 0.25, 1),
  "ease-in": $r(0.42, 0, 1, 1),
  "ease-out": $r(0, 0, 0.58, 1),
  "ease-in-out": $r(0.42, 0, 0.58, 1),
  // sine
  "ease-in-sine": $r(0.47, 0, 0.745, 0.715),
  "ease-out-sine": $r(0.39, 0.575, 0.565, 1),
  "ease-in-out-sine": $r(0.445, 0.05, 0.55, 0.95),
  // quad
  "ease-in-quad": $r(0.55, 0.085, 0.68, 0.53),
  "ease-out-quad": $r(0.25, 0.46, 0.45, 0.94),
  "ease-in-out-quad": $r(0.455, 0.03, 0.515, 0.955),
  // cubic
  "ease-in-cubic": $r(0.55, 0.055, 0.675, 0.19),
  "ease-out-cubic": $r(0.215, 0.61, 0.355, 1),
  "ease-in-out-cubic": $r(0.645, 0.045, 0.355, 1),
  // quart
  "ease-in-quart": $r(0.895, 0.03, 0.685, 0.22),
  "ease-out-quart": $r(0.165, 0.84, 0.44, 1),
  "ease-in-out-quart": $r(0.77, 0, 0.175, 1),
  // quint
  "ease-in-quint": $r(0.755, 0.05, 0.855, 0.06),
  "ease-out-quint": $r(0.23, 1, 0.32, 1),
  "ease-in-out-quint": $r(0.86, 0, 0.07, 1),
  // expo
  "ease-in-expo": $r(0.95, 0.05, 0.795, 0.035),
  "ease-out-expo": $r(0.19, 1, 0.22, 1),
  "ease-in-out-expo": $r(1, 0, 0, 1),
  // circ
  "ease-in-circ": $r(0.6, 0.04, 0.98, 0.335),
  "ease-out-circ": $r(0.075, 0.82, 0.165, 1),
  "ease-in-out-circ": $r(0.785, 0.135, 0.15, 0.86),
  // user param easings...
  spring: function(e, r, n) {
    if (n === 0)
      return sv.linear;
    var i = Oxe(e, r, n);
    return function(a, s, o) {
      return a + (s - a) * i(o);
    };
  },
  "cubic-bezier": $r
};
function N9(t, e, r, n, i) {
  if (n === 1 || e === r)
    return r;
  var a = i(e, r, n);
  return t == null || ((t.roundValue || t.color) && (a = Math.round(a)), t.min !== void 0 && (a = Math.max(a, t.min)), t.max !== void 0 && (a = Math.min(a, t.max))), a;
}
function M9(t, e) {
  return t.pfValue != null || t.value != null ? t.pfValue != null && (e == null || e.type.units !== "%") ? t.pfValue : t.value : t;
}
function th(t, e, r, n, i) {
  var a = i != null ? i.type : null;
  r < 0 ? r = 0 : r > 1 && (r = 1);
  var s = M9(t, i), o = M9(e, i);
  if (vt(s) && vt(o))
    return N9(a, s, o, r, n);
  if (Br(s) && Br(o)) {
    for (var l = [], u = 0; u < o.length; u++) {
      var h = s[u], d = o[u];
      if (h != null && d != null) {
        var f = N9(a, h, d, r, n);
        l.push(f);
      } else
        l.push(d);
    }
    return l;
  }
}
function Pxe(t, e, r, n) {
  var i = !n, a = t._private, s = e._private, o = s.easing, l = s.startTime, u = n ? t : t.cy(), h = u.style();
  if (!s.easingImpl)
    if (o == null)
      s.easingImpl = sv.linear;
    else {
      var d;
      if (Bt(o)) {
        var f = h.parse("transition-timing-function", o);
        d = f.value;
      } else
        d = o;
      var p, g;
      Bt(d) ? (p = d, g = []) : (p = d[1], g = d.slice(2).map(function(B) {
        return +B;
      })), g.length > 0 ? (p === "spring" && g.push(s.duration), s.easingImpl = sv[p].apply(null, g)) : s.easingImpl = sv[p];
    }
  var m = s.easingImpl, v;
  if (s.duration === 0 ? v = 1 : v = (r - l) / s.duration, s.applying && (v = s.progress), v < 0 ? v = 0 : v > 1 && (v = 1), s.delay == null) {
    var y = s.startPosition, b = s.position;
    if (b && i && !t.locked()) {
      var w = {};
      l0(y.x, b.x) && (w.x = th(y.x, b.x, v, m)), l0(y.y, b.y) && (w.y = th(y.y, b.y, v, m)), t.position(w);
    }
    var T = s.startPan, E = s.pan, C = a.pan, k = E != null && n;
    k && (l0(T.x, E.x) && (C.x = th(T.x, E.x, v, m)), l0(T.y, E.y) && (C.y = th(T.y, E.y, v, m)), t.emit("pan"));
    var _ = s.startZoom, L = s.zoom, N = L != null && n;
    N && (l0(_, L) && (a.zoom = og(a.minZoom, th(_, L, v, m), a.maxZoom)), t.emit("zoom")), (k || N) && t.emit("viewport");
    var A = s.style;
    if (A && A.length > 0 && i) {
      for (var O = 0; O < A.length; O++) {
        var P = A[O], S = P.name, R = P, I = s.startStyle[S], D = h.properties[I.name], M = th(I, R, v, m, D);
        h.overrideBypass(t, S, M);
      }
      t.emit("style");
    }
  }
  return s.progress = v, v;
}
function l0(t, e) {
  return t == null || e == null ? !1 : vt(t) && vt(e) ? !0 : !!(t && e);
}
function Bxe(t, e, r, n) {
  var i = e._private;
  i.started = !0, i.startTime = r - i.progress * i.duration;
}
function D9(t, e) {
  var r = e._private.aniEles, n = [];
  function i(h, d) {
    var f = h._private, p = f.animation.current, g = f.animation.queue, m = !1;
    if (p.length === 0) {
      var v = g.shift();
      v && p.push(v);
    }
    for (var y = function(C) {
      for (var k = C.length - 1; k >= 0; k--) {
        var _ = C[k];
        _();
      }
      C.splice(0, C.length);
    }, b = p.length - 1; b >= 0; b--) {
      var w = p[b], T = w._private;
      if (T.stopped) {
        p.splice(b, 1), T.hooked = !1, T.playing = !1, T.started = !1, y(T.frames);
        continue;
      }
      !T.playing && !T.applying || (T.playing && T.applying && (T.applying = !1), T.started || Bxe(h, w, t), Pxe(h, w, t, d), T.applying && (T.applying = !1), y(T.frames), T.step != null && T.step(t), w.completed() && (p.splice(b, 1), T.hooked = !1, T.playing = !1, T.started = !1, y(T.completes)), m = !0);
    }
    return !d && p.length === 0 && g.length === 0 && n.push(h), m;
  }
  for (var a = !1, s = 0; s < r.length; s++) {
    var o = r[s], l = i(o);
    a = a || l;
  }
  var u = i(e, !0);
  (a || u) && (r.length > 0 ? e.notify("draw", r) : e.notify("draw")), r.unmerge(n), e.emit("step");
}
var Fxe = {
  // pull in animation functions
  animate: _r.animate(),
  animation: _r.animation(),
  animated: _r.animated(),
  clearQueue: _r.clearQueue(),
  delay: _r.delay(),
  delayAnimation: _r.delayAnimation(),
  stop: _r.stop(),
  addToAnimationPool: function(e) {
    var r = this;
    r.styleEnabled() && r._private.aniEles.merge(e);
  },
  stopAnimationLoop: function() {
    this._private.animationsRunning = !1;
  },
  startAnimationLoop: function() {
    var e = this;
    if (e._private.animationsRunning = !0, !e.styleEnabled())
      return;
    function r() {
      e._private.animationsRunning && Oy(function(a) {
        D9(a, e), r();
      });
    }
    var n = e.renderer();
    n && n.beforeRender ? n.beforeRender(function(a, s) {
      D9(s, e);
    }, n.beforeRenderPriorities.animations) : r();
  }
}, $xe = {
  qualifierCompare: function(e, r) {
    return e == null || r == null ? e == null && r == null : e.sameText(r);
  },
  eventMatches: function(e, r, n) {
    var i = r.qualifier;
    return i != null ? e !== n.target && Zg(n.target) && i.matches(n.target) : !0;
  },
  addEventFields: function(e, r) {
    r.cy = e, r.target = e;
  },
  callbackContext: function(e, r, n) {
    return r.qualifier != null ? n.target : e;
  }
}, im = function(e) {
  return Bt(e) ? new Hl(e) : e;
}, lG = {
  createEmitter: function() {
    var e = this._private;
    return e.emitter || (e.emitter = new $x($xe, this)), this;
  },
  emitter: function() {
    return this._private.emitter;
  },
  on: function(e, r, n) {
    return this.emitter().on(e, im(r), n), this;
  },
  removeListener: function(e, r, n) {
    return this.emitter().removeListener(e, im(r), n), this;
  },
  removeAllListeners: function() {
    return this.emitter().removeAllListeners(), this;
  },
  one: function(e, r, n) {
    return this.emitter().one(e, im(r), n), this;
  },
  once: function(e, r, n) {
    return this.emitter().one(e, im(r), n), this;
  },
  emit: function(e, r) {
    return this.emitter().emit(e, r), this;
  },
  emitAndNotify: function(e, r) {
    return this.emit(e), this.notify(e, r), this;
  }
};
_r.eventAliasesOn(lG);
var gT = {
  png: function(e) {
    var r = this._private.renderer;
    return e = e || {}, r.png(e);
  },
  jpg: function(e) {
    var r = this._private.renderer;
    return e = e || {}, e.bg = e.bg || "#fff", r.jpg(e);
  }
};
gT.jpeg = gT.jpg;
var ov = {
  layout: function(e) {
    var r = this;
    if (e == null) {
      Kr("Layout options must be specified to make a layout");
      return;
    }
    if (e.name == null) {
      Kr("A `name` must be specified to make a layout");
      return;
    }
    var n = e.name, i = r.extension("layout", n);
    if (i == null) {
      Kr("No such layout `" + n + "` found.  Did you forget to import it and `cytoscape.use()` it?");
      return;
    }
    var a;
    Bt(e.eles) ? a = r.$(e.eles) : a = e.eles != null ? e.eles : r.$();
    var s = new i(Gt({}, e, {
      cy: r,
      eles: a
    }));
    return s;
  }
};
ov.createLayout = ov.makeLayout = ov.layout;
var zxe = {
  notify: function(e, r) {
    var n = this._private;
    if (this.batching()) {
      n.batchNotifications = n.batchNotifications || {};
      var i = n.batchNotifications[e] = n.batchNotifications[e] || this.collection();
      r != null && i.merge(r);
      return;
    }
    if (n.notificationsEnabled) {
      var a = this.renderer();
      this.destroyed() || !a || a.notify(e, r);
    }
  },
  notifications: function(e) {
    var r = this._private;
    return e === void 0 ? r.notificationsEnabled : (r.notificationsEnabled = !!e, this);
  },
  noNotifications: function(e) {
    this.notifications(!1), e(), this.notifications(!0);
  },
  batching: function() {
    return this._private.batchCount > 0;
  },
  startBatch: function() {
    var e = this._private;
    return e.batchCount == null && (e.batchCount = 0), e.batchCount === 0 && (e.batchStyleEles = this.collection(), e.batchNotifications = {}), e.batchCount++, this;
  },
  endBatch: function() {
    var e = this._private;
    if (e.batchCount === 0)
      return this;
    if (e.batchCount--, e.batchCount === 0) {
      e.batchStyleEles.updateStyle();
      var r = this.renderer();
      Object.keys(e.batchNotifications).forEach(function(n) {
        var i = e.batchNotifications[n];
        i.empty() ? r.notify(n) : r.notify(n, i);
      });
    }
    return this;
  },
  batch: function(e) {
    return this.startBatch(), e(), this.endBatch(), this;
  },
  // for backwards compatibility
  batchData: function(e) {
    var r = this;
    return this.batch(function() {
      for (var n = Object.keys(e), i = 0; i < n.length; i++) {
        var a = n[i], s = e[a], o = r.getElementById(a);
        o.data(s);
      }
    });
  }
}, Vxe = di({
  hideEdgesOnViewport: !1,
  textureOnViewport: !1,
  motionBlur: !1,
  motionBlurOpacity: 0.05,
  pixelRatio: void 0,
  desktopTapThreshold: 4,
  touchTapThreshold: 8,
  wheelSensitivity: 1,
  debug: !1,
  showFps: !1,
  // webgl options
  webgl: !1,
  webglDebug: !1,
  webglDebugShowAtlases: !1,
  // defaults good for mobile
  webglTexSize: 2048,
  webglTexRows: 36,
  webglTexRowsNodes: 18,
  webglBatchSize: 2048,
  webglTexPerBatch: 14,
  webglBgColor: [255, 255, 255]
}), mT = {
  renderTo: function(e, r, n, i) {
    var a = this._private.renderer;
    return a.renderTo(e, r, n, i), this;
  },
  renderer: function() {
    return this._private.renderer;
  },
  forceRender: function() {
    return this.notify("draw"), this;
  },
  resize: function() {
    return this.invalidateSize(), this.emitAndNotify("resize"), this;
  },
  initRenderer: function(e) {
    var r = this, n = r.extension("renderer", e.name);
    if (n == null) {
      Kr("Can not initialise: No such renderer `".concat(e.name, "` found. Did you forget to import it and `cytoscape.use()` it?"));
      return;
    }
    e.wheelSensitivity !== void 0 && Nr("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");
    var i = Vxe(e);
    i.cy = r, r._private.renderer = new n(i), this.notify("init");
  },
  destroyRenderer: function() {
    var e = this;
    e.notify("destroy");
    var r = e.container();
    if (r)
      for (r._cyreg = null; r.childNodes.length > 0; )
        r.removeChild(r.childNodes[0]);
    e._private.renderer = null, e.mutableElements().forEach(function(n) {
      var i = n._private;
      i.rscratch = {}, i.rstyle = {}, i.animation.current = [], i.animation.queue = [];
    });
  },
  onRender: function(e) {
    return this.on("render", e);
  },
  offRender: function(e) {
    return this.off("render", e);
  }
};
mT.invalidateDimensions = mT.resize;
var lv = {
  // get a collection
  // - empty collection on no args
  // - collection of elements in the graph on selector arg
  // - guarantee a returned collection when elements or collection specified
  collection: function(e, r) {
    return Bt(e) ? this.$(e) : La(e) ? e.collection() : Br(e) ? (r || (r = {}), new ui(this, e, r.unique, r.removed)) : new ui(this);
  },
  nodes: function(e) {
    var r = this.$(function(n) {
      return n.isNode();
    });
    return e ? r.filter(e) : r;
  },
  edges: function(e) {
    var r = this.$(function(n) {
      return n.isEdge();
    });
    return e ? r.filter(e) : r;
  },
  // search the graph like jQuery
  $: function(e) {
    var r = this._private.elements;
    return e ? r.filter(e) : r.spawnSelf();
  },
  mutableElements: function() {
    return this._private.elements;
  }
};
lv.elements = lv.filter = lv.$;
var ei = {}, _p = "t", Gxe = "f";
ei.apply = function(t) {
  for (var e = this, r = e._private, n = r.cy, i = n.collection(), a = 0; a < t.length; a++) {
    var s = t[a], o = e.getContextMeta(s);
    if (!o.empty) {
      var l = e.getContextStyle(o), u = e.applyContextStyle(o, l, s);
      s._private.appliedInitStyle ? e.updateTransitions(s, u.diffProps) : s._private.appliedInitStyle = !0;
      var h = e.updateStyleHints(s);
      h && i.push(s);
    }
  }
  return i;
};
ei.getPropertiesDiff = function(t, e) {
  var r = this, n = r._private.propDiffs = r._private.propDiffs || {}, i = t + "-" + e, a = n[i];
  if (a)
    return a;
  for (var s = [], o = {}, l = 0; l < r.length; l++) {
    var u = r[l], h = t[l] === _p, d = e[l] === _p, f = h !== d, p = u.mappedProperties.length > 0;
    if (f || d && p) {
      var g = void 0;
      f && p || f ? g = u.properties : p && (g = u.mappedProperties);
      for (var m = 0; m < g.length; m++) {
        for (var v = g[m], y = v.name, b = !1, w = l + 1; w < r.length; w++) {
          var T = r[w], E = e[w] === _p;
          if (E && (b = T.properties[v.name] != null, b))
            break;
        }
        !o[y] && !b && (o[y] = !0, s.push(y));
      }
    }
  }
  return n[i] = s, s;
};
ei.getContextMeta = function(t) {
  for (var e = this, r = "", n, i = t._private.styleCxtKey || "", a = 0; a < e.length; a++) {
    var s = e[a], o = s.selector && s.selector.matches(t);
    o ? r += _p : r += Gxe;
  }
  return n = e.getPropertiesDiff(i, r), t._private.styleCxtKey = r, {
    key: r,
    diffPropNames: n,
    empty: n.length === 0
  };
};
ei.getContextStyle = function(t) {
  var e = t.key, r = this, n = this._private.contextStyles = this._private.contextStyles || {};
  if (n[e])
    return n[e];
  for (var i = {
    _private: {
      key: e
    }
  }, a = 0; a < r.length; a++) {
    var s = r[a], o = e[a] === _p;
    if (o)
      for (var l = 0; l < s.properties.length; l++) {
        var u = s.properties[l];
        i[u.name] = u;
      }
  }
  return n[e] = i, i;
};
ei.applyContextStyle = function(t, e, r) {
  for (var n = this, i = t.diffPropNames, a = {}, s = n.types, o = 0; o < i.length; o++) {
    var l = i[o], u = e[l], h = r.pstyle(l);
    if (!u)
      if (h)
        h.bypass ? u = {
          name: l,
          deleteBypassed: !0
        } : u = {
          name: l,
          delete: !0
        };
      else continue;
    if (h !== u) {
      if (u.mapped === s.fn && h != null && h.mapping != null && h.mapping.value === u.value) {
        var d = h.mapping, f = d.fnValue = u.value(r);
        if (f === d.prevFnValue)
          continue;
      }
      var p = a[l] = {
        prev: h
      };
      n.applyParsedProperty(r, u), p.next = r.pstyle(l), p.next && p.next.bypass && (p.next = p.next.bypassed);
    }
  }
  return {
    diffProps: a
  };
};
ei.updateStyleHints = function(t) {
  var e = t._private, r = this, n = r.propertyGroupNames, i = r.propertyGroupKeys, a = function(q, J, j) {
    return r.getPropertiesHash(q, J, j);
  }, s = e.styleKey;
  if (t.removed())
    return !1;
  var o = e.group === "nodes", l = t._private.style;
  n = Object.keys(l);
  for (var u = 0; u < i.length; u++) {
    var h = i[u];
    e.styleKeys[h] = [Bc, fh];
  }
  for (var d = function(q, J) {
    return e.styleKeys[J][0] = ig(q, e.styleKeys[J][0]);
  }, f = function(q, J) {
    return e.styleKeys[J][1] = ag(q, e.styleKeys[J][1]);
  }, p = function(q, J) {
    d(q, J), f(q, J);
  }, g = function(q, J) {
    for (var j = 0; j < q.length; j++) {
      var pe = q.charCodeAt(j);
      d(pe, J), f(pe, J);
    }
  }, m = 2e9, v = function(q) {
    return -128 < q && q < 128 && Math.floor(q) !== q ? m - (q * 1024 | 0) : q;
  }, y = 0; y < n.length; y++) {
    var b = n[y], w = l[b];
    if (w != null) {
      var T = this.properties[b], E = T.type, C = T.groupKey, k = void 0;
      T.hashOverride != null ? k = T.hashOverride(t, w) : w.pfValue != null && (k = w.pfValue);
      var _ = T.enums == null ? w.value : null, L = k != null, N = _ != null, A = L || N, O = w.units;
      if (E.number && A && !E.multiple) {
        var P = L ? k : _;
        p(v(P), C), !L && O != null && g(O, C);
      } else
        g(w.strValue, C);
    }
  }
  for (var S = [Bc, fh], R = 0; R < i.length; R++) {
    var I = i[R], D = e.styleKeys[I];
    S[0] = ig(D[0], S[0]), S[1] = ag(D[1], S[1]);
  }
  e.styleKey = ive(S[0], S[1]);
  var M = e.styleKeys;
  e.labelDimsKey = dl(M.labelDimensions);
  var B = a(t, ["label"], M.labelDimensions);
  if (e.labelKey = dl(B), e.labelStyleKey = dl(K1(M.commonLabel, B)), !o) {
    var $ = a(t, ["source-label"], M.labelDimensions);
    e.sourceLabelKey = dl($), e.sourceLabelStyleKey = dl(K1(M.commonLabel, $));
    var F = a(t, ["target-label"], M.labelDimensions);
    e.targetLabelKey = dl(F), e.targetLabelStyleKey = dl(K1(M.commonLabel, F));
  }
  if (o) {
    var G = e.styleKeys, H = G.nodeBody, ee = G.nodeBorder, Y = G.nodeOutline, re = G.backgroundImage, ne = G.compound, he = G.pie, K = G.stripe, Z = [H, ee, Y, re, ne, he, K].filter(function(X) {
      return X != null;
    }).reduce(K1, [Bc, fh]);
    e.nodeKey = dl(Z), e.hasPie = he != null && he[0] !== Bc && he[1] !== fh, e.hasStripe = K != null && K[0] !== Bc && K[1] !== fh;
  }
  return s !== e.styleKey;
};
ei.clearStyleHints = function(t) {
  var e = t._private;
  e.styleCxtKey = "", e.styleKeys = {}, e.styleKey = null, e.labelKey = null, e.labelStyleKey = null, e.sourceLabelKey = null, e.sourceLabelStyleKey = null, e.targetLabelKey = null, e.targetLabelStyleKey = null, e.nodeKey = null, e.hasPie = null, e.hasStripe = null;
};
ei.applyParsedProperty = function(t, e) {
  var r = this, n = e, i = t._private.style, a, s = r.types, o = r.properties[n.name].type, l = n.bypass, u = i[n.name], h = u && u.bypass, d = t._private, f = "mapping", p = function(H) {
    return H == null ? null : H.pfValue != null ? H.pfValue : H.value;
  }, g = function() {
    var H = p(u), ee = p(n);
    r.checkTriggers(t, n.name, H, ee);
  };
  if (e.name === "curve-style" && t.isEdge() && // loops must be bundled beziers
  (e.value !== "bezier" && t.isLoop() || // edges connected to compound nodes can not be haystacks
  e.value === "haystack" && (t.source().isParent() || t.target().isParent())) && (n = e = this.parse(e.name, "bezier", l)), n.delete)
    return i[n.name] = void 0, g(), !0;
  if (n.deleteBypassed)
    return u ? u.bypass ? (u.bypassed = void 0, g(), !0) : !1 : (g(), !0);
  if (n.deleteBypass)
    return u ? u.bypass ? (i[n.name] = u.bypassed, g(), !0) : !1 : (g(), !0);
  var m = function() {
    Nr("Do not assign mappings to elements without corresponding data (i.e. ele `" + t.id() + "` has no mapping for property `" + n.name + "` with data field `" + n.field + "`); try a `[" + n.field + "]` selector to limit scope to elements with `" + n.field + "` defined");
  };
  switch (n.mapped) {
    case s.mapData: {
      for (var v = n.field.split("."), y = d.data, b = 0; b < v.length && y; b++) {
        var w = v[b];
        y = y[w];
      }
      if (y == null)
        return m(), !1;
      var T;
      if (vt(y)) {
        var E = n.fieldMax - n.fieldMin;
        E === 0 ? T = 0 : T = (y - n.fieldMin) / E;
      } else
        return Nr("Do not use continuous mappers without specifying numeric data (i.e. `" + n.field + ": " + y + "` for `" + t.id() + "` is non-numeric)"), !1;
      if (T < 0 ? T = 0 : T > 1 && (T = 1), o.color) {
        var C = n.valueMin[0], k = n.valueMax[0], _ = n.valueMin[1], L = n.valueMax[1], N = n.valueMin[2], A = n.valueMax[2], O = n.valueMin[3] == null ? 1 : n.valueMin[3], P = n.valueMax[3] == null ? 1 : n.valueMax[3], S = [Math.round(C + (k - C) * T), Math.round(_ + (L - _) * T), Math.round(N + (A - N) * T), Math.round(O + (P - O) * T)];
        a = {
          // colours are simple, so just create the flat property instead of expensive string parsing
          bypass: n.bypass,
          // we're a bypass if the mapping property is a bypass
          name: n.name,
          value: S,
          strValue: "rgb(" + S[0] + ", " + S[1] + ", " + S[2] + ")"
        };
      } else if (o.number) {
        var R = n.valueMin + (n.valueMax - n.valueMin) * T;
        a = this.parse(n.name, R, n.bypass, f);
      } else
        return !1;
      if (!a)
        return m(), !1;
      a.mapping = n, n = a;
      break;
    }
    case s.data: {
      for (var I = n.field.split("."), D = d.data, M = 0; M < I.length && D; M++) {
        var B = I[M];
        D = D[B];
      }
      if (D != null && (a = this.parse(n.name, D, n.bypass, f)), !a)
        return m(), !1;
      a.mapping = n, n = a;
      break;
    }
    case s.fn: {
      var $ = n.value, F = n.fnValue != null ? n.fnValue : $(t);
      if (n.prevFnValue = F, F == null)
        return Nr("Custom function mappers may not return null (i.e. `" + n.name + "` for ele `" + t.id() + "` is null)"), !1;
      if (a = this.parse(n.name, F, n.bypass, f), !a)
        return Nr("Custom function mappers may not return invalid values for the property type (i.e. `" + n.name + "` for ele `" + t.id() + "` is invalid)"), !1;
      a.mapping = Hs(n), n = a;
      break;
    }
    case void 0:
      break;
    default:
      return !1;
  }
  return l ? (h ? n.bypassed = u.bypassed : n.bypassed = u, i[n.name] = n) : h ? u.bypassed = n : i[n.name] = n, g(), !0;
};
ei.cleanElements = function(t, e) {
  for (var r = 0; r < t.length; r++) {
    var n = t[r];
    if (this.clearStyleHints(n), n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), !e)
      n._private.style = {};
    else
      for (var i = n._private.style, a = Object.keys(i), s = 0; s < a.length; s++) {
        var o = a[s], l = i[o];
        l != null && (l.bypass ? l.bypassed = null : i[o] = null);
      }
  }
};
ei.update = function() {
  var t = this._private.cy, e = t.mutableElements();
  e.updateStyle();
};
ei.updateTransitions = function(t, e) {
  var r = this, n = t._private, i = t.pstyle("transition-property").value, a = t.pstyle("transition-duration").pfValue, s = t.pstyle("transition-delay").pfValue;
  if (i.length > 0 && a > 0) {
    for (var o = {}, l = !1, u = 0; u < i.length; u++) {
      var h = i[u], d = t.pstyle(h), f = e[h];
      if (f) {
        var p = f.prev, g = p, m = f.next != null ? f.next : d, v = !1, y = void 0, b = 1e-6;
        g && (vt(g.pfValue) && vt(m.pfValue) ? (v = m.pfValue - g.pfValue, y = g.pfValue + b * v) : vt(g.value) && vt(m.value) ? (v = m.value - g.value, y = g.value + b * v) : Br(g.value) && Br(m.value) && (v = g.value[0] !== m.value[0] || g.value[1] !== m.value[1] || g.value[2] !== m.value[2], y = g.strValue), v && (o[h] = m.strValue, this.applyBypass(t, h, y), l = !0));
      }
    }
    if (!l)
      return;
    n.transitioning = !0, new Df(function(w) {
      s > 0 ? t.delayAnimation(s).play().promise().then(w) : w();
    }).then(function() {
      return t.animation({
        style: o,
        duration: a,
        easing: t.pstyle("transition-timing-function").value,
        queue: !1
      }).play().promise();
    }).then(function() {
      r.removeBypasses(t, i), t.emitAndNotify("style"), n.transitioning = !1;
    });
  } else n.transitioning && (this.removeBypasses(t, i), t.emitAndNotify("style"), n.transitioning = !1);
};
ei.checkTrigger = function(t, e, r, n, i, a) {
  var s = this.properties[e], o = i(s);
  t.removed() || o != null && o(r, n, t) && a(s);
};
ei.checkZOrderTrigger = function(t, e, r, n) {
  var i = this;
  this.checkTrigger(t, e, r, n, function(a) {
    return a.triggersZOrder;
  }, function() {
    i._private.cy.notify("zorder", t);
  });
};
ei.checkBoundsTrigger = function(t, e, r, n) {
  this.checkTrigger(t, e, r, n, function(i) {
    return i.triggersBounds;
  }, function(i) {
    t.dirtyCompoundBoundsCache(), t.dirtyBoundingBoxCache();
  });
};
ei.checkConnectedEdgesBoundsTrigger = function(t, e, r, n) {
  this.checkTrigger(t, e, r, n, function(i) {
    return i.triggersBoundsOfConnectedEdges;
  }, function(i) {
    t.connectedEdges().forEach(function(a) {
      a.dirtyBoundingBoxCache();
    });
  });
};
ei.checkParallelEdgesBoundsTrigger = function(t, e, r, n) {
  this.checkTrigger(t, e, r, n, function(i) {
    return i.triggersBoundsOfParallelEdges;
  }, function(i) {
    t.parallelEdges().forEach(function(a) {
      a.dirtyBoundingBoxCache();
    });
  });
};
ei.checkTriggers = function(t, e, r, n) {
  t.dirtyStyleCache(), this.checkZOrderTrigger(t, e, r, n), this.checkBoundsTrigger(t, e, r, n), this.checkConnectedEdgesBoundsTrigger(t, e, r, n), this.checkParallelEdgesBoundsTrigger(t, e, r, n);
};
var i1 = {};
i1.applyBypass = function(t, e, r, n) {
  var i = this, a = [], s = !0;
  if (e === "*" || e === "**") {
    if (r !== void 0)
      for (var o = 0; o < i.properties.length; o++) {
        var l = i.properties[o], u = l.name, h = this.parse(u, r, !0);
        h && a.push(h);
      }
  } else if (Bt(e)) {
    var d = this.parse(e, r, !0);
    d && a.push(d);
  } else if (vr(e)) {
    var f = e;
    n = r;
    for (var p = Object.keys(f), g = 0; g < p.length; g++) {
      var m = p[g], v = f[m];
      if (v === void 0 && (v = f[Lx(m)]), v !== void 0) {
        var y = this.parse(m, v, !0);
        y && a.push(y);
      }
    }
  } else
    return !1;
  if (a.length === 0)
    return !1;
  for (var b = !1, w = 0; w < t.length; w++) {
    for (var T = t[w], E = {}, C = void 0, k = 0; k < a.length; k++) {
      var _ = a[k];
      if (n) {
        var L = T.pstyle(_.name);
        C = E[_.name] = {
          prev: L
        };
      }
      b = this.applyParsedProperty(T, Hs(_)) || b, n && (C.next = T.pstyle(_.name));
    }
    b && this.updateStyleHints(T), n && this.updateTransitions(T, E, s);
  }
  return b;
};
i1.overrideBypass = function(t, e, r) {
  e = Wk(e);
  for (var n = 0; n < t.length; n++) {
    var i = t[n], a = i._private.style[e], s = this.properties[e].type, o = s.color, l = s.mutiple, u = a ? a.pfValue != null ? a.pfValue : a.value : null;
    !a || !a.bypass ? this.applyBypass(i, e, r) : (a.value = r, a.pfValue != null && (a.pfValue = r), o ? a.strValue = "rgb(" + r.join(",") + ")" : l ? a.strValue = r.join(" ") : a.strValue = "" + r, this.updateStyleHints(i)), this.checkTriggers(i, e, u, r);
  }
};
i1.removeAllBypasses = function(t, e) {
  return this.removeBypasses(t, this.propertyNames, e);
};
i1.removeBypasses = function(t, e, r) {
  for (var n = !0, i = 0; i < t.length; i++) {
    for (var a = t[i], s = {}, o = 0; o < e.length; o++) {
      var l = e[o], u = this.properties[l], h = a.pstyle(u.name);
      if (!(!h || !h.bypass)) {
        var d = "", f = this.parse(l, d, !0), p = s[u.name] = {
          prev: h
        };
        this.applyParsedProperty(a, f), p.next = a.pstyle(u.name);
      }
    }
    this.updateStyleHints(a), r && this.updateTransitions(a, s, n);
  }
};
var aS = {};
aS.getEmSizeInPixels = function() {
  var t = this.containerCss("font-size");
  return t != null ? parseFloat(t) : 1;
};
aS.containerCss = function(t) {
  var e = this._private.cy, r = e.container(), n = e.window();
  if (n && r && n.getComputedStyle)
    return n.getComputedStyle(r).getPropertyValue(t);
};
var Js = {};
Js.getRenderedStyle = function(t, e) {
  return e ? this.getStylePropertyValue(t, e, !0) : this.getRawStyle(t, !0);
};
Js.getRawStyle = function(t, e) {
  var r = this;
  if (t = t[0], t) {
    for (var n = {}, i = 0; i < r.properties.length; i++) {
      var a = r.properties[i], s = r.getStylePropertyValue(t, a.name, e);
      s != null && (n[a.name] = s, n[Lx(a.name)] = s);
    }
    return n;
  }
};
Js.getIndexedStyle = function(t, e, r, n) {
  var i = t.pstyle(e)[r][n];
  return i ?? t.cy().style().getDefaultProperty(e)[r][0];
};
Js.getStylePropertyValue = function(t, e, r) {
  var n = this;
  if (t = t[0], t) {
    var i = n.properties[e];
    i.alias && (i = i.pointsTo);
    var a = i.type, s = t.pstyle(i.name);
    if (s) {
      var o = s.value, l = s.units, u = s.strValue;
      if (r && a.number && o != null && vt(o)) {
        var h = t.cy().zoom(), d = function(v) {
          return v * h;
        }, f = function(v, y) {
          return d(v) + y;
        }, p = Br(o), g = p ? l.every(function(m) {
          return m != null;
        }) : l != null;
        return g ? p ? o.map(function(m, v) {
          return f(m, l[v]);
        }).join(" ") : f(o, l) : p ? o.map(function(m) {
          return Bt(m) ? m : "" + d(m);
        }).join(" ") : "" + d(o);
      } else if (u != null)
        return u;
    }
    return null;
  }
};
Js.getAnimationStartStyle = function(t, e) {
  for (var r = {}, n = 0; n < e.length; n++) {
    var i = e[n], a = i.name, s = t.pstyle(a);
    s !== void 0 && (vr(s) ? s = this.parse(a, s.strValue) : s = this.parse(a, s)), s && (r[a] = s);
  }
  return r;
};
Js.getPropsList = function(t) {
  var e = this, r = [], n = t, i = e.properties;
  if (n)
    for (var a = Object.keys(n), s = 0; s < a.length; s++) {
      var o = a[s], l = n[o], u = i[o] || i[Wk(o)], h = this.parse(u.name, l);
      h && r.push(h);
    }
  return r;
};
Js.getNonDefaultPropertiesHash = function(t, e, r) {
  var n = r.slice(), i, a, s, o, l, u;
  for (l = 0; l < e.length; l++)
    if (i = e[l], a = t.pstyle(i, !1), a != null)
      if (a.pfValue != null)
        n[0] = ig(o, n[0]), n[1] = ag(o, n[1]);
      else
        for (s = a.strValue, u = 0; u < s.length; u++)
          o = s.charCodeAt(u), n[0] = ig(o, n[0]), n[1] = ag(o, n[1]);
  return n;
};
Js.getPropertiesHash = Js.getNonDefaultPropertiesHash;
var Gx = {};
Gx.appendFromJson = function(t) {
  for (var e = this, r = 0; r < t.length; r++) {
    var n = t[r], i = n.selector, a = n.style || n.css, s = Object.keys(a);
    e.selector(i);
    for (var o = 0; o < s.length; o++) {
      var l = s[o], u = a[l];
      e.css(l, u);
    }
  }
  return e;
};
Gx.fromJson = function(t) {
  var e = this;
  return e.resetToDefault(), e.appendFromJson(t), e;
};
Gx.json = function() {
  for (var t = [], e = this.defaultLength; e < this.length; e++) {
    for (var r = this[e], n = r.selector, i = r.properties, a = {}, s = 0; s < i.length; s++) {
      var o = i[s];
      a[o.name] = o.strValue;
    }
    t.push({
      selector: n ? n.toString() : "core",
      style: a
    });
  }
  return t;
};
var sS = {};
sS.appendFromString = function(t) {
  var e = this, r = this, n = "" + t, i, a, s;
  n = n.replace(/[/][*](\s|.)+?[*][/]/g, "");
  function o() {
    n.length > i.length ? n = n.substr(i.length) : n = "";
  }
  function l() {
    a.length > s.length ? a = a.substr(s.length) : a = "";
  }
  for (; ; ) {
    var u = n.match(/^\s*$/);
    if (u)
      break;
    var h = n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);
    if (!h) {
      Nr("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + n);
      break;
    }
    i = h[0];
    var d = h[1];
    if (d !== "core") {
      var f = new Hl(d);
      if (f.invalid) {
        Nr("Skipping parsing of block: Invalid selector found in string stylesheet: " + d), o();
        continue;
      }
    }
    var p = h[2], g = !1;
    a = p;
    for (var m = []; ; ) {
      var v = a.match(/^\s*$/);
      if (v)
        break;
      var y = a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);
      if (!y) {
        Nr("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + p), g = !0;
        break;
      }
      s = y[0];
      var b = y[1], w = y[2], T = e.properties[b];
      if (!T) {
        Nr("Skipping property: Invalid property name in: " + s), l();
        continue;
      }
      var E = r.parse(b, w);
      if (!E) {
        Nr("Skipping property: Invalid property definition in: " + s), l();
        continue;
      }
      m.push({
        name: b,
        val: w
      }), l();
    }
    if (g) {
      o();
      break;
    }
    r.selector(d);
    for (var C = 0; C < m.length; C++) {
      var k = m[C];
      r.css(k.name, k.val);
    }
    o();
  }
  return r;
};
sS.fromString = function(t) {
  var e = this;
  return e.resetToDefault(), e.appendFromString(t), e;
};
var wn = {};
(function() {
  var t = Bn, e = Pme, r = Fme, n = $me, i = zme, a = function(X) {
    return "^" + X + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$";
  }, s = function(X) {
    var q = t + "|\\w+|" + e + "|" + r + "|" + n + "|" + i;
    return "^" + X + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + t + ")\\s*\\,\\s*(" + t + ")\\s*,\\s*(" + q + ")\\s*\\,\\s*(" + q + ")\\)$";
  }, o = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"];
  wn.types = {
    time: {
      number: !0,
      min: 0,
      units: "s|ms",
      implicitUnits: "ms"
    },
    percent: {
      number: !0,
      min: 0,
      max: 100,
      units: "%",
      implicitUnits: "%"
    },
    percentages: {
      number: !0,
      min: 0,
      max: 100,
      units: "%",
      implicitUnits: "%",
      multiple: !0
    },
    zeroOneNumber: {
      number: !0,
      min: 0,
      max: 1,
      unitless: !0
    },
    zeroOneNumbers: {
      number: !0,
      min: 0,
      max: 1,
      unitless: !0,
      multiple: !0
    },
    nOneOneNumber: {
      number: !0,
      min: -1,
      max: 1,
      unitless: !0
    },
    nonNegativeInt: {
      number: !0,
      min: 0,
      integer: !0,
      unitless: !0
    },
    nonNegativeNumber: {
      number: !0,
      min: 0,
      unitless: !0
    },
    position: {
      enums: ["parent", "origin"]
    },
    nodeSize: {
      number: !0,
      min: 0,
      enums: ["label"]
    },
    number: {
      number: !0,
      unitless: !0
    },
    numbers: {
      number: !0,
      unitless: !0,
      multiple: !0
    },
    positiveNumber: {
      number: !0,
      unitless: !0,
      min: 0,
      strictMin: !0
    },
    size: {
      number: !0,
      min: 0
    },
    bidirectionalSize: {
      number: !0
    },
    // allows negative
    bidirectionalSizeMaybePercent: {
      number: !0,
      allowPercent: !0
    },
    // allows negative
    bidirectionalSizes: {
      number: !0,
      multiple: !0
    },
    // allows negative
    sizeMaybePercent: {
      number: !0,
      min: 0,
      allowPercent: !0
    },
    axisDirection: {
      enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"]
    },
    axisDirectionExplicit: {
      enums: ["leftward", "rightward", "upward", "downward"]
    },
    axisDirectionPrimary: {
      enums: ["horizontal", "vertical"]
    },
    paddingRelativeTo: {
      enums: ["width", "height", "average", "min", "max"]
    },
    bgWH: {
      number: !0,
      min: 0,
      allowPercent: !0,
      enums: ["auto"],
      multiple: !0
    },
    bgPos: {
      number: !0,
      allowPercent: !0,
      multiple: !0
    },
    bgRelativeTo: {
      enums: ["inner", "include-padding"],
      multiple: !0
    },
    bgRepeat: {
      enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"],
      multiple: !0
    },
    bgFit: {
      enums: ["none", "contain", "cover"],
      multiple: !0
    },
    bgCrossOrigin: {
      enums: ["anonymous", "use-credentials", "null"],
      multiple: !0
    },
    bgClip: {
      enums: ["none", "node"],
      multiple: !0
    },
    bgContainment: {
      enums: ["inside", "over"],
      multiple: !0
    },
    boxSelection: {
      enums: ["contain", "overlap", "none"]
    },
    color: {
      color: !0
    },
    colors: {
      color: !0,
      multiple: !0
    },
    fill: {
      enums: ["solid", "linear-gradient", "radial-gradient"]
    },
    bool: {
      enums: ["yes", "no"]
    },
    bools: {
      enums: ["yes", "no"],
      multiple: !0
    },
    lineStyle: {
      enums: ["solid", "dotted", "dashed"]
    },
    lineCap: {
      enums: ["butt", "round", "square"]
    },
    linePosition: {
      enums: ["center", "inside", "outside"]
    },
    lineJoin: {
      enums: ["round", "bevel", "miter"]
    },
    borderStyle: {
      enums: ["solid", "dotted", "dashed", "double"]
    },
    curveStyle: {
      enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi", "round-segments", "round-taxi"]
    },
    radiusType: {
      enums: ["arc-radius", "influence-radius"],
      multiple: !0
    },
    fontFamily: {
      regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'
    },
    fontStyle: {
      enums: ["italic", "normal", "oblique"]
    },
    fontWeight: {
      enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900]
    },
    textDecoration: {
      enums: ["none", "underline", "overline", "line-through"]
    },
    textTransform: {
      enums: ["none", "uppercase", "lowercase"]
    },
    textWrap: {
      enums: ["none", "wrap", "ellipsis"]
    },
    textOverflowWrap: {
      enums: ["whitespace", "anywhere"]
    },
    textBackgroundShape: {
      enums: ["rectangle", "roundrectangle", "round-rectangle", "circle"]
    },
    nodeShape: {
      enums: ["rectangle", "roundrectangle", "round-rectangle", "cutrectangle", "cut-rectangle", "bottomroundrectangle", "bottom-round-rectangle", "barrel", "ellipse", "triangle", "round-triangle", "square", "pentagon", "round-pentagon", "hexagon", "round-hexagon", "concavehexagon", "concave-hexagon", "heptagon", "round-heptagon", "octagon", "round-octagon", "tag", "round-tag", "star", "diamond", "round-diamond", "vee", "rhomboid", "right-rhomboid", "polygon"]
    },
    overlayShape: {
      enums: ["roundrectangle", "round-rectangle", "ellipse"]
    },
    cornerRadius: {
      number: !0,
      min: 0,
      units: "px|em",
      implicitUnits: "px",
      enums: ["auto"]
    },
    compoundIncludeLabels: {
      enums: ["include", "exclude"]
    },
    arrowShape: {
      enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"]
    },
    arrowFill: {
      enums: ["filled", "hollow"]
    },
    arrowWidth: {
      number: !0,
      units: "%|px|em",
      implicitUnits: "px",
      enums: ["match-line"]
    },
    display: {
      enums: ["element", "none"]
    },
    visibility: {
      enums: ["hidden", "visible"]
    },
    zCompoundDepth: {
      enums: ["bottom", "orphan", "auto", "top"]
    },
    zIndexCompare: {
      enums: ["auto", "manual"]
    },
    valign: {
      enums: ["top", "center", "bottom"]
    },
    halign: {
      enums: ["left", "center", "right"]
    },
    justification: {
      enums: ["left", "center", "right", "auto"]
    },
    text: {
      string: !0
    },
    data: {
      mapping: !0,
      regex: a("data")
    },
    layoutData: {
      mapping: !0,
      regex: a("layoutData")
    },
    scratch: {
      mapping: !0,
      regex: a("scratch")
    },
    mapData: {
      mapping: !0,
      regex: s("mapData")
    },
    mapLayoutData: {
      mapping: !0,
      regex: s("mapLayoutData")
    },
    mapScratch: {
      mapping: !0,
      regex: s("mapScratch")
    },
    fn: {
      mapping: !0,
      fn: !0
    },
    url: {
      regexes: o,
      singleRegexMatchValue: !0
    },
    urls: {
      regexes: o,
      singleRegexMatchValue: !0,
      multiple: !0
    },
    propList: {
      propList: !0
    },
    angle: {
      number: !0,
      units: "deg|rad",
      implicitUnits: "rad"
    },
    textRotation: {
      number: !0,
      units: "deg|rad",
      implicitUnits: "rad",
      enums: ["none", "autorotate"]
    },
    polygonPointList: {
      number: !0,
      multiple: !0,
      evenMultiple: !0,
      min: -1,
      max: 1,
      unitless: !0
    },
    edgeDistances: {
      enums: ["intersection", "node-position", "endpoints"]
    },
    edgeEndpoint: {
      number: !0,
      multiple: !0,
      units: "%|px|em|deg|rad",
      implicitUnits: "px",
      enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"],
      singleEnum: !0,
      validate: function(X, q) {
        switch (X.length) {
          case 2:
            return q[0] !== "deg" && q[0] !== "rad" && q[1] !== "deg" && q[1] !== "rad";
          case 1:
            return Bt(X[0]) || q[0] === "deg" || q[0] === "rad";
          default:
            return !1;
        }
      }
    },
    easing: {
      regexes: ["^(spring)\\s*\\(\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*\\)$"],
      enums: ["linear", "ease", "ease-in", "ease-out", "ease-in-out", "ease-in-sine", "ease-out-sine", "ease-in-out-sine", "ease-in-quad", "ease-out-quad", "ease-in-out-quad", "ease-in-cubic", "ease-out-cubic", "ease-in-out-cubic", "ease-in-quart", "ease-out-quart", "ease-in-out-quart", "ease-in-quint", "ease-out-quint", "ease-in-out-quint", "ease-in-expo", "ease-out-expo", "ease-in-out-expo", "ease-in-circ", "ease-out-circ", "ease-in-out-circ"]
    },
    gradientDirection: {
      enums: [
        "to-bottom",
        "to-top",
        "to-left",
        "to-right",
        "to-bottom-right",
        "to-bottom-left",
        "to-top-right",
        "to-top-left",
        "to-right-bottom",
        "to-left-bottom",
        "to-right-top",
        "to-left-top"
        // different order
      ]
    },
    boundsExpansion: {
      number: !0,
      multiple: !0,
      min: 0,
      validate: function(X) {
        var q = X.length;
        return q === 1 || q === 2 || q === 4;
      }
    }
  };
  var l = {
    zeroNonZero: function(X, q) {
      return (X == null || q == null) && X !== q || X == 0 && q != 0 ? !0 : X != 0 && q == 0;
    },
    any: function(X, q) {
      return X != q;
    },
    emptyNonEmpty: function(X, q) {
      var J = Gl(X), j = Gl(q);
      return J && !j || !J && j;
    }
  }, u = wn.types, h = [{
    name: "label",
    type: u.text,
    triggersBounds: l.any,
    triggersZOrder: l.emptyNonEmpty
  }, {
    name: "text-rotation",
    type: u.textRotation,
    triggersBounds: l.any
  }, {
    name: "text-margin-x",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "text-margin-y",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }], d = [{
    name: "source-label",
    type: u.text,
    triggersBounds: l.any
  }, {
    name: "source-text-rotation",
    type: u.textRotation,
    triggersBounds: l.any
  }, {
    name: "source-text-margin-x",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "source-text-margin-y",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "source-text-offset",
    type: u.size,
    triggersBounds: l.any
  }], f = [{
    name: "target-label",
    type: u.text,
    triggersBounds: l.any
  }, {
    name: "target-text-rotation",
    type: u.textRotation,
    triggersBounds: l.any
  }, {
    name: "target-text-margin-x",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "target-text-margin-y",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "target-text-offset",
    type: u.size,
    triggersBounds: l.any
  }], p = [{
    name: "font-family",
    type: u.fontFamily,
    triggersBounds: l.any
  }, {
    name: "font-style",
    type: u.fontStyle,
    triggersBounds: l.any
  }, {
    name: "font-weight",
    type: u.fontWeight,
    triggersBounds: l.any
  }, {
    name: "font-size",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "text-transform",
    type: u.textTransform,
    triggersBounds: l.any
  }, {
    name: "text-wrap",
    type: u.textWrap,
    triggersBounds: l.any
  }, {
    name: "text-overflow-wrap",
    type: u.textOverflowWrap,
    triggersBounds: l.any
  }, {
    name: "text-max-width",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "text-outline-width",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "line-height",
    type: u.positiveNumber,
    triggersBounds: l.any
  }], g = [{
    name: "text-valign",
    type: u.valign,
    triggersBounds: l.any
  }, {
    name: "text-halign",
    type: u.halign,
    triggersBounds: l.any
  }, {
    name: "color",
    type: u.color
  }, {
    name: "text-outline-color",
    type: u.color
  }, {
    name: "text-outline-opacity",
    type: u.zeroOneNumber
  }, {
    name: "text-background-color",
    type: u.color
  }, {
    name: "text-background-opacity",
    type: u.zeroOneNumber
  }, {
    name: "text-background-padding",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "text-border-opacity",
    type: u.zeroOneNumber
  }, {
    name: "text-border-color",
    type: u.color
  }, {
    name: "text-border-width",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "text-border-style",
    type: u.borderStyle,
    triggersBounds: l.any
  }, {
    name: "text-background-shape",
    type: u.textBackgroundShape,
    triggersBounds: l.any
  }, {
    name: "text-justification",
    type: u.justification
  }, {
    name: "box-select-labels",
    type: u.bool,
    triggersBounds: l.any
  }], m = [{
    name: "events",
    type: u.bool,
    triggersZOrder: l.any
  }, {
    name: "text-events",
    type: u.bool,
    triggersZOrder: l.any
  }, {
    name: "box-selection",
    type: u.boxSelection,
    triggersZOrder: l.any
  }], v = [{
    name: "display",
    type: u.display,
    triggersZOrder: l.any,
    triggersBounds: l.any,
    triggersBoundsOfConnectedEdges: l.any,
    triggersBoundsOfParallelEdges: function(X, q, J) {
      return X === q ? !1 : J.pstyle("curve-style").value === "bezier";
    }
  }, {
    name: "visibility",
    type: u.visibility,
    triggersZOrder: l.any
  }, {
    name: "opacity",
    type: u.zeroOneNumber,
    triggersZOrder: l.zeroNonZero
  }, {
    name: "text-opacity",
    type: u.zeroOneNumber
  }, {
    name: "min-zoomed-font-size",
    type: u.size
  }, {
    name: "z-compound-depth",
    type: u.zCompoundDepth,
    triggersZOrder: l.any
  }, {
    name: "z-index-compare",
    type: u.zIndexCompare,
    triggersZOrder: l.any
  }, {
    name: "z-index",
    type: u.number,
    triggersZOrder: l.any
  }], y = [{
    name: "overlay-padding",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "overlay-color",
    type: u.color
  }, {
    name: "overlay-opacity",
    type: u.zeroOneNumber,
    triggersBounds: l.zeroNonZero
  }, {
    name: "overlay-shape",
    type: u.overlayShape,
    triggersBounds: l.any
  }, {
    name: "overlay-corner-radius",
    type: u.cornerRadius
  }], b = [{
    name: "underlay-padding",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "underlay-color",
    type: u.color
  }, {
    name: "underlay-opacity",
    type: u.zeroOneNumber,
    triggersBounds: l.zeroNonZero
  }, {
    name: "underlay-shape",
    type: u.overlayShape,
    triggersBounds: l.any
  }, {
    name: "underlay-corner-radius",
    type: u.cornerRadius
  }], w = [{
    name: "transition-property",
    type: u.propList
  }, {
    name: "transition-duration",
    type: u.time
  }, {
    name: "transition-delay",
    type: u.time
  }, {
    name: "transition-timing-function",
    type: u.easing
  }], T = function(X, q) {
    return q.value === "label" ? -X.poolIndex() : q.pfValue;
  }, E = [{
    name: "height",
    type: u.nodeSize,
    triggersBounds: l.any,
    hashOverride: T
  }, {
    name: "width",
    type: u.nodeSize,
    triggersBounds: l.any,
    hashOverride: T
  }, {
    name: "shape",
    type: u.nodeShape,
    triggersBounds: l.any
  }, {
    name: "shape-polygon-points",
    type: u.polygonPointList,
    triggersBounds: l.any
  }, {
    name: "corner-radius",
    type: u.cornerRadius
  }, {
    name: "background-color",
    type: u.color
  }, {
    name: "background-fill",
    type: u.fill
  }, {
    name: "background-opacity",
    type: u.zeroOneNumber
  }, {
    name: "background-blacken",
    type: u.nOneOneNumber
  }, {
    name: "background-gradient-stop-colors",
    type: u.colors
  }, {
    name: "background-gradient-stop-positions",
    type: u.percentages
  }, {
    name: "background-gradient-direction",
    type: u.gradientDirection
  }, {
    name: "padding",
    type: u.sizeMaybePercent,
    triggersBounds: l.any
  }, {
    name: "padding-relative-to",
    type: u.paddingRelativeTo,
    triggersBounds: l.any
  }, {
    name: "bounds-expansion",
    type: u.boundsExpansion,
    triggersBounds: l.any
  }], C = [{
    name: "border-color",
    type: u.color
  }, {
    name: "border-opacity",
    type: u.zeroOneNumber
  }, {
    name: "border-width",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "border-style",
    type: u.borderStyle
  }, {
    name: "border-cap",
    type: u.lineCap
  }, {
    name: "border-join",
    type: u.lineJoin
  }, {
    name: "border-dash-pattern",
    type: u.numbers
  }, {
    name: "border-dash-offset",
    type: u.number
  }, {
    name: "border-position",
    type: u.linePosition
  }], k = [{
    name: "outline-color",
    type: u.color
  }, {
    name: "outline-opacity",
    type: u.zeroOneNumber
  }, {
    name: "outline-width",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "outline-style",
    type: u.borderStyle
  }, {
    name: "outline-offset",
    type: u.size,
    triggersBounds: l.any
  }], _ = [{
    name: "background-image",
    type: u.urls
  }, {
    name: "background-image-crossorigin",
    type: u.bgCrossOrigin
  }, {
    name: "background-image-opacity",
    type: u.zeroOneNumbers
  }, {
    name: "background-image-containment",
    type: u.bgContainment
  }, {
    name: "background-image-smoothing",
    type: u.bools
  }, {
    name: "background-position-x",
    type: u.bgPos
  }, {
    name: "background-position-y",
    type: u.bgPos
  }, {
    name: "background-width-relative-to",
    type: u.bgRelativeTo
  }, {
    name: "background-height-relative-to",
    type: u.bgRelativeTo
  }, {
    name: "background-repeat",
    type: u.bgRepeat
  }, {
    name: "background-fit",
    type: u.bgFit
  }, {
    name: "background-clip",
    type: u.bgClip
  }, {
    name: "background-width",
    type: u.bgWH
  }, {
    name: "background-height",
    type: u.bgWH
  }, {
    name: "background-offset-x",
    type: u.bgPos
  }, {
    name: "background-offset-y",
    type: u.bgPos
  }], L = [{
    name: "position",
    type: u.position,
    triggersBounds: l.any
  }, {
    name: "compound-sizing-wrt-labels",
    type: u.compoundIncludeLabels,
    triggersBounds: l.any
  }, {
    name: "min-width",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "min-width-bias-left",
    type: u.sizeMaybePercent,
    triggersBounds: l.any
  }, {
    name: "min-width-bias-right",
    type: u.sizeMaybePercent,
    triggersBounds: l.any
  }, {
    name: "min-height",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "min-height-bias-top",
    type: u.sizeMaybePercent,
    triggersBounds: l.any
  }, {
    name: "min-height-bias-bottom",
    type: u.sizeMaybePercent,
    triggersBounds: l.any
  }], N = [{
    name: "line-style",
    type: u.lineStyle
  }, {
    name: "line-color",
    type: u.color
  }, {
    name: "line-fill",
    type: u.fill
  }, {
    name: "line-cap",
    type: u.lineCap
  }, {
    name: "line-opacity",
    type: u.zeroOneNumber
  }, {
    name: "line-dash-pattern",
    type: u.numbers
  }, {
    name: "line-dash-offset",
    type: u.number
  }, {
    name: "line-outline-width",
    type: u.size
  }, {
    name: "line-outline-color",
    type: u.color
  }, {
    name: "line-gradient-stop-colors",
    type: u.colors
  }, {
    name: "line-gradient-stop-positions",
    type: u.percentages
  }, {
    name: "curve-style",
    type: u.curveStyle,
    triggersBounds: l.any,
    triggersBoundsOfParallelEdges: function(X, q) {
      return X === q ? !1 : X === "bezier" || // remove from bundle
      q === "bezier";
    }
  }, {
    name: "haystack-radius",
    type: u.zeroOneNumber,
    triggersBounds: l.any
  }, {
    name: "source-endpoint",
    type: u.edgeEndpoint,
    triggersBounds: l.any
  }, {
    name: "target-endpoint",
    type: u.edgeEndpoint,
    triggersBounds: l.any
  }, {
    name: "control-point-step-size",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "control-point-distances",
    type: u.bidirectionalSizes,
    triggersBounds: l.any
  }, {
    name: "control-point-weights",
    type: u.numbers,
    triggersBounds: l.any
  }, {
    name: "segment-distances",
    type: u.bidirectionalSizes,
    triggersBounds: l.any
  }, {
    name: "segment-weights",
    type: u.numbers,
    triggersBounds: l.any
  }, {
    name: "segment-radii",
    type: u.numbers,
    triggersBounds: l.any
  }, {
    name: "radius-type",
    type: u.radiusType,
    triggersBounds: l.any
  }, {
    name: "taxi-turn",
    type: u.bidirectionalSizeMaybePercent,
    triggersBounds: l.any
  }, {
    name: "taxi-turn-min-distance",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "taxi-direction",
    type: u.axisDirection,
    triggersBounds: l.any
  }, {
    name: "taxi-radius",
    type: u.number,
    triggersBounds: l.any
  }, {
    name: "edge-distances",
    type: u.edgeDistances,
    triggersBounds: l.any
  }, {
    name: "arrow-scale",
    type: u.positiveNumber,
    triggersBounds: l.any
  }, {
    name: "loop-direction",
    type: u.angle,
    triggersBounds: l.any
  }, {
    name: "loop-sweep",
    type: u.angle,
    triggersBounds: l.any
  }, {
    name: "source-distance-from-node",
    type: u.size,
    triggersBounds: l.any
  }, {
    name: "target-distance-from-node",
    type: u.size,
    triggersBounds: l.any
  }], A = [{
    name: "ghost",
    type: u.bool,
    triggersBounds: l.any
  }, {
    name: "ghost-offset-x",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "ghost-offset-y",
    type: u.bidirectionalSize,
    triggersBounds: l.any
  }, {
    name: "ghost-opacity",
    type: u.zeroOneNumber
  }], O = [{
    name: "selection-box-color",
    type: u.color
  }, {
    name: "selection-box-opacity",
    type: u.zeroOneNumber
  }, {
    name: "selection-box-border-color",
    type: u.color
  }, {
    name: "selection-box-border-width",
    type: u.size
  }, {
    name: "active-bg-color",
    type: u.color
  }, {
    name: "active-bg-opacity",
    type: u.zeroOneNumber
  }, {
    name: "active-bg-size",
    type: u.size
  }, {
    name: "outside-texture-bg-color",
    type: u.color
  }, {
    name: "outside-texture-bg-opacity",
    type: u.zeroOneNumber
  }], P = [];
  wn.pieBackgroundN = 16, P.push({
    name: "pie-size",
    type: u.sizeMaybePercent
  }), P.push({
    name: "pie-hole",
    type: u.sizeMaybePercent
  }), P.push({
    name: "pie-start-angle",
    type: u.angle
  });
  for (var S = 1; S <= wn.pieBackgroundN; S++)
    P.push({
      name: "pie-" + S + "-background-color",
      type: u.color
    }), P.push({
      name: "pie-" + S + "-background-size",
      type: u.percent
    }), P.push({
      name: "pie-" + S + "-background-opacity",
      type: u.zeroOneNumber
    });
  var R = [];
  wn.stripeBackgroundN = 16, R.push({
    name: "stripe-size",
    type: u.sizeMaybePercent
  }), R.push({
    name: "stripe-direction",
    type: u.axisDirectionPrimary
  });
  for (var I = 1; I <= wn.stripeBackgroundN; I++)
    R.push({
      name: "stripe-" + I + "-background-color",
      type: u.color
    }), R.push({
      name: "stripe-" + I + "-background-size",
      type: u.percent
    }), R.push({
      name: "stripe-" + I + "-background-opacity",
      type: u.zeroOneNumber
    });
  var D = [], M = wn.arrowPrefixes = ["source", "mid-source", "target", "mid-target"];
  [{
    name: "arrow-shape",
    type: u.arrowShape,
    triggersBounds: l.any
  }, {
    name: "arrow-color",
    type: u.color
  }, {
    name: "arrow-fill",
    type: u.arrowFill
  }, {
    name: "arrow-width",
    type: u.arrowWidth
  }].forEach(function(Z) {
    M.forEach(function(X) {
      var q = X + "-" + Z.name, J = Z.type, j = Z.triggersBounds;
      D.push({
        name: q,
        type: J,
        triggersBounds: j
      });
    });
  }, {});
  var B = wn.properties = [].concat(m, w, v, y, b, A, g, p, h, d, f, E, C, k, _, P, R, L, N, D, O), $ = wn.propertyGroups = {
    // common to all eles
    behavior: m,
    transition: w,
    visibility: v,
    overlay: y,
    underlay: b,
    ghost: A,
    // labels
    commonLabel: g,
    labelDimensions: p,
    mainLabel: h,
    sourceLabel: d,
    targetLabel: f,
    // node props
    nodeBody: E,
    nodeBorder: C,
    nodeOutline: k,
    backgroundImage: _,
    pie: P,
    stripe: R,
    compound: L,
    // edge props
    edgeLine: N,
    edgeArrow: D,
    core: O
  }, F = wn.propertyGroupNames = {}, G = wn.propertyGroupKeys = Object.keys($);
  G.forEach(function(Z) {
    F[Z] = $[Z].map(function(X) {
      return X.name;
    }), $[Z].forEach(function(X) {
      return X.groupKey = Z;
    });
  });
  var H = wn.aliases = [{
    name: "content",
    pointsTo: "label"
  }, {
    name: "control-point-distance",
    pointsTo: "control-point-distances"
  }, {
    name: "control-point-weight",
    pointsTo: "control-point-weights"
  }, {
    name: "segment-distance",
    pointsTo: "segment-distances"
  }, {
    name: "segment-weight",
    pointsTo: "segment-weights"
  }, {
    name: "segment-radius",
    pointsTo: "segment-radii"
  }, {
    name: "edge-text-rotation",
    pointsTo: "text-rotation"
  }, {
    name: "padding-left",
    pointsTo: "padding"
  }, {
    name: "padding-right",
    pointsTo: "padding"
  }, {
    name: "padding-top",
    pointsTo: "padding"
  }, {
    name: "padding-bottom",
    pointsTo: "padding"
  }];
  wn.propertyNames = B.map(function(Z) {
    return Z.name;
  });
  for (var ee = 0; ee < B.length; ee++) {
    var Y = B[ee];
    B[Y.name] = Y;
  }
  for (var re = 0; re < H.length; re++) {
    var ne = H[re], he = B[ne.pointsTo], K = {
      name: ne.name,
      alias: !0,
      pointsTo: he
    };
    B.push(K), B[ne.name] = K;
  }
})();
wn.getDefaultProperty = function(t) {
  return this.getDefaultProperties()[t];
};
wn.getDefaultProperties = function() {
  var t = this._private;
  if (t.defaultProperties != null)
    return t.defaultProperties;
  for (var e = Gt({
    // core props
    "selection-box-color": "#ddd",
    "selection-box-opacity": 0.65,
    "selection-box-border-color": "#aaa",
    "selection-box-border-width": 1,
    "active-bg-color": "black",
    "active-bg-opacity": 0.15,
    "active-bg-size": 30,
    "outside-texture-bg-color": "#000",
    "outside-texture-bg-opacity": 0.125,
    // common node/edge props
    events: "yes",
    "text-events": "no",
    "text-valign": "top",
    "text-halign": "center",
    "text-justification": "auto",
    "line-height": 1,
    color: "#000",
    "box-selection": "contain",
    "text-outline-color": "#000",
    "text-outline-width": 0,
    "text-outline-opacity": 1,
    "text-opacity": 1,
    "text-decoration": "none",
    "text-transform": "none",
    "text-wrap": "none",
    "text-overflow-wrap": "whitespace",
    "text-max-width": 9999,
    "text-background-color": "#000",
    "text-background-opacity": 0,
    "text-background-shape": "rectangle",
    "text-background-padding": 0,
    "text-border-opacity": 0,
    "text-border-width": 0,
    "text-border-style": "solid",
    "text-border-color": "#000",
    "font-family": "Helvetica Neue, Helvetica, sans-serif",
    "font-style": "normal",
    "font-weight": "normal",
    "font-size": 16,
    "min-zoomed-font-size": 0,
    "text-rotation": "none",
    "source-text-rotation": "none",
    "target-text-rotation": "none",
    visibility: "visible",
    display: "element",
    opacity: 1,
    "z-compound-depth": "auto",
    "z-index-compare": "auto",
    "z-index": 0,
    label: "",
    "text-margin-x": 0,
    "text-margin-y": 0,
    "source-label": "",
    "source-text-offset": 0,
    "source-text-margin-x": 0,
    "source-text-margin-y": 0,
    "target-label": "",
    "target-text-offset": 0,
    "target-text-margin-x": 0,
    "target-text-margin-y": 0,
    "overlay-opacity": 0,
    "overlay-color": "#000",
    "overlay-padding": 10,
    "overlay-shape": "round-rectangle",
    "overlay-corner-radius": "auto",
    "underlay-opacity": 0,
    "underlay-color": "#000",
    "underlay-padding": 10,
    "underlay-shape": "round-rectangle",
    "underlay-corner-radius": "auto",
    "transition-property": "none",
    "transition-duration": 0,
    "transition-delay": 0,
    "transition-timing-function": "linear",
    "box-select-labels": "no",
    // node props
    "background-blacken": 0,
    "background-color": "#999",
    "background-fill": "solid",
    "background-opacity": 1,
    "background-image": "none",
    "background-image-crossorigin": "anonymous",
    "background-image-opacity": 1,
    "background-image-containment": "inside",
    "background-image-smoothing": "yes",
    "background-position-x": "50%",
    "background-position-y": "50%",
    "background-offset-x": 0,
    "background-offset-y": 0,
    "background-width-relative-to": "include-padding",
    "background-height-relative-to": "include-padding",
    "background-repeat": "no-repeat",
    "background-fit": "none",
    "background-clip": "node",
    "background-width": "auto",
    "background-height": "auto",
    "border-color": "#000",
    "border-opacity": 1,
    "border-width": 0,
    "border-style": "solid",
    "border-dash-pattern": [4, 2],
    "border-dash-offset": 0,
    "border-cap": "butt",
    "border-join": "miter",
    "border-position": "center",
    "outline-color": "#999",
    "outline-opacity": 1,
    "outline-width": 0,
    "outline-offset": 0,
    "outline-style": "solid",
    height: 30,
    width: 30,
    shape: "ellipse",
    "shape-polygon-points": "-1, -1,   1, -1,   1, 1,   -1, 1",
    "corner-radius": "auto",
    "bounds-expansion": 0,
    // node gradient
    "background-gradient-direction": "to-bottom",
    "background-gradient-stop-colors": "#999",
    "background-gradient-stop-positions": "0%",
    // ghost props
    ghost: "no",
    "ghost-offset-y": 0,
    "ghost-offset-x": 0,
    "ghost-opacity": 0,
    // compound props
    padding: 0,
    "padding-relative-to": "width",
    position: "origin",
    "compound-sizing-wrt-labels": "include",
    "min-width": 0,
    "min-width-bias-left": 0,
    "min-width-bias-right": 0,
    "min-height": 0,
    "min-height-bias-top": 0,
    "min-height-bias-bottom": 0
  }, {
    // node pie bg
    "pie-size": "100%",
    "pie-hole": 0,
    "pie-start-angle": "0deg"
  }, [{
    name: "pie-{{i}}-background-color",
    value: "black"
  }, {
    name: "pie-{{i}}-background-size",
    value: "0%"
  }, {
    name: "pie-{{i}}-background-opacity",
    value: 1
  }].reduce(function(l, u) {
    for (var h = 1; h <= wn.pieBackgroundN; h++) {
      var d = u.name.replace("{{i}}", h), f = u.value;
      l[d] = f;
    }
    return l;
  }, {}), {
    // node stripes bg
    "stripe-size": "100%",
    "stripe-direction": "horizontal"
  }, [{
    name: "stripe-{{i}}-background-color",
    value: "black"
  }, {
    name: "stripe-{{i}}-background-size",
    value: "0%"
  }, {
    name: "stripe-{{i}}-background-opacity",
    value: 1
  }].reduce(function(l, u) {
    for (var h = 1; h <= wn.stripeBackgroundN; h++) {
      var d = u.name.replace("{{i}}", h), f = u.value;
      l[d] = f;
    }
    return l;
  }, {}), {
    // edge props
    "line-style": "solid",
    "line-color": "#999",
    "line-fill": "solid",
    "line-cap": "butt",
    "line-opacity": 1,
    "line-outline-width": 0,
    "line-outline-color": "#000",
    "line-gradient-stop-colors": "#999",
    "line-gradient-stop-positions": "0%",
    "control-point-step-size": 40,
    "control-point-weights": 0.5,
    "segment-weights": 0.5,
    "segment-distances": 20,
    "segment-radii": 15,
    "radius-type": "arc-radius",
    "taxi-turn": "50%",
    "taxi-radius": 15,
    "taxi-turn-min-distance": 10,
    "taxi-direction": "auto",
    "edge-distances": "intersection",
    "curve-style": "haystack",
    "haystack-radius": 0,
    "arrow-scale": 1,
    "loop-direction": "-45deg",
    "loop-sweep": "-90deg",
    "source-distance-from-node": 0,
    "target-distance-from-node": 0,
    "source-endpoint": "outside-to-node",
    "target-endpoint": "outside-to-node",
    "line-dash-pattern": [6, 3],
    "line-dash-offset": 0
  }, [{
    name: "arrow-shape",
    value: "none"
  }, {
    name: "arrow-color",
    value: "#999"
  }, {
    name: "arrow-fill",
    value: "filled"
  }, {
    name: "arrow-width",
    value: 1
  }].reduce(function(l, u) {
    return wn.arrowPrefixes.forEach(function(h) {
      var d = h + "-" + u.name, f = u.value;
      l[d] = f;
    }), l;
  }, {})), r = {}, n = 0; n < this.properties.length; n++) {
    var i = this.properties[n];
    if (!i.pointsTo) {
      var a = i.name, s = e[a], o = this.parse(a, s);
      r[a] = o;
    }
  }
  return t.defaultProperties = r, t.defaultProperties;
};
wn.addDefaultStylesheet = function() {
  this.selector(":parent").css({
    shape: "rectangle",
    padding: 10,
    "background-color": "#eee",
    "border-color": "#ccc",
    "border-width": 1
  }).selector("edge").css({
    width: 3
  }).selector(":loop").css({
    "curve-style": "bezier"
  }).selector("edge:compound").css({
    "curve-style": "bezier",
    "source-endpoint": "outside-to-line",
    "target-endpoint": "outside-to-line"
  }).selector(":selected").css({
    "background-color": "#0169D9",
    "line-color": "#0169D9",
    "source-arrow-color": "#0169D9",
    "target-arrow-color": "#0169D9",
    "mid-source-arrow-color": "#0169D9",
    "mid-target-arrow-color": "#0169D9"
  }).selector(":parent:selected").css({
    "background-color": "#CCE1F9",
    "border-color": "#aec8e5"
  }).selector(":active").css({
    "overlay-color": "black",
    "overlay-padding": 10,
    "overlay-opacity": 0.25
  }), this.defaultLength = this.length;
};
var Ux = {};
Ux.parse = function(t, e, r, n) {
  var i = this;
  if (nn(e))
    return i.parseImplWarn(t, e, r, n);
  var a = n === "mapping" || n === !0 || n === !1 || n == null ? "dontcare" : n, s = r ? "t" : "f", o = "" + e, l = yV(t, o, s, a), u = i.propCache = i.propCache || [], h;
  return (h = u[l]) || (h = u[l] = i.parseImplWarn(t, e, r, n)), (r || n === "mapping") && (h = Hs(h), h && (h.value = Hs(h.value))), h;
};
Ux.parseImplWarn = function(t, e, r, n) {
  var i = this.parseImpl(t, e, r, n);
  return !i && e != null && Nr("The style property `".concat(t, ": ").concat(e, "` is invalid")), i && (i.name === "width" || i.name === "height") && e === "label" && Nr("The style value of `label` is deprecated for `" + i.name + "`"), i;
};
Ux.parseImpl = function(t, e, r, n) {
  var i = this;
  t = Wk(t);
  var a = i.properties[t], s = e, o = i.types;
  if (!a || e === void 0)
    return null;
  a.alias && (a = a.pointsTo, t = a.name);
  var l = Bt(e);
  l && (e = e.trim());
  var u = a.type;
  if (!u)
    return null;
  if (r && (e === "" || e === null))
    return {
      name: t,
      value: e,
      bypass: !0,
      deleteBypass: !0
    };
  if (nn(e))
    return {
      name: t,
      value: e,
      strValue: "fn",
      mapped: o.fn,
      bypass: r
    };
  var h, d;
  if (!(!l || n || e.length < 7 || e[1] !== "a")) {
    if (e.length >= 7 && e[0] === "d" && (h = new RegExp(o.data.regex).exec(e))) {
      if (r)
        return !1;
      var f = o.data;
      return {
        name: t,
        value: h,
        strValue: "" + e,
        mapped: f,
        field: h[1],
        bypass: r
      };
    } else if (e.length >= 10 && e[0] === "m" && (d = new RegExp(o.mapData.regex).exec(e))) {
      if (r || u.multiple)
        return !1;
      var p = o.mapData;
      if (!(u.color || u.number))
        return !1;
      var g = this.parse(t, d[4]);
      if (!g || g.mapped)
        return !1;
      var m = this.parse(t, d[5]);
      if (!m || m.mapped)
        return !1;
      if (g.pfValue === m.pfValue || g.strValue === m.strValue)
        return Nr("`" + t + ": " + e + "` is not a valid mapper because the output range is zero; converting to `" + t + ": " + g.strValue + "`"), this.parse(t, g.strValue);
      if (u.color) {
        var v = g.value, y = m.value, b = v[0] === y[0] && v[1] === y[1] && v[2] === y[2] && // optional alpha
        (v[3] === y[3] || (v[3] == null || v[3] === 1) && (y[3] == null || y[3] === 1));
        if (b)
          return !1;
      }
      return {
        name: t,
        value: d,
        strValue: "" + e,
        mapped: p,
        field: d[1],
        fieldMin: parseFloat(d[2]),
        // min & max are numeric
        fieldMax: parseFloat(d[3]),
        valueMin: g.value,
        valueMax: m.value,
        bypass: r
      };
    }
  }
  if (u.multiple && n !== "multiple") {
    var w;
    if (l ? w = e.split(/\s+/) : Br(e) ? w = e : w = [e], u.evenMultiple && w.length % 2 !== 0)
      return null;
    for (var T = [], E = [], C = [], k = "", _ = !1, L = 0; L < w.length; L++) {
      var N = i.parse(t, w[L], r, "multiple");
      _ = _ || Bt(N.value), T.push(N.value), C.push(N.pfValue != null ? N.pfValue : N.value), E.push(N.units), k += (L > 0 ? " " : "") + N.strValue;
    }
    return u.validate && !u.validate(T, E) ? null : u.singleEnum && _ ? T.length === 1 && Bt(T[0]) ? {
      name: t,
      value: T[0],
      strValue: T[0],
      bypass: r
    } : null : {
      name: t,
      value: T,
      pfValue: C,
      strValue: k,
      bypass: r,
      units: E
    };
  }
  var A = function() {
    for (var K = 0; K < u.enums.length; K++) {
      var Z = u.enums[K];
      if (Z === e)
        return {
          name: t,
          value: e,
          strValue: "" + e,
          bypass: r
        };
    }
    return null;
  };
  if (u.number) {
    var O, P = "px";
    if (u.units && (O = u.units), u.implicitUnits && (P = u.implicitUnits), !u.unitless)
      if (l) {
        var S = "px|em" + (u.allowPercent ? "|\\%" : "");
        O && (S = O);
        var R = e.match("^(" + Bn + ")(" + S + ")?$");
        R && (e = R[1], O = R[2] || P);
      } else (!O || u.implicitUnits) && (O = P);
    if (e = parseFloat(e), isNaN(e) && u.enums === void 0)
      return null;
    if (isNaN(e) && u.enums !== void 0)
      return e = s, A();
    if (u.integer && !Lme(e) || u.min !== void 0 && (e < u.min || u.strictMin && e === u.min) || u.max !== void 0 && (e > u.max || u.strictMax && e === u.max))
      return null;
    var I = {
      name: t,
      value: e,
      strValue: "" + e + (O || ""),
      units: O,
      bypass: r
    };
    return u.unitless || O !== "px" && O !== "em" ? I.pfValue = e : I.pfValue = O === "px" || !O ? e : this.getEmSizeInPixels() * e, (O === "ms" || O === "s") && (I.pfValue = O === "ms" ? e : 1e3 * e), (O === "deg" || O === "rad") && (I.pfValue = O === "rad" ? e : $ve(e)), O === "%" && (I.pfValue = e / 100), I;
  } else if (u.propList) {
    var D = [], M = "" + e;
    if (M !== "none") {
      for (var B = M.split(/\s*,\s*|\s+/), $ = 0; $ < B.length; $++) {
        var F = B[$].trim();
        i.properties[F] ? D.push(F) : Nr("`" + F + "` is not a valid property name");
      }
      if (D.length === 0)
        return null;
    }
    return {
      name: t,
      value: D,
      strValue: D.length === 0 ? "none" : D.join(" "),
      bypass: r
    };
  } else if (u.color) {
    var G = hV(e);
    return G ? {
      name: t,
      value: G,
      pfValue: G,
      strValue: "rgb(" + G[0] + "," + G[1] + "," + G[2] + ")",
      // n.b. no spaces b/c of multiple support
      bypass: r
    } : null;
  } else if (u.regex || u.regexes) {
    if (u.enums) {
      var H = A();
      if (H)
        return H;
    }
    for (var ee = u.regexes ? u.regexes : [u.regex], Y = 0; Y < ee.length; Y++) {
      var re = new RegExp(ee[Y]), ne = re.exec(e);
      if (ne)
        return {
          name: t,
          value: u.singleRegexMatchValue ? ne[1] : ne,
          strValue: "" + e,
          bypass: r
        };
    }
    return null;
  } else return u.string ? {
    name: t,
    value: "" + e,
    strValue: "" + e,
    bypass: r
  } : u.enums ? A() : null;
};
var Kn = function(e) {
  if (!(this instanceof Kn))
    return new Kn(e);
  if (!Uk(e)) {
    Kr("A style must have a core reference");
    return;
  }
  this._private = {
    cy: e,
    coreStyle: {}
  }, this.length = 0, this.resetToDefault();
}, _i = Kn.prototype;
_i.instanceString = function() {
  return "style";
};
_i.clear = function() {
  for (var t = this._private, e = t.cy, r = e.elements(), n = 0; n < this.length; n++)
    this[n] = void 0;
  return this.length = 0, t.contextStyles = {}, t.propDiffs = {}, this.cleanElements(r, !0), r.forEach(function(i) {
    var a = i[0]._private;
    a.styleDirty = !0, a.appliedInitStyle = !1;
  }), this;
};
_i.resetToDefault = function() {
  return this.clear(), this.addDefaultStylesheet(), this;
};
_i.core = function(t) {
  return this._private.coreStyle[t] || this.getDefaultProperty(t);
};
_i.selector = function(t) {
  var e = t === "core" ? null : new Hl(t), r = this.length++;
  return this[r] = {
    selector: e,
    properties: [],
    mappedProperties: [],
    index: r
  }, this;
};
_i.css = function() {
  var t = this, e = arguments;
  if (e.length === 1)
    for (var r = e[0], n = 0; n < t.properties.length; n++) {
      var i = t.properties[n], a = r[i.name];
      a === void 0 && (a = r[Lx(i.name)]), a !== void 0 && this.cssRule(i.name, a);
    }
  else e.length === 2 && this.cssRule(e[0], e[1]);
  return this;
};
_i.style = _i.css;
_i.cssRule = function(t, e) {
  var r = this.parse(t, e);
  if (r) {
    var n = this.length - 1;
    this[n].properties.push(r), this[n].properties[r.name] = r, r.name.match(/pie-(\d+)-background-size/) && r.value && (this._private.hasPie = !0), r.name.match(/stripe-(\d+)-background-size/) && r.value && (this._private.hasStripe = !0), r.mapped && this[n].mappedProperties.push(r);
    var i = !this[n].selector;
    i && (this._private.coreStyle[r.name] = r);
  }
  return this;
};
_i.append = function(t) {
  return lV(t) ? t.appendToStyle(this) : Br(t) ? this.appendFromJson(t) : Bt(t) && this.appendFromString(t), this;
};
Kn.fromJson = function(t, e) {
  var r = new Kn(t);
  return r.fromJson(e), r;
};
Kn.fromString = function(t, e) {
  return new Kn(t).fromString(e);
};
[ei, i1, aS, Js, Gx, sS, wn, Ux].forEach(function(t) {
  Gt(_i, t);
});
Kn.types = _i.types;
Kn.properties = _i.properties;
Kn.propertyGroups = _i.propertyGroups;
Kn.propertyGroupNames = _i.propertyGroupNames;
Kn.propertyGroupKeys = _i.propertyGroupKeys;
var Uxe = {
  style: function(e) {
    if (e) {
      var r = this.setStyle(e);
      r.update();
    }
    return this._private.style;
  },
  setStyle: function(e) {
    var r = this._private;
    return lV(e) ? r.style = e.generateStyle(this) : Br(e) ? r.style = Kn.fromJson(this, e) : Bt(e) ? r.style = Kn.fromString(this, e) : r.style = Kn(this), r.style;
  },
  // e.g. cy.data() changed => recalc ele mappers
  updateStyle: function() {
    this.mutableElements().updateStyle();
  }
}, Wxe = "single", yu = {
  autolock: function(e) {
    if (e !== void 0)
      this._private.autolock = !!e;
    else
      return this._private.autolock;
    return this;
  },
  autoungrabify: function(e) {
    if (e !== void 0)
      this._private.autoungrabify = !!e;
    else
      return this._private.autoungrabify;
    return this;
  },
  autounselectify: function(e) {
    if (e !== void 0)
      this._private.autounselectify = !!e;
    else
      return this._private.autounselectify;
    return this;
  },
  selectionType: function(e) {
    var r = this._private;
    if (r.selectionType == null && (r.selectionType = Wxe), e !== void 0)
      (e === "additive" || e === "single") && (r.selectionType = e);
    else
      return r.selectionType;
    return this;
  },
  panningEnabled: function(e) {
    if (e !== void 0)
      this._private.panningEnabled = !!e;
    else
      return this._private.panningEnabled;
    return this;
  },
  userPanningEnabled: function(e) {
    if (e !== void 0)
      this._private.userPanningEnabled = !!e;
    else
      return this._private.userPanningEnabled;
    return this;
  },
  zoomingEnabled: function(e) {
    if (e !== void 0)
      this._private.zoomingEnabled = !!e;
    else
      return this._private.zoomingEnabled;
    return this;
  },
  userZoomingEnabled: function(e) {
    if (e !== void 0)
      this._private.userZoomingEnabled = !!e;
    else
      return this._private.userZoomingEnabled;
    return this;
  },
  boxSelectionEnabled: function(e) {
    if (e !== void 0)
      this._private.boxSelectionEnabled = !!e;
    else
      return this._private.boxSelectionEnabled;
    return this;
  },
  pan: function() {
    var e = arguments, r = this._private.pan, n, i, a, s, o;
    switch (e.length) {
      case 0:
        return r;
      case 1:
        if (Bt(e[0]))
          return n = e[0], r[n];
        if (vr(e[0])) {
          if (!this._private.panningEnabled)
            return this;
          a = e[0], s = a.x, o = a.y, vt(s) && (r.x = s), vt(o) && (r.y = o), this.emit("pan viewport");
        }
        break;
      case 2:
        if (!this._private.panningEnabled)
          return this;
        n = e[0], i = e[1], (n === "x" || n === "y") && vt(i) && (r[n] = i), this.emit("pan viewport");
        break;
    }
    return this.notify("viewport"), this;
  },
  panBy: function(e, r) {
    var n = arguments, i = this._private.pan, a, s, o, l, u;
    if (!this._private.panningEnabled)
      return this;
    switch (n.length) {
      case 1:
        vr(e) && (o = n[0], l = o.x, u = o.y, vt(l) && (i.x += l), vt(u) && (i.y += u), this.emit("pan viewport"));
        break;
      case 2:
        a = e, s = r, (a === "x" || a === "y") && vt(s) && (i[a] += s), this.emit("pan viewport");
        break;
    }
    return this.notify("viewport"), this;
  },
  gc: function() {
    this.notify("gc");
  },
  fit: function(e, r) {
    var n = this.getFitViewport(e, r);
    if (n) {
      var i = this._private;
      i.zoom = n.zoom, i.pan = n.pan, this.emit("pan zoom viewport"), this.notify("viewport");
    }
    return this;
  },
  getFitViewport: function(e, r) {
    if (vt(e) && r === void 0 && (r = e, e = void 0), !(!this._private.panningEnabled || !this._private.zoomingEnabled)) {
      var n;
      if (Bt(e)) {
        var i = e;
        e = this.$(i);
      } else if (Mme(e)) {
        var a = e;
        n = {
          x1: a.x1,
          y1: a.y1,
          x2: a.x2,
          y2: a.y2
        }, n.w = n.x2 - n.x1, n.h = n.y2 - n.y1;
      } else La(e) || (e = this.mutableElements());
      if (!(La(e) && e.empty())) {
        n = n || e.boundingBox();
        var s = this.width(), o = this.height(), l;
        if (r = vt(r) ? r : 0, !isNaN(s) && !isNaN(o) && s > 0 && o > 0 && !isNaN(n.w) && !isNaN(n.h) && n.w > 0 && n.h > 0) {
          l = Math.min((s - 2 * r) / n.w, (o - 2 * r) / n.h), l = l > this._private.maxZoom ? this._private.maxZoom : l, l = l < this._private.minZoom ? this._private.minZoom : l;
          var u = {
            // now pan to middle
            x: (s - l * (n.x1 + n.x2)) / 2,
            y: (o - l * (n.y1 + n.y2)) / 2
          };
          return {
            zoom: l,
            pan: u
          };
        }
      }
    }
  },
  zoomRange: function(e, r) {
    var n = this._private;
    if (r == null) {
      var i = e;
      e = i.min, r = i.max;
    }
    return vt(e) && vt(r) && e <= r ? (n.minZoom = e, n.maxZoom = r) : vt(e) && r === void 0 && e <= n.maxZoom ? n.minZoom = e : vt(r) && e === void 0 && r >= n.minZoom && (n.maxZoom = r), this;
  },
  minZoom: function(e) {
    return e === void 0 ? this._private.minZoom : this.zoomRange({
      min: e
    });
  },
  maxZoom: function(e) {
    return e === void 0 ? this._private.maxZoom : this.zoomRange({
      max: e
    });
  },
  getZoomedViewport: function(e) {
    var r = this._private, n = r.pan, i = r.zoom, a, s, o = !1;
    if (r.zoomingEnabled || (o = !0), vt(e) ? s = e : vr(e) && (s = e.level, e.position != null ? a = Mx(e.position, i, n) : e.renderedPosition != null && (a = e.renderedPosition), a != null && !r.panningEnabled && (o = !0)), s = s > r.maxZoom ? r.maxZoom : s, s = s < r.minZoom ? r.minZoom : s, o || !vt(s) || s === i || a != null && (!vt(a.x) || !vt(a.y)))
      return null;
    if (a != null) {
      var l = n, u = i, h = s, d = {
        x: -h / u * (a.x - l.x) + a.x,
        y: -h / u * (a.y - l.y) + a.y
      };
      return {
        zoomed: !0,
        panned: !0,
        zoom: h,
        pan: d
      };
    } else
      return {
        zoomed: !0,
        panned: !1,
        zoom: s,
        pan: n
      };
  },
  zoom: function(e) {
    if (e === void 0)
      return this._private.zoom;
    var r = this.getZoomedViewport(e), n = this._private;
    return r == null || !r.zoomed ? this : (n.zoom = r.zoom, r.panned && (n.pan.x = r.pan.x, n.pan.y = r.pan.y), this.emit("zoom" + (r.panned ? " pan" : "") + " viewport"), this.notify("viewport"), this);
  },
  viewport: function(e) {
    var r = this._private, n = !0, i = !0, a = [], s = !1, o = !1;
    if (!e)
      return this;
    if (vt(e.zoom) || (n = !1), vr(e.pan) || (i = !1), !n && !i)
      return this;
    if (n) {
      var l = e.zoom;
      l < r.minZoom || l > r.maxZoom || !r.zoomingEnabled ? s = !0 : (r.zoom = l, a.push("zoom"));
    }
    if (i && (!s || !e.cancelOnFailedZoom) && r.panningEnabled) {
      var u = e.pan;
      vt(u.x) && (r.pan.x = u.x, o = !1), vt(u.y) && (r.pan.y = u.y, o = !1), o || a.push("pan");
    }
    return a.length > 0 && (a.push("viewport"), this.emit(a.join(" ")), this.notify("viewport")), this;
  },
  center: function(e) {
    var r = this.getCenterPan(e);
    return r && (this._private.pan = r, this.emit("pan viewport"), this.notify("viewport")), this;
  },
  getCenterPan: function(e, r) {
    if (this._private.panningEnabled) {
      if (Bt(e)) {
        var n = e;
        e = this.mutableElements().filter(n);
      } else La(e) || (e = this.mutableElements());
      if (e.length !== 0) {
        var i = e.boundingBox(), a = this.width(), s = this.height();
        r = r === void 0 ? this._private.zoom : r;
        var o = {
          // middle
          x: (a - r * (i.x1 + i.x2)) / 2,
          y: (s - r * (i.y1 + i.y2)) / 2
        };
        return o;
      }
    }
  },
  reset: function() {
    return !this._private.panningEnabled || !this._private.zoomingEnabled ? this : (this.viewport({
      pan: {
        x: 0,
        y: 0
      },
      zoom: 1
    }), this);
  },
  invalidateSize: function() {
    this._private.sizeCache = null;
  },
  size: function() {
    var e = this._private, r = e.container, n = this;
    return e.sizeCache = e.sizeCache || (r ? function() {
      var i = n.window().getComputedStyle(r), a = function(o) {
        return parseFloat(i.getPropertyValue(o));
      };
      return {
        width: r.clientWidth - a("padding-left") - a("padding-right"),
        height: r.clientHeight - a("padding-top") - a("padding-bottom")
      };
    }() : {
      // fallback if no container (not 0 b/c can be used for dividing etc)
      width: 1,
      height: 1
    });
  },
  width: function() {
    return this.size().width;
  },
  height: function() {
    return this.size().height;
  },
  extent: function() {
    var e = this._private.pan, r = this._private.zoom, n = this.renderedExtent(), i = {
      x1: (n.x1 - e.x) / r,
      x2: (n.x2 - e.x) / r,
      y1: (n.y1 - e.y) / r,
      y2: (n.y2 - e.y) / r
    };
    return i.w = i.x2 - i.x1, i.h = i.y2 - i.y1, i;
  },
  renderedExtent: function() {
    var e = this.width(), r = this.height();
    return {
      x1: 0,
      y1: 0,
      x2: e,
      y2: r,
      w: e,
      h: r
    };
  },
  multiClickDebounceTime: function(e) {
    if (e) this._private.multiClickDebounceTime = e;
    else return this._private.multiClickDebounceTime;
    return this;
  }
};
yu.centre = yu.center;
yu.autolockNodes = yu.autolock;
yu.autoungrabifyNodes = yu.autoungrabify;
var hg = {
  data: _r.data({
    field: "data",
    bindingEvent: "data",
    allowBinding: !0,
    allowSetting: !0,
    settingEvent: "data",
    settingTriggersEvent: !0,
    triggerFnName: "trigger",
    allowGetting: !0,
    updateStyle: !0
  }),
  removeData: _r.removeData({
    field: "data",
    event: "data",
    triggerFnName: "trigger",
    triggerEvent: !0,
    updateStyle: !0
  }),
  scratch: _r.data({
    field: "scratch",
    bindingEvent: "scratch",
    allowBinding: !0,
    allowSetting: !0,
    settingEvent: "scratch",
    settingTriggersEvent: !0,
    triggerFnName: "trigger",
    allowGetting: !0,
    updateStyle: !0
  }),
  removeScratch: _r.removeData({
    field: "scratch",
    event: "scratch",
    triggerFnName: "trigger",
    triggerEvent: !0,
    updateStyle: !0
  })
};
hg.attr = hg.data;
hg.removeAttr = hg.removeData;
var dg = function(e) {
  var r = this;
  e = Gt({}, e);
  var n = e.container;
  n && !Iy(n) && Iy(n[0]) && (n = n[0]);
  var i = n ? n._cyreg : null;
  i = i || {}, i && i.cy && (i.cy.destroy(), i = {});
  var a = i.readies = i.readies || [];
  n && (n._cyreg = i), i.cy = r;
  var s = Dn !== void 0 && n !== void 0 && !e.headless, o = e;
  o.layout = Gt({
    name: s ? "grid" : "null"
  }, o.layout), o.renderer = Gt({
    name: s ? "canvas" : "null"
  }, o.renderer);
  var l = function(g, m, v) {
    return m !== void 0 ? m : v !== void 0 ? v : g;
  }, u = this._private = {
    container: n,
    // html dom ele container
    ready: !1,
    // whether ready has been triggered
    options: o,
    // cached options
    elements: new ui(this),
    // elements in the graph
    listeners: [],
    // list of listeners
    aniEles: new ui(this),
    // elements being animated
    data: o.data || {},
    // data for the core
    scratch: {},
    // scratch object for core
    layout: null,
    renderer: null,
    destroyed: !1,
    // whether destroy was called
    notificationsEnabled: !0,
    // whether notifications are sent to the renderer
    minZoom: 1e-50,
    maxZoom: 1e50,
    zoomingEnabled: l(!0, o.zoomingEnabled),
    userZoomingEnabled: l(!0, o.userZoomingEnabled),
    panningEnabled: l(!0, o.panningEnabled),
    userPanningEnabled: l(!0, o.userPanningEnabled),
    boxSelectionEnabled: l(!0, o.boxSelectionEnabled),
    autolock: l(!1, o.autolock, o.autolockNodes),
    autoungrabify: l(!1, o.autoungrabify, o.autoungrabifyNodes),
    autounselectify: l(!1, o.autounselectify),
    styleEnabled: o.styleEnabled === void 0 ? s : o.styleEnabled,
    zoom: vt(o.zoom) ? o.zoom : 1,
    pan: {
      x: vr(o.pan) && vt(o.pan.x) ? o.pan.x : 0,
      y: vr(o.pan) && vt(o.pan.y) ? o.pan.y : 0
    },
    animation: {
      // object for currently-running animations
      current: [],
      queue: []
    },
    hasCompoundNodes: !1,
    multiClickDebounceTime: l(250, o.multiClickDebounceTime)
  };
  this.createEmitter(), this.selectionType(o.selectionType), this.zoomRange({
    min: o.minZoom,
    max: o.maxZoom
  });
  var h = function(g, m) {
    var v = g.some(Dme);
    if (v)
      return Df.all(g).then(m);
    m(g);
  };
  u.styleEnabled && r.setStyle([]);
  var d = Gt({}, o, o.renderer);
  r.initRenderer(d);
  var f = function(g, m, v) {
    r.notifications(!1);
    var y = r.mutableElements();
    y.length > 0 && y.remove(), g != null && (vr(g) || Br(g)) && r.add(g), r.one("layoutready", function(w) {
      r.notifications(!0), r.emit(w), r.one("load", m), r.emitAndNotify("load");
    }).one("layoutstop", function() {
      r.one("done", v), r.emit("done");
    });
    var b = Gt({}, r._private.options.layout);
    b.eles = r.elements(), r.layout(b).run();
  };
  h([o.style, o.elements], function(p) {
    var g = p[0], m = p[1];
    u.styleEnabled && r.style().append(g), f(m, function() {
      r.startAnimationLoop(), u.ready = !0, nn(o.ready) && r.on("ready", o.ready);
      for (var v = 0; v < a.length; v++) {
        var y = a[v];
        r.on("ready", y);
      }
      i && (i.readies = []), r.emit("ready");
    }, o.done);
  });
}, Vy = dg.prototype;
Gt(Vy, {
  instanceString: function() {
    return "core";
  },
  isReady: function() {
    return this._private.ready;
  },
  destroyed: function() {
    return this._private.destroyed;
  },
  ready: function(e) {
    return this.isReady() ? this.emitter().emit("ready", [], e) : this.on("ready", e), this;
  },
  destroy: function() {
    var e = this;
    if (!e.destroyed())
      return e.stopAnimationLoop(), e.destroyRenderer(), this.emit("destroy"), e._private.destroyed = !0, e;
  },
  hasElementWithId: function(e) {
    return this._private.elements.hasElementWithId(e);
  },
  getElementById: function(e) {
    return this._private.elements.getElementById(e);
  },
  hasCompoundNodes: function() {
    return this._private.hasCompoundNodes;
  },
  headless: function() {
    return this._private.renderer.isHeadless();
  },
  styleEnabled: function() {
    return this._private.styleEnabled;
  },
  addToPool: function(e) {
    return this._private.elements.merge(e), this;
  },
  removeFromPool: function(e) {
    return this._private.elements.unmerge(e), this;
  },
  container: function() {
    return this._private.container || null;
  },
  window: function() {
    var e = this._private.container;
    if (e == null) return Dn;
    var r = this._private.container.ownerDocument;
    return r === void 0 || r == null ? Dn : r.defaultView || Dn;
  },
  mount: function(e) {
    if (e != null) {
      var r = this, n = r._private, i = n.options;
      return !Iy(e) && Iy(e[0]) && (e = e[0]), r.stopAnimationLoop(), r.destroyRenderer(), n.container = e, n.styleEnabled = !0, r.invalidateSize(), r.initRenderer(Gt({}, i, i.renderer, {
        // allow custom renderer name to be re-used, otherwise use canvas
        name: i.renderer.name === "null" ? "canvas" : i.renderer.name
      })), r.startAnimationLoop(), r.style(i.style), r.emit("mount"), r;
    }
  },
  unmount: function() {
    var e = this;
    return e.stopAnimationLoop(), e.destroyRenderer(), e.initRenderer({
      name: "null"
    }), e.emit("unmount"), e;
  },
  options: function() {
    return Hs(this._private.options);
  },
  json: function(e) {
    var r = this, n = r._private, i = r.mutableElements(), a = function(T) {
      return r.getElementById(T.id());
    };
    if (vr(e)) {
      if (r.startBatch(), e.elements) {
        var s = {}, o = function(T, E) {
          for (var C = [], k = [], _ = 0; _ < T.length; _++) {
            var L = T[_];
            if (!L.data.id) {
              Nr("cy.json() cannot handle elements without an ID attribute");
              continue;
            }
            var N = "" + L.data.id, A = r.getElementById(N);
            s[N] = !0, A.length !== 0 ? k.push({
              ele: A,
              json: L
            }) : (E && (L.group = E), C.push(L));
          }
          r.add(C);
          for (var O = 0; O < k.length; O++) {
            var P = k[O], S = P.ele, R = P.json;
            S.json(R);
          }
        };
        if (Br(e.elements))
          o(e.elements);
        else
          for (var l = ["nodes", "edges"], u = 0; u < l.length; u++) {
            var h = l[u], d = e.elements[h];
            Br(d) && o(d, h);
          }
        var f = r.collection();
        i.filter(function(w) {
          return !s[w.id()];
        }).forEach(function(w) {
          w.isParent() ? f.merge(w) : w.remove();
        }), f.forEach(function(w) {
          return w.children().move({
            parent: null
          });
        }), f.forEach(function(w) {
          return a(w).remove();
        });
      }
      e.style && r.style(e.style), e.zoom != null && e.zoom !== n.zoom && r.zoom(e.zoom), e.pan && (e.pan.x !== n.pan.x || e.pan.y !== n.pan.y) && r.pan(e.pan), e.data && r.data(e.data);
      for (var p = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"], g = 0; g < p.length; g++) {
        var m = p[g];
        e[m] != null && r[m](e[m]);
      }
      return r.endBatch(), this;
    } else {
      var v = !!e, y = {};
      v ? y.elements = this.elements().map(function(w) {
        return w.json();
      }) : (y.elements = {}, i.forEach(function(w) {
        var T = w.group();
        y.elements[T] || (y.elements[T] = []), y.elements[T].push(w.json());
      })), this._private.styleEnabled && (y.style = r.style().json()), y.data = Hs(r.data());
      var b = n.options;
      return y.zoomingEnabled = n.zoomingEnabled, y.userZoomingEnabled = n.userZoomingEnabled, y.zoom = n.zoom, y.minZoom = n.minZoom, y.maxZoom = n.maxZoom, y.panningEnabled = n.panningEnabled, y.userPanningEnabled = n.userPanningEnabled, y.pan = Hs(n.pan), y.boxSelectionEnabled = n.boxSelectionEnabled, y.renderer = Hs(b.renderer), y.hideEdgesOnViewport = b.hideEdgesOnViewport, y.textureOnViewport = b.textureOnViewport, y.wheelSensitivity = b.wheelSensitivity, y.motionBlur = b.motionBlur, y.multiClickDebounceTime = b.multiClickDebounceTime, y;
    }
  }
});
Vy.$id = Vy.getElementById;
[Dxe, Fxe, lG, gT, ov, zxe, mT, lv, Uxe, yu, hg].forEach(function(t) {
  Gt(Vy, t);
});
var Hxe = {
  fit: !0,
  // whether to fit the viewport to the graph
  directed: !1,
  // whether the tree is directed downwards (or edges can point in any direction if false)
  direction: "downward",
  // determines the direction in which the tree structure is drawn.  The possible values are 'downward', 'upward', 'rightward', or 'leftward'.
  padding: 30,
  // padding on fit
  circle: !1,
  // put depths in concentric circles if true, put depths top down if false
  grid: !1,
  // whether to create an even grid into which the DAG is placed (circle:false only)
  spacingFactor: 1.75,
  // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap)
  boundingBox: void 0,
  // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
  avoidOverlap: !0,
  // prevents node overlap, may overflow boundingBox if not enough space
  nodeDimensionsIncludeLabels: !1,
  // Excludes the label when calculating node bounding boxes for the layout algorithm
  roots: void 0,
  // the roots of the trees
  depthSort: void 0,
  // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
  animate: !1,
  // whether to transition the node positions
  animationDuration: 500,
  // duration of animation in ms if enabled
  animationEasing: void 0,
  // easing of animation if enabled,
  animateFilter: function(e, r) {
    return !0;
  },
  // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
  ready: void 0,
  // callback on layoutready
  stop: void 0,
  // callback on layoutstop
  transform: function(e, r) {
    return r;
  }
  // transform a given node position. Useful for changing flow direction in discrete layouts
}, qxe = {
  maximal: !1,
  // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also
  acyclic: !1
  // whether the tree is acyclic and thus a node could be shifted (due to the maximal option) multiple times without causing an infinite loop; setting to true sets maximal to true also; if you are uncertain whether a tree is acyclic, set to false to avoid potential infinite loops
}, rh = function(e) {
  return e.scratch("breadthfirst");
}, I9 = function(e, r) {
  return e.scratch("breadthfirst", r);
};
function cG(t) {
  this.options = Gt({}, Hxe, qxe, t);
}
cG.prototype.run = function() {
  var t = this.options, e = t.cy, r = t.eles, n = r.nodes().filter(function(Oe) {
    return Oe.isChildless();
  }), i = r, a = t.directed, s = t.acyclic || t.maximal || t.maximalAdjustments > 0, o = !!t.boundingBox, l = Yi(o ? t.boundingBox : structuredClone(e.extent())), u;
  if (La(t.roots))
    u = t.roots;
  else if (Br(t.roots)) {
    for (var h = [], d = 0; d < t.roots.length; d++) {
      var f = t.roots[d], p = e.getElementById(f);
      h.push(p);
    }
    u = e.collection(h);
  } else if (Bt(t.roots))
    u = e.$(t.roots);
  else if (a)
    u = n.roots();
  else {
    var g = r.components();
    u = e.collection();
    for (var m = function() {
      var ue = g[v], Ve = ue.maxDegree(!1), Ge = ue.filter(function(Ue) {
        return Ue.degree(!1) === Ve;
      });
      u = u.add(Ge);
    }, v = 0; v < g.length; v++)
      m();
  }
  var y = [], b = {}, w = function(ue, Ve) {
    y[Ve] == null && (y[Ve] = []);
    var Ge = y[Ve].length;
    y[Ve].push(ue), I9(ue, {
      index: Ge,
      depth: Ve
    });
  }, T = function(ue, Ve) {
    var Ge = rh(ue), Ue = Ge.depth, ke = Ge.index;
    y[Ue][ke] = null, ue.isChildless() && w(ue, Ve);
  };
  i.bfs({
    roots: u,
    directed: t.directed,
    visit: function(ue, Ve, Ge, Ue, ke) {
      var Pe = ue[0], Se = Pe.id();
      Pe.isChildless() && w(Pe, ke), b[Se] = !0;
    }
  });
  for (var E = [], C = 0; C < n.length; C++) {
    var k = n[C];
    b[k.id()] || E.push(k);
  }
  var _ = function(ue) {
    for (var Ve = y[ue], Ge = 0; Ge < Ve.length; Ge++) {
      var Ue = Ve[Ge];
      if (Ue == null) {
        Ve.splice(Ge, 1), Ge--;
        continue;
      }
      I9(Ue, {
        depth: ue,
        index: Ge
      });
    }
  }, L = function(ue, Ve) {
    for (var Ge = rh(ue), Ue = ue.incomers().filter(function(Me) {
      return Me.isNode() && r.has(Me);
    }), ke = -1, Pe = ue.id(), Se = 0; Se < Ue.length; Se++) {
      var _e = Ue[Se], ze = rh(_e);
      ke = Math.max(ke, ze.depth);
    }
    if (Ge.depth <= ke) {
      if (!t.acyclic && Ve[Pe])
        return null;
      var me = ke + 1;
      return T(ue, me), Ve[Pe] = me, !0;
    }
    return !1;
  };
  if (a && s) {
    var N = [], A = {}, O = function(ue) {
      return N.push(ue);
    }, P = function() {
      return N.shift();
    };
    for (n.forEach(function(Oe) {
      return N.push(Oe);
    }); N.length > 0; ) {
      var S = P(), R = L(S, A);
      if (R)
        S.outgoers().filter(function(Oe) {
          return Oe.isNode() && r.has(Oe);
        }).forEach(O);
      else if (R === null) {
        Nr("Detected double maximal shift for node `" + S.id() + "`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");
        break;
      }
    }
  }
  var I = 0;
  if (t.avoidOverlap)
    for (var D = 0; D < n.length; D++) {
      var M = n[D], B = M.layoutDimensions(t), $ = B.w, F = B.h;
      I = Math.max(I, $, F);
    }
  var G = {}, H = function(ue) {
    if (G[ue.id()])
      return G[ue.id()];
    for (var Ve = rh(ue).depth, Ge = ue.neighborhood(), Ue = 0, ke = 0, Pe = 0; Pe < Ge.length; Pe++) {
      var Se = Ge[Pe];
      if (!(Se.isEdge() || Se.isParent() || !n.has(Se))) {
        var _e = rh(Se);
        if (_e != null) {
          var ze = _e.index, me = _e.depth;
          if (!(ze == null || me == null)) {
            var Me = y[me].length;
            me < Ve && (Ue += ze / Me, ke++);
          }
        }
      }
    }
    return ke = Math.max(1, ke), Ue = Ue / ke, ke === 0 && (Ue = 0), G[ue.id()] = Ue, Ue;
  }, ee = function(ue, Ve) {
    var Ge = H(ue), Ue = H(Ve), ke = Ge - Ue;
    return ke === 0 ? uV(ue.id(), Ve.id()) : ke;
  };
  t.depthSort !== void 0 && (ee = t.depthSort);
  for (var Y = y.length, re = 0; re < Y; re++)
    y[re].sort(ee), _(re);
  for (var ne = [], he = 0; he < E.length; he++)
    ne.push(E[he]);
  var K = function() {
    for (var ue = 0; ue < Y; ue++)
      _(ue);
  };
  ne.length && (y.unshift(ne), Y = y.length, K());
  for (var Z = 0, X = 0; X < Y; X++)
    Z = Math.max(y[X].length, Z);
  var q = {
    x: l.x1 + l.w / 2,
    y: l.y1 + l.h / 2
  }, J = n.reduce(function(Oe, ue) {
    return function(Ve) {
      return {
        w: Oe.w === -1 ? Ve.w : (Oe.w + Ve.w) / 2,
        h: Oe.h === -1 ? Ve.h : (Oe.h + Ve.h) / 2
      };
    }(ue.boundingBox({
      includeLabels: t.nodeDimensionsIncludeLabels
    }));
  }, {
    w: -1,
    h: -1
  }), j = Math.max(
    // only one depth
    Y === 1 ? 0 : (
      // inside a bounding box, no need for top & bottom padding
      o ? (l.h - t.padding * 2 - J.h) / (Y - 1) : (l.h - t.padding * 2 - J.h) / (Y + 1)
    ),
    I
  ), pe = y.reduce(function(Oe, ue) {
    return Math.max(Oe, ue.length);
  }, 0), te = function(ue) {
    var Ve = rh(ue), Ge = Ve.depth, Ue = Ve.index;
    if (t.circle) {
      var ke = Math.min(l.w / 2 / Y, l.h / 2 / Y);
      ke = Math.max(ke, I);
      var Pe = ke * Ge + ke - (Y > 0 && y[0].length <= 3 ? ke / 2 : 0), Se = 2 * Math.PI / y[Ge].length * Ue;
      return Ge === 0 && y[0].length === 1 && (Pe = 1), {
        x: q.x + Pe * Math.cos(Se),
        y: q.y + Pe * Math.sin(Se)
      };
    } else {
      var _e = y[Ge].length, ze = Math.max(
        // only one depth
        _e === 1 ? 0 : (
          // inside a bounding box, no need for left & right padding
          o ? (l.w - t.padding * 2 - J.w) / ((t.grid ? pe : _e) - 1) : (l.w - t.padding * 2 - J.w) / ((t.grid ? pe : _e) + 1)
        ),
        I
      ), me = {
        x: q.x + (Ue + 1 - (_e + 1) / 2) * ze,
        y: q.y + (Ge + 1 - (Y + 1) / 2) * j
      };
      return me;
    }
  }, Ae = {
    downward: 0,
    leftward: 90,
    upward: 180,
    rightward: -90
  };
  Object.keys(Ae).indexOf(t.direction) === -1 && Kr("Invalid direction '".concat(t.direction, "' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Ae).join(", ")));
  var W = function(ue) {
    return lve(te(ue), l, Ae[t.direction]);
  };
  return r.nodes().layoutPositions(this, t, W), this;
};
var Yxe = {
  fit: !0,
  // whether to fit the viewport to the graph
  padding: 30,
  // the padding on fit
  boundingBox: void 0,
  // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
  avoidOverlap: !0,
  // prevents node overlap, may overflow boundingBox and radius if not enough space
  nodeDimensionsIncludeLabels: !1,
  // Excludes the label when calculating node bounding boxes for the layout algorithm
  spacingFactor: void 0,
  // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
  radius: void 0,
  // the radius of the circle
  startAngle: 3 / 2 * Math.PI,
  // where nodes start in radians
  sweep: void 0,
  // how many radians should be between the first and last node (defaults to full circle)
  clockwise: !0,
  // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
  sort: void 0,
  // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
  animate: !1,
  // whether to transition the node positions
  animationDuration: 500,
  // duration of animation in ms if enabled
  animationEasing: void 0,
  // easing of animation if enabled
  animateFilter: function(e, r) {
    return !0;
  },
  // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
  ready: void 0,
  // callback on layoutready
  stop: void 0,
  // callback on layoutstop
  transform: function(e, r) {
    return r;
  }
  // transform a given node position. Useful for changing flow direction in discrete layouts 
};
function uG(t) {
  this.options = Gt({}, Yxe, t);
}
uG.prototype.run = function() {
  var t = this.options, e = t, r = t.cy, n = e.eles, i = e.counterclockwise !== void 0 ? !e.counterclockwise : e.clockwise, a = n.nodes().not(":parent");
  e.sort && (a = a.sort(e.sort));
  for (var s = Yi(e.boundingBox ? e.boundingBox : {
    x1: 0,
    y1: 0,
    w: r.width(),
    h: r.height()
  }), o = {
    x: s.x1 + s.w / 2,
    y: s.y1 + s.h / 2
  }, l = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / a.length : e.sweep, u = l / Math.max(1, a.length - 1), h, d = 0, f = 0; f < a.length; f++) {
    var p = a[f], g = p.layoutDimensions(e), m = g.w, v = g.h;
    d = Math.max(d, m, v);
  }
  if (vt(e.radius) ? h = e.radius : a.length <= 1 ? h = 0 : h = Math.min(s.h, s.w) / 2 - d, a.length > 1 && e.avoidOverlap) {
    d *= 1.75;
    var y = Math.cos(u) - Math.cos(0), b = Math.sin(u) - Math.sin(0), w = Math.sqrt(d * d / (y * y + b * b));
    h = Math.max(w, h);
  }
  var T = function(C, k) {
    var _ = e.startAngle + k * u * (i ? 1 : -1), L = h * Math.cos(_), N = h * Math.sin(_), A = {
      x: o.x + L,
      y: o.y + N
    };
    return A;
  };
  return n.nodes().layoutPositions(this, e, T), this;
};
var Xxe = {
  fit: !0,
  // whether to fit the viewport to the graph
  padding: 30,
  // the padding on fit
  startAngle: 3 / 2 * Math.PI,
  // where nodes start in radians
  sweep: void 0,
  // how many radians should be between the first and last node (defaults to full circle)
  clockwise: !0,
  // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
  equidistant: !1,
  // whether levels have an equal radial distance betwen them, may cause bounding box overflow
  minNodeSpacing: 10,
  // min spacing between outside of nodes (used for radius adjustment)
  boundingBox: void 0,
  // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
  avoidOverlap: !0,
  // prevents node overlap, may overflow boundingBox if not enough space
  nodeDimensionsIncludeLabels: !1,
  // Excludes the label when calculating node bounding boxes for the layout algorithm
  height: void 0,
  // height of layout area (overrides container height)
  width: void 0,
  // width of layout area (overrides container width)
  spacingFactor: void 0,
  // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
  concentric: function(e) {
    return e.degree();
  },
  levelWidth: function(e) {
    return e.maxDegree() / 4;
  },
  animate: !1,
  // whether to transition the node positions
  animationDuration: 500,
  // duration of animation in ms if enabled
  animationEasing: void 0,
  // easing of animation if enabled
  animateFilter: function(e, r) {
    return !0;
  },
  // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
  ready: void 0,
  // callback on layoutready
  stop: void 0,
  // callback on layoutstop
  transform: function(e, r) {
    return r;
  }
  // transform a given node position. Useful for changing flow direction in discrete layouts
};
function hG(t) {
  this.options = Gt({}, Xxe, t);
}
hG.prototype.run = function() {
  for (var t = this.options, e = t, r = e.counterclockwise !== void 0 ? !e.counterclockwise : e.clockwise, n = t.cy, i = e.eles, a = i.nodes().not(":parent"), s = Yi(e.boundingBox ? e.boundingBox : {
    x1: 0,
    y1: 0,
    w: n.width(),
    h: n.height()
  }), o = {
    x: s.x1 + s.w / 2,
    y: s.y1 + s.h / 2
  }, l = [], u = 0, h = 0; h < a.length; h++) {
    var d = a[h], f = void 0;
    f = e.concentric(d), l.push({
      value: f,
      node: d
    }), d._private.scratch.concentric = f;
  }
  a.updateStyle();
  for (var p = 0; p < a.length; p++) {
    var g = a[p], m = g.layoutDimensions(e);
    u = Math.max(u, m.w, m.h);
  }
  l.sort(function(j, pe) {
    return pe.value - j.value;
  });
  for (var v = e.levelWidth(a), y = [[]], b = y[0], w = 0; w < l.length; w++) {
    var T = l[w];
    if (b.length > 0) {
      var E = Math.abs(b[0].value - T.value);
      E >= v && (b = [], y.push(b));
    }
    b.push(T);
  }
  var C = u + e.minNodeSpacing;
  if (!e.avoidOverlap) {
    var k = y.length > 0 && y[0].length > 1, _ = Math.min(s.w, s.h) / 2 - C, L = _ / (y.length + k ? 1 : 0);
    C = Math.min(C, L);
  }
  for (var N = 0, A = 0; A < y.length; A++) {
    var O = y[A], P = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / O.length : e.sweep, S = O.dTheta = P / Math.max(1, O.length - 1);
    if (O.length > 1 && e.avoidOverlap) {
      var R = Math.cos(S) - Math.cos(0), I = Math.sin(S) - Math.sin(0), D = Math.sqrt(C * C / (R * R + I * I));
      N = Math.max(D, N);
    }
    O.r = N, N += C;
  }
  if (e.equidistant) {
    for (var M = 0, B = 0, $ = 0; $ < y.length; $++) {
      var F = y[$], G = F.r - B;
      M = Math.max(M, G);
    }
    B = 0;
    for (var H = 0; H < y.length; H++) {
      var ee = y[H];
      H === 0 && (B = ee.r), ee.r = B, B += M;
    }
  }
  for (var Y = {}, re = 0; re < y.length; re++)
    for (var ne = y[re], he = ne.dTheta, K = ne.r, Z = 0; Z < ne.length; Z++) {
      var X = ne[Z], q = e.startAngle + (r ? 1 : -1) * he * Z, J = {
        x: o.x + K * Math.cos(q),
        y: o.y + K * Math.sin(q)
      };
      Y[X.node.id()] = J;
    }
  return i.nodes().layoutPositions(this, e, function(j) {
    var pe = j.id();
    return Y[pe];
  }), this;
};
var Y3, jxe = {
  // Called on `layoutready`
  ready: function() {
  },
  // Called on `layoutstop`
  stop: function() {
  },
  // Whether to animate while running the layout
  // true : Animate continuously as the layout is running
  // false : Just show the end result
  // 'end' : Animate with the end result, from the initial positions to the end positions
  animate: !0,
  // Easing of the animation for animate:'end'
  animationEasing: void 0,
  // The duration of the animation for animate:'end'
  animationDuration: void 0,
  // A function that determines whether the node should be animated
  // All nodes animated by default on animate enabled
  // Non-animated nodes are positioned immediately when the layout starts
  animateFilter: function(e, r) {
    return !0;
  },
  // The layout animates only after this many milliseconds for animate:true
  // (prevents flashing on fast runs)
  animationThreshold: 250,
  // Number of iterations between consecutive screen positions update
  refresh: 20,
  // Whether to fit the network view after when done
  fit: !0,
  // Padding on fit
  padding: 30,
  // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
  boundingBox: void 0,
  // Excludes the label when calculating node bounding boxes for the layout algorithm
  nodeDimensionsIncludeLabels: !1,
  // Randomize the initial positions of the nodes (true) or use existing positions (false)
  randomize: !1,
  // Extra spacing between components in non-compound graphs
  componentSpacing: 40,
  // Node repulsion (non overlapping) multiplier
  nodeRepulsion: function(e) {
    return 2048;
  },
  // Node repulsion (overlapping) multiplier
  nodeOverlap: 4,
  // Ideal edge (non nested) length
  idealEdgeLength: function(e) {
    return 32;
  },
  // Divisor to compute edge forces
  edgeElasticity: function(e) {
    return 32;
  },
  // Nesting factor (multiplier) to compute ideal edge length for nested edges
  nestingFactor: 1.2,
  // Gravity force (constant)
  gravity: 1,
  // Maximum number of iterations to perform
  numIter: 1e3,
  // Initial temperature (maximum node displacement)
  initialTemp: 1e3,
  // Cooling factor (how the temperature is reduced between consecutive iterations
  coolingFactor: 0.99,
  // Lower temperature threshold (below this point the layout will end)
  minTemp: 1
};
function Wx(t) {
  this.options = Gt({}, jxe, t), this.options.layout = this;
  var e = this.options.eles.nodes(), r = this.options.eles.edges(), n = r.filter(function(i) {
    var a = i.source().data("id"), s = i.target().data("id"), o = e.some(function(u) {
      return u.data("id") === a;
    }), l = e.some(function(u) {
      return u.data("id") === s;
    });
    return !o || !l;
  });
  this.options.eles = this.options.eles.not(n);
}
Wx.prototype.run = function() {
  var t = this.options, e = t.cy, r = this;
  r.stopped = !1, (t.animate === !0 || t.animate === !1) && r.emit({
    type: "layoutstart",
    layout: r
  }), t.debug === !0 ? Y3 = !0 : Y3 = !1;
  var n = Kxe(e, r, t);
  Y3 && Qxe(n), t.randomize && Jxe(n);
  var i = Qo(), a = function() {
    ebe(n, e, t), t.fit === !0 && e.fit(t.padding);
  }, s = function(f) {
    return !(r.stopped || f >= t.numIter || (tbe(n, t), n.temperature = n.temperature * t.coolingFactor, n.temperature < t.minTemp));
  }, o = function() {
    if (t.animate === !0 || t.animate === !1)
      a(), r.one("layoutstop", t.stop), r.emit({
        type: "layoutstop",
        layout: r
      });
    else {
      var f = t.eles.nodes(), p = fG(n, t, f);
      f.layoutPositions(r, t, p);
    }
  }, l = 0, u = !0;
  if (t.animate === !0) {
    var h = function() {
      for (var f = 0; u && f < t.refresh; )
        u = s(l), l++, f++;
      if (!u)
        P9(n, t), o();
      else {
        var p = Qo();
        p - i >= t.animationThreshold && a(), Oy(h);
      }
    };
    h();
  } else {
    for (; u; )
      u = s(l), l++;
    P9(n, t), o();
  }
  return this;
};
Wx.prototype.stop = function() {
  return this.stopped = !0, this.thread && this.thread.stop(), this.emit("layoutstop"), this;
};
Wx.prototype.destroy = function() {
  return this.thread && this.thread.stop(), this;
};
var Kxe = function(e, r, n) {
  for (var i = n.eles.edges(), a = n.eles.nodes(), s = Yi(n.boundingBox ? n.boundingBox : {
    x1: 0,
    y1: 0,
    w: e.width(),
    h: e.height()
  }), o = {
    isCompound: e.hasCompoundNodes(),
    layoutNodes: [],
    idToIndex: {},
    nodeSize: a.size(),
    graphSet: [],
    indexToGraph: [],
    layoutEdges: [],
    edgeSize: i.size(),
    temperature: n.initialTemp,
    clientWidth: s.w,
    clientHeight: s.h,
    boundingBox: s
  }, l = n.eles.components(), u = {}, h = 0; h < l.length; h++)
    for (var d = l[h], f = 0; f < d.length; f++) {
      var p = d[f];
      u[p.id()] = h;
    }
  for (var h = 0; h < o.nodeSize; h++) {
    var g = a[h], m = g.layoutDimensions(n), v = {};
    v.isLocked = g.locked(), v.id = g.data("id"), v.parentId = g.data("parent"), v.cmptId = u[g.id()], v.children = [], v.positionX = g.position("x"), v.positionY = g.position("y"), v.offsetX = 0, v.offsetY = 0, v.height = m.w, v.width = m.h, v.maxX = v.positionX + v.width / 2, v.minX = v.positionX - v.width / 2, v.maxY = v.positionY + v.height / 2, v.minY = v.positionY - v.height / 2, v.padLeft = parseFloat(g.style("padding")), v.padRight = parseFloat(g.style("padding")), v.padTop = parseFloat(g.style("padding")), v.padBottom = parseFloat(g.style("padding")), v.nodeRepulsion = nn(n.nodeRepulsion) ? n.nodeRepulsion(g) : n.nodeRepulsion, o.layoutNodes.push(v), o.idToIndex[v.id] = h;
  }
  for (var y = [], b = 0, w = -1, T = [], h = 0; h < o.nodeSize; h++) {
    var g = o.layoutNodes[h], E = g.parentId;
    E != null ? o.layoutNodes[o.idToIndex[E]].children.push(g.id) : (y[++w] = g.id, T.push(g.id));
  }
  for (o.graphSet.push(T); b <= w; ) {
    var C = y[b++], k = o.idToIndex[C], p = o.layoutNodes[k], _ = p.children;
    if (_.length > 0) {
      o.graphSet.push(_);
      for (var h = 0; h < _.length; h++)
        y[++w] = _[h];
    }
  }
  for (var h = 0; h < o.graphSet.length; h++)
    for (var L = o.graphSet[h], f = 0; f < L.length; f++) {
      var N = o.idToIndex[L[f]];
      o.indexToGraph[N] = h;
    }
  for (var h = 0; h < o.edgeSize; h++) {
    var A = i[h], O = {};
    O.id = A.data("id"), O.sourceId = A.data("source"), O.targetId = A.data("target");
    var P = nn(n.idealEdgeLength) ? n.idealEdgeLength(A) : n.idealEdgeLength, S = nn(n.edgeElasticity) ? n.edgeElasticity(A) : n.edgeElasticity, R = o.idToIndex[O.sourceId], I = o.idToIndex[O.targetId], D = o.indexToGraph[R], M = o.indexToGraph[I];
    if (D != M) {
      for (var B = Zxe(O.sourceId, O.targetId, o), $ = o.graphSet[B], F = 0, v = o.layoutNodes[R]; $.indexOf(v.id) === -1; )
        v = o.layoutNodes[o.idToIndex[v.parentId]], F++;
      for (v = o.layoutNodes[I]; $.indexOf(v.id) === -1; )
        v = o.layoutNodes[o.idToIndex[v.parentId]], F++;
      P *= F * n.nestingFactor;
    }
    O.idealLength = P, O.elasticity = S, o.layoutEdges.push(O);
  }
  return o;
}, Zxe = function(e, r, n) {
  var i = dG(e, r, 0, n);
  return 2 > i.count ? 0 : i.graph;
}, dG = function(e, r, n, i) {
  var a = i.graphSet[n];
  if (-1 < a.indexOf(e) && -1 < a.indexOf(r))
    return {
      count: 2,
      graph: n
    };
  for (var s = 0, o = 0; o < a.length; o++) {
    var l = a[o], u = i.idToIndex[l], h = i.layoutNodes[u].children;
    if (h.length !== 0) {
      var d = i.indexToGraph[i.idToIndex[h[0]]], f = dG(e, r, d, i);
      if (f.count !== 0)
        if (f.count === 1) {
          if (s++, s === 2)
            break;
        } else
          return f;
    }
  }
  return {
    count: s,
    graph: n
  };
}, Qxe, Jxe = function(e, r) {
  for (var n = e.clientWidth, i = e.clientHeight, a = 0; a < e.nodeSize; a++) {
    var s = e.layoutNodes[a];
    s.children.length === 0 && !s.isLocked && (s.positionX = Math.random() * n, s.positionY = Math.random() * i);
  }
}, fG = function(e, r, n) {
  var i = e.boundingBox, a = {
    x1: 1 / 0,
    x2: -1 / 0,
    y1: 1 / 0,
    y2: -1 / 0
  };
  return r.boundingBox && (n.forEach(function(s) {
    var o = e.layoutNodes[e.idToIndex[s.data("id")]];
    a.x1 = Math.min(a.x1, o.positionX), a.x2 = Math.max(a.x2, o.positionX), a.y1 = Math.min(a.y1, o.positionY), a.y2 = Math.max(a.y2, o.positionY);
  }), a.w = a.x2 - a.x1, a.h = a.y2 - a.y1), function(s, o) {
    var l = e.layoutNodes[e.idToIndex[s.data("id")]];
    if (r.boundingBox) {
      var u = a.w === 0 ? 0.5 : (l.positionX - a.x1) / a.w, h = a.h === 0 ? 0.5 : (l.positionY - a.y1) / a.h;
      return {
        x: i.x1 + u * i.w,
        y: i.y1 + h * i.h
      };
    } else
      return {
        x: l.positionX,
        y: l.positionY
      };
  };
}, ebe = function(e, r, n) {
  var i = n.layout, a = n.eles.nodes(), s = fG(e, n, a);
  a.positions(s), e.ready !== !0 && (e.ready = !0, i.one("layoutready", n.ready), i.emit({
    type: "layoutready",
    layout: this
  }));
}, tbe = function(e, r, n) {
  rbe(e, r), abe(e), sbe(e, r), obe(e), lbe(e);
}, rbe = function(e, r) {
  for (var n = 0; n < e.graphSet.length; n++)
    for (var i = e.graphSet[n], a = i.length, s = 0; s < a; s++)
      for (var o = e.layoutNodes[e.idToIndex[i[s]]], l = s + 1; l < a; l++) {
        var u = e.layoutNodes[e.idToIndex[i[l]]];
        nbe(o, u, e, r);
      }
}, O9 = function(e) {
  return -1 + 2 * e * Math.random();
}, nbe = function(e, r, n, i) {
  var a = e.cmptId, s = r.cmptId;
  if (!(a !== s && !n.isCompound)) {
    var o = r.positionX - e.positionX, l = r.positionY - e.positionY, u = 1;
    o === 0 && l === 0 && (o = O9(u), l = O9(u));
    var h = ibe(e, r, o, l);
    if (h > 0)
      var d = i.nodeOverlap * h, f = Math.sqrt(o * o + l * l), p = d * o / f, g = d * l / f;
    else
      var m = Gy(e, o, l), v = Gy(r, -1 * o, -1 * l), y = v.x - m.x, b = v.y - m.y, w = y * y + b * b, f = Math.sqrt(w), d = (e.nodeRepulsion + r.nodeRepulsion) / w, p = d * y / f, g = d * b / f;
    e.isLocked || (e.offsetX -= p, e.offsetY -= g), r.isLocked || (r.offsetX += p, r.offsetY += g);
  }
}, ibe = function(e, r, n, i) {
  if (n > 0)
    var a = e.maxX - r.minX;
  else
    var a = r.maxX - e.minX;
  if (i > 0)
    var s = e.maxY - r.minY;
  else
    var s = r.maxY - e.minY;
  return a >= 0 && s >= 0 ? Math.sqrt(a * a + s * s) : 0;
}, Gy = function(e, r, n) {
  var i = e.positionX, a = e.positionY, s = e.height || 1, o = e.width || 1, l = n / r, u = s / o, h = {};
  return r === 0 && 0 < n || r === 0 && 0 > n ? (h.x = i, h.y = a + s / 2, h) : 0 < r && -1 * u <= l && l <= u ? (h.x = i + o / 2, h.y = a + o * n / 2 / r, h) : 0 > r && -1 * u <= l && l <= u ? (h.x = i - o / 2, h.y = a - o * n / 2 / r, h) : 0 < n && (l <= -1 * u || l >= u) ? (h.x = i + s * r / 2 / n, h.y = a + s / 2, h) : (0 > n && (l <= -1 * u || l >= u) && (h.x = i - s * r / 2 / n, h.y = a - s / 2), h);
}, abe = function(e, r) {
  for (var n = 0; n < e.edgeSize; n++) {
    var i = e.layoutEdges[n], a = e.idToIndex[i.sourceId], s = e.layoutNodes[a], o = e.idToIndex[i.targetId], l = e.layoutNodes[o], u = l.positionX - s.positionX, h = l.positionY - s.positionY;
    if (!(u === 0 && h === 0)) {
      var d = Gy(s, u, h), f = Gy(l, -1 * u, -1 * h), p = f.x - d.x, g = f.y - d.y, m = Math.sqrt(p * p + g * g), v = Math.pow(i.idealLength - m, 2) / i.elasticity;
      if (m !== 0)
        var y = v * p / m, b = v * g / m;
      else
        var y = 0, b = 0;
      s.isLocked || (s.offsetX += y, s.offsetY += b), l.isLocked || (l.offsetX -= y, l.offsetY -= b);
    }
  }
}, sbe = function(e, r) {
  if (r.gravity !== 0)
    for (var n = 1, i = 0; i < e.graphSet.length; i++) {
      var a = e.graphSet[i], s = a.length;
      if (i === 0)
        var o = e.clientHeight / 2, l = e.clientWidth / 2;
      else
        var u = e.layoutNodes[e.idToIndex[a[0]]], h = e.layoutNodes[e.idToIndex[u.parentId]], o = h.positionX, l = h.positionY;
      for (var d = 0; d < s; d++) {
        var f = e.layoutNodes[e.idToIndex[a[d]]];
        if (!f.isLocked) {
          var p = o - f.positionX, g = l - f.positionY, m = Math.sqrt(p * p + g * g);
          if (m > n) {
            var v = r.gravity * p / m, y = r.gravity * g / m;
            f.offsetX += v, f.offsetY += y;
          }
        }
      }
    }
}, obe = function(e, r) {
  var n = [], i = 0, a = -1;
  for (n.push.apply(n, e.graphSet[0]), a += e.graphSet[0].length; i <= a; ) {
    var s = n[i++], o = e.idToIndex[s], l = e.layoutNodes[o], u = l.children;
    if (0 < u.length && !l.isLocked) {
      for (var h = l.offsetX, d = l.offsetY, f = 0; f < u.length; f++) {
        var p = e.layoutNodes[e.idToIndex[u[f]]];
        p.offsetX += h, p.offsetY += d, n[++a] = u[f];
      }
      l.offsetX = 0, l.offsetY = 0;
    }
  }
}, lbe = function(e, r) {
  for (var n = 0; n < e.nodeSize; n++) {
    var i = e.layoutNodes[n];
    0 < i.children.length && (i.maxX = void 0, i.minX = void 0, i.maxY = void 0, i.minY = void 0);
  }
  for (var n = 0; n < e.nodeSize; n++) {
    var i = e.layoutNodes[n];
    if (!(0 < i.children.length || i.isLocked)) {
      var a = cbe(i.offsetX, i.offsetY, e.temperature);
      i.positionX += a.x, i.positionY += a.y, i.offsetX = 0, i.offsetY = 0, i.minX = i.positionX - i.width, i.maxX = i.positionX + i.width, i.minY = i.positionY - i.height, i.maxY = i.positionY + i.height, pG(i, e);
    }
  }
  for (var n = 0; n < e.nodeSize; n++) {
    var i = e.layoutNodes[n];
    0 < i.children.length && !i.isLocked && (i.positionX = (i.maxX + i.minX) / 2, i.positionY = (i.maxY + i.minY) / 2, i.width = i.maxX - i.minX, i.height = i.maxY - i.minY);
  }
}, cbe = function(e, r, n) {
  var i = Math.sqrt(e * e + r * r);
  if (i > n)
    var a = {
      x: n * e / i,
      y: n * r / i
    };
  else
    var a = {
      x: e,
      y: r
    };
  return a;
}, pG = function(e, r) {
  var n = e.parentId;
  if (n != null) {
    var i = r.layoutNodes[r.idToIndex[n]], a = !1;
    if ((i.maxX == null || e.maxX + i.padRight > i.maxX) && (i.maxX = e.maxX + i.padRight, a = !0), (i.minX == null || e.minX - i.padLeft < i.minX) && (i.minX = e.minX - i.padLeft, a = !0), (i.maxY == null || e.maxY + i.padBottom > i.maxY) && (i.maxY = e.maxY + i.padBottom, a = !0), (i.minY == null || e.minY - i.padTop < i.minY) && (i.minY = e.minY - i.padTop, a = !0), a)
      return pG(i, r);
  }
}, P9 = function(e, r) {
  for (var n = e.layoutNodes, i = [], a = 0; a < n.length; a++) {
    var s = n[a], o = s.cmptId, l = i[o] = i[o] || [];
    l.push(s);
  }
  for (var u = 0, a = 0; a < i.length; a++) {
    var h = i[a];
    if (h) {
      h.x1 = 1 / 0, h.x2 = -1 / 0, h.y1 = 1 / 0, h.y2 = -1 / 0;
      for (var d = 0; d < h.length; d++) {
        var f = h[d];
        h.x1 = Math.min(h.x1, f.positionX - f.width / 2), h.x2 = Math.max(h.x2, f.positionX + f.width / 2), h.y1 = Math.min(h.y1, f.positionY - f.height / 2), h.y2 = Math.max(h.y2, f.positionY + f.height / 2);
      }
      h.w = h.x2 - h.x1, h.h = h.y2 - h.y1, u += h.w * h.h;
    }
  }
  i.sort(function(b, w) {
    return w.w * w.h - b.w * b.h;
  });
  for (var p = 0, g = 0, m = 0, v = 0, y = Math.sqrt(u) * e.clientWidth / e.clientHeight, a = 0; a < i.length; a++) {
    var h = i[a];
    if (h) {
      for (var d = 0; d < h.length; d++) {
        var f = h[d];
        f.isLocked || (f.positionX += p - h.x1, f.positionY += g - h.y1);
      }
      p += h.w + r.componentSpacing, m += h.w + r.componentSpacing, v = Math.max(v, h.h), m > y && (g += v + r.componentSpacing, p = 0, m = 0, v = 0);
    }
  }
}, ube = {
  fit: !0,
  // whether to fit the viewport to the graph
  padding: 30,
  // padding used on fit
  boundingBox: void 0,
  // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
  avoidOverlap: !0,
  // prevents node overlap, may overflow boundingBox if not enough space
  avoidOverlapPadding: 10,
  // extra spacing around nodes when avoidOverlap: true
  nodeDimensionsIncludeLabels: !1,
  // Excludes the label when calculating node bounding boxes for the layout algorithm
  spacingFactor: void 0,
  // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
  condense: !1,
  // uses all available space on false, uses minimal space on true
  rows: void 0,
  // force num of rows in the grid
  cols: void 0,
  // force num of columns in the grid
  position: function(e) {
  },
  // returns { row, col } for element
  sort: void 0,
  // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
  animate: !1,
  // whether to transition the node positions
  animationDuration: 500,
  // duration of animation in ms if enabled
  animationEasing: void 0,
  // easing of animation if enabled
  animateFilter: function(e, r) {
    return !0;
  },
  // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
  ready: void 0,
  // callback on layoutready
  stop: void 0,
  // callback on layoutstop
  transform: function(e, r) {
    return r;
  }
  // transform a given node position. Useful for changing flow direction in discrete layouts 
};
function gG(t) {
  this.options = Gt({}, ube, t);
}
gG.prototype.run = function() {
  var t = this.options, e = t, r = t.cy, n = e.eles, i = n.nodes().not(":parent");
  e.sort && (i = i.sort(e.sort));
  var a = Yi(e.boundingBox ? e.boundingBox : {
    x1: 0,
    y1: 0,
    w: r.width(),
    h: r.height()
  });
  if (a.h === 0 || a.w === 0)
    n.nodes().layoutPositions(this, e, function(H) {
      return {
        x: a.x1,
        y: a.y1
      };
    });
  else {
    var s = i.size(), o = Math.sqrt(s * a.h / a.w), l = Math.round(o), u = Math.round(a.w / a.h * o), h = function(ee) {
      if (ee == null)
        return Math.min(l, u);
      var Y = Math.min(l, u);
      Y == l ? l = ee : u = ee;
    }, d = function(ee) {
      if (ee == null)
        return Math.max(l, u);
      var Y = Math.max(l, u);
      Y == l ? l = ee : u = ee;
    }, f = e.rows, p = e.cols != null ? e.cols : e.columns;
    if (f != null && p != null)
      l = f, u = p;
    else if (f != null && p == null)
      l = f, u = Math.ceil(s / l);
    else if (f == null && p != null)
      u = p, l = Math.ceil(s / u);
    else if (u * l > s) {
      var g = h(), m = d();
      (g - 1) * m >= s ? h(g - 1) : (m - 1) * g >= s && d(m - 1);
    } else
      for (; u * l < s; ) {
        var v = h(), y = d();
        (y + 1) * v >= s ? d(y + 1) : h(v + 1);
      }
    var b = a.w / u, w = a.h / l;
    if (e.condense && (b = 0, w = 0), e.avoidOverlap)
      for (var T = 0; T < i.length; T++) {
        var E = i[T], C = E._private.position;
        (C.x == null || C.y == null) && (C.x = 0, C.y = 0);
        var k = E.layoutDimensions(e), _ = e.avoidOverlapPadding, L = k.w + _, N = k.h + _;
        b = Math.max(b, L), w = Math.max(w, N);
      }
    for (var A = {}, O = function(ee, Y) {
      return !!A["c-" + ee + "-" + Y];
    }, P = function(ee, Y) {
      A["c-" + ee + "-" + Y] = !0;
    }, S = 0, R = 0, I = function() {
      R++, R >= u && (R = 0, S++);
    }, D = {}, M = 0; M < i.length; M++) {
      var B = i[M], $ = e.position(B);
      if ($ && ($.row !== void 0 || $.col !== void 0)) {
        var F = {
          row: $.row,
          col: $.col
        };
        if (F.col === void 0)
          for (F.col = 0; O(F.row, F.col); )
            F.col++;
        else if (F.row === void 0)
          for (F.row = 0; O(F.row, F.col); )
            F.row++;
        D[B.id()] = F, P(F.row, F.col);
      }
    }
    var G = function(ee, Y) {
      var re, ne;
      if (ee.locked() || ee.isParent())
        return !1;
      var he = D[ee.id()];
      if (he)
        re = he.col * b + b / 2 + a.x1, ne = he.row * w + w / 2 + a.y1;
      else {
        for (; O(S, R); )
          I();
        re = R * b + b / 2 + a.x1, ne = S * w + w / 2 + a.y1, P(S, R), I();
      }
      return {
        x: re,
        y: ne
      };
    };
    i.layoutPositions(this, e, G);
  }
  return this;
};
var hbe = {
  ready: function() {
  },
  // on layoutready
  stop: function() {
  }
  // on layoutstop
};
function oS(t) {
  this.options = Gt({}, hbe, t);
}
oS.prototype.run = function() {
  var t = this.options, e = t.eles, r = this;
  return t.cy, r.emit("layoutstart"), e.nodes().positions(function() {
    return {
      x: 0,
      y: 0
    };
  }), r.one("layoutready", t.ready), r.emit("layoutready"), r.one("layoutstop", t.stop), r.emit("layoutstop"), this;
};
oS.prototype.stop = function() {
  return this;
};
var dbe = {
  positions: void 0,
  // map of (node id) => (position obj); or function(node){ return somPos; }
  zoom: void 0,
  // the zoom level to set (prob want fit = false if set)
  pan: void 0,
  // the pan level to set (prob want fit = false if set)
  fit: !0,
  // whether to fit to viewport
  padding: 30,
  // padding on fit
  spacingFactor: void 0,
  // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
  animate: !1,
  // whether to transition the node positions
  animationDuration: 500,
  // duration of animation in ms if enabled
  animationEasing: void 0,
  // easing of animation if enabled
  animateFilter: function(e, r) {
    return !0;
  },
  // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
  ready: void 0,
  // callback on layoutready
  stop: void 0,
  // callback on layoutstop
  transform: function(e, r) {
    return r;
  }
  // transform a given node position. Useful for changing flow direction in discrete layouts
};
function mG(t) {
  this.options = Gt({}, dbe, t);
}
mG.prototype.run = function() {
  var t = this.options, e = t.eles, r = e.nodes(), n = nn(t.positions);
  function i(a) {
    if (t.positions == null)
      return Ive(a.position());
    if (n)
      return t.positions(a);
    var s = t.positions[a._private.data.id];
    return s ?? null;
  }
  return r.layoutPositions(this, t, function(a, s) {
    var o = i(a);
    return a.locked() || o == null ? !1 : o;
  }), this;
};
var fbe = {
  fit: !0,
  // whether to fit to viewport
  padding: 30,
  // fit padding
  boundingBox: void 0,
  // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
  animate: !1,
  // whether to transition the node positions
  animationDuration: 500,
  // duration of animation in ms if enabled
  animationEasing: void 0,
  // easing of animation if enabled
  animateFilter: function(e, r) {
    return !0;
  },
  // a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts
  ready: void 0,
  // callback on layoutready
  stop: void 0,
  // callback on layoutstop
  transform: function(e, r) {
    return r;
  }
  // transform a given node position. Useful for changing flow direction in discrete layouts 
};
function vG(t) {
  this.options = Gt({}, fbe, t);
}
vG.prototype.run = function() {
  var t = this.options, e = t.cy, r = t.eles, n = Yi(t.boundingBox ? t.boundingBox : {
    x1: 0,
    y1: 0,
    w: e.width(),
    h: e.height()
  }), i = function(s, o) {
    return {
      x: n.x1 + Math.round(Math.random() * n.w),
      y: n.y1 + Math.round(Math.random() * n.h)
    };
  };
  return r.nodes().layoutPositions(this, t, i), this;
};
var pbe = [{
  name: "breadthfirst",
  impl: cG
}, {
  name: "circle",
  impl: uG
}, {
  name: "concentric",
  impl: hG
}, {
  name: "cose",
  impl: Wx
}, {
  name: "grid",
  impl: gG
}, {
  name: "null",
  impl: oS
}, {
  name: "preset",
  impl: mG
}, {
  name: "random",
  impl: vG
}];
function yG(t) {
  this.options = t, this.notifications = 0;
}
var B9 = function() {
}, F9 = function() {
  throw new Error("A headless instance can not render images");
};
yG.prototype = {
  recalculateRenderedStyle: B9,
  notify: function() {
    this.notifications++;
  },
  init: B9,
  isHeadless: function() {
    return !0;
  },
  png: F9,
  jpg: F9
};
var lS = {};
lS.arrowShapeWidth = 0.3;
lS.registerArrowShapes = function() {
  var t = this.arrowShapes = {}, e = this, r = function(u, h, d, f, p, g, m) {
    var v = p.x - d / 2 - m, y = p.x + d / 2 + m, b = p.y - d / 2 - m, w = p.y + d / 2 + m, T = v <= u && u <= y && b <= h && h <= w;
    return T;
  }, n = function(u, h, d, f, p) {
    var g = u * Math.cos(f) - h * Math.sin(f), m = u * Math.sin(f) + h * Math.cos(f), v = g * d, y = m * d, b = v + p.x, w = y + p.y;
    return {
      x: b,
      y: w
    };
  }, i = function(u, h, d, f) {
    for (var p = [], g = 0; g < u.length; g += 2) {
      var m = u[g], v = u[g + 1];
      p.push(n(m, v, h, d, f));
    }
    return p;
  }, a = function(u) {
    for (var h = [], d = 0; d < u.length; d++) {
      var f = u[d];
      h.push(f.x, f.y);
    }
    return h;
  }, s = function(u) {
    return u.pstyle("width").pfValue * u.pstyle("arrow-scale").pfValue * 2;
  }, o = function(u, h) {
    Bt(h) && (h = t[h]), t[u] = Gt({
      name: u,
      points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3],
      collide: function(f, p, g, m, v, y) {
        var b = a(i(this.points, g + 2 * y, m, v)), w = sa(f, p, b);
        return w;
      },
      roughCollide: r,
      draw: function(f, p, g, m) {
        var v = i(this.points, p, g, m);
        e.arrowShapeImpl("polygon")(f, v);
      },
      spacing: function(f) {
        return 0;
      },
      gap: s
    }, h);
  };
  o("none", {
    collide: Py,
    roughCollide: Py,
    draw: Yk,
    spacing: QA,
    gap: QA
  }), o("triangle", {
    points: [-0.15, -0.3, 0, 0, 0.15, -0.3]
  }), o("arrow", "triangle"), o("triangle-backcurve", {
    points: t.triangle.points,
    controlPoint: [0, -0.15],
    roughCollide: r,
    draw: function(u, h, d, f, p) {
      var g = i(this.points, h, d, f), m = this.controlPoint, v = n(m[0], m[1], h, d, f);
      e.arrowShapeImpl(this.name)(u, g, v);
    },
    gap: function(u) {
      return s(u) * 0.8;
    }
  }), o("triangle-tee", {
    points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
    pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4],
    collide: function(u, h, d, f, p, g, m) {
      var v = a(i(this.points, d + 2 * m, f, p)), y = a(i(this.pointsTee, d + 2 * m, f, p)), b = sa(u, h, v) || sa(u, h, y);
      return b;
    },
    draw: function(u, h, d, f, p) {
      var g = i(this.points, h, d, f), m = i(this.pointsTee, h, d, f);
      e.arrowShapeImpl(this.name)(u, g, m);
    }
  }), o("circle-triangle", {
    radius: 0.15,
    pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15],
    collide: function(u, h, d, f, p, g, m) {
      var v = p, y = Math.pow(v.x - u, 2) + Math.pow(v.y - h, 2) <= Math.pow((d + 2 * m) * this.radius, 2), b = a(i(this.points, d + 2 * m, f, p));
      return sa(u, h, b) || y;
    },
    draw: function(u, h, d, f, p) {
      var g = i(this.pointsTr, h, d, f);
      e.arrowShapeImpl(this.name)(u, g, f.x, f.y, this.radius * h);
    },
    spacing: function(u) {
      return e.getArrowWidth(u.pstyle("width").pfValue, u.pstyle("arrow-scale").value) * this.radius;
    }
  }), o("triangle-cross", {
    points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
    baseCrossLinePts: [
      -0.15,
      -0.4,
      // first half of the rectangle
      -0.15,
      -0.4,
      0.15,
      -0.4,
      // second half of the rectangle
      0.15,
      -0.4
    ],
    crossLinePts: function(u, h) {
      var d = this.baseCrossLinePts.slice(), f = h / u, p = 3, g = 5;
      return d[p] = d[p] - f, d[g] = d[g] - f, d;
    },
    collide: function(u, h, d, f, p, g, m) {
      var v = a(i(this.points, d + 2 * m, f, p)), y = a(i(this.crossLinePts(d, g), d + 2 * m, f, p)), b = sa(u, h, v) || sa(u, h, y);
      return b;
    },
    draw: function(u, h, d, f, p) {
      var g = i(this.points, h, d, f), m = i(this.crossLinePts(h, p), h, d, f);
      e.arrowShapeImpl(this.name)(u, g, m);
    }
  }), o("vee", {
    points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15],
    gap: function(u) {
      return s(u) * 0.525;
    }
  }), o("circle", {
    radius: 0.15,
    collide: function(u, h, d, f, p, g, m) {
      var v = p, y = Math.pow(v.x - u, 2) + Math.pow(v.y - h, 2) <= Math.pow((d + 2 * m) * this.radius, 2);
      return y;
    },
    draw: function(u, h, d, f, p) {
      e.arrowShapeImpl(this.name)(u, f.x, f.y, this.radius * h);
    },
    spacing: function(u) {
      return e.getArrowWidth(u.pstyle("width").pfValue, u.pstyle("arrow-scale").value) * this.radius;
    }
  }), o("tee", {
    points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0],
    spacing: function(u) {
      return 1;
    },
    gap: function(u) {
      return 1;
    }
  }), o("square", {
    points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3]
  }), o("diamond", {
    points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0],
    gap: function(u) {
      return u.pstyle("width").pfValue * u.pstyle("arrow-scale").value;
    }
  }), o("chevron", {
    points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15],
    gap: function(u) {
      return 0.95 * u.pstyle("width").pfValue * u.pstyle("arrow-scale").value;
    }
  });
};
var Fu = {};
Fu.projectIntoViewport = function(t, e) {
  var r = this.cy, n = this.findContainerClientCoords(), i = n[0], a = n[1], s = n[4], o = r.pan(), l = r.zoom(), u = ((t - i) / s - o.x) / l, h = ((e - a) / s - o.y) / l;
  return [u, h];
};
Fu.findContainerClientCoords = function() {
  if (this.containerBB)
    return this.containerBB;
  var t = this.container, e = t.getBoundingClientRect(), r = this.cy.window().getComputedStyle(t), n = function(y) {
    return parseFloat(r.getPropertyValue(y));
  }, i = {
    left: n("padding-left"),
    right: n("padding-right"),
    top: n("padding-top"),
    bottom: n("padding-bottom")
  }, a = {
    left: n("border-left-width"),
    right: n("border-right-width"),
    top: n("border-top-width"),
    bottom: n("border-bottom-width")
  }, s = t.clientWidth, o = t.clientHeight, l = i.left + i.right, u = i.top + i.bottom, h = a.left + a.right, d = e.width / (s + h), f = s - l, p = o - u, g = e.left + i.left + a.left, m = e.top + i.top + a.top;
  return this.containerBB = [g, m, f, p, d];
};
Fu.invalidateContainerClientCoordsCache = function() {
  this.containerBB = null;
};
Fu.findNearestElement = function(t, e, r, n) {
  return this.findNearestElements(t, e, r, n)[0];
};
Fu.findNearestElements = function(t, e, r, n) {
  var i = this, a = this, s = a.getCachedZSortedEles(), o = [], l = a.cy.zoom(), u = a.cy.hasCompoundNodes(), h = (n ? 24 : 8) / l, d = (n ? 8 : 2) / l, f = (n ? 8 : 2) / l, p = 1 / 0, g, m;
  r && (s = s.interactive);
  function v(k, _) {
    if (k.isNode()) {
      if (m)
        return;
      m = k, o.push(k);
    }
    if (k.isEdge() && (_ == null || _ < p))
      if (g) {
        if (g.pstyle("z-compound-depth").value === k.pstyle("z-compound-depth").value && g.pstyle("z-compound-depth").value === k.pstyle("z-compound-depth").value) {
          for (var L = 0; L < o.length; L++)
            if (o[L].isEdge()) {
              o[L] = k, g = k, p = _ ?? p;
              break;
            }
        }
      } else
        o.push(k), g = k, p = _ ?? p;
  }
  function y(k) {
    var _ = k.outerWidth() + 2 * d, L = k.outerHeight() + 2 * d, N = _ / 2, A = L / 2, O = k.position(), P = k.pstyle("corner-radius").value === "auto" ? "auto" : k.pstyle("corner-radius").pfValue, S = k._private.rscratch;
    if (O.x - N <= t && t <= O.x + N && O.y - A <= e && e <= O.y + A) {
      var R = a.nodeShapes[i.getNodeShape(k)];
      if (R.checkPoint(t, e, 0, _, L, O.x, O.y, P, S))
        return v(k, 0), !0;
    }
  }
  function b(k) {
    var _ = k._private, L = _.rscratch, N = k.pstyle("width").pfValue, A = k.pstyle("arrow-scale").value, O = N / 2 + h, P = O * O, S = O * 2, M = _.source, B = _.target, R;
    if (L.edgeType === "segments" || L.edgeType === "straight" || L.edgeType === "haystack") {
      for (var I = L.allpts, D = 0; D + 3 < I.length; D += 2)
        if (Xve(t, e, I[D], I[D + 1], I[D + 2], I[D + 3], S) && P > (R = Jve(t, e, I[D], I[D + 1], I[D + 2], I[D + 3])))
          return v(k, R), !0;
    } else if (L.edgeType === "bezier" || L.edgeType === "multibezier" || L.edgeType === "self" || L.edgeType === "compound") {
      for (var I = L.allpts, D = 0; D + 5 < L.allpts.length; D += 4)
        if (jve(t, e, I[D], I[D + 1], I[D + 2], I[D + 3], I[D + 4], I[D + 5], S) && P > (R = Qve(t, e, I[D], I[D + 1], I[D + 2], I[D + 3], I[D + 4], I[D + 5])))
          return v(k, R), !0;
    }
    for (var M = M || _.source, B = B || _.target, $ = i.getArrowWidth(N, A), F = [{
      name: "source",
      x: L.arrowStartX,
      y: L.arrowStartY,
      angle: L.srcArrowAngle
    }, {
      name: "target",
      x: L.arrowEndX,
      y: L.arrowEndY,
      angle: L.tgtArrowAngle
    }, {
      name: "mid-source",
      x: L.midX,
      y: L.midY,
      angle: L.midsrcArrowAngle
    }, {
      name: "mid-target",
      x: L.midX,
      y: L.midY,
      angle: L.midtgtArrowAngle
    }], D = 0; D < F.length; D++) {
      var G = F[D], H = a.arrowShapes[k.pstyle(G.name + "-arrow-shape").value], ee = k.pstyle("width").pfValue;
      if (H.roughCollide(t, e, $, G.angle, {
        x: G.x,
        y: G.y
      }, ee, h) && H.collide(t, e, $, G.angle, {
        x: G.x,
        y: G.y
      }, ee, h))
        return v(k), !0;
    }
    u && o.length > 0 && (y(M), y(B));
  }
  function w(k, _, L) {
    return aa(k, _, L);
  }
  function T(k, _) {
    var L = k._private, N = f, A;
    _ ? A = _ + "-" : A = "", k.boundingBox();
    var O = L.labelBounds[_ || "main"], P = k.pstyle(A + "label").value, S = k.pstyle("text-events").strValue === "yes";
    if (!(!S || !P)) {
      var R = w(L.rscratch, "labelX", _), I = w(L.rscratch, "labelY", _), D = w(L.rscratch, "labelAngle", _), M = k.pstyle(A + "text-margin-x").pfValue, B = k.pstyle(A + "text-margin-y").pfValue, $ = O.x1 - N - M, F = O.x2 + N - M, G = O.y1 - N - B, H = O.y2 + N - B;
      if (D) {
        var ee = Math.cos(D), Y = Math.sin(D), re = function(J, j) {
          return J = J - R, j = j - I, {
            x: J * ee - j * Y + R,
            y: J * Y + j * ee + I
          };
        }, ne = re($, G), he = re($, H), K = re(F, G), Z = re(F, H), X = [
          // with the margin added after the rotation is applied
          ne.x + M,
          ne.y + B,
          K.x + M,
          K.y + B,
          Z.x + M,
          Z.y + B,
          he.x + M,
          he.y + B
        ];
        if (sa(t, e, X))
          return v(k), !0;
      } else if (kl(O, t, e))
        return v(k), !0;
    }
  }
  for (var E = s.length - 1; E >= 0; E--) {
    var C = s[E];
    C.isNode() ? y(C) || T(C) : b(C) || T(C) || T(C, "source") || T(C, "target");
  }
  return o;
};
Fu.getAllInBox = function(t, e, r, n) {
  var i = this.getCachedZSortedEles().interactive, a = this.cy.zoom(), s = 2 / a, o = [], l = Math.min(t, r), u = Math.max(t, r), h = Math.min(e, n), d = Math.max(e, n);
  t = l, r = u, e = h, n = d;
  var f = Yi({
    x1: t,
    y1: e,
    x2: r,
    y2: n
  }), p = [{
    x: f.x1,
    y: f.y1
  }, {
    x: f.x2,
    y: f.y1
  }, {
    x: f.x2,
    y: f.y2
  }, {
    x: f.x1,
    y: f.y2
  }], g = [[p[0], p[1]], [p[1], p[2]], [p[2], p[3]], [p[3], p[0]]];
  function m(J, j, pe) {
    return aa(J, j, pe);
  }
  function v(J, j) {
    var pe = J._private, te = s, Ae = "";
    J.boundingBox();
    var W = pe.labelBounds.main;
    if (!W)
      return null;
    var Oe = m(pe.rscratch, "labelX", j), ue = m(pe.rscratch, "labelY", j), Ve = m(pe.rscratch, "labelAngle", j), Ge = J.pstyle(Ae + "text-margin-x").pfValue, Ue = J.pstyle(Ae + "text-margin-y").pfValue, ke = W.x1 - te - Ge, Pe = W.x2 + te - Ge, Se = W.y1 - te - Ue, _e = W.y2 + te - Ue;
    if (Ve) {
      var ze = Math.cos(Ve), me = Math.sin(Ve), Me = function(ce, z) {
        return ce = ce - Oe, z = z - ue, {
          x: ce * ze - z * me + Oe,
          y: ce * me + z * ze + ue
        };
      };
      return [Me(ke, Se), Me(Pe, Se), Me(Pe, _e), Me(ke, _e)];
    } else
      return [{
        x: ke,
        y: Se
      }, {
        x: Pe,
        y: Se
      }, {
        x: Pe,
        y: _e
      }, {
        x: ke,
        y: _e
      }];
  }
  function y(J, j, pe, te) {
    function Ae(W, Oe, ue) {
      return (ue.y - W.y) * (Oe.x - W.x) > (Oe.y - W.y) * (ue.x - W.x);
    }
    return Ae(J, pe, te) !== Ae(j, pe, te) && Ae(J, j, pe) !== Ae(J, j, te);
  }
  for (var b = 0; b < i.length; b++) {
    var w = i[b];
    if (w.isNode()) {
      var T = w, E = T.pstyle("text-events").strValue === "yes", C = T.pstyle("box-selection").strValue, k = T.pstyle("box-select-labels").strValue === "yes";
      if (C === "none")
        continue;
      var _ = (C === "overlap" || k) && E, L = T.boundingBox({
        includeNodes: !0,
        includeEdges: !1,
        includeLabels: _
      });
      if (C === "contain") {
        var N = !1;
        if (k && E) {
          var A = v(T);
          A && H4(A, p) && (o.push(T), N = !0);
        }
        !N && SV(f, L) && o.push(T);
      } else if (C === "overlap" && Zk(f, L)) {
        var O = T.boundingBox({
          includeNodes: !0,
          includeEdges: !0,
          includeLabels: !1,
          includeMainLabels: !1,
          includeSourceLabels: !1,
          includeTargetLabels: !1
        }), P = [{
          x: O.x1,
          y: O.y1
        }, {
          x: O.x2,
          y: O.y1
        }, {
          x: O.x2,
          y: O.y2
        }, {
          x: O.x1,
          y: O.y2
        }];
        if (H4(P, p))
          o.push(T);
        else {
          var S = v(T);
          S && H4(S, p) && o.push(T);
        }
      }
    } else {
      var R = w, I = R._private, D = I.rscratch, M = R.pstyle("box-selection").strValue;
      if (M === "none")
        continue;
      if (M === "contain") {
        if (D.startX != null && D.startY != null && !kl(f, D.startX, D.startY) || D.endX != null && D.endY != null && !kl(f, D.endX, D.endY))
          continue;
        if (D.edgeType === "bezier" || D.edgeType === "multibezier" || D.edgeType === "self" || D.edgeType === "compound" || D.edgeType === "segments" || D.edgeType === "haystack") {
          for (var B = I.rstyle.bezierPts || I.rstyle.linePts || I.rstyle.haystackPts, $ = !0, F = 0; F < B.length; F++)
            if (!n_(f, B[F])) {
              $ = !1;
              break;
            }
          $ && o.push(R);
        } else D.edgeType === "straight" && o.push(R);
      } else if (M === "overlap") {
        var G = !1;
        if (D.startX != null && D.startY != null && D.endX != null && D.endY != null && (kl(f, D.startX, D.startY) || kl(f, D.endX, D.endY)))
          o.push(R), G = !0;
        else if (!G && D.edgeType === "haystack") {
          for (var H = I.rstyle.haystackPts, ee = 0; ee < H.length; ee++)
            if (n_(f, H[ee])) {
              o.push(R), G = !0;
              break;
            }
        }
        if (!G) {
          var Y = I.rstyle.bezierPts || I.rstyle.linePts || I.rstyle.haystackPts;
          if ((!Y || Y.length < 2) && D.edgeType === "straight" && D.startX != null && D.startY != null && D.endX != null && D.endY != null && (Y = [{
            x: D.startX,
            y: D.startY
          }, {
            x: D.endX,
            y: D.endY
          }]), !Y || Y.length < 2) continue;
          for (var re = 0; re < Y.length - 1; re++) {
            for (var ne = Y[re], he = Y[re + 1], K = 0; K < g.length; K++) {
              var Z = Tn(g[K], 2), X = Z[0], q = Z[1];
              if (y(ne, he, X, q)) {
                o.push(R), G = !0;
                break;
              }
            }
            if (G) break;
          }
        }
      }
    }
  }
  return o;
};
var Uy = {};
Uy.calculateArrowAngles = function(t) {
  var e = t._private.rscratch, r = e.edgeType === "haystack", n = e.edgeType === "bezier", i = e.edgeType === "multibezier", a = e.edgeType === "segments", s = e.edgeType === "compound", o = e.edgeType === "self", l, u, h, d, f, p, y, b;
  if (r ? (h = e.haystackPts[0], d = e.haystackPts[1], f = e.haystackPts[2], p = e.haystackPts[3]) : (h = e.arrowStartX, d = e.arrowStartY, f = e.arrowEndX, p = e.arrowEndY), y = e.midX, b = e.midY, a)
    l = h - e.segpts[0], u = d - e.segpts[1];
  else if (i || s || o || n) {
    var g = e.allpts, m = Yn(g[0], g[2], g[4], 0.1), v = Yn(g[1], g[3], g[5], 0.1);
    l = h - m, u = d - v;
  } else
    l = h - y, u = d - b;
  e.srcArrowAngle = Z1(l, u);
  var y = e.midX, b = e.midY;
  if (r && (y = (h + f) / 2, b = (d + p) / 2), l = f - h, u = p - d, a) {
    var g = e.allpts;
    if (g.length / 2 % 2 === 0) {
      var w = g.length / 2, T = w - 2;
      l = g[w] - g[T], u = g[w + 1] - g[T + 1];
    } else if (e.isRound)
      l = e.midVector[1], u = -e.midVector[0];
    else {
      var w = g.length / 2 - 1, T = w - 2;
      l = g[w] - g[T], u = g[w + 1] - g[T + 1];
    }
  } else if (i || s || o) {
    var g = e.allpts, E = e.ctrlpts, C, k, _, L;
    if (E.length / 2 % 2 === 0) {
      var N = g.length / 2 - 1, A = N + 2, O = A + 2;
      C = Yn(g[N], g[A], g[O], 0), k = Yn(g[N + 1], g[A + 1], g[O + 1], 0), _ = Yn(g[N], g[A], g[O], 1e-4), L = Yn(g[N + 1], g[A + 1], g[O + 1], 1e-4);
    } else {
      var A = g.length / 2 - 1, N = A - 2, O = A + 2;
      C = Yn(g[N], g[A], g[O], 0.4999), k = Yn(g[N + 1], g[A + 1], g[O + 1], 0.4999), _ = Yn(g[N], g[A], g[O], 0.5), L = Yn(g[N + 1], g[A + 1], g[O + 1], 0.5);
    }
    l = _ - C, u = L - k;
  }
  if (e.midtgtArrowAngle = Z1(l, u), e.midDispX = l, e.midDispY = u, l *= -1, u *= -1, a) {
    var g = e.allpts;
    if (g.length / 2 % 2 !== 0) {
      if (!e.isRound) {
        var w = g.length / 2 - 1, P = w + 2;
        l = -(g[P] - g[w]), u = -(g[P + 1] - g[w + 1]);
      }
    }
  }
  if (e.midsrcArrowAngle = Z1(l, u), a)
    l = f - e.segpts[e.segpts.length - 2], u = p - e.segpts[e.segpts.length - 1];
  else if (i || s || o || n) {
    var g = e.allpts, S = g.length, m = Yn(g[S - 6], g[S - 4], g[S - 2], 0.9), v = Yn(g[S - 5], g[S - 3], g[S - 1], 0.9);
    l = f - m, u = p - v;
  } else
    l = f - y, u = p - b;
  e.tgtArrowAngle = Z1(l, u);
};
Uy.getArrowWidth = Uy.getArrowHeight = function(t, e) {
  var r = this.arrowWidthCache = this.arrowWidthCache || {}, n = r[t + ", " + e];
  return n || (n = Math.max(Math.pow(t * 13.37, 0.9), 29) * e, r[t + ", " + e] = n, n);
};
var vT, yT, Ps = {}, Va = {}, $9, z9, Fc, cv, yo, _c, Ic, Ms, nh, am, xG, bG, xT, bT, V9, G9 = function(e, r, n) {
  n.x = r.x - e.x, n.y = r.y - e.y, n.len = Math.sqrt(n.x * n.x + n.y * n.y), n.nx = n.x / n.len, n.ny = n.y / n.len, n.ang = Math.atan2(n.ny, n.nx);
}, gbe = function(e, r) {
  r.x = e.x * -1, r.y = e.y * -1, r.nx = e.nx * -1, r.ny = e.ny * -1, r.ang = e.ang > 0 ? -(Math.PI - e.ang) : Math.PI + e.ang;
}, mbe = function(e, r, n, i, a) {
  if (e !== V9 ? G9(r, e, Ps) : gbe(Va, Ps), G9(r, n, Va), $9 = Ps.nx * Va.ny - Ps.ny * Va.nx, z9 = Ps.nx * Va.nx - Ps.ny * -Va.ny, yo = Math.asin(Math.max(-1, Math.min(1, $9))), Math.abs(yo) < 1e-6) {
    vT = r.x, yT = r.y, Ic = nh = 0;
    return;
  }
  Fc = 1, cv = !1, z9 < 0 ? yo < 0 ? yo = Math.PI + yo : (yo = Math.PI - yo, Fc = -1, cv = !0) : yo > 0 && (Fc = -1, cv = !0), r.radius !== void 0 ? nh = r.radius : nh = i, _c = yo / 2, am = Math.min(Ps.len / 2, Va.len / 2), a ? (Ms = Math.abs(Math.cos(_c) * nh / Math.sin(_c)), Ms > am ? (Ms = am, Ic = Math.abs(Ms * Math.sin(_c) / Math.cos(_c))) : Ic = nh) : (Ms = Math.min(am, nh), Ic = Math.abs(Ms * Math.sin(_c) / Math.cos(_c))), xT = r.x + Va.nx * Ms, bT = r.y + Va.ny * Ms, vT = xT - Va.ny * Ic * Fc, yT = bT + Va.nx * Ic * Fc, xG = r.x + Ps.nx * Ms, bG = r.y + Ps.ny * Ms, V9 = r;
};
function wG(t, e) {
  e.radius === 0 ? t.lineTo(e.cx, e.cy) : t.arc(e.cx, e.cy, e.radius, e.startAngle, e.endAngle, e.counterClockwise);
}
function cS(t, e, r, n) {
  var i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0;
  return n === 0 || e.radius === 0 ? {
    cx: e.x,
    cy: e.y,
    radius: 0,
    startX: e.x,
    startY: e.y,
    stopX: e.x,
    stopY: e.y,
    startAngle: void 0,
    endAngle: void 0,
    counterClockwise: void 0
  } : (mbe(t, e, r, n, i), {
    cx: vT,
    cy: yT,
    radius: Ic,
    startX: xG,
    startY: bG,
    stopX: xT,
    stopY: bT,
    startAngle: Ps.ang + Math.PI / 2 * Fc,
    endAngle: Va.ang - Math.PI / 2 * Fc,
    counterClockwise: cv
  });
}
var fg = 0.01, vbe = Math.sqrt(2 * fg), Ni = {};
Ni.findMidptPtsEtc = function(t, e) {
  var r = e.posPts, n = e.intersectionPts, i = e.vectorNormInverse, a, s = t.pstyle("source-endpoint"), o = t.pstyle("target-endpoint"), l = s.units != null && o.units != null, u = function(E, C, k, _) {
    var L = _ - C, N = k - E, A = Math.sqrt(N * N + L * L);
    return {
      x: -L / A,
      y: N / A
    };
  }, h = t.pstyle("edge-distances").value;
  switch (h) {
    case "node-position":
      a = r;
      break;
    case "intersection":
      a = n;
      break;
    case "endpoints": {
      if (l) {
        var d = this.manualEndptToPx(t.source()[0], s), f = Tn(d, 2), p = f[0], g = f[1], m = this.manualEndptToPx(t.target()[0], o), v = Tn(m, 2), y = v[0], b = v[1], w = {
          x1: p,
          y1: g,
          x2: y,
          y2: b
        };
        i = u(p, g, y, b), a = w;
      } else
        Nr("Edge ".concat(t.id(), " has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint.  Falling back on edge-distances:intersection (default).")), a = n;
      break;
    }
  }
  return {
    midptPts: a,
    vectorNormInverse: i
  };
};
Ni.findHaystackPoints = function(t) {
  for (var e = 0; e < t.length; e++) {
    var r = t[e], n = r._private, i = n.rscratch;
    if (!i.haystack) {
      var a = Math.random() * 2 * Math.PI;
      i.source = {
        x: Math.cos(a),
        y: Math.sin(a)
      }, a = Math.random() * 2 * Math.PI, i.target = {
        x: Math.cos(a),
        y: Math.sin(a)
      };
    }
    var s = n.source, o = n.target, l = s.position(), u = o.position(), h = s.width(), d = o.width(), f = s.height(), p = o.height(), g = r.pstyle("haystack-radius").value, m = g / 2;
    i.haystackPts = i.allpts = [i.source.x * h * m + l.x, i.source.y * f * m + l.y, i.target.x * d * m + u.x, i.target.y * p * m + u.y], i.midX = (i.allpts[0] + i.allpts[2]) / 2, i.midY = (i.allpts[1] + i.allpts[3]) / 2, i.edgeType = "haystack", i.haystack = !0, this.storeEdgeProjections(r), this.calculateArrowAngles(r), this.recalculateEdgeLabelProjections(r), this.calculateLabelAngles(r);
  }
};
Ni.findSegmentsPoints = function(t, e) {
  var r = t._private.rscratch, n = t.pstyle("segment-weights"), i = t.pstyle("segment-distances"), a = t.pstyle("segment-radii"), s = t.pstyle("radius-type"), o = Math.min(n.pfValue.length, i.pfValue.length), l = a.pfValue[a.pfValue.length - 1], u = s.pfValue[s.pfValue.length - 1];
  r.edgeType = "segments", r.segpts = [], r.radii = [], r.isArcRadius = [];
  for (var h = 0; h < o; h++) {
    var d = n.pfValue[h], f = i.pfValue[h], p = 1 - d, g = d, m = this.findMidptPtsEtc(t, e), v = m.midptPts, y = m.vectorNormInverse, b = {
      x: v.x1 * p + v.x2 * g,
      y: v.y1 * p + v.y2 * g
    };
    r.segpts.push(b.x + y.x * f, b.y + y.y * f), r.radii.push(a.pfValue[h] !== void 0 ? a.pfValue[h] : l), r.isArcRadius.push((s.pfValue[h] !== void 0 ? s.pfValue[h] : u) === "arc-radius");
  }
};
Ni.findLoopPoints = function(t, e, r, n) {
  var i = t._private.rscratch, a = e.dirCounts, s = e.srcPos, o = t.pstyle("control-point-distances"), l = o ? o.pfValue[0] : void 0, u = t.pstyle("loop-direction").pfValue, h = t.pstyle("loop-sweep").pfValue, d = t.pstyle("control-point-step-size").pfValue;
  i.edgeType = "self";
  var f = r, p = d;
  n && (f = 0, p = l);
  var g = u - Math.PI / 2, m = g - h / 2, v = g + h / 2, y = u + "_" + h;
  f = a[y] === void 0 ? a[y] = 0 : ++a[y], i.ctrlpts = [s.x + Math.cos(m) * 1.4 * p * (f / 3 + 1), s.y + Math.sin(m) * 1.4 * p * (f / 3 + 1), s.x + Math.cos(v) * 1.4 * p * (f / 3 + 1), s.y + Math.sin(v) * 1.4 * p * (f / 3 + 1)];
};
Ni.findCompoundLoopPoints = function(t, e, r, n) {
  var i = t._private.rscratch;
  i.edgeType = "compound";
  var a = e.srcPos, s = e.tgtPos, o = e.srcW, l = e.srcH, u = e.tgtW, h = e.tgtH, d = t.pstyle("control-point-step-size").pfValue, f = t.pstyle("control-point-distances"), p = f ? f.pfValue[0] : void 0, g = r, m = d;
  n && (g = 0, m = p);
  var v = 50, y = {
    x: a.x - o / 2,
    y: a.y - l / 2
  }, b = {
    x: s.x - u / 2,
    y: s.y - h / 2
  }, w = {
    x: Math.min(y.x, b.x),
    y: Math.min(y.y, b.y)
  }, T = 0.5, E = Math.max(T, Math.log(o * fg)), C = Math.max(T, Math.log(u * fg));
  i.ctrlpts = [w.x, w.y - (1 + Math.pow(v, 1.12) / 100) * m * (g / 3 + 1) * E, w.x - (1 + Math.pow(v, 1.12) / 100) * m * (g / 3 + 1) * C, w.y];
};
Ni.findStraightEdgePoints = function(t) {
  t._private.rscratch.edgeType = "straight";
};
Ni.findBezierPoints = function(t, e, r, n, i) {
  var a = t._private.rscratch, s = t.pstyle("control-point-step-size").pfValue, o = t.pstyle("control-point-distances"), l = t.pstyle("control-point-weights"), u = o && l ? Math.min(o.value.length, l.value.length) : 1, h = o ? o.pfValue[0] : void 0, d = l.value[0], f = n;
  a.edgeType = f ? "multibezier" : "bezier", a.ctrlpts = [];
  for (var p = 0; p < u; p++) {
    var g = (0.5 - e.eles.length / 2 + r) * s * (i ? -1 : 1), m = void 0, v = Kk(g);
    f && (h = o ? o.pfValue[p] : s, d = l.value[p]), n ? m = h : m = h !== void 0 ? v * h : void 0;
    var y = m !== void 0 ? m : g, b = 1 - d, w = d, T = this.findMidptPtsEtc(t, e), E = T.midptPts, C = T.vectorNormInverse, k = {
      x: E.x1 * b + E.x2 * w,
      y: E.y1 * b + E.y2 * w
    };
    a.ctrlpts.push(k.x + C.x * y, k.y + C.y * y);
  }
};
Ni.findTaxiPoints = function(t, e) {
  var r = t._private.rscratch;
  r.edgeType = "segments";
  var n = "vertical", i = "horizontal", a = "leftward", s = "rightward", o = "downward", l = "upward", u = "auto", h = e.posPts, d = e.srcW, f = e.srcH, p = e.tgtW, g = e.tgtH, m = t.pstyle("edge-distances").value, v = m !== "node-position", y = t.pstyle("taxi-direction").value, b = y, w = t.pstyle("taxi-turn"), T = w.units === "%", E = w.pfValue, C = E < 0, k = t.pstyle("taxi-turn-min-distance").pfValue, _ = v ? (d + p) / 2 : 0, L = v ? (f + g) / 2 : 0, N = h.x2 - h.x1, A = h.y2 - h.y1, O = function(z, oe) {
    return z > 0 ? Math.max(z - oe, 0) : Math.min(z + oe, 0);
  }, P = O(N, _), S = O(A, L), R = !1;
  b === u ? y = Math.abs(P) > Math.abs(S) ? i : n : b === l || b === o ? (y = n, R = !0) : (b === a || b === s) && (y = i, R = !0);
  var I = y === n, D = I ? S : P, M = I ? A : N, B = Kk(M), $ = !1;
  !(R && (T || C)) && (b === o && M < 0 || b === l && M > 0 || b === a && M > 0 || b === s && M < 0) && (B *= -1, D = B * Math.abs(D), $ = !0);
  var F;
  if (T) {
    var G = E < 0 ? 1 + E : E;
    F = G * D;
  } else {
    var H = E < 0 ? D : 0;
    F = H + E * B;
  }
  var ee = function(z) {
    return Math.abs(z) < k || Math.abs(z) >= Math.abs(D);
  }, Y = ee(F), re = ee(Math.abs(D) - Math.abs(F)), ne = Y || re;
  if (ne && !$)
    if (I) {
      var he = Math.abs(M) <= f / 2, K = Math.abs(N) <= p / 2;
      if (he) {
        var Z = (h.x1 + h.x2) / 2, X = h.y1, q = h.y2;
        r.segpts = [Z, X, Z, q];
      } else if (K) {
        var J = (h.y1 + h.y2) / 2, j = h.x1, pe = h.x2;
        r.segpts = [j, J, pe, J];
      } else
        r.segpts = [h.x1, h.y2];
    } else {
      var te = Math.abs(M) <= d / 2, Ae = Math.abs(A) <= g / 2;
      if (te) {
        var W = (h.y1 + h.y2) / 2, Oe = h.x1, ue = h.x2;
        r.segpts = [Oe, W, ue, W];
      } else if (Ae) {
        var Ve = (h.x1 + h.x2) / 2, Ge = h.y1, Ue = h.y2;
        r.segpts = [Ve, Ge, Ve, Ue];
      } else
        r.segpts = [h.x2, h.y1];
    }
  else if (I) {
    var ke = h.y1 + F + (v ? f / 2 * B : 0), Pe = h.x1, Se = h.x2;
    r.segpts = [Pe, ke, Se, ke];
  } else {
    var _e = h.x1 + F + (v ? d / 2 * B : 0), ze = h.y1, me = h.y2;
    r.segpts = [_e, ze, _e, me];
  }
  if (r.isRound) {
    var Me = t.pstyle("taxi-radius").value, Q = t.pstyle("radius-type").value[0] === "arc-radius";
    r.radii = new Array(r.segpts.length / 2).fill(Me), r.isArcRadius = new Array(r.segpts.length / 2).fill(Q);
  }
};
Ni.tryToCorrectInvalidPoints = function(t, e) {
  var r = t._private.rscratch;
  if (r.edgeType === "bezier") {
    var n = e.srcPos, i = e.tgtPos, a = e.srcW, s = e.srcH, o = e.tgtW, l = e.tgtH, u = e.srcShape, h = e.tgtShape, d = e.srcCornerRadius, f = e.tgtCornerRadius, p = e.srcRs, g = e.tgtRs, m = !vt(r.startX) || !vt(r.startY), v = !vt(r.arrowStartX) || !vt(r.arrowStartY), y = !vt(r.endX) || !vt(r.endY), b = !vt(r.arrowEndX) || !vt(r.arrowEndY), w = 3, T = this.getArrowWidth(t.pstyle("width").pfValue, t.pstyle("arrow-scale").value) * this.arrowShapeWidth, E = w * T, C = mu({
      x: r.ctrlpts[0],
      y: r.ctrlpts[1]
    }, {
      x: r.startX,
      y: r.startY
    }), k = C < E, _ = mu({
      x: r.ctrlpts[0],
      y: r.ctrlpts[1]
    }, {
      x: r.endX,
      y: r.endY
    }), L = _ < E, N = !1;
    if (m || v || k) {
      N = !0;
      var A = {
        // delta
        x: r.ctrlpts[0] - n.x,
        y: r.ctrlpts[1] - n.y
      }, O = Math.sqrt(A.x * A.x + A.y * A.y), P = {
        // normalised delta
        x: A.x / O,
        y: A.y / O
      }, S = Math.max(a, s), R = {
        // *2 radius guarantees outside shape
        x: r.ctrlpts[0] + P.x * 2 * S,
        y: r.ctrlpts[1] + P.y * 2 * S
      }, I = u.intersectLine(n.x, n.y, a, s, R.x, R.y, 0, d, p);
      k ? (r.ctrlpts[0] = r.ctrlpts[0] + P.x * (E - C), r.ctrlpts[1] = r.ctrlpts[1] + P.y * (E - C)) : (r.ctrlpts[0] = I[0] + P.x * E, r.ctrlpts[1] = I[1] + P.y * E);
    }
    if (y || b || L) {
      N = !0;
      var D = {
        // delta
        x: r.ctrlpts[0] - i.x,
        y: r.ctrlpts[1] - i.y
      }, M = Math.sqrt(D.x * D.x + D.y * D.y), B = {
        // normalised delta
        x: D.x / M,
        y: D.y / M
      }, $ = Math.max(a, s), F = {
        // *2 radius guarantees outside shape
        x: r.ctrlpts[0] + B.x * 2 * $,
        y: r.ctrlpts[1] + B.y * 2 * $
      }, G = h.intersectLine(i.x, i.y, o, l, F.x, F.y, 0, f, g);
      L ? (r.ctrlpts[0] = r.ctrlpts[0] + B.x * (E - _), r.ctrlpts[1] = r.ctrlpts[1] + B.y * (E - _)) : (r.ctrlpts[0] = G[0] + B.x * E, r.ctrlpts[1] = G[1] + B.y * E);
    }
    N && this.findEndpoints(t);
  }
};
Ni.storeAllpts = function(t) {
  var e = t._private.rscratch;
  if (e.edgeType === "multibezier" || e.edgeType === "bezier" || e.edgeType === "self" || e.edgeType === "compound") {
    e.allpts = [], e.allpts.push(e.startX, e.startY);
    for (var r = 0; r + 1 < e.ctrlpts.length; r += 2)
      e.allpts.push(e.ctrlpts[r], e.ctrlpts[r + 1]), r + 3 < e.ctrlpts.length && e.allpts.push((e.ctrlpts[r] + e.ctrlpts[r + 2]) / 2, (e.ctrlpts[r + 1] + e.ctrlpts[r + 3]) / 2);
    e.allpts.push(e.endX, e.endY);
    var n, i;
    e.ctrlpts.length / 2 % 2 === 0 ? (n = e.allpts.length / 2 - 1, e.midX = e.allpts[n], e.midY = e.allpts[n + 1]) : (n = e.allpts.length / 2 - 3, i = 0.5, e.midX = Yn(e.allpts[n], e.allpts[n + 2], e.allpts[n + 4], i), e.midY = Yn(e.allpts[n + 1], e.allpts[n + 3], e.allpts[n + 5], i));
  } else if (e.edgeType === "straight")
    e.allpts = [e.startX, e.startY, e.endX, e.endY], e.midX = (e.startX + e.endX + e.arrowStartX + e.arrowEndX) / 4, e.midY = (e.startY + e.endY + e.arrowStartY + e.arrowEndY) / 4;
  else if (e.edgeType === "segments") {
    if (e.allpts = [], e.allpts.push(e.startX, e.startY), e.allpts.push.apply(e.allpts, e.segpts), e.allpts.push(e.endX, e.endY), e.isRound) {
      e.roundCorners = [];
      for (var a = 2; a + 3 < e.allpts.length; a += 2) {
        var s = e.radii[a / 2 - 1], o = e.isArcRadius[a / 2 - 1];
        e.roundCorners.push(cS({
          x: e.allpts[a - 2],
          y: e.allpts[a - 1]
        }, {
          x: e.allpts[a],
          y: e.allpts[a + 1],
          radius: s
        }, {
          x: e.allpts[a + 2],
          y: e.allpts[a + 3]
        }, s, o));
      }
    }
    if (e.segpts.length % 4 === 0) {
      var l = e.segpts.length / 2, u = l - 2;
      e.midX = (e.segpts[u] + e.segpts[l]) / 2, e.midY = (e.segpts[u + 1] + e.segpts[l + 1]) / 2;
    } else {
      var h = e.segpts.length / 2 - 1;
      if (!e.isRound)
        e.midX = e.segpts[h], e.midY = e.segpts[h + 1];
      else {
        var d = {
          x: e.segpts[h],
          y: e.segpts[h + 1]
        }, f = e.roundCorners[h / 2];
        if (f.radius === 0) {
          var p = {
            x: e.segpts[h + 2],
            y: e.segpts[h + 3]
          };
          e.midX = d.x, e.midY = d.y, e.midVector = [d.y - p.y, p.x - d.x];
        } else {
          var g = [d.x - f.cx, d.y - f.cy], m = f.radius / Math.sqrt(Math.pow(g[0], 2) + Math.pow(g[1], 2));
          g = g.map(function(v) {
            return v * m;
          }), e.midX = f.cx + g[0], e.midY = f.cy + g[1], e.midVector = g;
        }
      }
    }
  }
};
Ni.checkForInvalidEdgeWarning = function(t) {
  var e = t[0]._private.rscratch;
  e.nodesOverlap || vt(e.startX) && vt(e.startY) && vt(e.endX) && vt(e.endY) ? e.loggedErr = !1 : e.loggedErr || (e.loggedErr = !0, Nr("Edge `" + t.id() + "` has invalid endpoints and so it is impossible to draw.  Adjust your edge style (e.g. control points) accordingly or use an alternative edge type.  This is expected behaviour when the source node and the target node overlap."));
};
Ni.findEdgeControlPoints = function(t) {
  var e = this;
  if (!(!t || t.length === 0)) {
    for (var r = this, n = r.cy, i = n.hasCompoundNodes(), a = new Io(), s = function(L, N) {
      return [].concat(Dy(L), [N ? 1 : 0]).join("-");
    }, o = [], l = [], u = 0; u < t.length; u++) {
      var h = t[u], d = h._private, f = h.pstyle("curve-style").value;
      if (!(h.removed() || !h.takesUpSpace())) {
        if (f === "haystack") {
          l.push(h);
          continue;
        }
        var p = f === "unbundled-bezier" || El(f, "segments") || f === "straight" || f === "straight-triangle" || El(f, "taxi"), g = f === "unbundled-bezier" || f === "bezier", m = d.source, v = d.target, y = m.poolIndex(), b = v.poolIndex(), w = [y, b].sort(), T = s(w, p), E = a.get(T);
        E == null && (E = {
          eles: []
        }, o.push({
          pairId: w,
          edgeIsUnbundled: p
        }), a.set(T, E)), E.eles.push(h), p && (E.hasUnbundled = !0), g && (E.hasBezier = !0);
      }
    }
    for (var C = function() {
      var L = o[k], N = L.pairId, A = L.edgeIsUnbundled, O = s(N, A), P = a.get(O), S;
      if (!P.hasUnbundled) {
        var R = P.eles[0].parallelEdges().filter(function(Q) {
          return Q.isBundledBezier();
        });
        Xk(P.eles), R.forEach(function(Q) {
          return P.eles.push(Q);
        }), P.eles.sort(function(Q, ce) {
          return Q.poolIndex() - ce.poolIndex();
        });
      }
      var I = P.eles[0], D = I.source(), M = I.target();
      if (D.poolIndex() > M.poolIndex()) {
        var B = D;
        D = M, M = B;
      }
      var $ = P.srcPos = D.position(), F = P.tgtPos = M.position(), G = P.srcW = D.outerWidth(), H = P.srcH = D.outerHeight(), ee = P.tgtW = M.outerWidth(), Y = P.tgtH = M.outerHeight(), re = P.srcShape = r.nodeShapes[e.getNodeShape(D)], ne = P.tgtShape = r.nodeShapes[e.getNodeShape(M)], he = P.srcCornerRadius = D.pstyle("corner-radius").value === "auto" ? "auto" : D.pstyle("corner-radius").pfValue, K = P.tgtCornerRadius = M.pstyle("corner-radius").value === "auto" ? "auto" : M.pstyle("corner-radius").pfValue, Z = P.tgtRs = M._private.rscratch, X = P.srcRs = D._private.rscratch;
      P.dirCounts = {
        north: 0,
        west: 0,
        south: 0,
        east: 0,
        northwest: 0,
        southwest: 0,
        northeast: 0,
        southeast: 0
      };
      for (var q = 0; q < P.eles.length; q++) {
        var J = P.eles[q], j = J[0]._private.rscratch, pe = J.pstyle("curve-style").value, te = pe === "unbundled-bezier" || El(pe, "segments") || El(pe, "taxi"), Ae = !D.same(J.source());
        if (!P.calculatedIntersection && D !== M && (P.hasBezier || P.hasUnbundled)) {
          P.calculatedIntersection = !0;
          var W = re.intersectLine($.x, $.y, G, H, F.x, F.y, 0, he, X), Oe = P.srcIntn = W, ue = ne.intersectLine(F.x, F.y, ee, Y, $.x, $.y, 0, K, Z), Ve = P.tgtIntn = ue, Ge = P.intersectionPts = {
            x1: W[0],
            x2: ue[0],
            y1: W[1],
            y2: ue[1]
          }, Ue = P.posPts = {
            x1: $.x,
            x2: F.x,
            y1: $.y,
            y2: F.y
          }, ke = ue[1] - W[1], Pe = ue[0] - W[0], Se = Math.sqrt(Pe * Pe + ke * ke);
          vt(Se) && Se >= vbe || (Se = Math.sqrt(Math.max(Pe * Pe, fg) + Math.max(ke * ke, fg)));
          var _e = P.vector = {
            x: Pe,
            y: ke
          }, ze = P.vectorNorm = {
            x: _e.x / Se,
            y: _e.y / Se
          }, me = {
            x: -ze.y,
            y: ze.x
          };
          P.nodesOverlap = !vt(Se) || ne.checkPoint(W[0], W[1], 0, ee, Y, F.x, F.y, K, Z) || re.checkPoint(ue[0], ue[1], 0, G, H, $.x, $.y, he, X), P.vectorNormInverse = me, S = {
            nodesOverlap: P.nodesOverlap,
            dirCounts: P.dirCounts,
            calculatedIntersection: !0,
            hasBezier: P.hasBezier,
            hasUnbundled: P.hasUnbundled,
            eles: P.eles,
            srcPos: F,
            srcRs: Z,
            tgtPos: $,
            tgtRs: X,
            srcW: ee,
            srcH: Y,
            tgtW: G,
            tgtH: H,
            srcIntn: Ve,
            tgtIntn: Oe,
            srcShape: ne,
            tgtShape: re,
            posPts: {
              x1: Ue.x2,
              y1: Ue.y2,
              x2: Ue.x1,
              y2: Ue.y1
            },
            intersectionPts: {
              x1: Ge.x2,
              y1: Ge.y2,
              x2: Ge.x1,
              y2: Ge.y1
            },
            vector: {
              x: -_e.x,
              y: -_e.y
            },
            vectorNorm: {
              x: -ze.x,
              y: -ze.y
            },
            vectorNormInverse: {
              x: -me.x,
              y: -me.y
            }
          };
        }
        var Me = Ae ? S : P;
        j.nodesOverlap = Me.nodesOverlap, j.srcIntn = Me.srcIntn, j.tgtIntn = Me.tgtIntn, j.isRound = pe.startsWith("round"), i && (D.isParent() || D.isChild() || M.isParent() || M.isChild()) && (D.parents().anySame(M) || M.parents().anySame(D) || D.same(M) && D.isParent()) ? e.findCompoundLoopPoints(J, Me, q, te) : D === M ? e.findLoopPoints(J, Me, q, te) : pe.endsWith("segments") ? e.findSegmentsPoints(J, Me) : pe.endsWith("taxi") ? e.findTaxiPoints(J, Me) : pe === "straight" || !te && P.eles.length % 2 === 1 && q === Math.floor(P.eles.length / 2) ? e.findStraightEdgePoints(J) : e.findBezierPoints(J, Me, q, te, Ae), e.findEndpoints(J), e.tryToCorrectInvalidPoints(J, Me), e.checkForInvalidEdgeWarning(J), e.storeAllpts(J), e.storeEdgeProjections(J), e.calculateArrowAngles(J), e.recalculateEdgeLabelProjections(J), e.calculateLabelAngles(J);
      }
    }, k = 0; k < o.length; k++)
      C();
    this.findHaystackPoints(l);
  }
};
function TG(t) {
  var e = [];
  if (t != null) {
    for (var r = 0; r < t.length; r += 2) {
      var n = t[r], i = t[r + 1];
      e.push({
        x: n,
        y: i
      });
    }
    return e;
  }
}
Ni.getSegmentPoints = function(t) {
  var e = t[0]._private.rscratch;
  this.recalculateRenderedStyle(t);
  var r = e.edgeType;
  if (r === "segments")
    return TG(e.segpts);
};
Ni.getControlPoints = function(t) {
  var e = t[0]._private.rscratch;
  this.recalculateRenderedStyle(t);
  var r = e.edgeType;
  if (r === "bezier" || r === "multibezier" || r === "self" || r === "compound")
    return TG(e.ctrlpts);
};
Ni.getEdgeMidpoint = function(t) {
  var e = t[0]._private.rscratch;
  return this.recalculateRenderedStyle(t), {
    x: e.midX,
    y: e.midY
  };
};
var a1 = {};
a1.manualEndptToPx = function(t, e) {
  var r = this, n = t.position(), i = t.outerWidth(), a = t.outerHeight(), s = t._private.rscratch;
  if (e.value.length === 2) {
    var o = [e.pfValue[0], e.pfValue[1]];
    return e.units[0] === "%" && (o[0] = o[0] * i), e.units[1] === "%" && (o[1] = o[1] * a), o[0] += n.x, o[1] += n.y, o;
  } else {
    var l = e.pfValue[0];
    l = -Math.PI / 2 + l;
    var u = 2 * Math.max(i, a), h = [n.x + Math.cos(l) * u, n.y + Math.sin(l) * u];
    return r.nodeShapes[this.getNodeShape(t)].intersectLine(n.x, n.y, i, a, h[0], h[1], 0, t.pstyle("corner-radius").value === "auto" ? "auto" : t.pstyle("corner-radius").pfValue, s);
  }
};
a1.findEndpoints = function(t) {
  var e, r, n, i, a = this, s, o = t.source()[0], l = t.target()[0], u = o.position(), h = l.position(), d = t.pstyle("target-arrow-shape").value, f = t.pstyle("source-arrow-shape").value, p = t.pstyle("target-distance-from-node").pfValue, g = t.pstyle("source-distance-from-node").pfValue, m = o._private.rscratch, v = l._private.rscratch, y = t.pstyle("curve-style").value, b = t._private.rscratch, w = b.edgeType, T = El(y, "taxi"), E = w === "self" || w === "compound", C = w === "bezier" || w === "multibezier" || E, k = w !== "bezier", _ = w === "straight" || w === "segments", L = w === "segments", N = C || k || _, A = E || T, O = t.pstyle("source-endpoint"), P = A ? "outside-to-node" : O.value, S = o.pstyle("corner-radius").value === "auto" ? "auto" : o.pstyle("corner-radius").pfValue, R = t.pstyle("target-endpoint"), I = A ? "outside-to-node" : R.value, D = l.pstyle("corner-radius").value === "auto" ? "auto" : l.pstyle("corner-radius").pfValue;
  b.srcManEndpt = O, b.tgtManEndpt = R;
  var M, B, $, F, G = (e = (R == null || (r = R.pfValue) === null || r === void 0 ? void 0 : r.length) === 2 ? R.pfValue : null) !== null && e !== void 0 ? e : [0, 0], H = (n = (O == null || (i = O.pfValue) === null || i === void 0 ? void 0 : i.length) === 2 ? O.pfValue : null) !== null && n !== void 0 ? n : [0, 0];
  if (C) {
    var ee = [b.ctrlpts[0], b.ctrlpts[1]], Y = k ? [b.ctrlpts[b.ctrlpts.length - 2], b.ctrlpts[b.ctrlpts.length - 1]] : ee;
    M = Y, B = ee;
  } else if (_) {
    var re = L ? b.segpts.slice(0, 2) : [h.x + G[0], h.y + G[1]], ne = L ? b.segpts.slice(b.segpts.length - 2) : [u.x + H[0], u.y + H[1]];
    M = ne, B = re;
  }
  if (I === "inside-to-node")
    s = [h.x, h.y];
  else if (R.units)
    s = this.manualEndptToPx(l, R);
  else if (I === "outside-to-line")
    s = b.tgtIntn;
  else if (I === "outside-to-node" || I === "outside-to-node-or-label" ? $ = M : (I === "outside-to-line" || I === "outside-to-line-or-label") && ($ = [u.x, u.y]), s = a.nodeShapes[this.getNodeShape(l)].intersectLine(h.x, h.y, l.outerWidth(), l.outerHeight(), $[0], $[1], 0, D, v), I === "outside-to-node-or-label" || I === "outside-to-line-or-label") {
    var he = l._private.rscratch, K = he.labelWidth, Z = he.labelHeight, X = he.labelX, q = he.labelY, J = K / 2, j = Z / 2, pe = l.pstyle("text-valign").value;
    pe === "top" ? q -= j : pe === "bottom" && (q += j);
    var te = l.pstyle("text-halign").value;
    te === "left" ? X -= J : te === "right" && (X += J);
    var Ae = lg($[0], $[1], [X - J, q - j, X + J, q - j, X + J, q + j, X - J, q + j], h.x, h.y);
    if (Ae.length > 0) {
      var W = u, Oe = Dc(W, Th(s)), ue = Dc(W, Th(Ae)), Ve = Oe;
      if (ue < Oe && (s = Ae, Ve = ue), Ae.length > 2) {
        var Ge = Dc(W, {
          x: Ae[2],
          y: Ae[3]
        });
        Ge < Ve && (s = [Ae[2], Ae[3]]);
      }
    }
  }
  var Ue = Q1(s, M, a.arrowShapes[d].spacing(t) + p), ke = Q1(s, M, a.arrowShapes[d].gap(t) + p);
  if (b.endX = ke[0], b.endY = ke[1], b.arrowEndX = Ue[0], b.arrowEndY = Ue[1], P === "inside-to-node")
    s = [u.x, u.y];
  else if (O.units)
    s = this.manualEndptToPx(o, O);
  else if (P === "outside-to-line")
    s = b.srcIntn;
  else if (P === "outside-to-node" || P === "outside-to-node-or-label" ? F = B : (P === "outside-to-line" || P === "outside-to-line-or-label") && (F = [h.x, h.y]), s = a.nodeShapes[this.getNodeShape(o)].intersectLine(u.x, u.y, o.outerWidth(), o.outerHeight(), F[0], F[1], 0, S, m), P === "outside-to-node-or-label" || P === "outside-to-line-or-label") {
    var Pe = o._private.rscratch, Se = Pe.labelWidth, _e = Pe.labelHeight, ze = Pe.labelX, me = Pe.labelY, Me = Se / 2, Q = _e / 2, ce = o.pstyle("text-valign").value;
    ce === "top" ? me -= Q : ce === "bottom" && (me += Q);
    var z = o.pstyle("text-halign").value;
    z === "left" ? ze -= Me : z === "right" && (ze += Me);
    var oe = lg(F[0], F[1], [ze - Me, me - Q, ze + Me, me - Q, ze + Me, me + Q, ze - Me, me + Q], u.x, u.y);
    if (oe.length > 0) {
      var se = h, ge = Dc(se, Th(s)), de = Dc(se, Th(oe)), be = ge;
      if (de < ge && (s = [oe[0], oe[1]], be = de), oe.length > 2) {
        var Ce = Dc(se, {
          x: oe[2],
          y: oe[3]
        });
        Ce < be && (s = [oe[2], oe[3]]);
      }
    }
  }
  var Te = Q1(s, B, a.arrowShapes[f].spacing(t) + g), Ne = Q1(s, B, a.arrowShapes[f].gap(t) + g);
  b.startX = Ne[0], b.startY = Ne[1], b.arrowStartX = Te[0], b.arrowStartY = Te[1], N && (!vt(b.startX) || !vt(b.startY) || !vt(b.endX) || !vt(b.endY) ? b.badLine = !0 : b.badLine = !1);
};
a1.getSourceEndpoint = function(t) {
  var e = t[0]._private.rscratch;
  switch (this.recalculateRenderedStyle(t), e.edgeType) {
    case "haystack":
      return {
        x: e.haystackPts[0],
        y: e.haystackPts[1]
      };
    default:
      return {
        x: e.arrowStartX,
        y: e.arrowStartY
      };
  }
};
a1.getTargetEndpoint = function(t) {
  var e = t[0]._private.rscratch;
  switch (this.recalculateRenderedStyle(t), e.edgeType) {
    case "haystack":
      return {
        x: e.haystackPts[2],
        y: e.haystackPts[3]
      };
    default:
      return {
        x: e.arrowEndX,
        y: e.arrowEndY
      };
  }
};
var uS = {};
function ybe(t, e, r) {
  for (var n = function(u, h, d, f) {
    return Yn(u, h, d, f);
  }, i = e._private, a = i.rstyle.bezierPts, s = 0; s < t.bezierProjPcts.length; s++) {
    var o = t.bezierProjPcts[s];
    a.push({
      x: n(r[0], r[2], r[4], o),
      y: n(r[1], r[3], r[5], o)
    });
  }
}
uS.storeEdgeProjections = function(t) {
  var e = t._private, r = e.rscratch, n = r.edgeType;
  if (e.rstyle.bezierPts = null, e.rstyle.linePts = null, e.rstyle.haystackPts = null, n === "multibezier" || n === "bezier" || n === "self" || n === "compound") {
    e.rstyle.bezierPts = [];
    for (var i = 0; i + 5 < r.allpts.length; i += 4)
      ybe(this, t, r.allpts.slice(i, i + 6));
  } else if (n === "segments")
    for (var a = e.rstyle.linePts = [], i = 0; i + 1 < r.allpts.length; i += 2)
      a.push({
        x: r.allpts[i],
        y: r.allpts[i + 1]
      });
  else if (n === "haystack") {
    var s = r.haystackPts;
    e.rstyle.haystackPts = [{
      x: s[0],
      y: s[1]
    }, {
      x: s[2],
      y: s[3]
    }];
  }
  e.rstyle.arrowWidth = this.getArrowWidth(t.pstyle("width").pfValue, t.pstyle("arrow-scale").value) * this.arrowShapeWidth;
};
uS.recalculateEdgeProjections = function(t) {
  this.findEdgeControlPoints(t);
};
var co = {};
co.recalculateNodeLabelProjection = function(t) {
  var e = t.pstyle("label").strValue;
  if (!Gl(e)) {
    var r, n, i = t._private, a = t.width(), s = t.height(), o = t.padding(), l = t.position(), u = t.pstyle("text-halign").strValue, h = t.pstyle("text-valign").strValue, d = i.rscratch, f = i.rstyle;
    switch (u) {
      case "left":
        r = l.x - a / 2 - o;
        break;
      case "right":
        r = l.x + a / 2 + o;
        break;
      default:
        r = l.x;
    }
    switch (h) {
      case "top":
        n = l.y - s / 2 - o;
        break;
      case "bottom":
        n = l.y + s / 2 + o;
        break;
      default:
        n = l.y;
    }
    d.labelX = r, d.labelY = n, f.labelX = r, f.labelY = n, this.calculateLabelAngles(t), this.applyLabelDimensions(t);
  }
};
var EG = function(e, r) {
  var n = Math.atan(r / e);
  return e === 0 && n < 0 && (n = n * -1), n;
}, kG = function(e, r) {
  var n = r.x - e.x, i = r.y - e.y;
  return EG(n, i);
}, xbe = function(e, r, n, i) {
  var a = og(0, i - 1e-3, 1), s = og(0, i + 1e-3, 1), o = Oh(e, r, n, a), l = Oh(e, r, n, s);
  return kG(o, l);
};
co.recalculateEdgeLabelProjections = function(t) {
  var e, r = t._private, n = r.rscratch, i = this, a = {
    mid: t.pstyle("label").strValue,
    source: t.pstyle("source-label").strValue,
    target: t.pstyle("target-label").strValue
  };
  if (a.mid || a.source || a.target) {
    e = {
      x: n.midX,
      y: n.midY
    };
    var s = function(d, f, p) {
      Ao(r.rscratch, d, f, p), Ao(r.rstyle, d, f, p);
    };
    s("labelX", null, e.x), s("labelY", null, e.y);
    var o = EG(n.midDispX, n.midDispY);
    s("labelAutoAngle", null, o);
    var l = function() {
      if (l.cache)
        return l.cache;
      for (var d = [], f = 0; f + 5 < n.allpts.length; f += 4) {
        var p = {
          x: n.allpts[f],
          y: n.allpts[f + 1]
        }, g = {
          x: n.allpts[f + 2],
          y: n.allpts[f + 3]
        }, m = {
          x: n.allpts[f + 4],
          y: n.allpts[f + 5]
        };
        d.push({
          p0: p,
          p1: g,
          p2: m,
          startDist: 0,
          length: 0,
          segments: []
        });
      }
      var v = r.rstyle.bezierPts, y = i.bezierProjPcts.length;
      function b(k, _, L, N, A) {
        var O = mu(_, L), P = k.segments[k.segments.length - 1], S = {
          p0: _,
          p1: L,
          t0: N,
          t1: A,
          startDist: P ? P.startDist + P.length : 0,
          length: O
        };
        k.segments.push(S), k.length += O;
      }
      for (var w = 0; w < d.length; w++) {
        var T = d[w], E = d[w - 1];
        E && (T.startDist = E.startDist + E.length), b(T, T.p0, v[w * y], 0, i.bezierProjPcts[0]);
        for (var C = 0; C < y - 1; C++)
          b(T, v[w * y + C], v[w * y + C + 1], i.bezierProjPcts[C], i.bezierProjPcts[C + 1]);
        b(T, v[w * y + y - 1], T.p2, i.bezierProjPcts[y - 1], 1);
      }
      return l.cache = d;
    }, u = function(d) {
      var f, p = d === "source";
      if (a[d]) {
        var g = t.pstyle(d + "-text-offset").pfValue;
        switch (n.edgeType) {
          case "self":
          case "compound":
          case "bezier":
          case "multibezier": {
            for (var m = l(), v, y = 0, b = 0, w = 0; w < m.length; w++) {
              for (var T = m[p ? w : m.length - 1 - w], E = 0; E < T.segments.length; E++) {
                var C = T.segments[p ? E : T.segments.length - 1 - E], k = w === m.length - 1 && E === T.segments.length - 1;
                if (y = b, b += C.length, b >= g || k) {
                  v = {
                    cp: T,
                    segment: C
                  };
                  break;
                }
              }
              if (v)
                break;
            }
            var _ = v.cp, L = v.segment, N = (g - y) / L.length, A = L.t1 - L.t0, O = p ? L.t0 + A * N : L.t1 - A * N;
            O = og(0, O, 1), e = Oh(_.p0, _.p1, _.p2, O), f = xbe(_.p0, _.p1, _.p2, O);
            break;
          }
          case "straight":
          case "segments":
          case "haystack": {
            for (var P = 0, S, R, I, D, M = n.allpts.length, B = 0; B + 3 < M && (p ? (I = {
              x: n.allpts[B],
              y: n.allpts[B + 1]
            }, D = {
              x: n.allpts[B + 2],
              y: n.allpts[B + 3]
            }) : (I = {
              x: n.allpts[M - 2 - B],
              y: n.allpts[M - 1 - B]
            }, D = {
              x: n.allpts[M - 4 - B],
              y: n.allpts[M - 3 - B]
            }), S = mu(I, D), R = P, P += S, !(P >= g)); B += 2)
              ;
            var $ = g - R, F = $ / S;
            F = og(0, F, 1), e = Vve(I, D, F), f = kG(I, D);
            break;
          }
        }
        s("labelX", d, e.x), s("labelY", d, e.y), s("labelAutoAngle", d, f);
      }
    };
    u("source"), u("target"), this.applyLabelDimensions(t);
  }
};
co.applyLabelDimensions = function(t) {
  this.applyPrefixedLabelDimensions(t), t.isEdge() && (this.applyPrefixedLabelDimensions(t, "source"), this.applyPrefixedLabelDimensions(t, "target"));
};
co.applyPrefixedLabelDimensions = function(t, e) {
  var r = t._private, n = this.getLabelText(t, e), i = gu(n, t._private.labelDimsKey);
  if (aa(r.rscratch, "prefixedLabelDimsKey", e) !== i) {
    Ao(r.rscratch, "prefixedLabelDimsKey", e, i);
    var a = this.calculateLabelDimensions(t, n), s = t.pstyle("line-height").pfValue, o = t.pstyle("text-wrap").strValue, l = aa(r.rscratch, "labelWrapCachedLines", e) || [], u = o !== "wrap" ? 1 : Math.max(l.length, 1), h = a.height / u, d = h * s, f = a.width, p = a.height + (u - 1) * (s - 1) * h;
    Ao(r.rstyle, "labelWidth", e, f), Ao(r.rscratch, "labelWidth", e, f), Ao(r.rstyle, "labelHeight", e, p), Ao(r.rscratch, "labelHeight", e, p), Ao(r.rscratch, "labelLineHeight", e, d);
  }
};
co.getLabelText = function(t, e) {
  var r = t._private, n = e ? e + "-" : "", i = t.pstyle(n + "label").strValue, a = t.pstyle("text-transform").value, s = function(H, ee) {
    return ee ? (Ao(r.rscratch, H, e, ee), ee) : aa(r.rscratch, H, e);
  };
  if (!i)
    return "";
  a == "none" || (a == "uppercase" ? i = i.toUpperCase() : a == "lowercase" && (i = i.toLowerCase()));
  var o = t.pstyle("text-wrap").value;
  if (o === "wrap") {
    var l = s("labelKey");
    if (l != null && s("labelWrapKey") === l)
      return s("labelWrapCachedText");
    for (var u = "​", h = i.split(`
`), d = t.pstyle("text-max-width").pfValue, f = t.pstyle("text-overflow-wrap").value, p = f === "anywhere", g = [], m = /[\s\u200b]+|$/g, v = 0; v < h.length; v++) {
      var y = h[v], b = this.calculateLabelDimensions(t, y), w = b.width;
      if (p) {
        var T = y.split("").join(u);
        y = T;
      }
      if (w > d) {
        var E = y.matchAll(m), C = "", k = 0, _ = ca(E), L;
        try {
          for (_.s(); !(L = _.n()).done; ) {
            var N = L.value, A = N[0], O = y.substring(k, N.index);
            k = N.index + A.length;
            var P = C.length === 0 ? O : C + O + A, S = this.calculateLabelDimensions(t, P), R = S.width;
            R <= d ? C += O + A : (C && g.push(C), C = O + A);
          }
        } catch (G) {
          _.e(G);
        } finally {
          _.f();
        }
        C.match(/^[\s\u200b]+$/) || g.push(C);
      } else
        g.push(y);
    }
    s("labelWrapCachedLines", g), i = s("labelWrapCachedText", g.join(`
`)), s("labelWrapKey", l);
  } else if (o === "ellipsis") {
    var I = t.pstyle("text-max-width").pfValue, D = "", M = "…", B = !1;
    if (this.calculateLabelDimensions(t, i).width < I)
      return i;
    for (var $ = 0; $ < i.length; $++) {
      var F = this.calculateLabelDimensions(t, D + i[$] + M).width;
      if (F > I)
        break;
      D += i[$], $ === i.length - 1 && (B = !0);
    }
    return B || (D += M), D;
  }
  return i;
};
co.getLabelJustification = function(t) {
  var e = t.pstyle("text-justification").strValue, r = t.pstyle("text-halign").strValue;
  if (e === "auto")
    if (t.isNode())
      switch (r) {
        case "left":
          return "right";
        case "right":
          return "left";
        default:
          return "center";
      }
    else
      return "center";
  else
    return e;
};
co.calculateLabelDimensions = function(t, e) {
  var r = this, n = r.cy.window(), i = n.document, a = 0, s = t.pstyle("font-style").strValue, o = t.pstyle("font-size").pfValue, l = t.pstyle("font-family").strValue, u = t.pstyle("font-weight").strValue, h = this.labelCalcCanvas, d = this.labelCalcCanvasContext;
  if (!h) {
    h = this.labelCalcCanvas = i.createElement("canvas"), d = this.labelCalcCanvasContext = h.getContext("2d");
    var f = h.style;
    f.position = "absolute", f.left = "-9999px", f.top = "-9999px", f.zIndex = "-1", f.visibility = "hidden", f.pointerEvents = "none";
  }
  d.font = "".concat(s, " ").concat(u, " ").concat(o, "px ").concat(l);
  for (var p = 0, g = 0, m = e.split(`
`), v = 0; v < m.length; v++) {
    var y = m[v], b = d.measureText(y), w = Math.ceil(b.width), T = o;
    p = Math.max(w, p), g += T;
  }
  return p += a, g += a, {
    width: p,
    height: g
  };
};
co.calculateLabelAngle = function(t, e) {
  var r = t._private, n = r.rscratch, i = t.isEdge(), a = e ? e + "-" : "", s = t.pstyle(a + "text-rotation"), o = s.strValue;
  return o === "none" ? 0 : i && o === "autorotate" ? n.labelAutoAngle : o === "autorotate" ? 0 : s.pfValue;
};
co.calculateLabelAngles = function(t) {
  var e = this, r = t.isEdge(), n = t._private, i = n.rscratch;
  i.labelAngle = e.calculateLabelAngle(t), r && (i.sourceLabelAngle = e.calculateLabelAngle(t, "source"), i.targetLabelAngle = e.calculateLabelAngle(t, "target"));
};
var SG = {}, U9 = 28, W9 = !1;
SG.getNodeShape = function(t) {
  var e = this, r = t.pstyle("shape").value;
  if (r === "cutrectangle" && (t.width() < U9 || t.height() < U9))
    return W9 || (Nr("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"), W9 = !0), "rectangle";
  if (t.isParent())
    return r === "rectangle" || r === "roundrectangle" || r === "round-rectangle" || r === "cutrectangle" || r === "cut-rectangle" || r === "barrel" ? r : "rectangle";
  if (r === "polygon") {
    var n = t.pstyle("shape-polygon-points").value;
    return e.nodeShapes.makePolygon(n).name;
  }
  return r;
};
var Hx = {};
Hx.registerCalculationListeners = function() {
  var t = this.cy, e = t.collection(), r = this, n = function(s) {
    var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
    if (e.merge(s), o)
      for (var l = 0; l < s.length; l++) {
        var u = s[l], h = u._private, d = h.rstyle;
        d.clean = !1, d.cleanConnected = !1;
      }
  };
  r.binder(t).on("bounds.* dirty.*", function(s) {
    var o = s.target;
    n(o);
  }).on("style.* background.*", function(s) {
    var o = s.target;
    n(o, !1);
  });
  var i = function(s) {
    if (s) {
      var o = r.onUpdateEleCalcsFns;
      e.cleanStyle();
      for (var l = 0; l < e.length; l++) {
        var u = e[l], h = u._private.rstyle;
        u.isNode() && !h.cleanConnected && (n(u.connectedEdges()), h.cleanConnected = !0);
      }
      if (o)
        for (var d = 0; d < o.length; d++) {
          var f = o[d];
          f(s, e);
        }
      r.recalculateRenderedStyle(e), e = t.collection();
    }
  };
  r.flushRenderedStyleQueue = function() {
    i(!0);
  }, r.beforeRender(i, r.beforeRenderPriorities.eleCalcs);
};
Hx.onUpdateEleCalcs = function(t) {
  var e = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || [];
  e.push(t);
};
Hx.recalculateRenderedStyle = function(t, e) {
  var r = function(T) {
    return T._private.rstyle.cleanConnected;
  };
  if (t.length !== 0) {
    var n = [], i = [];
    if (!this.destroyed) {
      e === void 0 && (e = !0);
      for (var a = 0; a < t.length; a++) {
        var s = t[a], o = s._private, l = o.rstyle;
        s.isEdge() && (!r(s.source()) || !r(s.target())) && (l.clean = !1), s.isEdge() && s.isBundledBezier() && s.parallelEdges().some(function(w) {
          return !w._private.rstyle.clean && w.isBundledBezier();
        }) && (l.clean = !1), !(e && l.clean || s.removed()) && s.pstyle("display").value !== "none" && (o.group === "nodes" ? i.push(s) : n.push(s), l.clean = !0);
      }
      for (var u = 0; u < i.length; u++) {
        var h = i[u], d = h._private, f = d.rstyle, p = h.position();
        this.recalculateNodeLabelProjection(h), f.nodeX = p.x, f.nodeY = p.y, f.nodeW = h.pstyle("width").pfValue, f.nodeH = h.pstyle("height").pfValue;
      }
      this.recalculateEdgeProjections(n);
      for (var g = 0; g < n.length; g++) {
        var m = n[g], v = m._private, y = v.rstyle, b = v.rscratch;
        y.srcX = b.arrowStartX, y.srcY = b.arrowStartY, y.tgtX = b.arrowEndX, y.tgtY = b.arrowEndY, y.midX = b.midX, y.midY = b.midY, y.labelAngle = b.labelAngle, y.sourceLabelAngle = b.sourceLabelAngle, y.targetLabelAngle = b.targetLabelAngle;
      }
    }
  }
};
var qx = {};
qx.updateCachedGrabbedEles = function() {
  var t = this.cachedZSortedEles;
  if (t) {
    t.drag = [], t.nondrag = [];
    for (var e = [], r = 0; r < t.length; r++) {
      var n = t[r], i = n._private.rscratch;
      n.grabbed() && !n.isParent() ? e.push(n) : i.inDragLayer ? t.drag.push(n) : t.nondrag.push(n);
    }
    for (var r = 0; r < e.length; r++) {
      var n = e[r];
      t.drag.push(n);
    }
  }
};
qx.invalidateCachedZSortedEles = function() {
  this.cachedZSortedEles = null;
};
qx.getCachedZSortedEles = function(t) {
  if (t || !this.cachedZSortedEles) {
    var e = this.cy.mutableElements().toArray();
    e.sort(sG), e.interactive = e.filter(function(r) {
      return r.interactive();
    }), this.cachedZSortedEles = e, this.updateCachedGrabbedEles();
  } else
    e = this.cachedZSortedEles;
  return e;
};
var CG = {};
[Fu, Uy, Ni, a1, uS, co, SG, Hx, qx].forEach(function(t) {
  Gt(CG, t);
});
var AG = {};
AG.getCachedImage = function(t, e, r) {
  var n = this, i = n.imageCache = n.imageCache || {}, a = i[t];
  if (a)
    return a.image.complete || a.image.addEventListener("load", r), a.image;
  a = i[t] = i[t] || {};
  var s = a.image = new Image();
  s.addEventListener("load", r), s.addEventListener("error", function() {
    s.error = !0;
  });
  var o = "data:", l = t.substring(0, o.length).toLowerCase() === o;
  return l || (e = e === "null" ? null : e, s.crossOrigin = e), s.src = t, s;
};
var Pf = {};
Pf.registerBinding = function(t, e, r, n) {
  var i = Array.prototype.slice.apply(arguments, [1]);
  if (Array.isArray(t)) {
    for (var a = [], s = 0; s < t.length; s++) {
      var o = t[s];
      if (o !== void 0) {
        var l = this.binder(o);
        a.push(l.on.apply(l, i));
      }
    }
    return a;
  }
  var l = this.binder(t);
  return l.on.apply(l, i);
};
Pf.binder = function(t) {
  var e = this, r = e.cy.window(), n = t === r || t === r.document || t === r.document.body || Nme(t);
  if (e.supportsPassiveEvents == null) {
    var i = !1;
    try {
      var a = Object.defineProperty({}, "passive", {
        get: function() {
          return i = !0, !0;
        }
      });
      r.addEventListener("test", null, a);
    } catch {
    }
    e.supportsPassiveEvents = i;
  }
  var s = function(l, u, h) {
    var d = Array.prototype.slice.call(arguments);
    return n && e.supportsPassiveEvents && (d[2] = {
      capture: h ?? !1,
      passive: !1,
      once: !1
    }), e.bindings.push({
      target: t,
      args: d
    }), (t.addEventListener || t.on).apply(t, d), this;
  };
  return {
    on: s,
    addEventListener: s,
    addListener: s,
    bind: s
  };
};
Pf.nodeIsDraggable = function(t) {
  return t && t.isNode() && !t.locked() && t.grabbable();
};
Pf.nodeIsGrabbable = function(t) {
  return this.nodeIsDraggable(t) && t.interactive();
};
Pf.load = function() {
  var t = this, e = t.cy.window(), r = function(z) {
    return z.selected();
  }, n = function(z) {
    var oe = z.getRootNode();
    if (oe && oe.nodeType === 11 && oe.host !== void 0)
      return oe;
  }, i = function(z, oe, se, ge) {
    z == null && (z = t.cy);
    for (var de = 0; de < oe.length; de++) {
      var be = oe[de];
      z.emit({
        originalEvent: se,
        type: be,
        position: ge
      });
    }
  }, a = function(z) {
    return z.shiftKey || z.metaKey || z.ctrlKey;
  }, s = function(z, oe) {
    var se = !0;
    if (t.cy.hasCompoundNodes() && z && z.pannable())
      for (var ge = 0; oe && ge < oe.length; ge++) {
        var z = oe[ge];
        if (z.isNode() && z.isParent() && !z.pannable()) {
          se = !1;
          break;
        }
      }
    else
      se = !0;
    return se;
  }, o = function(z) {
    z[0]._private.grabbed = !0;
  }, l = function(z) {
    z[0]._private.grabbed = !1;
  }, u = function(z) {
    z[0]._private.rscratch.inDragLayer = !0;
  }, h = function(z) {
    z[0]._private.rscratch.inDragLayer = !1;
  }, d = function(z) {
    z[0]._private.rscratch.isGrabTarget = !0;
  }, f = function(z) {
    z[0]._private.rscratch.isGrabTarget = !1;
  }, p = function(z, oe) {
    var se = oe.addToList, ge = se.has(z);
    !ge && z.grabbable() && !z.locked() && (se.merge(z), o(z));
  }, g = function(z, oe) {
    if (z.cy().hasCompoundNodes() && !(oe.inDragLayer == null && oe.addToList == null)) {
      var se = z.descendants();
      oe.inDragLayer && (se.forEach(u), se.connectedEdges().forEach(u)), oe.addToList && p(se, oe);
    }
  }, m = function(z, oe) {
    oe = oe || {};
    var se = z.cy().hasCompoundNodes();
    oe.inDragLayer && (z.forEach(u), z.neighborhood().stdFilter(function(ge) {
      return !se || ge.isEdge();
    }).forEach(u)), oe.addToList && z.forEach(function(ge) {
      p(ge, oe);
    }), g(z, oe), b(z, {
      inDragLayer: oe.inDragLayer
    }), t.updateCachedGrabbedEles();
  }, v = m, y = function(z) {
    z && (t.getCachedZSortedEles().forEach(function(oe) {
      l(oe), h(oe), f(oe);
    }), t.updateCachedGrabbedEles());
  }, b = function(z, oe) {
    if (!(oe.inDragLayer == null && oe.addToList == null) && z.cy().hasCompoundNodes()) {
      var se = z.ancestors().orphans();
      if (!se.same(z)) {
        var ge = se.descendants().spawnSelf().merge(se).unmerge(z).unmerge(z.descendants()), de = ge.connectedEdges();
        oe.inDragLayer && (de.forEach(u), ge.forEach(u)), oe.addToList && ge.forEach(function(be) {
          p(be, oe);
        });
      }
    }
  }, w = function() {
    document.activeElement != null && document.activeElement.blur != null && document.activeElement.blur();
  }, T = typeof MutationObserver < "u", E = typeof ResizeObserver < "u";
  T ? (t.removeObserver = new MutationObserver(function(ce) {
    for (var z = 0; z < ce.length; z++) {
      var oe = ce[z], se = oe.removedNodes;
      if (se)
        for (var ge = 0; ge < se.length; ge++) {
          var de = se[ge];
          if (de === t.container) {
            t.destroy();
            break;
          }
        }
    }
  }), t.container.parentNode && t.removeObserver.observe(t.container.parentNode, {
    childList: !0
  })) : t.registerBinding(t.container, "DOMNodeRemoved", function(ce) {
    t.destroy();
  });
  var C = t1(function() {
    t.cy.resize();
  }, 100);
  T && (t.styleObserver = new MutationObserver(C), t.styleObserver.observe(t.container, {
    attributes: !0
  })), t.registerBinding(e, "resize", C), E && (t.resizeObserver = new ResizeObserver(C), t.resizeObserver.observe(t.container));
  var k = function(z, oe) {
    for (; z != null; )
      oe(z), z = z.parentNode;
  }, _ = function() {
    t.invalidateContainerClientCoordsCache();
  };
  k(t.container, function(ce) {
    t.registerBinding(ce, "transitionend", _), t.registerBinding(ce, "animationend", _), t.registerBinding(ce, "scroll", _);
  }), t.registerBinding(t.container, "contextmenu", function(ce) {
    ce.preventDefault();
  });
  var L = function() {
    return t.selection[4] !== 0;
  }, N = function(z) {
    for (var oe = t.findContainerClientCoords(), se = oe[0], ge = oe[1], de = oe[2], be = oe[3], Ce = z.touches ? z.touches : [z], Te = !1, Ne = 0; Ne < Ce.length; Ne++) {
      var Xe = Ce[Ne];
      if (se <= Xe.clientX && Xe.clientX <= se + de && ge <= Xe.clientY && Xe.clientY <= ge + be) {
        Te = !0;
        break;
      }
    }
    if (!Te)
      return !1;
    for (var Ye = t.container, Ke = z.target, Ze = Ke.parentNode, Be = !1; Ze; ) {
      if (Ze === Ye) {
        Be = !0;
        break;
      }
      Ze = Ze.parentNode;
    }
    return !!Be;
  };
  t.registerBinding(t.container, "mousedown", function(z) {
    if (N(z) && !(t.hoverData.which === 1 && z.which !== 1)) {
      z.preventDefault(), w(), t.hoverData.capture = !0, t.hoverData.which = z.which;
      var oe = t.cy, se = [z.clientX, z.clientY], ge = t.projectIntoViewport(se[0], se[1]), de = t.selection, be = t.findNearestElements(ge[0], ge[1], !0, !1), Ce = be[0], Te = t.dragData.possibleDragElements;
      t.hoverData.mdownPos = ge, t.hoverData.mdownGPos = se;
      var Ne = function(He) {
        return {
          originalEvent: z,
          type: He,
          position: {
            x: ge[0],
            y: ge[1]
          }
        };
      }, Xe = function() {
        t.hoverData.tapholdCancelled = !1, clearTimeout(t.hoverData.tapholdTimeout), t.hoverData.tapholdTimeout = setTimeout(function() {
          if (!t.hoverData.tapholdCancelled) {
            var He = t.hoverData.down;
            He ? He.emit(Ne("taphold")) : oe.emit(Ne("taphold"));
          }
        }, t.tapholdDuration);
      };
      if (z.which == 3) {
        t.hoverData.cxtStarted = !0;
        var Ye = {
          originalEvent: z,
          type: "cxttapstart",
          position: {
            x: ge[0],
            y: ge[1]
          }
        };
        Ce ? (Ce.activate(), Ce.emit(Ye), t.hoverData.down = Ce) : oe.emit(Ye), t.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(), t.hoverData.cxtDragged = !1;
      } else if (z.which == 1) {
        Ce && Ce.activate();
        {
          if (Ce != null && t.nodeIsGrabbable(Ce)) {
            var Ke = function(He) {
              He.emit(Ne("grab"));
            };
            if (d(Ce), !Ce.selected())
              Te = t.dragData.possibleDragElements = oe.collection(), v(Ce, {
                addToList: Te
              }), Ce.emit(Ne("grabon")).emit(Ne("grab"));
            else {
              Te = t.dragData.possibleDragElements = oe.collection();
              var Ze = oe.$(function(Be) {
                return Be.isNode() && Be.selected() && t.nodeIsGrabbable(Be);
              });
              m(Ze, {
                addToList: Te
              }), Ce.emit(Ne("grabon")), Ze.forEach(Ke);
            }
            t.redrawHint("eles", !0), t.redrawHint("drag", !0);
          }
          t.hoverData.down = Ce, t.hoverData.downs = be, t.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime();
        }
        i(Ce, ["mousedown", "tapstart", "vmousedown"], z, {
          x: ge[0],
          y: ge[1]
        }), Ce == null ? (de[4] = 1, t.data.bgActivePosistion = {
          x: ge[0],
          y: ge[1]
        }, t.redrawHint("select", !0), t.redraw()) : Ce.pannable() && (de[4] = 1), Xe();
      }
      de[0] = de[2] = ge[0], de[1] = de[3] = ge[1];
    }
  }, !1);
  var A = n(t.container);
  t.registerBinding([e, A], "mousemove", function(z) {
    var oe = t.hoverData.capture;
    if (!(!oe && !N(z))) {
      var se = !1, ge = t.cy, de = ge.zoom(), be = [z.clientX, z.clientY], Ce = t.projectIntoViewport(be[0], be[1]), Te = t.hoverData.mdownPos, Ne = t.hoverData.mdownGPos, Xe = t.selection, Ye = null;
      !t.hoverData.draggingEles && !t.hoverData.dragging && !t.hoverData.selecting && (Ye = t.findNearestElement(Ce[0], Ce[1], !0, !1));
      var Ke = t.hoverData.last, Ze = t.hoverData.down, Be = [Ce[0] - Xe[2], Ce[1] - Xe[3]], He = t.dragData.possibleDragElements, ht;
      if (Ne) {
        var st = be[0] - Ne[0], We = st * st, kt = be[1] - Ne[1], qe = kt * kt, rt = We + qe;
        t.hoverData.isOverThresholdDrag = ht = rt >= t.desktopTapThreshold2;
      }
      var ct = a(z);
      ht && (t.hoverData.tapholdCancelled = !0);
      var ut = function() {
        var dt = t.hoverData.dragDelta = t.hoverData.dragDelta || [];
        dt.length === 0 ? (dt.push(Be[0]), dt.push(Be[1])) : (dt[0] += Be[0], dt[1] += Be[1]);
      };
      se = !0, i(Ye, ["mousemove", "vmousemove", "tapdrag"], z, {
        x: Ce[0],
        y: Ce[1]
      });
      var nt = function(dt) {
        return {
          originalEvent: z,
          type: dt,
          position: {
            x: Ce[0],
            y: Ce[1]
          }
        };
      }, bt = function() {
        t.data.bgActivePosistion = void 0, t.hoverData.selecting || ge.emit(nt("boxstart")), Xe[4] = 1, t.hoverData.selecting = !0, t.redrawHint("select", !0), t.redraw();
      };
      if (t.hoverData.which === 3) {
        if (ht) {
          var Zt = nt("cxtdrag");
          Ze ? Ze.emit(Zt) : ge.emit(Zt), t.hoverData.cxtDragged = !0, (!t.hoverData.cxtOver || Ye !== t.hoverData.cxtOver) && (t.hoverData.cxtOver && t.hoverData.cxtOver.emit(nt("cxtdragout")), t.hoverData.cxtOver = Ye, Ye && Ye.emit(nt("cxtdragover")));
        }
      } else if (t.hoverData.dragging) {
        if (se = !0, ge.panningEnabled() && ge.userPanningEnabled()) {
          var Ot;
          if (t.hoverData.justStartedPan) {
            var tr = t.hoverData.mdownPos;
            Ot = {
              x: (Ce[0] - tr[0]) * de,
              y: (Ce[1] - tr[1]) * de
            }, t.hoverData.justStartedPan = !1;
          } else
            Ot = {
              x: Be[0] * de,
              y: Be[1] * de
            };
          ge.panBy(Ot), ge.emit(nt("dragpan")), t.hoverData.dragged = !0;
        }
        Ce = t.projectIntoViewport(z.clientX, z.clientY);
      } else if (Xe[4] == 1 && (Ze == null || Ze.pannable())) {
        if (ht) {
          if (!t.hoverData.dragging && ge.boxSelectionEnabled() && (ct || !ge.panningEnabled() || !ge.userPanningEnabled()))
            bt();
          else if (!t.hoverData.selecting && ge.panningEnabled() && ge.userPanningEnabled()) {
            var xr = s(Ze, t.hoverData.downs);
            xr && (t.hoverData.dragging = !0, t.hoverData.justStartedPan = !0, Xe[4] = 0, t.data.bgActivePosistion = Th(Te), t.redrawHint("select", !0), t.redraw());
          }
          Ze && Ze.pannable() && Ze.active() && Ze.unactivate();
        }
      } else {
        if (Ze && Ze.pannable() && Ze.active() && Ze.unactivate(), (!Ze || !Ze.grabbed()) && Ye != Ke && (Ke && i(Ke, ["mouseout", "tapdragout"], z, {
          x: Ce[0],
          y: Ce[1]
        }), Ye && i(Ye, ["mouseover", "tapdragover"], z, {
          x: Ce[0],
          y: Ce[1]
        }), t.hoverData.last = Ye), Ze)
          if (ht) {
            if (ge.boxSelectionEnabled() && ct)
              Ze && Ze.grabbed() && (y(He), Ze.emit(nt("freeon")), He.emit(nt("free")), t.dragData.didDrag && (Ze.emit(nt("dragfreeon")), He.emit(nt("dragfree")))), bt();
            else if (Ze && Ze.grabbed() && t.nodeIsDraggable(Ze)) {
              var rr = !t.dragData.didDrag;
              rr && t.redrawHint("eles", !0), t.dragData.didDrag = !0, t.hoverData.draggingEles || m(He, {
                inDragLayer: !0
              });
              var Wt = {
                x: 0,
                y: 0
              };
              if (vt(Be[0]) && vt(Be[1]) && (Wt.x += Be[0], Wt.y += Be[1], rr)) {
                var lr = t.hoverData.dragDelta;
                lr && vt(lr[0]) && vt(lr[1]) && (Wt.x += lr[0], Wt.y += lr[1]);
              }
              t.hoverData.draggingEles = !0, He.silentShift(Wt).emit(nt("position")).emit(nt("drag")), t.redrawHint("drag", !0), t.redraw();
            }
          } else
            ut();
        se = !0;
      }
      if (Xe[2] = Ce[0], Xe[3] = Ce[1], se)
        return z.stopPropagation && z.stopPropagation(), z.preventDefault && z.preventDefault(), !1;
    }
  }, !1);
  var O, P, S;
  t.registerBinding(e, "mouseup", function(z) {
    if (!(t.hoverData.which === 1 && z.which !== 1 && t.hoverData.capture)) {
      var oe = t.hoverData.capture;
      if (oe) {
        t.hoverData.capture = !1;
        var se = t.cy, ge = t.projectIntoViewport(z.clientX, z.clientY), de = t.selection, be = t.findNearestElement(ge[0], ge[1], !0, !1), Ce = t.dragData.possibleDragElements, Te = t.hoverData.down, Ne = a(z);
        t.data.bgActivePosistion && (t.redrawHint("select", !0), t.redraw()), t.hoverData.tapholdCancelled = !0, t.data.bgActivePosistion = void 0, Te && Te.unactivate();
        var Xe = function(st) {
          return {
            originalEvent: z,
            type: st,
            position: {
              x: ge[0],
              y: ge[1]
            }
          };
        };
        if (t.hoverData.which === 3) {
          var Ye = Xe("cxttapend");
          if (Te ? Te.emit(Ye) : se.emit(Ye), !t.hoverData.cxtDragged) {
            var Ke = Xe("cxttap");
            Te ? Te.emit(Ke) : se.emit(Ke);
          }
          t.hoverData.cxtDragged = !1, t.hoverData.which = null;
        } else if (t.hoverData.which === 1) {
          if (i(be, ["mouseup", "tapend", "vmouseup"], z, {
            x: ge[0],
            y: ge[1]
          }), !t.dragData.didDrag && // didn't move a node around
          !t.hoverData.dragged && // didn't pan
          !t.hoverData.selecting && // not box selection
          !t.hoverData.isOverThresholdDrag && (i(Te, ["click", "tap", "vclick"], z, {
            x: ge[0],
            y: ge[1]
          }), P = !1, z.timeStamp - S <= se.multiClickDebounceTime() ? (O && clearTimeout(O), P = !0, S = null, i(Te, ["dblclick", "dbltap", "vdblclick"], z, {
            x: ge[0],
            y: ge[1]
          })) : (O = setTimeout(function() {
            P || i(Te, ["oneclick", "onetap", "voneclick"], z, {
              x: ge[0],
              y: ge[1]
            });
          }, se.multiClickDebounceTime()), S = z.timeStamp)), Te == null && !t.dragData.didDrag && !t.hoverData.selecting && !t.hoverData.dragged && !a(z) && (se.$(r).unselect(["tapunselect"]), Ce.length > 0 && t.redrawHint("eles", !0), t.dragData.possibleDragElements = Ce = se.collection()), be == Te && !t.dragData.didDrag && !t.hoverData.selecting && be != null && be._private.selectable && (t.hoverData.dragging || (se.selectionType() === "additive" || Ne ? be.selected() ? be.unselect(["tapunselect"]) : be.select(["tapselect"]) : Ne || (se.$(r).unmerge(be).unselect(["tapunselect"]), be.select(["tapselect"]))), t.redrawHint("eles", !0)), t.hoverData.selecting) {
            var Ze = se.collection(t.getAllInBox(de[0], de[1], de[2], de[3]));
            t.redrawHint("select", !0), Ze.length > 0 && t.redrawHint("eles", !0), se.emit(Xe("boxend"));
            var Be = function(st) {
              return st.selectable() && !st.selected();
            };
            se.selectionType() === "additive" || Ne || se.$(r).unmerge(Ze).unselect(), Ze.emit(Xe("box")).stdFilter(Be).select().emit(Xe("boxselect")), t.redraw();
          }
          if (t.hoverData.dragging && (t.hoverData.dragging = !1, t.redrawHint("select", !0), t.redrawHint("eles", !0), t.redraw()), !de[4]) {
            t.redrawHint("drag", !0), t.redrawHint("eles", !0);
            var He = Te && Te.grabbed();
            y(Ce), He && (Te.emit(Xe("freeon")), Ce.emit(Xe("free")), t.dragData.didDrag && (Te.emit(Xe("dragfreeon")), Ce.emit(Xe("dragfree"))));
          }
        }
        de[4] = 0, t.hoverData.down = null, t.hoverData.cxtStarted = !1, t.hoverData.draggingEles = !1, t.hoverData.selecting = !1, t.hoverData.isOverThresholdDrag = !1, t.dragData.didDrag = !1, t.hoverData.dragged = !1, t.hoverData.dragDelta = [], t.hoverData.mdownPos = null, t.hoverData.mdownGPos = null, t.hoverData.which = null;
      }
    }
  }, !1);
  var R = [], I = 4, D, M = 1e5, B = function(z, oe) {
    for (var se = 0; se < z.length; se++)
      if (z[se] % oe !== 0)
        return !1;
    return !0;
  }, $ = function(z) {
    for (var oe = Math.abs(z[0]), se = 1; se < z.length; se++)
      if (Math.abs(z[se]) !== oe)
        return !1;
    return !0;
  }, F = function(z) {
    var oe = !1, se = z.deltaY;
    if (se == null && (z.wheelDeltaY != null ? se = z.wheelDeltaY / 4 : z.wheelDelta != null && (se = z.wheelDelta / 4)), se !== 0) {
      if (D == null)
        if (R.length >= I) {
          var ge = R;
          if (D = B(ge, 5), !D) {
            var de = Math.abs(ge[0]);
            D = $(ge) && de > 5;
          }
          if (D)
            for (var be = 0; be < ge.length; be++)
              M = Math.min(Math.abs(ge[be]), M);
        } else
          R.push(se), oe = !0;
      else D && (M = Math.min(Math.abs(se), M));
      if (!t.scrollingPage) {
        var Ce = t.cy, Te = Ce.zoom(), Ne = Ce.pan(), Xe = t.projectIntoViewport(z.clientX, z.clientY), Ye = [Xe[0] * Te + Ne.x, Xe[1] * Te + Ne.y];
        if (t.hoverData.draggingEles || t.hoverData.dragging || t.hoverData.cxtStarted || L()) {
          z.preventDefault();
          return;
        }
        if (Ce.panningEnabled() && Ce.userPanningEnabled() && Ce.zoomingEnabled() && Ce.userZoomingEnabled()) {
          z.preventDefault(), t.data.wheelZooming = !0, clearTimeout(t.data.wheelTimeout), t.data.wheelTimeout = setTimeout(function() {
            t.data.wheelZooming = !1, t.redrawHint("eles", !0), t.redraw();
          }, 150);
          var Ke;
          oe && Math.abs(se) > 5 && (se = Kk(se) * 5), Ke = se / -250, D && (Ke /= M, Ke *= 3), Ke = Ke * t.wheelSensitivity;
          var Ze = z.deltaMode === 1;
          Ze && (Ke *= 33);
          var Be = Ce.zoom() * Math.pow(10, Ke);
          z.type === "gesturechange" && (Be = t.gestureStartZoom * z.scale), Ce.zoom({
            level: Be,
            renderedPosition: {
              x: Ye[0],
              y: Ye[1]
            }
          }), Ce.emit({
            type: z.type === "gesturechange" ? "pinchzoom" : "scrollzoom",
            originalEvent: z,
            position: {
              x: Xe[0],
              y: Xe[1]
            }
          });
        }
      }
    }
  };
  t.registerBinding(t.container, "wheel", F, !0), t.registerBinding(e, "scroll", function(z) {
    t.scrollingPage = !0, clearTimeout(t.scrollingPageTimeout), t.scrollingPageTimeout = setTimeout(function() {
      t.scrollingPage = !1;
    }, 250);
  }, !0), t.registerBinding(t.container, "gesturestart", function(z) {
    t.gestureStartZoom = t.cy.zoom(), t.hasTouchStarted || z.preventDefault();
  }, !0), t.registerBinding(t.container, "gesturechange", function(ce) {
    t.hasTouchStarted || F(ce);
  }, !0), t.registerBinding(t.container, "mouseout", function(z) {
    var oe = t.projectIntoViewport(z.clientX, z.clientY);
    t.cy.emit({
      originalEvent: z,
      type: "mouseout",
      position: {
        x: oe[0],
        y: oe[1]
      }
    });
  }, !1), t.registerBinding(t.container, "mouseover", function(z) {
    var oe = t.projectIntoViewport(z.clientX, z.clientY);
    t.cy.emit({
      originalEvent: z,
      type: "mouseover",
      position: {
        x: oe[0],
        y: oe[1]
      }
    });
  }, !1);
  var G, H, ee, Y, re, ne, he, K, Z, X, q, J, j, pe = function(z, oe, se, ge) {
    return Math.sqrt((se - z) * (se - z) + (ge - oe) * (ge - oe));
  }, te = function(z, oe, se, ge) {
    return (se - z) * (se - z) + (ge - oe) * (ge - oe);
  }, Ae;
  t.registerBinding(t.container, "touchstart", Ae = function(z) {
    if (t.hasTouchStarted = !0, !!N(z)) {
      w(), t.touchData.capture = !0, t.data.bgActivePosistion = void 0;
      var oe = t.cy, se = t.touchData.now, ge = t.touchData.earlier;
      if (z.touches[0]) {
        var de = t.projectIntoViewport(z.touches[0].clientX, z.touches[0].clientY);
        se[0] = de[0], se[1] = de[1];
      }
      if (z.touches[1]) {
        var de = t.projectIntoViewport(z.touches[1].clientX, z.touches[1].clientY);
        se[2] = de[0], se[3] = de[1];
      }
      if (z.touches[2]) {
        var de = t.projectIntoViewport(z.touches[2].clientX, z.touches[2].clientY);
        se[4] = de[0], se[5] = de[1];
      }
      var be = function(ct) {
        return {
          originalEvent: z,
          type: ct,
          position: {
            x: se[0],
            y: se[1]
          }
        };
      };
      if (z.touches[1]) {
        t.touchData.singleTouchMoved = !0, y(t.dragData.touchDragEles);
        var Ce = t.findContainerClientCoords();
        Z = Ce[0], X = Ce[1], q = Ce[2], J = Ce[3], G = z.touches[0].clientX - Z, H = z.touches[0].clientY - X, ee = z.touches[1].clientX - Z, Y = z.touches[1].clientY - X, j = 0 <= G && G <= q && 0 <= ee && ee <= q && 0 <= H && H <= J && 0 <= Y && Y <= J;
        var Te = oe.pan(), Ne = oe.zoom();
        re = pe(G, H, ee, Y), ne = te(G, H, ee, Y), he = [(G + ee) / 2, (H + Y) / 2], K = [(he[0] - Te.x) / Ne, (he[1] - Te.y) / Ne];
        var Xe = 200, Ye = Xe * Xe;
        if (ne < Ye && !z.touches[2]) {
          var Ke = t.findNearestElement(se[0], se[1], !0, !0), Ze = t.findNearestElement(se[2], se[3], !0, !0);
          Ke && Ke.isNode() ? (Ke.activate().emit(be("cxttapstart")), t.touchData.start = Ke) : Ze && Ze.isNode() ? (Ze.activate().emit(be("cxttapstart")), t.touchData.start = Ze) : oe.emit(be("cxttapstart")), t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxt = !0, t.touchData.cxtDragged = !1, t.data.bgActivePosistion = void 0, t.redraw();
          return;
        }
      }
      if (z.touches[2])
        oe.boxSelectionEnabled() && z.preventDefault();
      else if (!z.touches[1]) {
        if (z.touches[0]) {
          var Be = t.findNearestElements(se[0], se[1], !0, !0), He = Be[0];
          if (He != null && (He.activate(), t.touchData.start = He, t.touchData.starts = Be, t.nodeIsGrabbable(He))) {
            var ht = t.dragData.touchDragEles = oe.collection(), st = null;
            t.redrawHint("eles", !0), t.redrawHint("drag", !0), He.selected() ? (st = oe.$(function(rt) {
              return rt.selected() && t.nodeIsGrabbable(rt);
            }), m(st, {
              addToList: ht
            })) : v(He, {
              addToList: ht
            }), d(He), He.emit(be("grabon")), st ? st.forEach(function(rt) {
              rt.emit(be("grab"));
            }) : He.emit(be("grab"));
          }
          i(He, ["touchstart", "tapstart", "vmousedown"], z, {
            x: se[0],
            y: se[1]
          }), He == null && (t.data.bgActivePosistion = {
            x: de[0],
            y: de[1]
          }, t.redrawHint("select", !0), t.redraw()), t.touchData.singleTouchMoved = !1, t.touchData.singleTouchStartTime = +/* @__PURE__ */ new Date(), clearTimeout(t.touchData.tapholdTimeout), t.touchData.tapholdTimeout = setTimeout(function() {
            t.touchData.singleTouchMoved === !1 && !t.pinching && !t.touchData.selecting && i(t.touchData.start, ["taphold"], z, {
              x: se[0],
              y: se[1]
            });
          }, t.tapholdDuration);
        }
      }
      if (z.touches.length >= 1) {
        for (var We = t.touchData.startPosition = [null, null, null, null, null, null], kt = 0; kt < se.length; kt++)
          We[kt] = ge[kt] = se[kt];
        var qe = z.touches[0];
        t.touchData.startGPosition = [qe.clientX, qe.clientY];
      }
    }
  }, !1);
  var W;
  t.registerBinding(e, "touchmove", W = function(z) {
    var oe = t.touchData.capture;
    if (!(!oe && !N(z))) {
      var se = t.selection, ge = t.cy, de = t.touchData.now, be = t.touchData.earlier, Ce = ge.zoom();
      if (z.touches[0]) {
        var Te = t.projectIntoViewport(z.touches[0].clientX, z.touches[0].clientY);
        de[0] = Te[0], de[1] = Te[1];
      }
      if (z.touches[1]) {
        var Te = t.projectIntoViewport(z.touches[1].clientX, z.touches[1].clientY);
        de[2] = Te[0], de[3] = Te[1];
      }
      if (z.touches[2]) {
        var Te = t.projectIntoViewport(z.touches[2].clientX, z.touches[2].clientY);
        de[4] = Te[0], de[5] = Te[1];
      }
      var Ne = function(w1) {
        return {
          originalEvent: z,
          type: w1,
          position: {
            x: de[0],
            y: de[1]
          }
        };
      }, Xe = t.touchData.startGPosition, Ye;
      if (oe && z.touches[0] && Xe) {
        for (var Ke = [], Ze = 0; Ze < de.length; Ze++)
          Ke[Ze] = de[Ze] - be[Ze];
        var Be = z.touches[0].clientX - Xe[0], He = Be * Be, ht = z.touches[0].clientY - Xe[1], st = ht * ht, We = He + st;
        Ye = We >= t.touchTapThreshold2;
      }
      if (oe && t.touchData.cxt) {
        z.preventDefault();
        var kt = z.touches[0].clientX - Z, qe = z.touches[0].clientY - X, rt = z.touches[1].clientX - Z, ct = z.touches[1].clientY - X, ut = te(kt, qe, rt, ct), nt = ut / ne, bt = 150, Zt = bt * bt, Ot = 1.5, tr = Ot * Ot;
        if (nt >= tr || ut >= Zt) {
          t.touchData.cxt = !1, t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
          var xr = Ne("cxttapend");
          t.touchData.start ? (t.touchData.start.unactivate().emit(xr), t.touchData.start = null) : ge.emit(xr);
        }
      }
      if (oe && t.touchData.cxt) {
        var xr = Ne("cxtdrag");
        t.data.bgActivePosistion = void 0, t.redrawHint("select", !0), t.touchData.start ? t.touchData.start.emit(xr) : ge.emit(xr), t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxtDragged = !0;
        var rr = t.findNearestElement(de[0], de[1], !0, !0);
        (!t.touchData.cxtOver || rr !== t.touchData.cxtOver) && (t.touchData.cxtOver && t.touchData.cxtOver.emit(Ne("cxtdragout")), t.touchData.cxtOver = rr, rr && rr.emit(Ne("cxtdragover")));
      } else if (oe && z.touches[2] && ge.boxSelectionEnabled())
        z.preventDefault(), t.data.bgActivePosistion = void 0, this.lastThreeTouch = +/* @__PURE__ */ new Date(), t.touchData.selecting || ge.emit(Ne("boxstart")), t.touchData.selecting = !0, t.touchData.didSelect = !0, se[4] = 1, !se || se.length === 0 || se[0] === void 0 ? (se[0] = (de[0] + de[2] + de[4]) / 3, se[1] = (de[1] + de[3] + de[5]) / 3, se[2] = (de[0] + de[2] + de[4]) / 3 + 1, se[3] = (de[1] + de[3] + de[5]) / 3 + 1) : (se[2] = (de[0] + de[2] + de[4]) / 3, se[3] = (de[1] + de[3] + de[5]) / 3), t.redrawHint("select", !0), t.redraw();
      else if (oe && z.touches[1] && !t.touchData.didSelect && ge.zoomingEnabled() && ge.panningEnabled() && ge.userZoomingEnabled() && ge.userPanningEnabled()) {
        z.preventDefault(), t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
        var Wt = t.dragData.touchDragEles;
        if (Wt) {
          t.redrawHint("drag", !0);
          for (var lr = 0; lr < Wt.length; lr++) {
            var an = Wt[lr]._private;
            an.grabbed = !1, an.rscratch.inDragLayer = !1;
          }
        }
        var dt = t.touchData.start, kt = z.touches[0].clientX - Z, qe = z.touches[0].clientY - X, rt = z.touches[1].clientX - Z, ct = z.touches[1].clientY - X, Ee = pe(kt, qe, rt, ct), Je = Ee / re;
        if (j) {
          var wt = kt - G, sr = qe - H, Ur = rt - ee, cr = ct - Y, Yr = (wt + Ur) / 2, pi = (sr + cr) / 2, xn = ge.zoom(), bn = xn * Je, pt = ge.pan(), Tt = K[0] * xn + pt.x, lt = K[1] * xn + pt.y, je = {
            x: -bn / xn * (Tt - pt.x - Yr) + Tt,
            y: -bn / xn * (lt - pt.y - pi) + lt
          };
          if (dt && dt.active()) {
            var Wt = t.dragData.touchDragEles;
            y(Wt), t.redrawHint("drag", !0), t.redrawHint("eles", !0), dt.unactivate().emit(Ne("freeon")), Wt.emit(Ne("free")), t.dragData.didDrag && (dt.emit(Ne("dragfreeon")), Wt.emit(Ne("dragfree")));
          }
          ge.viewport({
            zoom: bn,
            pan: je,
            cancelOnFailedZoom: !0
          }), ge.emit(Ne("pinchzoom")), re = Ee, G = kt, H = qe, ee = rt, Y = ct, t.pinching = !0;
        }
        if (z.touches[0]) {
          var Te = t.projectIntoViewport(z.touches[0].clientX, z.touches[0].clientY);
          de[0] = Te[0], de[1] = Te[1];
        }
        if (z.touches[1]) {
          var Te = t.projectIntoViewport(z.touches[1].clientX, z.touches[1].clientY);
          de[2] = Te[0], de[3] = Te[1];
        }
        if (z.touches[2]) {
          var Te = t.projectIntoViewport(z.touches[2].clientX, z.touches[2].clientY);
          de[4] = Te[0], de[5] = Te[1];
        }
      } else if (z.touches[0] && !t.touchData.didSelect) {
        var jt = t.touchData.start, fe = t.touchData.last, rr;
        if (!t.hoverData.draggingEles && !t.swipePanning && (rr = t.findNearestElement(de[0], de[1], !0, !0)), oe && jt != null && z.preventDefault(), oe && jt != null && t.nodeIsDraggable(jt))
          if (Ye) {
            var Wt = t.dragData.touchDragEles, cl = !t.dragData.didDrag;
            cl && m(Wt, {
              inDragLayer: !0
            }), t.dragData.didDrag = !0;
            var ve = {
              x: 0,
              y: 0
            };
            if (vt(Ke[0]) && vt(Ke[1]) && (ve.x += Ke[0], ve.y += Ke[1], cl)) {
              t.redrawHint("eles", !0);
              var br = t.touchData.dragDelta;
              br && vt(br[0]) && vt(br[1]) && (ve.x += br[0], ve.y += br[1]);
            }
            t.hoverData.draggingEles = !0, Wt.silentShift(ve).emit(Ne("position")).emit(Ne("drag")), t.redrawHint("drag", !0), t.touchData.startPosition[0] == be[0] && t.touchData.startPosition[1] == be[1] && t.redrawHint("eles", !0), t.redraw();
          } else {
            var br = t.touchData.dragDelta = t.touchData.dragDelta || [];
            br.length === 0 ? (br.push(Ke[0]), br.push(Ke[1])) : (br[0] += Ke[0], br[1] += Ke[1]);
          }
        if (i(jt || rr, ["touchmove", "tapdrag", "vmousemove"], z, {
          x: de[0],
          y: de[1]
        }), (!jt || !jt.grabbed()) && rr != fe && (fe && fe.emit(Ne("tapdragout")), rr && rr.emit(Ne("tapdragover"))), t.touchData.last = rr, oe)
          for (var lr = 0; lr < de.length; lr++)
            de[lr] && t.touchData.startPosition[lr] && Ye && (t.touchData.singleTouchMoved = !0);
        if (oe && (jt == null || jt.pannable()) && ge.panningEnabled() && ge.userPanningEnabled()) {
          var b1 = s(jt, t.touchData.starts);
          b1 && (z.preventDefault(), t.data.bgActivePosistion || (t.data.bgActivePosistion = Th(t.touchData.startPosition)), t.swipePanning ? (ge.panBy({
            x: Ke[0] * Ce,
            y: Ke[1] * Ce
          }), ge.emit(Ne("dragpan"))) : Ye && (t.swipePanning = !0, ge.panBy({
            x: Be * Ce,
            y: ht * Ce
          }), ge.emit(Ne("dragpan")), jt && (jt.unactivate(), t.redrawHint("select", !0), t.touchData.start = null)));
          var Te = t.projectIntoViewport(z.touches[0].clientX, z.touches[0].clientY);
          de[0] = Te[0], de[1] = Te[1];
        }
      }
      for (var Ze = 0; Ze < de.length; Ze++)
        be[Ze] = de[Ze];
      oe && z.touches.length > 0 && !t.hoverData.draggingEles && !t.swipePanning && t.data.bgActivePosistion != null && (t.data.bgActivePosistion = void 0, t.redrawHint("select", !0), t.redraw());
    }
  }, !1);
  var Oe;
  t.registerBinding(e, "touchcancel", Oe = function(z) {
    var oe = t.touchData.start;
    t.touchData.capture = !1, oe && oe.unactivate();
  });
  var ue, Ve, Ge, Ue;
  if (t.registerBinding(e, "touchend", ue = function(z) {
    var oe = t.touchData.start, se = t.touchData.capture;
    if (se)
      z.touches.length === 0 && (t.touchData.capture = !1), z.preventDefault();
    else
      return;
    var ge = t.selection;
    t.swipePanning = !1, t.hoverData.draggingEles = !1;
    var de = t.cy, be = de.zoom(), Ce = t.touchData.now, Te = t.touchData.earlier;
    if (z.touches[0]) {
      var Ne = t.projectIntoViewport(z.touches[0].clientX, z.touches[0].clientY);
      Ce[0] = Ne[0], Ce[1] = Ne[1];
    }
    if (z.touches[1]) {
      var Ne = t.projectIntoViewport(z.touches[1].clientX, z.touches[1].clientY);
      Ce[2] = Ne[0], Ce[3] = Ne[1];
    }
    if (z.touches[2]) {
      var Ne = t.projectIntoViewport(z.touches[2].clientX, z.touches[2].clientY);
      Ce[4] = Ne[0], Ce[5] = Ne[1];
    }
    var Xe = function(Zt) {
      return {
        originalEvent: z,
        type: Zt,
        position: {
          x: Ce[0],
          y: Ce[1]
        }
      };
    };
    oe && oe.unactivate();
    var Ye;
    if (t.touchData.cxt) {
      if (Ye = Xe("cxttapend"), oe ? oe.emit(Ye) : de.emit(Ye), !t.touchData.cxtDragged) {
        var Ke = Xe("cxttap");
        oe ? oe.emit(Ke) : de.emit(Ke);
      }
      t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxt = !1, t.touchData.start = null, t.redraw();
      return;
    }
    if (!z.touches[2] && de.boxSelectionEnabled() && t.touchData.selecting) {
      t.touchData.selecting = !1;
      var Ze = de.collection(t.getAllInBox(ge[0], ge[1], ge[2], ge[3]));
      ge[0] = void 0, ge[1] = void 0, ge[2] = void 0, ge[3] = void 0, ge[4] = 0, t.redrawHint("select", !0), de.emit(Xe("boxend"));
      var Be = function(Zt) {
        return Zt.selectable() && !Zt.selected();
      };
      Ze.emit(Xe("box")).stdFilter(Be).select().emit(Xe("boxselect")), Ze.nonempty() && t.redrawHint("eles", !0), t.redraw();
    }
    if (oe != null && oe.unactivate(), z.touches[2])
      t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
    else if (!z.touches[1]) {
      if (!z.touches[0]) {
        if (!z.touches[0]) {
          t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
          var He = t.dragData.touchDragEles;
          if (oe != null) {
            var ht = oe._private.grabbed;
            y(He), t.redrawHint("drag", !0), t.redrawHint("eles", !0), ht && (oe.emit(Xe("freeon")), He.emit(Xe("free")), t.dragData.didDrag && (oe.emit(Xe("dragfreeon")), He.emit(Xe("dragfree")))), i(oe, ["touchend", "tapend", "vmouseup", "tapdragout"], z, {
              x: Ce[0],
              y: Ce[1]
            }), oe.unactivate(), t.touchData.start = null;
          } else {
            var st = t.findNearestElement(Ce[0], Ce[1], !0, !0);
            i(st, ["touchend", "tapend", "vmouseup", "tapdragout"], z, {
              x: Ce[0],
              y: Ce[1]
            });
          }
          var We = t.touchData.startPosition[0] - Ce[0], kt = We * We, qe = t.touchData.startPosition[1] - Ce[1], rt = qe * qe, ct = kt + rt, ut = ct * be * be;
          t.touchData.singleTouchMoved || (oe || de.$(":selected").unselect(["tapunselect"]), i(oe, ["tap", "vclick"], z, {
            x: Ce[0],
            y: Ce[1]
          }), Ve = !1, z.timeStamp - Ue <= de.multiClickDebounceTime() ? (Ge && clearTimeout(Ge), Ve = !0, Ue = null, i(oe, ["dbltap", "vdblclick"], z, {
            x: Ce[0],
            y: Ce[1]
          })) : (Ge = setTimeout(function() {
            Ve || i(oe, ["onetap", "voneclick"], z, {
              x: Ce[0],
              y: Ce[1]
            });
          }, de.multiClickDebounceTime()), Ue = z.timeStamp)), oe != null && !t.dragData.didDrag && oe._private.selectable && ut < t.touchTapThreshold2 && !t.pinching && (de.selectionType() === "single" ? (de.$(r).unmerge(oe).unselect(["tapunselect"]), oe.select(["tapselect"])) : oe.selected() ? oe.unselect(["tapunselect"]) : oe.select(["tapselect"]), t.redrawHint("eles", !0)), t.touchData.singleTouchMoved = !0;
        }
      }
    }
    for (var nt = 0; nt < Ce.length; nt++)
      Te[nt] = Ce[nt];
    t.dragData.didDrag = !1, z.touches.length === 0 && (t.touchData.dragDelta = [], t.touchData.startPosition = [null, null, null, null, null, null], t.touchData.startGPosition = null, t.touchData.didSelect = !1), z.touches.length < 2 && (z.touches.length === 1 && (t.touchData.startGPosition = [z.touches[0].clientX, z.touches[0].clientY]), t.pinching = !1, t.redrawHint("eles", !0), t.redraw());
  }, !1), typeof TouchEvent > "u") {
    var ke = [], Pe = function(z) {
      return {
        clientX: z.clientX,
        clientY: z.clientY,
        force: 1,
        identifier: z.pointerId,
        pageX: z.pageX,
        pageY: z.pageY,
        radiusX: z.width / 2,
        radiusY: z.height / 2,
        screenX: z.screenX,
        screenY: z.screenY,
        target: z.target
      };
    }, Se = function(z) {
      return {
        event: z,
        touch: Pe(z)
      };
    }, _e = function(z) {
      ke.push(Se(z));
    }, ze = function(z) {
      for (var oe = 0; oe < ke.length; oe++) {
        var se = ke[oe];
        if (se.event.pointerId === z.pointerId) {
          ke.splice(oe, 1);
          return;
        }
      }
    }, me = function(z) {
      var oe = ke.filter(function(se) {
        return se.event.pointerId === z.pointerId;
      })[0];
      oe.event = z, oe.touch = Pe(z);
    }, Me = function(z) {
      z.touches = ke.map(function(oe) {
        return oe.touch;
      });
    }, Q = function(z) {
      return z.pointerType === "mouse" || z.pointerType === 4;
    };
    t.registerBinding(t.container, "pointerdown", function(ce) {
      Q(ce) || (ce.preventDefault(), _e(ce), Me(ce), Ae(ce));
    }), t.registerBinding(t.container, "pointerup", function(ce) {
      Q(ce) || (ze(ce), Me(ce), ue(ce));
    }), t.registerBinding(t.container, "pointercancel", function(ce) {
      Q(ce) || (ze(ce), Me(ce), Oe(ce));
    }), t.registerBinding(t.container, "pointermove", function(ce) {
      Q(ce) || (ce.preventDefault(), me(ce), Me(ce), W(ce));
    });
  }
};
var sl = {};
sl.generatePolygon = function(t, e) {
  return this.nodeShapes[t] = {
    renderer: this,
    name: t,
    points: e,
    draw: function(n, i, a, s, o, l) {
      this.renderer.nodeShapeImpl("polygon", n, i, a, s, o, this.points);
    },
    intersectLine: function(n, i, a, s, o, l, u, h) {
      return lg(o, l, this.points, n, i, a / 2, s / 2, u);
    },
    checkPoint: function(n, i, a, s, o, l, u, h) {
      return Jo(n, i, this.points, l, u, s, o, [0, -1], a);
    },
    hasMiterBounds: t !== "rectangle",
    miterBounds: function(n, i, a, s, o, l) {
      return Yve(this.points, n, i, a, s, o);
    }
  };
};
sl.generateEllipse = function() {
  return this.nodeShapes.ellipse = {
    renderer: this,
    name: "ellipse",
    draw: function(e, r, n, i, a, s) {
      this.renderer.nodeShapeImpl(this.name, e, r, n, i, a);
    },
    intersectLine: function(e, r, n, i, a, s, o, l) {
      return tye(a, s, e, r, n / 2 + o, i / 2 + o);
    },
    checkPoint: function(e, r, n, i, a, s, o, l) {
      return Xc(e, r, i, a, s, o, n);
    }
  };
};
sl.generateRoundPolygon = function(t, e) {
  return this.nodeShapes[t] = {
    renderer: this,
    name: t,
    points: e,
    getOrCreateCorners: function(n, i, a, s, o, l, u) {
      if (l[u] !== void 0 && l[u + "-cx"] === n && l[u + "-cy"] === i)
        return l[u];
      l[u] = new Array(e.length / 2), l[u + "-cx"] = n, l[u + "-cy"] = i;
      var h = a / 2, d = s / 2;
      o = o === "auto" ? _V(a, s) : o;
      for (var f = new Array(e.length / 2), p = 0; p < e.length / 2; p++)
        f[p] = {
          x: n + h * e[p * 2],
          y: i + d * e[p * 2 + 1]
        };
      var g, m, v, y, b = f.length;
      for (m = f[b - 1], g = 0; g < b; g++)
        v = f[g % b], y = f[(g + 1) % b], l[u][g] = cS(m, v, y, o), m = v, v = y;
      return l[u];
    },
    draw: function(n, i, a, s, o, l, u) {
      this.renderer.nodeShapeImpl("round-polygon", n, i, a, s, o, this.points, this.getOrCreateCorners(i, a, s, o, l, u, "drawCorners"));
    },
    intersectLine: function(n, i, a, s, o, l, u, h, d) {
      return nye(o, l, this.points, n, i, a, s, u, this.getOrCreateCorners(n, i, a, s, h, d, "corners"));
    },
    checkPoint: function(n, i, a, s, o, l, u, h, d) {
      return eye(n, i, this.points, l, u, s, o, this.getOrCreateCorners(l, u, s, o, h, d, "corners"));
    }
  };
};
sl.generateRoundRectangle = function() {
  return this.nodeShapes["round-rectangle"] = this.nodeShapes.roundrectangle = {
    renderer: this,
    name: "round-rectangle",
    points: Pi(4, 0),
    draw: function(e, r, n, i, a, s) {
      this.renderer.nodeShapeImpl(this.name, e, r, n, i, a, this.points, s);
    },
    intersectLine: function(e, r, n, i, a, s, o, l) {
      return CV(a, s, e, r, n, i, o, l);
    },
    checkPoint: function(e, r, n, i, a, s, o, l) {
      var u = i / 2, h = a / 2;
      l = l === "auto" ? Wl(i, a) : l, l = Math.min(u, h, l);
      var d = l * 2;
      return !!(Jo(e, r, this.points, s, o, i, a - d, [0, -1], n) || Jo(e, r, this.points, s, o, i - d, a, [0, -1], n) || Xc(e, r, d, d, s - u + l, o - h + l, n) || Xc(e, r, d, d, s + u - l, o - h + l, n) || Xc(e, r, d, d, s + u - l, o + h - l, n) || Xc(e, r, d, d, s - u + l, o + h - l, n));
    }
  };
};
sl.generateCutRectangle = function() {
  return this.nodeShapes["cut-rectangle"] = this.nodeShapes.cutrectangle = {
    renderer: this,
    name: "cut-rectangle",
    cornerLength: Qk(),
    points: Pi(4, 0),
    draw: function(e, r, n, i, a, s) {
      this.renderer.nodeShapeImpl(this.name, e, r, n, i, a, null, s);
    },
    generateCutTrianglePts: function(e, r, n, i, a) {
      var s = a === "auto" ? this.cornerLength : a, o = r / 2, l = e / 2, u = n - l, h = n + l, d = i - o, f = i + o;
      return {
        topLeft: [u, d + s, u + s, d, u + s, d + s],
        topRight: [h - s, d, h, d + s, h - s, d + s],
        bottomRight: [h, f - s, h - s, f, h - s, f - s],
        bottomLeft: [u + s, f, u, f - s, u + s, f - s]
      };
    },
    intersectLine: function(e, r, n, i, a, s, o, l) {
      var u = this.generateCutTrianglePts(n + 2 * o, i + 2 * o, e, r, l), h = [].concat.apply([], [u.topLeft.splice(0, 4), u.topRight.splice(0, 4), u.bottomRight.splice(0, 4), u.bottomLeft.splice(0, 4)]);
      return lg(a, s, h, e, r);
    },
    checkPoint: function(e, r, n, i, a, s, o, l) {
      var u = l === "auto" ? this.cornerLength : l;
      if (Jo(e, r, this.points, s, o, i, a - 2 * u, [0, -1], n) || Jo(e, r, this.points, s, o, i - 2 * u, a, [0, -1], n))
        return !0;
      var h = this.generateCutTrianglePts(i, a, s, o);
      return sa(e, r, h.topLeft) || sa(e, r, h.topRight) || sa(e, r, h.bottomRight) || sa(e, r, h.bottomLeft);
    }
  };
};
sl.generateBarrel = function() {
  return this.nodeShapes.barrel = {
    renderer: this,
    name: "barrel",
    points: Pi(4, 0),
    draw: function(e, r, n, i, a, s) {
      this.renderer.nodeShapeImpl(this.name, e, r, n, i, a);
    },
    intersectLine: function(e, r, n, i, a, s, o, l) {
      var u = 0.15, h = 0.5, d = 0.85, f = this.generateBarrelBezierPts(n + 2 * o, i + 2 * o, e, r), p = function(v) {
        var y = Oh({
          x: v[0],
          y: v[1]
        }, {
          x: v[2],
          y: v[3]
        }, {
          x: v[4],
          y: v[5]
        }, u), b = Oh({
          x: v[0],
          y: v[1]
        }, {
          x: v[2],
          y: v[3]
        }, {
          x: v[4],
          y: v[5]
        }, h), w = Oh({
          x: v[0],
          y: v[1]
        }, {
          x: v[2],
          y: v[3]
        }, {
          x: v[4],
          y: v[5]
        }, d);
        return [v[0], v[1], y.x, y.y, b.x, b.y, w.x, w.y, v[4], v[5]];
      }, g = [].concat(p(f.topLeft), p(f.topRight), p(f.bottomRight), p(f.bottomLeft));
      return lg(a, s, g, e, r);
    },
    generateBarrelBezierPts: function(e, r, n, i) {
      var a = r / 2, s = e / 2, o = n - s, l = n + s, u = i - a, h = i + a, d = lT(e, r), f = d.heightOffset, p = d.widthOffset, g = d.ctrlPtOffsetPct * e, m = {
        topLeft: [o, u + f, o + g, u, o + p, u],
        topRight: [l - p, u, l - g, u, l, u + f],
        bottomRight: [l, h - f, l - g, h, l - p, h],
        bottomLeft: [o + p, h, o + g, h, o, h - f]
      };
      return m.topLeft.isTop = !0, m.topRight.isTop = !0, m.bottomLeft.isBottom = !0, m.bottomRight.isBottom = !0, m;
    },
    checkPoint: function(e, r, n, i, a, s, o, l) {
      var u = lT(i, a), h = u.heightOffset, d = u.widthOffset;
      if (Jo(e, r, this.points, s, o, i, a - 2 * h, [0, -1], n) || Jo(e, r, this.points, s, o, i - 2 * d, a, [0, -1], n))
        return !0;
      for (var f = this.generateBarrelBezierPts(i, a, s, o), p = function(_, L, N) {
        var A = N[4], O = N[2], P = N[0], S = N[5], R = N[1], I = Math.min(A, P), D = Math.max(A, P), M = Math.min(S, R), B = Math.max(S, R);
        if (I <= _ && _ <= D && M <= L && L <= B) {
          var $ = iye(A, O, P), F = Kve($[0], $[1], $[2], _), G = F.filter(function(H) {
            return 0 <= H && H <= 1;
          });
          if (G.length > 0)
            return G[0];
        }
        return null;
      }, g = Object.keys(f), m = 0; m < g.length; m++) {
        var v = g[m], y = f[v], b = p(e, r, y);
        if (b != null) {
          var w = y[5], T = y[3], E = y[1], C = Yn(w, T, E, b);
          if (y.isTop && C <= r || y.isBottom && r <= C)
            return !0;
        }
      }
      return !1;
    }
  };
};
sl.generateBottomRoundrectangle = function() {
  return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes.bottomroundrectangle = {
    renderer: this,
    name: "bottom-round-rectangle",
    points: Pi(4, 0),
    draw: function(e, r, n, i, a, s) {
      this.renderer.nodeShapeImpl(this.name, e, r, n, i, a, this.points, s);
    },
    intersectLine: function(e, r, n, i, a, s, o, l) {
      var u = e - (n / 2 + o), h = r - (i / 2 + o), d = h, f = e + (n / 2 + o), p = Sl(a, s, e, r, u, h, f, d, !1);
      return p.length > 0 ? p : CV(a, s, e, r, n, i, o, l);
    },
    checkPoint: function(e, r, n, i, a, s, o, l) {
      l = l === "auto" ? Wl(i, a) : l;
      var u = 2 * l;
      if (Jo(e, r, this.points, s, o, i, a - u, [0, -1], n) || Jo(e, r, this.points, s, o, i - u, a, [0, -1], n))
        return !0;
      var h = i / 2 + 2 * n, d = a / 2 + 2 * n, f = [s - h, o - d, s - h, o, s + h, o, s + h, o - d];
      return !!(sa(e, r, f) || Xc(e, r, u, u, s + i / 2 - l, o + a / 2 - l, n) || Xc(e, r, u, u, s - i / 2 + l, o + a / 2 - l, n));
    }
  };
};
sl.registerNodeShapes = function() {
  var t = this.nodeShapes = {}, e = this;
  this.generateEllipse(), this.generatePolygon("triangle", Pi(3, 0)), this.generateRoundPolygon("round-triangle", Pi(3, 0)), this.generatePolygon("rectangle", Pi(4, 0)), t.square = t.rectangle, this.generateRoundRectangle(), this.generateCutRectangle(), this.generateBarrel(), this.generateBottomRoundrectangle();
  {
    var r = [0, 1, 1, 0, 0, -1, -1, 0];
    this.generatePolygon("diamond", r), this.generateRoundPolygon("round-diamond", r);
  }
  this.generatePolygon("pentagon", Pi(5, 0)), this.generateRoundPolygon("round-pentagon", Pi(5, 0)), this.generatePolygon("hexagon", Pi(6, 0)), this.generateRoundPolygon("round-hexagon", Pi(6, 0)), this.generatePolygon("heptagon", Pi(7, 0)), this.generateRoundPolygon("round-heptagon", Pi(7, 0)), this.generatePolygon("octagon", Pi(8, 0)), this.generateRoundPolygon("round-octagon", Pi(8, 0));
  var n = new Array(20);
  {
    var i = oT(5, 0), a = oT(5, Math.PI / 5), s = 0.5 * (3 - Math.sqrt(5));
    s *= 1.57;
    for (var o = 0; o < a.length / 2; o++)
      a[o * 2] *= s, a[o * 2 + 1] *= s;
    for (var o = 0; o < 20 / 4; o++)
      n[o * 4] = i[o * 2], n[o * 4 + 1] = i[o * 2 + 1], n[o * 4 + 2] = a[o * 2], n[o * 4 + 3] = a[o * 2 + 1];
  }
  n = AV(n), this.generatePolygon("star", n), this.generatePolygon("vee", [-1, -1, 0, -0.333, 1, -1, 0, 1]), this.generatePolygon("rhomboid", [-1, -1, 0.333, -1, 1, 1, -0.333, 1]), this.generatePolygon("right-rhomboid", [-0.333, -1, 1, -1, 0.333, 1, -1, 1]), this.nodeShapes.concavehexagon = this.generatePolygon("concave-hexagon", [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]);
  {
    var l = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1];
    this.generatePolygon("tag", l), this.generateRoundPolygon("round-tag", l);
  }
  t.makePolygon = function(u) {
    var h = u.join("$"), d = "polygon-" + h, f;
    return (f = this[d]) ? f : e.generatePolygon(d, u);
  };
};
var s1 = {};
s1.timeToRender = function() {
  return this.redrawTotalTime / this.redrawCount;
};
s1.redraw = function(t) {
  t = t || TV();
  var e = this;
  e.averageRedrawTime === void 0 && (e.averageRedrawTime = 0), e.lastRedrawTime === void 0 && (e.lastRedrawTime = 0), e.lastDrawTime === void 0 && (e.lastDrawTime = 0), e.requestedFrame = !0, e.renderOptions = t;
};
s1.beforeRender = function(t, e) {
  if (!this.destroyed) {
    e == null && Kr("Priority is not optional for beforeRender");
    var r = this.beforeRenderCallbacks;
    r.push({
      fn: t,
      priority: e
    }), r.sort(function(n, i) {
      return i.priority - n.priority;
    });
  }
};
var H9 = function(e, r, n) {
  for (var i = e.beforeRenderCallbacks, a = 0; a < i.length; a++)
    i[a].fn(r, n);
};
s1.startRenderLoop = function() {
  var t = this, e = t.cy;
  if (!t.renderLoopStarted) {
    t.renderLoopStarted = !0;
    var r = function(i) {
      if (!t.destroyed) {
        if (!e.batching()) if (t.requestedFrame && !t.skipFrame) {
          H9(t, !0, i);
          var a = Qo();
          t.render(t.renderOptions);
          var s = t.lastDrawTime = Qo();
          t.averageRedrawTime === void 0 && (t.averageRedrawTime = s - a), t.redrawCount === void 0 && (t.redrawCount = 0), t.redrawCount++, t.redrawTotalTime === void 0 && (t.redrawTotalTime = 0);
          var o = s - a;
          t.redrawTotalTime += o, t.lastRedrawTime = o, t.averageRedrawTime = t.averageRedrawTime / 2 + o / 2, t.requestedFrame = !1;
        } else
          H9(t, !1, i);
        t.skipFrame = !1, Oy(r);
      }
    };
    Oy(r);
  }
};
var bbe = function(e) {
  this.init(e);
}, _G = bbe, Bf = _G.prototype;
Bf.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"];
Bf.init = function(t) {
  var e = this;
  e.options = t, e.cy = t.cy;
  var r = e.container = t.cy.container(), n = e.cy.window();
  if (n) {
    var i = n.document, a = i.head, s = "__________cytoscape_stylesheet", o = "__________cytoscape_container", l = i.getElementById(s) != null;
    if (r.className.indexOf(o) < 0 && (r.className = (r.className || "") + " " + o), !l) {
      var u = i.createElement("style");
      u.id = s, u.textContent = "." + o + " { position: relative; }", a.insertBefore(u, a.children[0]);
    }
    var h = n.getComputedStyle(r), d = h.getPropertyValue("position");
    d === "static" && Nr("A Cytoscape container has style position:static and so can not use UI extensions properly");
  }
  e.selection = [void 0, void 0, void 0, void 0, 0], e.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95], e.hoverData = {
    down: null,
    last: null,
    downTime: null,
    triggerMode: null,
    dragging: !1,
    initialPan: [null, null],
    capture: !1
  }, e.dragData = {
    possibleDragElements: []
  }, e.touchData = {
    start: null,
    capture: !1,
    // These 3 fields related to tap, taphold events
    startPosition: [null, null, null, null, null, null],
    singleTouchStartTime: null,
    singleTouchMoved: !0,
    now: [null, null, null, null, null, null],
    earlier: [null, null, null, null, null, null]
  }, e.redraws = 0, e.showFps = t.showFps, e.debug = t.debug, e.webgl = t.webgl, e.hideEdgesOnViewport = t.hideEdgesOnViewport, e.textureOnViewport = t.textureOnViewport, e.wheelSensitivity = t.wheelSensitivity, e.motionBlurEnabled = t.motionBlur, e.forcedPixelRatio = vt(t.pixelRatio) ? t.pixelRatio : null, e.motionBlur = t.motionBlur, e.motionBlurOpacity = t.motionBlurOpacity, e.motionBlurTransparency = 1 - e.motionBlurOpacity, e.motionBlurPxRatio = 1, e.mbPxRBlurry = 1, e.minMbLowQualFrames = 4, e.fullQualityMb = !1, e.clearedForMotionBlur = [], e.desktopTapThreshold = t.desktopTapThreshold, e.desktopTapThreshold2 = t.desktopTapThreshold * t.desktopTapThreshold, e.touchTapThreshold = t.touchTapThreshold, e.touchTapThreshold2 = t.touchTapThreshold * t.touchTapThreshold, e.tapholdDuration = 500, e.bindings = [], e.beforeRenderCallbacks = [], e.beforeRenderPriorities = {
    // higher priority execs before lower one
    animations: 400,
    eleCalcs: 300,
    eleTxrDeq: 200,
    lyrTxrDeq: 150,
    lyrTxrSkip: 100
  }, e.registerNodeShapes(), e.registerArrowShapes(), e.registerCalculationListeners();
};
Bf.notify = function(t, e) {
  var r = this, n = r.cy;
  if (!this.destroyed) {
    if (t === "init") {
      r.load();
      return;
    }
    if (t === "destroy") {
      r.destroy();
      return;
    }
    (t === "add" || t === "remove" || t === "move" && n.hasCompoundNodes() || t === "load" || t === "zorder" || t === "mount") && r.invalidateCachedZSortedEles(), t === "viewport" && r.redrawHint("select", !0), t === "gc" && r.redrawHint("gc", !0), (t === "load" || t === "resize" || t === "mount") && (r.invalidateContainerClientCoordsCache(), r.matchCanvasSize(r.container)), r.redrawHint("eles", !0), r.redrawHint("drag", !0), this.startRenderLoop(), this.redraw();
  }
};
Bf.destroy = function() {
  var t = this;
  t.destroyed = !0, t.cy.stopAnimationLoop();
  for (var e = 0; e < t.bindings.length; e++) {
    var r = t.bindings[e], n = r, i = n.target;
    (i.off || i.removeEventListener).apply(i, n.args);
  }
  if (t.bindings = [], t.beforeRenderCallbacks = [], t.onUpdateEleCalcsFns = [], t.removeObserver && t.removeObserver.disconnect(), t.styleObserver && t.styleObserver.disconnect(), t.resizeObserver && t.resizeObserver.disconnect(), t.labelCalcDiv)
    try {
      document.body.removeChild(t.labelCalcDiv);
    } catch {
    }
};
Bf.isHeadless = function() {
  return !1;
};
[lS, CG, AG, Pf, sl, s1].forEach(function(t) {
  Gt(Bf, t);
});
var X3 = 1e3 / 60, LG = {
  setupDequeueing: function(e) {
    return function() {
      var n = this, i = this.renderer;
      if (!n.dequeueingSetup) {
        n.dequeueingSetup = !0;
        var a = t1(function() {
          i.redrawHint("eles", !0), i.redrawHint("drag", !0), i.redraw();
        }, e.deqRedrawThreshold), s = function(u, h) {
          var d = Qo(), f = i.averageRedrawTime, p = i.lastRedrawTime, g = [], m = i.cy.extent(), v = i.getPixelRatio();
          for (u || i.flushRenderedStyleQueue(); ; ) {
            var y = Qo(), b = y - d, w = y - h;
            if (p < X3) {
              var T = X3 - (u ? f : 0);
              if (w >= e.deqFastCost * T)
                break;
            } else if (u) {
              if (b >= e.deqCost * p || b >= e.deqAvgCost * f)
                break;
            } else if (w >= e.deqNoDrawCost * X3)
              break;
            var E = e.deq(n, v, m);
            if (E.length > 0)
              for (var C = 0; C < E.length; C++)
                g.push(E[C]);
            else
              break;
          }
          g.length > 0 && (e.onDeqd(n, g), !u && e.shouldRedraw(n, g, v, m) && a());
        }, o = e.priority || Yk;
        i.beforeRender(s, o(n));
      }
    };
  }
}, wbe = /* @__PURE__ */ function() {
  function t(e) {
    var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Py;
    sc(this, t), this.idsByKey = new Io(), this.keyForId = new Io(), this.cachesByLvl = new Io(), this.lvls = [], this.getKey = e, this.doesEleInvalidateKey = r;
  }
  return oc(t, [{
    key: "getIdsFor",
    value: function(r) {
      r == null && Kr("Can not get id list for null key");
      var n = this.idsByKey, i = this.idsByKey.get(r);
      return i || (i = new Mf(), n.set(r, i)), i;
    }
  }, {
    key: "addIdForKey",
    value: function(r, n) {
      r != null && this.getIdsFor(r).add(n);
    }
  }, {
    key: "deleteIdForKey",
    value: function(r, n) {
      r != null && this.getIdsFor(r).delete(n);
    }
  }, {
    key: "getNumberOfIdsForKey",
    value: function(r) {
      return r == null ? 0 : this.getIdsFor(r).size;
    }
  }, {
    key: "updateKeyMappingFor",
    value: function(r) {
      var n = r.id(), i = this.keyForId.get(n), a = this.getKey(r);
      this.deleteIdForKey(i, n), this.addIdForKey(a, n), this.keyForId.set(n, a);
    }
  }, {
    key: "deleteKeyMappingFor",
    value: function(r) {
      var n = r.id(), i = this.keyForId.get(n);
      this.deleteIdForKey(i, n), this.keyForId.delete(n);
    }
  }, {
    key: "keyHasChangedFor",
    value: function(r) {
      var n = r.id(), i = this.keyForId.get(n), a = this.getKey(r);
      return i !== a;
    }
  }, {
    key: "isInvalid",
    value: function(r) {
      return this.keyHasChangedFor(r) || this.doesEleInvalidateKey(r);
    }
  }, {
    key: "getCachesAt",
    value: function(r) {
      var n = this.cachesByLvl, i = this.lvls, a = n.get(r);
      return a || (a = new Io(), n.set(r, a), i.push(r)), a;
    }
  }, {
    key: "getCache",
    value: function(r, n) {
      return this.getCachesAt(n).get(r);
    }
  }, {
    key: "get",
    value: function(r, n) {
      var i = this.getKey(r), a = this.getCache(i, n);
      return a != null && this.updateKeyMappingFor(r), a;
    }
  }, {
    key: "getForCachedKey",
    value: function(r, n) {
      var i = this.keyForId.get(r.id()), a = this.getCache(i, n);
      return a;
    }
  }, {
    key: "hasCache",
    value: function(r, n) {
      return this.getCachesAt(n).has(r);
    }
  }, {
    key: "has",
    value: function(r, n) {
      var i = this.getKey(r);
      return this.hasCache(i, n);
    }
  }, {
    key: "setCache",
    value: function(r, n, i) {
      i.key = r, this.getCachesAt(n).set(r, i);
    }
  }, {
    key: "set",
    value: function(r, n, i) {
      var a = this.getKey(r);
      this.setCache(a, n, i), this.updateKeyMappingFor(r);
    }
  }, {
    key: "deleteCache",
    value: function(r, n) {
      this.getCachesAt(n).delete(r);
    }
  }, {
    key: "delete",
    value: function(r, n) {
      var i = this.getKey(r);
      this.deleteCache(i, n);
    }
  }, {
    key: "invalidateKey",
    value: function(r) {
      var n = this;
      this.lvls.forEach(function(i) {
        return n.deleteCache(r, i);
      });
    }
    // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key)
  }, {
    key: "invalidate",
    value: function(r) {
      var n = r.id(), i = this.keyForId.get(n);
      this.deleteKeyMappingFor(r);
      var a = this.doesEleInvalidateKey(r);
      return a && this.invalidateKey(i), a || this.getNumberOfIdsForKey(i) === 0;
    }
  }]);
}(), q9 = 25, sm = 50, uv = -4, wT = 3, RG = 7.99, Tbe = 8, Ebe = 1024, kbe = 1024, Sbe = 1024, Cbe = 0.2, Abe = 0.8, _be = 10, Lbe = 0.15, Rbe = 0.1, Nbe = 0.9, Mbe = 0.9, Dbe = 100, Ibe = 1, kh = {
  dequeue: "dequeue",
  downscale: "downscale",
  highQuality: "highQuality"
}, Obe = di({
  getKey: null,
  doesEleInvalidateKey: Py,
  drawElement: null,
  getBoundingBox: null,
  getRotationPoint: null,
  getRotationOffset: null,
  isVisible: xV,
  allowEdgeTxrCaching: !0,
  allowParentTxrCaching: !0
}), R0 = function(e, r) {
  var n = this;
  n.renderer = e, n.onDequeues = [];
  var i = Obe(r);
  Gt(n, i), n.lookup = new wbe(i.getKey, i.doesEleInvalidateKey), n.setupDequeueing();
}, Hn = R0.prototype;
Hn.reasons = kh;
Hn.getTextureQueue = function(t) {
  var e = this;
  return e.eleImgCaches = e.eleImgCaches || {}, e.eleImgCaches[t] = e.eleImgCaches[t] || [];
};
Hn.getRetiredTextureQueue = function(t) {
  var e = this, r = e.eleImgCaches.retired = e.eleImgCaches.retired || {}, n = r[t] = r[t] || [];
  return n;
};
Hn.getElementQueue = function() {
  var t = this, e = t.eleCacheQueue = t.eleCacheQueue || new r1(function(r, n) {
    return n.reqs - r.reqs;
  });
  return e;
};
Hn.getElementKeyToQueue = function() {
  var t = this, e = t.eleKeyToCacheQueue = t.eleKeyToCacheQueue || {};
  return e;
};
Hn.getElement = function(t, e, r, n, i) {
  var a = this, s = this.renderer, o = s.cy.zoom(), l = this.lookup;
  if (!e || e.w === 0 || e.h === 0 || isNaN(e.w) || isNaN(e.h) || !t.visible() || t.removed() || !a.allowEdgeTxrCaching && t.isEdge() || !a.allowParentTxrCaching && t.isParent())
    return null;
  if (n == null && (n = Math.ceil(jk(o * r))), n < uv)
    n = uv;
  else if (o >= RG || n > wT)
    return null;
  var u = Math.pow(2, n), h = e.h * u, d = e.w * u, f = s.eleTextBiggerThanMin(t, u);
  if (!this.isVisible(t, f))
    return null;
  var p = l.get(t, n);
  if (p && p.invalidated && (p.invalidated = !1, p.texture.invalidatedWidth -= p.width), p)
    return p;
  var g;
  if (h <= q9 ? g = q9 : h <= sm ? g = sm : g = Math.ceil(h / sm) * sm, h > Sbe || d > kbe)
    return null;
  var m = a.getTextureQueue(g), v = m[m.length - 2], y = function() {
    return a.recycleTexture(g, d) || a.addTexture(g, d);
  };
  v || (v = m[m.length - 1]), v || (v = y()), v.width - v.usedWidth < d && (v = y());
  for (var b = function(I) {
    return I && I.scaledLabelShown === f;
  }, w = i && i === kh.dequeue, T = i && i === kh.highQuality, E = i && i === kh.downscale, C, k = n + 1; k <= wT; k++) {
    var _ = l.get(t, k);
    if (_) {
      C = _;
      break;
    }
  }
  var L = C && C.level === n + 1 ? C : null, N = function() {
    v.context.drawImage(L.texture.canvas, L.x, 0, L.width, L.height, v.usedWidth, 0, d, h);
  };
  if (v.context.setTransform(1, 0, 0, 1, 0, 0), v.context.clearRect(v.usedWidth, 0, d, g), b(L))
    N();
  else if (b(C))
    if (T) {
      for (var A = C.level; A > n; A--)
        L = a.getElement(t, e, r, A, kh.downscale);
      N();
    } else
      return a.queueElement(t, C.level - 1), C;
  else {
    var O;
    if (!w && !T && !E)
      for (var P = n - 1; P >= uv; P--) {
        var S = l.get(t, P);
        if (S) {
          O = S;
          break;
        }
      }
    if (b(O))
      return a.queueElement(t, n), O;
    v.context.translate(v.usedWidth, 0), v.context.scale(u, u), this.drawElement(v.context, t, e, f, !1), v.context.scale(1 / u, 1 / u), v.context.translate(-v.usedWidth, 0);
  }
  return p = {
    x: v.usedWidth,
    texture: v,
    level: n,
    scale: u,
    width: d,
    height: h,
    scaledLabelShown: f
  }, v.usedWidth += Math.ceil(d + Tbe), v.eleCaches.push(p), l.set(t, n, p), a.checkTextureFullness(v), p;
};
Hn.invalidateElements = function(t) {
  for (var e = 0; e < t.length; e++)
    this.invalidateElement(t[e]);
};
Hn.invalidateElement = function(t) {
  var e = this, r = e.lookup, n = [], i = r.isInvalid(t);
  if (i) {
    for (var a = uv; a <= wT; a++) {
      var s = r.getForCachedKey(t, a);
      s && n.push(s);
    }
    var o = r.invalidate(t);
    if (o)
      for (var l = 0; l < n.length; l++) {
        var u = n[l], h = u.texture;
        h.invalidatedWidth += u.width, u.invalidated = !0, e.checkTextureUtility(h);
      }
    e.removeFromQueue(t);
  }
};
Hn.checkTextureUtility = function(t) {
  t.invalidatedWidth >= Cbe * t.width && this.retireTexture(t);
};
Hn.checkTextureFullness = function(t) {
  var e = this, r = e.getTextureQueue(t.height);
  t.usedWidth / t.width > Abe && t.fullnessChecks >= _be ? Ul(r, t) : t.fullnessChecks++;
};
Hn.retireTexture = function(t) {
  var e = this, r = t.height, n = e.getTextureQueue(r), i = this.lookup;
  Ul(n, t), t.retired = !0;
  for (var a = t.eleCaches, s = 0; s < a.length; s++) {
    var o = a[s];
    i.deleteCache(o.key, o.level);
  }
  Xk(a);
  var l = e.getRetiredTextureQueue(r);
  l.push(t);
};
Hn.addTexture = function(t, e) {
  var r = this, n = r.getTextureQueue(t), i = {};
  return n.push(i), i.eleCaches = [], i.height = t, i.width = Math.max(Ebe, e), i.usedWidth = 0, i.invalidatedWidth = 0, i.fullnessChecks = 0, i.canvas = r.renderer.makeOffscreenCanvas(i.width, i.height), i.context = i.canvas.getContext("2d"), i;
};
Hn.recycleTexture = function(t, e) {
  for (var r = this, n = r.getTextureQueue(t), i = r.getRetiredTextureQueue(t), a = 0; a < i.length; a++) {
    var s = i[a];
    if (s.width >= e)
      return s.retired = !1, s.usedWidth = 0, s.invalidatedWidth = 0, s.fullnessChecks = 0, Xk(s.eleCaches), s.context.setTransform(1, 0, 0, 1, 0, 0), s.context.clearRect(0, 0, s.width, s.height), Ul(i, s), n.push(s), s;
  }
};
Hn.queueElement = function(t, e) {
  var r = this, n = r.getElementQueue(), i = r.getElementKeyToQueue(), a = this.getKey(t), s = i[a];
  if (s)
    s.level = Math.max(s.level, e), s.eles.merge(t), s.reqs++, n.updateItem(s);
  else {
    var o = {
      eles: t.spawn().merge(t),
      level: e,
      reqs: 1,
      key: a
    };
    n.push(o), i[a] = o;
  }
};
Hn.dequeue = function(t) {
  for (var e = this, r = e.getElementQueue(), n = e.getElementKeyToQueue(), i = [], a = e.lookup, s = 0; s < Ibe && r.size() > 0; s++) {
    var o = r.pop(), l = o.key, u = o.eles[0], h = a.hasCache(u, o.level);
    if (n[l] = null, h)
      continue;
    i.push(o);
    var d = e.getBoundingBox(u);
    e.getElement(u, d, t, o.level, kh.dequeue);
  }
  return i;
};
Hn.removeFromQueue = function(t) {
  var e = this, r = e.getElementQueue(), n = e.getElementKeyToQueue(), i = this.getKey(t), a = n[i];
  a != null && (a.eles.length === 1 ? (a.reqs = qk, r.updateItem(a), r.pop(), n[i] = null) : a.eles.unmerge(t));
};
Hn.onDequeue = function(t) {
  this.onDequeues.push(t);
};
Hn.offDequeue = function(t) {
  Ul(this.onDequeues, t);
};
Hn.setupDequeueing = LG.setupDequeueing({
  deqRedrawThreshold: Dbe,
  deqCost: Lbe,
  deqAvgCost: Rbe,
  deqNoDrawCost: Nbe,
  deqFastCost: Mbe,
  deq: function(e, r, n) {
    return e.dequeue(r, n);
  },
  onDeqd: function(e, r) {
    for (var n = 0; n < e.onDequeues.length; n++) {
      var i = e.onDequeues[n];
      i(r);
    }
  },
  shouldRedraw: function(e, r, n, i) {
    for (var a = 0; a < r.length; a++)
      for (var s = r[a].eles, o = 0; o < s.length; o++) {
        var l = s[o].boundingBox();
        if (Zk(l, i))
          return !0;
      }
    return !1;
  },
  priority: function(e) {
    return e.renderer.beforeRenderPriorities.eleTxrDeq;
  }
});
var Pbe = 1, Lp = -4, Wy = 2, Bbe = 3.99, Fbe = 50, $be = 50, zbe = 0.15, Vbe = 0.1, Gbe = 0.9, Ube = 0.9, Wbe = 1, Y9 = 250, Hbe = 4e3 * 4e3, X9 = 32767, qbe = !0, NG = function(e) {
  var r = this, n = r.renderer = e, i = n.cy;
  r.layersByLevel = {}, r.firstGet = !0, r.lastInvalidationTime = Qo() - 2 * Y9, r.skipping = !1, r.eleTxrDeqs = i.collection(), r.scheduleElementRefinement = t1(function() {
    r.refineElementTextures(r.eleTxrDeqs), r.eleTxrDeqs.unmerge(r.eleTxrDeqs);
  }, $be), n.beforeRender(function(s, o) {
    o - r.lastInvalidationTime <= Y9 ? r.skipping = !0 : r.skipping = !1;
  }, n.beforeRenderPriorities.lyrTxrSkip);
  var a = function(o, l) {
    return l.reqs - o.reqs;
  };
  r.layersQueue = new r1(a), r.setupDequeueing();
}, fi = NG.prototype, j9 = 0, Ybe = Math.pow(2, 53) - 1;
fi.makeLayer = function(t, e) {
  var r = Math.pow(2, e), n = Math.ceil(t.w * r), i = Math.ceil(t.h * r), a = this.renderer.makeOffscreenCanvas(n, i), s = {
    id: j9 = ++j9 % Ybe,
    bb: t,
    level: e,
    width: n,
    height: i,
    canvas: a,
    context: a.getContext("2d"),
    eles: [],
    elesQueue: [],
    reqs: 0
  }, o = s.context, l = -s.bb.x1, u = -s.bb.y1;
  return o.scale(r, r), o.translate(l, u), s;
};
fi.getLayers = function(t, e, r) {
  var n = this, i = n.renderer, a = i.cy, s = a.zoom(), o = n.firstGet;
  if (n.firstGet = !1, r == null) {
    if (r = Math.ceil(jk(s * e)), r < Lp)
      r = Lp;
    else if (s >= Bbe || r > Wy)
      return null;
  }
  n.validateLayersElesOrdering(r, t);
  var l = n.layersByLevel, u = Math.pow(2, r), h = l[r] = l[r] || [], d, f = n.levelIsComplete(r, t), p, g = function() {
    var N = function(R) {
      if (n.validateLayersElesOrdering(R, t), n.levelIsComplete(R, t))
        return p = l[R], !0;
    }, A = function(R) {
      if (!p)
        for (var I = r + R; Lp <= I && I <= Wy && !N(I); I += R)
          ;
    };
    A(1), A(-1);
    for (var O = h.length - 1; O >= 0; O--) {
      var P = h[O];
      P.invalid && Ul(h, P);
    }
  };
  if (!f)
    g();
  else
    return h;
  var m = function() {
    if (!d) {
      d = Yi();
      for (var N = 0; N < t.length; N++)
        Wve(d, t[N].boundingBox());
    }
    return d;
  }, v = function(N) {
    N = N || {};
    var A = N.after;
    m();
    var O = Math.ceil(d.w * u), P = Math.ceil(d.h * u);
    if (O > X9 || P > X9)
      return null;
    var S = O * P;
    if (S > Hbe)
      return null;
    var R = n.makeLayer(d, r);
    if (A != null) {
      var I = h.indexOf(A) + 1;
      h.splice(I, 0, R);
    } else (N.insert === void 0 || N.insert) && h.unshift(R);
    return R;
  };
  if (n.skipping && !o)
    return null;
  for (var y = null, b = t.length / Pbe, w = !o, T = 0; T < t.length; T++) {
    var E = t[T], C = E._private.rscratch, k = C.imgLayerCaches = C.imgLayerCaches || {}, _ = k[r];
    if (_) {
      y = _;
      continue;
    }
    if ((!y || y.eles.length >= b || !SV(y.bb, E.boundingBox())) && (y = v({
      insert: !0,
      after: y
    }), !y))
      return null;
    p || w ? n.queueLayer(y, E) : n.drawEleInLayer(y, E, r, e), y.eles.push(E), k[r] = y;
  }
  return p || (w ? null : h);
};
fi.getEleLevelForLayerLevel = function(t, e) {
  return t;
};
fi.drawEleInLayer = function(t, e, r, n) {
  var i = this, a = this.renderer, s = t.context, o = e.boundingBox();
  o.w === 0 || o.h === 0 || !e.visible() || (r = i.getEleLevelForLayerLevel(r, n), a.setImgSmoothing(s, !1), a.drawCachedElement(s, e, null, null, r, qbe), a.setImgSmoothing(s, !0));
};
fi.levelIsComplete = function(t, e) {
  var r = this, n = r.layersByLevel[t];
  if (!n || n.length === 0)
    return !1;
  for (var i = 0, a = 0; a < n.length; a++) {
    var s = n[a];
    if (s.reqs > 0 || s.invalid)
      return !1;
    i += s.eles.length;
  }
  return i === e.length;
};
fi.validateLayersElesOrdering = function(t, e) {
  var r = this.layersByLevel[t];
  if (r)
    for (var n = 0; n < r.length; n++) {
      for (var i = r[n], a = -1, s = 0; s < e.length; s++)
        if (i.eles[0] === e[s]) {
          a = s;
          break;
        }
      if (a < 0) {
        this.invalidateLayer(i);
        continue;
      }
      for (var o = a, s = 0; s < i.eles.length; s++)
        if (i.eles[s] !== e[o + s]) {
          this.invalidateLayer(i);
          break;
        }
    }
};
fi.updateElementsInLayers = function(t, e) {
  for (var r = this, n = Zg(t[0]), i = 0; i < t.length; i++)
    for (var a = n ? null : t[i], s = n ? t[i] : t[i].ele, o = s._private.rscratch, l = o.imgLayerCaches = o.imgLayerCaches || {}, u = Lp; u <= Wy; u++) {
      var h = l[u];
      h && (a && r.getEleLevelForLayerLevel(h.level) !== a.level || e(h, s, a));
    }
};
fi.haveLayers = function() {
  for (var t = this, e = !1, r = Lp; r <= Wy; r++) {
    var n = t.layersByLevel[r];
    if (n && n.length > 0) {
      e = !0;
      break;
    }
  }
  return e;
};
fi.invalidateElements = function(t) {
  var e = this;
  t.length !== 0 && (e.lastInvalidationTime = Qo(), !(t.length === 0 || !e.haveLayers()) && e.updateElementsInLayers(t, function(n, i, a) {
    e.invalidateLayer(n);
  }));
};
fi.invalidateLayer = function(t) {
  if (this.lastInvalidationTime = Qo(), !t.invalid) {
    var e = t.level, r = t.eles, n = this.layersByLevel[e];
    Ul(n, t), t.elesQueue = [], t.invalid = !0, t.replacement && (t.replacement.invalid = !0);
    for (var i = 0; i < r.length; i++) {
      var a = r[i]._private.rscratch.imgLayerCaches;
      a && (a[e] = null);
    }
  }
};
fi.refineElementTextures = function(t) {
  var e = this;
  e.updateElementsInLayers(t, function(n, i, a) {
    var s = n.replacement;
    if (s || (s = n.replacement = e.makeLayer(n.bb, n.level), s.replaces = n, s.eles = n.eles), !s.reqs)
      for (var o = 0; o < s.eles.length; o++)
        e.queueLayer(s, s.eles[o]);
  });
};
fi.enqueueElementRefinement = function(t) {
  this.eleTxrDeqs.merge(t), this.scheduleElementRefinement();
};
fi.queueLayer = function(t, e) {
  var r = this, n = r.layersQueue, i = t.elesQueue, a = i.hasId = i.hasId || {};
  if (!t.replacement) {
    if (e) {
      if (a[e.id()])
        return;
      i.push(e), a[e.id()] = !0;
    }
    t.reqs ? (t.reqs++, n.updateItem(t)) : (t.reqs = 1, n.push(t));
  }
};
fi.dequeue = function(t) {
  for (var e = this, r = e.layersQueue, n = [], i = 0; i < Wbe && r.size() !== 0; ) {
    var a = r.peek();
    if (a.replacement) {
      r.pop();
      continue;
    }
    if (a.replaces && a !== a.replaces.replacement) {
      r.pop();
      continue;
    }
    if (a.invalid) {
      r.pop();
      continue;
    }
    var s = a.elesQueue.shift();
    s && (e.drawEleInLayer(a, s, a.level, t), i++), n.length === 0 && n.push(!0), a.elesQueue.length === 0 && (r.pop(), a.reqs = 0, a.replaces && e.applyLayerReplacement(a), e.requestRedraw());
  }
  return n;
};
fi.applyLayerReplacement = function(t) {
  var e = this, r = e.layersByLevel[t.level], n = t.replaces, i = r.indexOf(n);
  if (!(i < 0 || n.invalid)) {
    r[i] = t;
    for (var a = 0; a < t.eles.length; a++) {
      var s = t.eles[a]._private, o = s.imgLayerCaches = s.imgLayerCaches || {};
      o && (o[t.level] = t);
    }
    e.requestRedraw();
  }
};
fi.requestRedraw = t1(function() {
  var t = this.renderer;
  t.redrawHint("eles", !0), t.redrawHint("drag", !0), t.redraw();
}, 100);
fi.setupDequeueing = LG.setupDequeueing({
  deqRedrawThreshold: Fbe,
  deqCost: zbe,
  deqAvgCost: Vbe,
  deqNoDrawCost: Gbe,
  deqFastCost: Ube,
  deq: function(e, r) {
    return e.dequeue(r);
  },
  onDeqd: Yk,
  shouldRedraw: xV,
  priority: function(e) {
    return e.renderer.beforeRenderPriorities.lyrTxrDeq;
  }
});
var MG = {}, K9;
function Xbe(t, e) {
  for (var r = 0; r < e.length; r++) {
    var n = e[r];
    t.lineTo(n.x, n.y);
  }
}
function jbe(t, e, r) {
  for (var n, i = 0; i < e.length; i++) {
    var a = e[i];
    i === 0 && (n = a), t.lineTo(a.x, a.y);
  }
  t.quadraticCurveTo(r.x, r.y, n.x, n.y);
}
function Z9(t, e, r) {
  t.beginPath && t.beginPath();
  for (var n = e, i = 0; i < n.length; i++) {
    var a = n[i];
    t.lineTo(a.x, a.y);
  }
  var s = r, o = r[0];
  t.moveTo(o.x, o.y);
  for (var i = 1; i < s.length; i++) {
    var a = s[i];
    t.lineTo(a.x, a.y);
  }
  t.closePath && t.closePath();
}
function Kbe(t, e, r, n, i) {
  t.beginPath && t.beginPath(), t.arc(r, n, i, 0, Math.PI * 2, !1);
  var a = e, s = a[0];
  t.moveTo(s.x, s.y);
  for (var o = 0; o < a.length; o++) {
    var l = a[o];
    t.lineTo(l.x, l.y);
  }
  t.closePath && t.closePath();
}
function Zbe(t, e, r, n) {
  t.arc(e, r, n, 0, Math.PI * 2, !1);
}
MG.arrowShapeImpl = function(t) {
  return (K9 || (K9 = {
    polygon: Xbe,
    "triangle-backcurve": jbe,
    "triangle-tee": Z9,
    "circle-triangle": Kbe,
    "triangle-cross": Z9,
    circle: Zbe
  }))[t];
};
var uo = {};
uo.drawElement = function(t, e, r, n, i, a) {
  var s = this;
  e.isNode() ? s.drawNode(t, e, r, n, i, a) : s.drawEdge(t, e, r, n, i, a);
};
uo.drawElementOverlay = function(t, e) {
  var r = this;
  e.isNode() ? r.drawNodeOverlay(t, e) : r.drawEdgeOverlay(t, e);
};
uo.drawElementUnderlay = function(t, e) {
  var r = this;
  e.isNode() ? r.drawNodeUnderlay(t, e) : r.drawEdgeUnderlay(t, e);
};
uo.drawCachedElementPortion = function(t, e, r, n, i, a, s, o) {
  var l = this, u = r.getBoundingBox(e);
  if (!(u.w === 0 || u.h === 0)) {
    var h = r.getElement(e, u, n, i, a);
    if (h != null) {
      var d = o(l, e);
      if (d === 0)
        return;
      var f = s(l, e), p = u.x1, g = u.y1, m = u.w, v = u.h, y, b, w, T, E;
      if (f !== 0) {
        var C = r.getRotationPoint(e);
        w = C.x, T = C.y, t.translate(w, T), t.rotate(f), E = l.getImgSmoothing(t), E || l.setImgSmoothing(t, !0);
        var k = r.getRotationOffset(e);
        y = k.x, b = k.y;
      } else
        y = p, b = g;
      var _;
      d !== 1 && (_ = t.globalAlpha, t.globalAlpha = _ * d), t.drawImage(h.texture.canvas, h.x, 0, h.width, h.height, y, b, m, v), d !== 1 && (t.globalAlpha = _), f !== 0 && (t.rotate(-f), t.translate(-w, -T), E || l.setImgSmoothing(t, !1));
    } else
      r.drawElement(t, e);
  }
};
var Qbe = function() {
  return 0;
}, Jbe = function(e, r) {
  return e.getTextAngle(r, null);
}, e4e = function(e, r) {
  return e.getTextAngle(r, "source");
}, t4e = function(e, r) {
  return e.getTextAngle(r, "target");
}, r4e = function(e, r) {
  return r.effectiveOpacity();
}, j3 = function(e, r) {
  return r.pstyle("text-opacity").pfValue * r.effectiveOpacity();
};
uo.drawCachedElement = function(t, e, r, n, i, a) {
  var s = this, o = s.data, l = o.eleTxrCache, u = o.lblTxrCache, h = o.slbTxrCache, d = o.tlbTxrCache, f = e.boundingBox(), p = a === !0 ? l.reasons.highQuality : null;
  if (!(f.w === 0 || f.h === 0 || !e.visible()) && (!n || Zk(f, n))) {
    var g = e.isEdge(), m = e.element()._private.rscratch.badLine;
    s.drawElementUnderlay(t, e), s.drawCachedElementPortion(t, e, l, r, i, p, Qbe, r4e), (!g || !m) && s.drawCachedElementPortion(t, e, u, r, i, p, Jbe, j3), g && !m && (s.drawCachedElementPortion(t, e, h, r, i, p, e4e, j3), s.drawCachedElementPortion(t, e, d, r, i, p, t4e, j3)), s.drawElementOverlay(t, e);
  }
};
uo.drawElements = function(t, e) {
  for (var r = this, n = 0; n < e.length; n++) {
    var i = e[n];
    r.drawElement(t, i);
  }
};
uo.drawCachedElements = function(t, e, r, n) {
  for (var i = this, a = 0; a < e.length; a++) {
    var s = e[a];
    i.drawCachedElement(t, s, r, n);
  }
};
uo.drawCachedNodes = function(t, e, r, n) {
  for (var i = this, a = 0; a < e.length; a++) {
    var s = e[a];
    s.isNode() && i.drawCachedElement(t, s, r, n);
  }
};
uo.drawLayeredElements = function(t, e, r, n) {
  var i = this, a = i.data.lyrTxrCache.getLayers(e, r);
  if (a)
    for (var s = 0; s < a.length; s++) {
      var o = a[s], l = o.bb;
      l.w === 0 || l.h === 0 || t.drawImage(o.canvas, l.x1, l.y1, l.w, l.h);
    }
  else
    i.drawCachedElements(t, e, r, n);
};
var ol = {};
ol.drawEdge = function(t, e, r) {
  var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this, o = e._private.rscratch;
  if (!(a && !e.visible()) && !(o.badLine || o.allpts == null || isNaN(o.allpts[0]))) {
    var l;
    r && (l = r, t.translate(-l.x1, -l.y1));
    var u = a ? e.pstyle("opacity").value : 1, h = a ? e.pstyle("line-opacity").value : 1, d = e.pstyle("curve-style").value, f = e.pstyle("line-style").value, p = e.pstyle("width").pfValue, g = e.pstyle("line-cap").value, m = e.pstyle("line-outline-width").value, v = e.pstyle("line-outline-color").value, y = u * h, b = u * h, w = function() {
      var R = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : y;
      d === "straight-triangle" ? (s.eleStrokeStyle(t, e, R), s.drawEdgeTrianglePath(e, t, o.allpts)) : (t.lineWidth = p, t.lineCap = g, s.eleStrokeStyle(t, e, R), s.drawEdgePath(e, t, o.allpts, f), t.lineCap = "butt");
    }, T = function() {
      var R = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : y;
      if (t.lineWidth = p + m, t.lineCap = g, m > 0)
        s.colorStrokeStyle(t, v[0], v[1], v[2], R);
      else {
        t.lineCap = "butt";
        return;
      }
      d === "straight-triangle" ? s.drawEdgeTrianglePath(e, t, o.allpts) : (s.drawEdgePath(e, t, o.allpts, f), t.lineCap = "butt");
    }, E = function() {
      i && s.drawEdgeOverlay(t, e);
    }, C = function() {
      i && s.drawEdgeUnderlay(t, e);
    }, k = function() {
      var R = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : b;
      s.drawArrowheads(t, e, R);
    }, _ = function() {
      s.drawElementText(t, e, null, n);
    };
    t.lineJoin = "round";
    var L = e.pstyle("ghost").value === "yes";
    if (L) {
      var N = e.pstyle("ghost-offset-x").pfValue, A = e.pstyle("ghost-offset-y").pfValue, O = e.pstyle("ghost-opacity").value, P = y * O;
      t.translate(N, A), w(P), k(P), t.translate(-N, -A);
    } else
      T();
    C(), w(), k(), E(), _(), r && t.translate(l.x1, l.y1);
  }
};
var DG = function(e) {
  if (!["overlay", "underlay"].includes(e))
    throw new Error("Invalid state");
  return function(r, n) {
    if (n.visible()) {
      var i = n.pstyle("".concat(e, "-opacity")).value;
      if (i !== 0) {
        var a = this, s = a.usePaths(), o = n._private.rscratch, l = n.pstyle("".concat(e, "-padding")).pfValue, u = 2 * l, h = n.pstyle("".concat(e, "-color")).value;
        r.lineWidth = u, o.edgeType === "self" && !s ? r.lineCap = "butt" : r.lineCap = "round", a.colorStrokeStyle(r, h[0], h[1], h[2], i), a.drawEdgePath(n, r, o.allpts, "solid");
      }
    }
  };
};
ol.drawEdgeOverlay = DG("overlay");
ol.drawEdgeUnderlay = DG("underlay");
ol.drawEdgePath = function(t, e, r, n) {
  var i = t._private.rscratch, a = e, s, o = !1, l = this.usePaths(), u = t.pstyle("line-dash-pattern").pfValue, h = t.pstyle("line-dash-offset").pfValue;
  if (l) {
    var d = r.join("$"), f = i.pathCacheKey && i.pathCacheKey === d;
    f ? (s = e = i.pathCache, o = !0) : (s = e = new Path2D(), i.pathCacheKey = d, i.pathCache = s);
  }
  if (a.setLineDash)
    switch (n) {
      case "dotted":
        a.setLineDash([1, 1]);
        break;
      case "dashed":
        a.setLineDash(u), a.lineDashOffset = h;
        break;
      case "solid":
        a.setLineDash([]);
        break;
    }
  if (!o && !i.badLine)
    switch (e.beginPath && e.beginPath(), e.moveTo(r[0], r[1]), i.edgeType) {
      case "bezier":
      case "self":
      case "compound":
      case "multibezier":
        for (var p = 2; p + 3 < r.length; p += 4)
          e.quadraticCurveTo(r[p], r[p + 1], r[p + 2], r[p + 3]);
        break;
      case "straight":
      case "haystack":
        for (var g = 2; g + 1 < r.length; g += 2)
          e.lineTo(r[g], r[g + 1]);
        break;
      case "segments":
        if (i.isRound) {
          var m = ca(i.roundCorners), v;
          try {
            for (m.s(); !(v = m.n()).done; ) {
              var y = v.value;
              wG(e, y);
            }
          } catch (w) {
            m.e(w);
          } finally {
            m.f();
          }
          e.lineTo(r[r.length - 2], r[r.length - 1]);
        } else
          for (var b = 2; b + 1 < r.length; b += 2)
            e.lineTo(r[b], r[b + 1]);
        break;
    }
  e = a, l ? e.stroke(s) : e.stroke(), e.setLineDash && e.setLineDash([]);
};
ol.drawEdgeTrianglePath = function(t, e, r) {
  e.fillStyle = e.strokeStyle;
  for (var n = t.pstyle("width").pfValue, i = 0; i + 1 < r.length; i += 2) {
    var a = [r[i + 2] - r[i], r[i + 3] - r[i + 1]], s = Math.sqrt(a[0] * a[0] + a[1] * a[1]), o = [a[1] / s, -a[0] / s], l = [o[0] * n / 2, o[1] * n / 2];
    e.beginPath(), e.moveTo(r[i] - l[0], r[i + 1] - l[1]), e.lineTo(r[i] + l[0], r[i + 1] + l[1]), e.lineTo(r[i + 2], r[i + 3]), e.closePath(), e.fill();
  }
};
ol.drawArrowheads = function(t, e, r) {
  var n = e._private.rscratch, i = n.edgeType === "haystack";
  i || this.drawArrowhead(t, e, "source", n.arrowStartX, n.arrowStartY, n.srcArrowAngle, r), this.drawArrowhead(t, e, "mid-target", n.midX, n.midY, n.midtgtArrowAngle, r), this.drawArrowhead(t, e, "mid-source", n.midX, n.midY, n.midsrcArrowAngle, r), i || this.drawArrowhead(t, e, "target", n.arrowEndX, n.arrowEndY, n.tgtArrowAngle, r);
};
ol.drawArrowhead = function(t, e, r, n, i, a, s) {
  if (!(isNaN(n) || n == null || isNaN(i) || i == null || isNaN(a) || a == null)) {
    var o = this, l = e.pstyle(r + "-arrow-shape").value;
    if (l !== "none") {
      var u = e.pstyle(r + "-arrow-fill").value === "hollow" ? "both" : "filled", h = e.pstyle(r + "-arrow-fill").value, d = e.pstyle("width").pfValue, f = e.pstyle(r + "-arrow-width"), p = f.value === "match-line" ? d : f.pfValue;
      f.units === "%" && (p *= d);
      var g = e.pstyle("opacity").value;
      s === void 0 && (s = g);
      var m = t.globalCompositeOperation;
      (s !== 1 || h === "hollow") && (t.globalCompositeOperation = "destination-out", o.colorFillStyle(t, 255, 255, 255, 1), o.colorStrokeStyle(t, 255, 255, 255, 1), o.drawArrowShape(e, t, u, d, l, p, n, i, a), t.globalCompositeOperation = m);
      var v = e.pstyle(r + "-arrow-color").value;
      o.colorFillStyle(t, v[0], v[1], v[2], s), o.colorStrokeStyle(t, v[0], v[1], v[2], s), o.drawArrowShape(e, t, h, d, l, p, n, i, a);
    }
  }
};
ol.drawArrowShape = function(t, e, r, n, i, a, s, o, l) {
  var u = this, h = this.usePaths() && i !== "triangle-cross", d = !1, f, p = e, g = {
    x: s,
    y: o
  }, m = t.pstyle("arrow-scale").value, v = this.getArrowWidth(n, m), y = u.arrowShapes[i];
  if (h) {
    var b = u.arrowPathCache = u.arrowPathCache || [], w = gu(i), T = b[w];
    T != null ? (f = e = T, d = !0) : (f = e = new Path2D(), b[w] = f);
  }
  d || (e.beginPath && e.beginPath(), h ? y.draw(e, 1, 0, {
    x: 0,
    y: 0
  }, 1) : y.draw(e, v, l, g, n), e.closePath && e.closePath()), e = p, h && (e.translate(s, o), e.rotate(l), e.scale(v, v)), (r === "filled" || r === "both") && (h ? e.fill(f) : e.fill()), (r === "hollow" || r === "both") && (e.lineWidth = a / (h ? v : 1), e.lineJoin = "miter", h ? e.stroke(f) : e.stroke()), h && (e.scale(1 / v, 1 / v), e.rotate(-l), e.translate(-s, -o));
};
var hS = {};
hS.safeDrawImage = function(t, e, r, n, i, a, s, o, l, u) {
  if (!(i <= 0 || a <= 0 || l <= 0 || u <= 0))
    try {
      t.drawImage(e, r, n, i, a, s, o, l, u);
    } catch (h) {
      Nr(h);
    }
};
hS.drawInscribedImage = function(t, e, r, n, i) {
  var a = this, s = r.position(), o = s.x, l = s.y, u = r.cy().style(), h = u.getIndexedStyle.bind(u), d = h(r, "background-fit", "value", n), f = h(r, "background-repeat", "value", n), p = r.width(), g = r.height(), m = r.padding() * 2, v = p + (h(r, "background-width-relative-to", "value", n) === "inner" ? 0 : m), y = g + (h(r, "background-height-relative-to", "value", n) === "inner" ? 0 : m), b = r._private.rscratch, w = h(r, "background-clip", "value", n), T = w === "node", E = h(r, "background-image-opacity", "value", n) * i, C = h(r, "background-image-smoothing", "value", n), k = r.pstyle("corner-radius").value;
  k !== "auto" && (k = r.pstyle("corner-radius").pfValue);
  var _ = e.width || e.cachedW, L = e.height || e.cachedH;
  (_ == null || L == null) && (document.body.appendChild(e), _ = e.cachedW = e.width || e.offsetWidth, L = e.cachedH = e.height || e.offsetHeight, document.body.removeChild(e));
  var N = _, A = L;
  if (h(r, "background-width", "value", n) !== "auto" && (h(r, "background-width", "units", n) === "%" ? N = h(r, "background-width", "pfValue", n) * v : N = h(r, "background-width", "pfValue", n)), h(r, "background-height", "value", n) !== "auto" && (h(r, "background-height", "units", n) === "%" ? A = h(r, "background-height", "pfValue", n) * y : A = h(r, "background-height", "pfValue", n)), !(N === 0 || A === 0)) {
    if (d === "contain") {
      var O = Math.min(v / N, y / A);
      N *= O, A *= O;
    } else if (d === "cover") {
      var O = Math.max(v / N, y / A);
      N *= O, A *= O;
    }
    var P = o - v / 2, S = h(r, "background-position-x", "units", n), R = h(r, "background-position-x", "pfValue", n);
    S === "%" ? P += (v - N) * R : P += R;
    var I = h(r, "background-offset-x", "units", n), D = h(r, "background-offset-x", "pfValue", n);
    I === "%" ? P += (v - N) * D : P += D;
    var M = l - y / 2, B = h(r, "background-position-y", "units", n), $ = h(r, "background-position-y", "pfValue", n);
    B === "%" ? M += (y - A) * $ : M += $;
    var F = h(r, "background-offset-y", "units", n), G = h(r, "background-offset-y", "pfValue", n);
    F === "%" ? M += (y - A) * G : M += G, b.pathCache && (P -= o, M -= l, o = 0, l = 0);
    var H = t.globalAlpha;
    t.globalAlpha = E;
    var ee = a.getImgSmoothing(t), Y = !1;
    if (C === "no" && ee ? (a.setImgSmoothing(t, !1), Y = !0) : C === "yes" && !ee && (a.setImgSmoothing(t, !0), Y = !0), f === "no-repeat")
      T && (t.save(), b.pathCache ? t.clip(b.pathCache) : (a.nodeShapes[a.getNodeShape(r)].draw(t, o, l, v, y, k, b), t.clip())), a.safeDrawImage(t, e, 0, 0, _, L, P, M, N, A), T && t.restore();
    else {
      var re = t.createPattern(e, f);
      t.fillStyle = re, a.nodeShapes[a.getNodeShape(r)].draw(t, o, l, v, y, k, b), t.translate(P, M), t.fill(), t.translate(-P, -M);
    }
    t.globalAlpha = H, Y && a.setImgSmoothing(t, ee);
  }
};
var $u = {};
$u.eleTextBiggerThanMin = function(t, e) {
  if (!e) {
    var r = t.cy().zoom(), n = this.getPixelRatio(), i = Math.ceil(jk(r * n));
    e = Math.pow(2, i);
  }
  var a = t.pstyle("font-size").pfValue * e, s = t.pstyle("min-zoomed-font-size").pfValue;
  return !(a < s);
};
$u.drawElementText = function(t, e, r, n, i) {
  var a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this;
  if (n == null) {
    if (a && !s.eleTextBiggerThanMin(e))
      return;
  } else if (n === !1)
    return;
  if (e.isNode()) {
    var o = e.pstyle("label");
    if (!o || !o.value)
      return;
    var l = s.getLabelJustification(e);
    t.textAlign = l, t.textBaseline = "bottom";
  } else {
    var u = e.element()._private.rscratch.badLine, h = e.pstyle("label"), d = e.pstyle("source-label"), f = e.pstyle("target-label");
    if (u || (!h || !h.value) && (!d || !d.value) && (!f || !f.value))
      return;
    t.textAlign = "center", t.textBaseline = "bottom";
  }
  var p = !r, g;
  r && (g = r, t.translate(-g.x1, -g.y1)), i == null ? (s.drawText(t, e, null, p, a), e.isEdge() && (s.drawText(t, e, "source", p, a), s.drawText(t, e, "target", p, a))) : s.drawText(t, e, i, p, a), r && t.translate(g.x1, g.y1);
};
$u.getFontCache = function(t) {
  var e;
  this.fontCaches = this.fontCaches || [];
  for (var r = 0; r < this.fontCaches.length; r++)
    if (e = this.fontCaches[r], e.context === t)
      return e;
  return e = {
    context: t
  }, this.fontCaches.push(e), e;
};
$u.setupTextStyle = function(t, e) {
  var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0, n = e.pstyle("font-style").strValue, i = e.pstyle("font-size").pfValue + "px", a = e.pstyle("font-family").strValue, s = e.pstyle("font-weight").strValue, o = r ? e.effectiveOpacity() * e.pstyle("text-opacity").value : 1, l = e.pstyle("text-outline-opacity").value * o, u = e.pstyle("color").value, h = e.pstyle("text-outline-color").value;
  t.font = n + " " + s + " " + i + " " + a, t.lineJoin = "round", this.colorFillStyle(t, u[0], u[1], u[2], o), this.colorStrokeStyle(t, h[0], h[1], h[2], l);
};
function n4e(t, e, r, n, i) {
  var a = Math.min(n, i), s = a / 2, o = e + n / 2, l = r + i / 2;
  t.beginPath(), t.arc(o, l, s, 0, Math.PI * 2), t.closePath();
}
function Q9(t, e, r, n, i) {
  var a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5, s = Math.min(a, n / 2, i / 2);
  t.beginPath(), t.moveTo(e + s, r), t.lineTo(e + n - s, r), t.quadraticCurveTo(e + n, r, e + n, r + s), t.lineTo(e + n, r + i - s), t.quadraticCurveTo(e + n, r + i, e + n - s, r + i), t.lineTo(e + s, r + i), t.quadraticCurveTo(e, r + i, e, r + i - s), t.lineTo(e, r + s), t.quadraticCurveTo(e, r, e + s, r), t.closePath();
}
$u.getTextAngle = function(t, e) {
  var r, n = t._private, i = n.rscratch, a = e ? e + "-" : "", s = t.pstyle(a + "text-rotation");
  if (s.strValue === "autorotate") {
    var o = aa(i, "labelAngle", e);
    r = t.isEdge() ? o : 0;
  } else s.strValue === "none" ? r = 0 : r = s.pfValue;
  return r;
};
$u.drawText = function(t, e, r) {
  var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = e._private, s = a.rscratch, o = i ? e.effectiveOpacity() : 1;
  if (!(i && (o === 0 || e.pstyle("text-opacity").value === 0))) {
    r === "main" && (r = null);
    var l = aa(s, "labelX", r), u = aa(s, "labelY", r), h, d, f = this.getLabelText(e, r);
    if (f != null && f !== "" && !isNaN(l) && !isNaN(u)) {
      this.setupTextStyle(t, e, i);
      var p = r ? r + "-" : "", g = aa(s, "labelWidth", r), m = aa(s, "labelHeight", r), v = e.pstyle(p + "text-margin-x").pfValue, y = e.pstyle(p + "text-margin-y").pfValue, b = e.isEdge(), w = e.pstyle("text-halign").value, T = e.pstyle("text-valign").value;
      b && (w = "center", T = "center"), l += v, u += y;
      var E;
      switch (n ? E = this.getTextAngle(e, r) : E = 0, E !== 0 && (h = l, d = u, t.translate(h, d), t.rotate(E), l = 0, u = 0), T) {
        case "top":
          break;
        case "center":
          u += m / 2;
          break;
        case "bottom":
          u += m;
          break;
      }
      var C = e.pstyle("text-background-opacity").value, k = e.pstyle("text-border-opacity").value, _ = e.pstyle("text-border-width").pfValue, L = e.pstyle("text-background-padding").pfValue, N = e.pstyle("text-background-shape").strValue, A = N === "round-rectangle" || N === "roundrectangle", O = N === "circle", P = 2;
      if (C > 0 || _ > 0 && k > 0) {
        var S = t.fillStyle, R = t.strokeStyle, I = t.lineWidth, D = e.pstyle("text-background-color").value, M = e.pstyle("text-border-color").value, B = e.pstyle("text-border-style").value, $ = C > 0, F = _ > 0 && k > 0, G = l - L;
        switch (w) {
          case "left":
            G -= g;
            break;
          case "center":
            G -= g / 2;
            break;
        }
        var H = u - m - L, ee = g + 2 * L, Y = m + 2 * L;
        if ($ && (t.fillStyle = "rgba(".concat(D[0], ",").concat(D[1], ",").concat(D[2], ",").concat(C * o, ")")), F && (t.strokeStyle = "rgba(".concat(M[0], ",").concat(M[1], ",").concat(M[2], ",").concat(k * o, ")"), t.lineWidth = _, t.setLineDash))
          switch (B) {
            case "dotted":
              t.setLineDash([1, 1]);
              break;
            case "dashed":
              t.setLineDash([4, 2]);
              break;
            case "double":
              t.lineWidth = _ / 4, t.setLineDash([]);
              break;
            case "solid":
            default:
              t.setLineDash([]);
              break;
          }
        if (A ? (t.beginPath(), Q9(t, G, H, ee, Y, P)) : O ? (t.beginPath(), n4e(t, G, H, ee, Y)) : (t.beginPath(), t.rect(G, H, ee, Y)), $ && t.fill(), F && t.stroke(), F && B === "double") {
          var re = _ / 2;
          t.beginPath(), A ? Q9(t, G + re, H + re, ee - 2 * re, Y - 2 * re, P) : t.rect(G + re, H + re, ee - 2 * re, Y - 2 * re), t.stroke();
        }
        t.fillStyle = S, t.strokeStyle = R, t.lineWidth = I, t.setLineDash && t.setLineDash([]);
      }
      var ne = 2 * e.pstyle("text-outline-width").pfValue;
      if (ne > 0 && (t.lineWidth = ne), e.pstyle("text-wrap").value === "wrap") {
        var he = aa(s, "labelWrapCachedLines", r), K = aa(s, "labelLineHeight", r), Z = g / 2, X = this.getLabelJustification(e);
        switch (X === "auto" || (w === "left" ? X === "left" ? l += -g : X === "center" && (l += -Z) : w === "center" ? X === "left" ? l += -Z : X === "right" && (l += Z) : w === "right" && (X === "center" ? l += Z : X === "right" && (l += g))), T) {
          case "top":
            u -= (he.length - 1) * K;
            break;
          case "center":
          case "bottom":
            u -= (he.length - 1) * K;
            break;
        }
        for (var q = 0; q < he.length; q++)
          ne > 0 && t.strokeText(he[q], l, u), t.fillText(he[q], l, u), u += K;
      } else
        ne > 0 && t.strokeText(f, l, u), t.fillText(f, l, u);
      E !== 0 && (t.rotate(-E), t.translate(-h, -d));
    }
  }
};
var cc = {};
cc.drawNode = function(t, e, r) {
  var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this, o, l, u = e._private, h = u.rscratch, d = e.position();
  if (!(!vt(d.x) || !vt(d.y)) && !(a && !e.visible())) {
    var f = a ? e.effectiveOpacity() : 1, p = s.usePaths(), g, m = !1, v = e.padding();
    o = e.width() + 2 * v, l = e.height() + 2 * v;
    var y;
    r && (y = r, t.translate(-y.x1, -y.y1));
    for (var b = e.pstyle("background-image"), w = b.value, T = new Array(w.length), E = new Array(w.length), C = 0, k = 0; k < w.length; k++) {
      var _ = w[k], L = T[k] = _ != null && _ !== "none";
      if (L) {
        var N = e.cy().style().getIndexedStyle(e, "background-image-crossorigin", "value", k);
        C++, E[k] = s.getCachedImage(_, N, function() {
          u.backgroundTimestamp = Date.now(), e.emitAndNotify("background");
        });
      }
    }
    var A = e.pstyle("background-blacken").value, O = e.pstyle("border-width").pfValue, P = e.pstyle("background-opacity").value * f, S = e.pstyle("border-color").value, R = e.pstyle("border-style").value, I = e.pstyle("border-join").value, D = e.pstyle("border-cap").value, M = e.pstyle("border-position").value, B = e.pstyle("border-dash-pattern").pfValue, $ = e.pstyle("border-dash-offset").pfValue, F = e.pstyle("border-opacity").value * f, G = e.pstyle("outline-width").pfValue, H = e.pstyle("outline-color").value, ee = e.pstyle("outline-style").value, Y = e.pstyle("outline-opacity").value * f, re = e.pstyle("outline-offset").value, ne = e.pstyle("corner-radius").value;
    ne !== "auto" && (ne = e.pstyle("corner-radius").pfValue);
    var he = function() {
      var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : P;
      s.eleFillStyle(t, e, Q);
    }, K = function() {
      var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : F;
      s.colorStrokeStyle(t, S[0], S[1], S[2], Q);
    }, Z = function() {
      var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Y;
      s.colorStrokeStyle(t, H[0], H[1], H[2], Q);
    }, X = function(Q, ce, z, oe) {
      var se = s.nodePathCache = s.nodePathCache || [], ge = yV(z === "polygon" ? z + "," + oe.join(",") : z, "" + ce, "" + Q, "" + ne), de = se[ge], be, Ce = !1;
      return de != null ? (be = de, Ce = !0, h.pathCache = be) : (be = new Path2D(), se[ge] = h.pathCache = be), {
        path: be,
        cacheHit: Ce
      };
    }, q = e.pstyle("shape").strValue, J = e.pstyle("shape-polygon-points").pfValue;
    if (p) {
      t.translate(d.x, d.y);
      var j = X(o, l, q, J);
      g = j.path, m = j.cacheHit;
    }
    var pe = function() {
      if (!m) {
        var Q = d;
        p && (Q = {
          x: 0,
          y: 0
        }), s.nodeShapes[s.getNodeShape(e)].draw(g || t, Q.x, Q.y, o, l, ne, h);
      }
      p ? t.fill(g) : t.fill();
    }, te = function() {
      for (var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : f, ce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, z = u.backgrounding, oe = 0, se = 0; se < E.length; se++) {
        var ge = e.cy().style().getIndexedStyle(e, "background-image-containment", "value", se);
        if (ce && ge === "over" || !ce && ge === "inside") {
          oe++;
          continue;
        }
        T[se] && E[se].complete && !E[se].error && (oe++, s.drawInscribedImage(t, E[se], e, se, Q));
      }
      u.backgrounding = oe !== C, z !== u.backgrounding && e.updateStyle(!1);
    }, Ae = function() {
      var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, ce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : f;
      s.hasPie(e) && (s.drawPie(t, e, ce), Q && (p || s.nodeShapes[s.getNodeShape(e)].draw(t, d.x, d.y, o, l, ne, h)));
    }, W = function() {
      var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, ce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : f;
      s.hasStripe(e) && (t.save(), p ? t.clip(h.pathCache) : (s.nodeShapes[s.getNodeShape(e)].draw(t, d.x, d.y, o, l, ne, h), t.clip()), s.drawStripe(t, e, ce), t.restore(), Q && (p || s.nodeShapes[s.getNodeShape(e)].draw(t, d.x, d.y, o, l, ne, h)));
    }, Oe = function() {
      var Q = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : f, ce = (A > 0 ? A : -A) * Q, z = A > 0 ? 0 : 255;
      A !== 0 && (s.colorFillStyle(t, z, z, z, ce), p ? t.fill(g) : t.fill());
    }, ue = function() {
      if (O > 0) {
        if (t.lineWidth = O, t.lineCap = D, t.lineJoin = I, t.setLineDash)
          switch (R) {
            case "dotted":
              t.setLineDash([1, 1]);
              break;
            case "dashed":
              t.setLineDash(B), t.lineDashOffset = $;
              break;
            case "solid":
            case "double":
              t.setLineDash([]);
              break;
          }
        if (M !== "center") {
          if (t.save(), t.lineWidth *= 2, M === "inside")
            p ? t.clip(g) : t.clip();
          else {
            var Q = new Path2D();
            Q.rect(-o / 2 - O, -l / 2 - O, o + 2 * O, l + 2 * O), Q.addPath(g), t.clip(Q, "evenodd");
          }
          p ? t.stroke(g) : t.stroke(), t.restore();
        } else
          p ? t.stroke(g) : t.stroke();
        if (R === "double") {
          t.lineWidth = O / 3;
          var ce = t.globalCompositeOperation;
          t.globalCompositeOperation = "destination-out", p ? t.stroke(g) : t.stroke(), t.globalCompositeOperation = ce;
        }
        t.setLineDash && t.setLineDash([]);
      }
    }, Ve = function() {
      if (G > 0) {
        if (t.lineWidth = G, t.lineCap = "butt", t.setLineDash)
          switch (ee) {
            case "dotted":
              t.setLineDash([1, 1]);
              break;
            case "dashed":
              t.setLineDash([4, 2]);
              break;
            case "solid":
            case "double":
              t.setLineDash([]);
              break;
          }
        var Q = d;
        p && (Q = {
          x: 0,
          y: 0
        });
        var ce = s.getNodeShape(e), z = O;
        M === "inside" && (z = 0), M === "outside" && (z *= 2);
        var oe = (o + z + (G + re)) / o, se = (l + z + (G + re)) / l, ge = o * oe, de = l * se, be = s.nodeShapes[ce].points, Ce;
        if (p) {
          var Te = X(ge, de, ce, be);
          Ce = Te.path;
        }
        if (ce === "ellipse")
          s.drawEllipsePath(Ce || t, Q.x, Q.y, ge, de);
        else if (["round-diamond", "round-heptagon", "round-hexagon", "round-octagon", "round-pentagon", "round-polygon", "round-triangle", "round-tag"].includes(ce)) {
          var Ne = 0, Xe = 0, Ye = 0;
          ce === "round-diamond" ? Ne = (z + re + G) * 1.4 : ce === "round-heptagon" ? (Ne = (z + re + G) * 1.075, Ye = -(z / 2 + re + G) / 35) : ce === "round-hexagon" ? Ne = (z + re + G) * 1.12 : ce === "round-pentagon" ? (Ne = (z + re + G) * 1.13, Ye = -(z / 2 + re + G) / 15) : ce === "round-tag" ? (Ne = (z + re + G) * 1.12, Xe = (z / 2 + G + re) * 0.07) : ce === "round-triangle" && (Ne = (z + re + G) * (Math.PI / 2), Ye = -(z + re / 2 + G) / Math.PI), Ne !== 0 && (oe = (o + Ne) / o, ge = o * oe, ["round-hexagon", "round-tag"].includes(ce) || (se = (l + Ne) / l, de = l * se)), ne = ne === "auto" ? _V(ge, de) : ne;
          for (var Ke = ge / 2, Ze = de / 2, Be = ne + (z + G + re) / 2, He = new Array(be.length / 2), ht = new Array(be.length / 2), st = 0; st < be.length / 2; st++)
            He[st] = {
              x: Q.x + Xe + Ke * be[st * 2],
              y: Q.y + Ye + Ze * be[st * 2 + 1]
            };
          var We, kt, qe, rt, ct = He.length;
          for (kt = He[ct - 1], We = 0; We < ct; We++)
            qe = He[We % ct], rt = He[(We + 1) % ct], ht[We] = cS(kt, qe, rt, Be), kt = qe, qe = rt;
          s.drawRoundPolygonPath(Ce || t, Q.x + Xe, Q.y + Ye, o * oe, l * se, be, ht);
        } else if (["roundrectangle", "round-rectangle"].includes(ce))
          ne = ne === "auto" ? Wl(ge, de) : ne, s.drawRoundRectanglePath(Ce || t, Q.x, Q.y, ge, de, ne + (z + G + re) / 2);
        else if (["cutrectangle", "cut-rectangle"].includes(ce))
          ne = ne === "auto" ? Qk() : ne, s.drawCutRectanglePath(Ce || t, Q.x, Q.y, ge, de, null, ne + (z + G + re) / 4);
        else if (["bottomroundrectangle", "bottom-round-rectangle"].includes(ce))
          ne = ne === "auto" ? Wl(ge, de) : ne, s.drawBottomRoundRectanglePath(Ce || t, Q.x, Q.y, ge, de, ne + (z + G + re) / 2);
        else if (ce === "barrel")
          s.drawBarrelPath(Ce || t, Q.x, Q.y, ge, de);
        else if (ce.startsWith("polygon") || ["rhomboid", "right-rhomboid", "round-tag", "tag", "vee"].includes(ce)) {
          var ut = (z + G + re) / o;
          be = By(Fy(be, ut)), s.drawPolygonPath(Ce || t, Q.x, Q.y, o, l, be);
        } else {
          var nt = (z + G + re) / o;
          be = By(Fy(be, -nt)), s.drawPolygonPath(Ce || t, Q.x, Q.y, o, l, be);
        }
        if (p ? t.stroke(Ce) : t.stroke(), ee === "double") {
          t.lineWidth = z / 3;
          var bt = t.globalCompositeOperation;
          t.globalCompositeOperation = "destination-out", p ? t.stroke(Ce) : t.stroke(), t.globalCompositeOperation = bt;
        }
        t.setLineDash && t.setLineDash([]);
      }
    }, Ge = function() {
      i && s.drawNodeOverlay(t, e, d, o, l);
    }, Ue = function() {
      i && s.drawNodeUnderlay(t, e, d, o, l);
    }, ke = function() {
      s.drawElementText(t, e, null, n);
    }, Pe = e.pstyle("ghost").value === "yes";
    if (Pe) {
      var Se = e.pstyle("ghost-offset-x").pfValue, _e = e.pstyle("ghost-offset-y").pfValue, ze = e.pstyle("ghost-opacity").value, me = ze * f;
      t.translate(Se, _e), Z(), Ve(), he(ze * P), pe(), te(me, !0), K(ze * F), ue(), Ae(A !== 0 || O !== 0), W(A !== 0 || O !== 0), te(me, !1), Oe(me), t.translate(-Se, -_e);
    }
    p && t.translate(-d.x, -d.y), Ue(), p && t.translate(d.x, d.y), Z(), Ve(), he(), pe(), te(f, !0), K(), ue(), Ae(A !== 0 || O !== 0), W(A !== 0 || O !== 0), te(f, !1), Oe(), p && t.translate(-d.x, -d.y), ke(), Ge(), r && t.translate(y.x1, y.y1);
  }
};
var IG = function(e) {
  if (!["overlay", "underlay"].includes(e))
    throw new Error("Invalid state");
  return function(r, n, i, a, s) {
    var o = this;
    if (n.visible()) {
      var l = n.pstyle("".concat(e, "-padding")).pfValue, u = n.pstyle("".concat(e, "-opacity")).value, h = n.pstyle("".concat(e, "-color")).value, d = n.pstyle("".concat(e, "-shape")).value, f = n.pstyle("".concat(e, "-corner-radius")).value;
      if (u > 0) {
        if (i = i || n.position(), a == null || s == null) {
          var p = n.padding();
          a = n.width() + 2 * p, s = n.height() + 2 * p;
        }
        o.colorFillStyle(r, h[0], h[1], h[2], u), o.nodeShapes[d].draw(r, i.x, i.y, a + l * 2, s + l * 2, f), r.fill();
      }
    }
  };
};
cc.drawNodeOverlay = IG("overlay");
cc.drawNodeUnderlay = IG("underlay");
cc.hasPie = function(t) {
  return t = t[0], t._private.hasPie;
};
cc.hasStripe = function(t) {
  return t = t[0], t._private.hasStripe;
};
cc.drawPie = function(t, e, r, n) {
  e = e[0], n = n || e.position();
  var i = e.cy().style(), a = e.pstyle("pie-size"), s = e.pstyle("pie-hole"), o = e.pstyle("pie-start-angle").pfValue, l = n.x, u = n.y, h = e.width(), d = e.height(), f = Math.min(h, d) / 2, p, g = 0, m = this.usePaths();
  if (m && (l = 0, u = 0), a.units === "%" ? f = f * a.pfValue : a.pfValue !== void 0 && (f = a.pfValue / 2), s.units === "%" ? p = f * s.pfValue : s.pfValue !== void 0 && (p = s.pfValue / 2), !(p >= f))
    for (var v = 1; v <= i.pieBackgroundN; v++) {
      var y = e.pstyle("pie-" + v + "-background-size").value, b = e.pstyle("pie-" + v + "-background-color").value, w = e.pstyle("pie-" + v + "-background-opacity").value * r, T = y / 100;
      T + g > 1 && (T = 1 - g);
      var E = 1.5 * Math.PI + 2 * Math.PI * g;
      E += o;
      var C = 2 * Math.PI * T, k = E + C;
      y === 0 || g >= 1 || g + T > 1 || (p === 0 ? (t.beginPath(), t.moveTo(l, u), t.arc(l, u, f, E, k), t.closePath()) : (t.beginPath(), t.arc(l, u, f, E, k), t.arc(l, u, p, k, E, !0), t.closePath()), this.colorFillStyle(t, b[0], b[1], b[2], w), t.fill(), g += T);
    }
};
cc.drawStripe = function(t, e, r, n) {
  e = e[0], n = n || e.position();
  var i = e.cy().style(), a = n.x, s = n.y, o = e.width(), l = e.height(), u = 0, h = this.usePaths();
  t.save();
  var d = e.pstyle("stripe-direction").value, f = e.pstyle("stripe-size");
  switch (d) {
    case "vertical":
      break;
    case "righward":
      t.rotate(-Math.PI / 2);
      break;
  }
  var p = o, g = l;
  f.units === "%" ? (p = p * f.pfValue, g = g * f.pfValue) : f.pfValue !== void 0 && (p = f.pfValue, g = f.pfValue), h && (a = 0, s = 0), s -= p / 2, a -= g / 2;
  for (var m = 1; m <= i.stripeBackgroundN; m++) {
    var v = e.pstyle("stripe-" + m + "-background-size").value, y = e.pstyle("stripe-" + m + "-background-color").value, b = e.pstyle("stripe-" + m + "-background-opacity").value * r, w = v / 100;
    w + u > 1 && (w = 1 - u), !(v === 0 || u >= 1 || u + w > 1) && (t.beginPath(), t.rect(a, s + g * u, p, g * w), t.closePath(), this.colorFillStyle(t, y[0], y[1], y[2], b), t.fill(), u += w);
  }
  t.restore();
};
var Ji = {}, i4e = 100;
Ji.getPixelRatio = function() {
  var t = this.data.contexts[0];
  if (this.forcedPixelRatio != null)
    return this.forcedPixelRatio;
  var e = this.cy.window(), r = t.backingStorePixelRatio || t.webkitBackingStorePixelRatio || t.mozBackingStorePixelRatio || t.msBackingStorePixelRatio || t.oBackingStorePixelRatio || t.backingStorePixelRatio || 1;
  return (e.devicePixelRatio || 1) / r;
};
Ji.paintCache = function(t) {
  for (var e = this.paintCaches = this.paintCaches || [], r = !0, n, i = 0; i < e.length; i++)
    if (n = e[i], n.context === t) {
      r = !1;
      break;
    }
  return r && (n = {
    context: t
  }, e.push(n)), n;
};
Ji.createGradientStyleFor = function(t, e, r, n, i) {
  var a, s = this.usePaths(), o = r.pstyle(e + "-gradient-stop-colors").value, l = r.pstyle(e + "-gradient-stop-positions").pfValue;
  if (n === "radial-gradient")
    if (r.isEdge()) {
      var u = r.sourceEndpoint(), h = r.targetEndpoint(), d = r.midpoint(), f = mu(u, d), p = mu(h, d);
      a = t.createRadialGradient(d.x, d.y, 0, d.x, d.y, Math.max(f, p));
    } else {
      var g = s ? {
        x: 0,
        y: 0
      } : r.position(), m = r.paddedWidth(), v = r.paddedHeight();
      a = t.createRadialGradient(g.x, g.y, 0, g.x, g.y, Math.max(m, v));
    }
  else if (r.isEdge()) {
    var y = r.sourceEndpoint(), b = r.targetEndpoint();
    a = t.createLinearGradient(y.x, y.y, b.x, b.y);
  } else {
    var w = s ? {
      x: 0,
      y: 0
    } : r.position(), T = r.paddedWidth(), E = r.paddedHeight(), C = T / 2, k = E / 2, _ = r.pstyle("background-gradient-direction").value;
    switch (_) {
      case "to-bottom":
        a = t.createLinearGradient(w.x, w.y - k, w.x, w.y + k);
        break;
      case "to-top":
        a = t.createLinearGradient(w.x, w.y + k, w.x, w.y - k);
        break;
      case "to-left":
        a = t.createLinearGradient(w.x + C, w.y, w.x - C, w.y);
        break;
      case "to-right":
        a = t.createLinearGradient(w.x - C, w.y, w.x + C, w.y);
        break;
      case "to-bottom-right":
      case "to-right-bottom":
        a = t.createLinearGradient(w.x - C, w.y - k, w.x + C, w.y + k);
        break;
      case "to-top-right":
      case "to-right-top":
        a = t.createLinearGradient(w.x - C, w.y + k, w.x + C, w.y - k);
        break;
      case "to-bottom-left":
      case "to-left-bottom":
        a = t.createLinearGradient(w.x + C, w.y - k, w.x - C, w.y + k);
        break;
      case "to-top-left":
      case "to-left-top":
        a = t.createLinearGradient(w.x + C, w.y + k, w.x - C, w.y - k);
        break;
    }
  }
  if (!a) return null;
  for (var L = l.length === o.length, N = o.length, A = 0; A < N; A++)
    a.addColorStop(L ? l[A] : A / (N - 1), "rgba(" + o[A][0] + "," + o[A][1] + "," + o[A][2] + "," + i + ")");
  return a;
};
Ji.gradientFillStyle = function(t, e, r, n) {
  var i = this.createGradientStyleFor(t, "background", e, r, n);
  if (!i) return null;
  t.fillStyle = i;
};
Ji.colorFillStyle = function(t, e, r, n, i) {
  t.fillStyle = "rgba(" + e + "," + r + "," + n + "," + i + ")";
};
Ji.eleFillStyle = function(t, e, r) {
  var n = e.pstyle("background-fill").value;
  if (n === "linear-gradient" || n === "radial-gradient")
    this.gradientFillStyle(t, e, n, r);
  else {
    var i = e.pstyle("background-color").value;
    this.colorFillStyle(t, i[0], i[1], i[2], r);
  }
};
Ji.gradientStrokeStyle = function(t, e, r, n) {
  var i = this.createGradientStyleFor(t, "line", e, r, n);
  if (!i) return null;
  t.strokeStyle = i;
};
Ji.colorStrokeStyle = function(t, e, r, n, i) {
  t.strokeStyle = "rgba(" + e + "," + r + "," + n + "," + i + ")";
};
Ji.eleStrokeStyle = function(t, e, r) {
  var n = e.pstyle("line-fill").value;
  if (n === "linear-gradient" || n === "radial-gradient")
    this.gradientStrokeStyle(t, e, n, r);
  else {
    var i = e.pstyle("line-color").value;
    this.colorStrokeStyle(t, i[0], i[1], i[2], r);
  }
};
Ji.matchCanvasSize = function(t) {
  var e = this, r = e.data, n = e.findContainerClientCoords(), i = n[2], a = n[3], s = e.getPixelRatio(), o = e.motionBlurPxRatio;
  (t === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE] || t === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG]) && (s = o);
  var l = i * s, u = a * s, h;
  if (!(l === e.canvasWidth && u === e.canvasHeight)) {
    e.fontCaches = null;
    var d = r.canvasContainer;
    d.style.width = i + "px", d.style.height = a + "px";
    for (var f = 0; f < e.CANVAS_LAYERS; f++)
      h = r.canvases[f], h.width = l, h.height = u, h.style.width = i + "px", h.style.height = a + "px";
    for (var f = 0; f < e.BUFFER_COUNT; f++)
      h = r.bufferCanvases[f], h.width = l, h.height = u, h.style.width = i + "px", h.style.height = a + "px";
    e.textureMult = 1, s <= 1 && (h = r.bufferCanvases[e.TEXTURE_BUFFER], e.textureMult = 2, h.width = l * e.textureMult, h.height = u * e.textureMult), e.canvasWidth = l, e.canvasHeight = u, e.pixelRatio = s;
  }
};
Ji.renderTo = function(t, e, r, n) {
  this.render({
    forcedContext: t,
    forcedZoom: e,
    forcedPan: r,
    drawAllLayers: !0,
    forcedPxRatio: n
  });
};
Ji.clearCanvas = function() {
  var t = this, e = t.data;
  function r(n) {
    n.clearRect(0, 0, t.canvasWidth, t.canvasHeight);
  }
  r(e.contexts[t.NODE]), r(e.contexts[t.DRAG]);
};
Ji.render = function(t) {
  var e = this;
  t = t || TV();
  var r = e.cy, n = t.forcedContext, i = t.drawAllLayers, a = t.drawOnlyNodeLayer, s = t.forcedZoom, o = t.forcedPan, l = t.forcedPxRatio === void 0 ? this.getPixelRatio() : t.forcedPxRatio, u = e.data, h = u.canvasNeedsRedraw, d = e.textureOnViewport && !n && (e.pinching || e.hoverData.dragging || e.swipePanning || e.data.wheelZooming), f = t.motionBlur !== void 0 ? t.motionBlur : e.motionBlur, p = e.motionBlurPxRatio, g = r.hasCompoundNodes(), m = e.hoverData.draggingEles, v = !!(e.hoverData.selecting || e.touchData.selecting);
  f = f && !n && e.motionBlurEnabled && !v;
  var y = f;
  n || (e.prevPxRatio !== l && (e.invalidateContainerClientCoordsCache(), e.matchCanvasSize(e.container), e.redrawHint("eles", !0), e.redrawHint("drag", !0)), e.prevPxRatio = l), !n && e.motionBlurTimeout && clearTimeout(e.motionBlurTimeout), f && (e.mbFrames == null && (e.mbFrames = 0), e.mbFrames++, e.mbFrames < 3 && (y = !1), e.mbFrames > e.minMbLowQualFrames && (e.motionBlurPxRatio = e.mbPxRBlurry)), e.clearingMotionBlur && (e.motionBlurPxRatio = 1), e.textureDrawLastFrame && !d && (h[e.NODE] = !0, h[e.SELECT_BOX] = !0);
  var b = r.style(), w = r.zoom(), T = s !== void 0 ? s : w, E = r.pan(), C = {
    x: E.x,
    y: E.y
  }, k = {
    zoom: w,
    pan: {
      x: E.x,
      y: E.y
    }
  }, _ = e.prevViewport, L = _ === void 0 || k.zoom !== _.zoom || k.pan.x !== _.pan.x || k.pan.y !== _.pan.y;
  !L && !(m && !g) && (e.motionBlurPxRatio = 1), o && (C = o), T *= l, C.x *= l, C.y *= l;
  var N = e.getCachedZSortedEles();
  function A(K, Z, X, q, J) {
    var j = K.globalCompositeOperation;
    K.globalCompositeOperation = "destination-out", e.colorFillStyle(K, 255, 255, 255, e.motionBlurTransparency), K.fillRect(Z, X, q, J), K.globalCompositeOperation = j;
  }
  function O(K, Z) {
    var X, q, J, j;
    !e.clearingMotionBlur && (K === u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE] || K === u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]) ? (X = {
      x: E.x * p,
      y: E.y * p
    }, q = w * p, J = e.canvasWidth * p, j = e.canvasHeight * p) : (X = C, q = T, J = e.canvasWidth, j = e.canvasHeight), K.setTransform(1, 0, 0, 1, 0, 0), Z === "motionBlur" ? A(K, 0, 0, J, j) : !n && (Z === void 0 || Z) && K.clearRect(0, 0, J, j), i || (K.translate(X.x, X.y), K.scale(q, q)), o && K.translate(o.x, o.y), s && K.scale(s, s);
  }
  if (d || (e.textureDrawLastFrame = !1), d) {
    if (e.textureDrawLastFrame = !0, !e.textureCache) {
      e.textureCache = {}, e.textureCache.bb = r.mutableElements().boundingBox(), e.textureCache.texture = e.data.bufferCanvases[e.TEXTURE_BUFFER];
      var P = e.data.bufferContexts[e.TEXTURE_BUFFER];
      P.setTransform(1, 0, 0, 1, 0, 0), P.clearRect(0, 0, e.canvasWidth * e.textureMult, e.canvasHeight * e.textureMult), e.render({
        forcedContext: P,
        drawOnlyNodeLayer: !0,
        forcedPxRatio: l * e.textureMult
      });
      var k = e.textureCache.viewport = {
        zoom: r.zoom(),
        pan: r.pan(),
        width: e.canvasWidth,
        height: e.canvasHeight
      };
      k.mpan = {
        x: (0 - k.pan.x) / k.zoom,
        y: (0 - k.pan.y) / k.zoom
      };
    }
    h[e.DRAG] = !1, h[e.NODE] = !1;
    var S = u.contexts[e.NODE], R = e.textureCache.texture, k = e.textureCache.viewport;
    S.setTransform(1, 0, 0, 1, 0, 0), f ? A(S, 0, 0, k.width, k.height) : S.clearRect(0, 0, k.width, k.height);
    var I = b.core("outside-texture-bg-color").value, D = b.core("outside-texture-bg-opacity").value;
    e.colorFillStyle(S, I[0], I[1], I[2], D), S.fillRect(0, 0, k.width, k.height);
    var w = r.zoom();
    O(S, !1), S.clearRect(k.mpan.x, k.mpan.y, k.width / k.zoom / l, k.height / k.zoom / l), S.drawImage(R, k.mpan.x, k.mpan.y, k.width / k.zoom / l, k.height / k.zoom / l);
  } else e.textureOnViewport && !n && (e.textureCache = null);
  var M = r.extent(), B = e.pinching || e.hoverData.dragging || e.swipePanning || e.data.wheelZooming || e.hoverData.draggingEles || e.cy.animated(), $ = e.hideEdgesOnViewport && B, F = [];
  if (F[e.NODE] = !h[e.NODE] && f && !e.clearedForMotionBlur[e.NODE] || e.clearingMotionBlur, F[e.NODE] && (e.clearedForMotionBlur[e.NODE] = !0), F[e.DRAG] = !h[e.DRAG] && f && !e.clearedForMotionBlur[e.DRAG] || e.clearingMotionBlur, F[e.DRAG] && (e.clearedForMotionBlur[e.DRAG] = !0), h[e.NODE] || i || a || F[e.NODE]) {
    var G = f && !F[e.NODE] && p !== 1, S = n || (G ? e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE] : u.contexts[e.NODE]), H = f && !G ? "motionBlur" : void 0;
    O(S, H), $ ? e.drawCachedNodes(S, N.nondrag, l, M) : e.drawLayeredElements(S, N.nondrag, l, M), e.debug && e.drawDebugPoints(S, N.nondrag), !i && !f && (h[e.NODE] = !1);
  }
  if (!a && (h[e.DRAG] || i || F[e.DRAG])) {
    var G = f && !F[e.DRAG] && p !== 1, S = n || (G ? e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG] : u.contexts[e.DRAG]);
    O(S, f && !G ? "motionBlur" : void 0), $ ? e.drawCachedNodes(S, N.drag, l, M) : e.drawCachedElements(S, N.drag, l, M), e.debug && e.drawDebugPoints(S, N.drag), !i && !f && (h[e.DRAG] = !1);
  }
  if (this.drawSelectionRectangle(t, O), f && p !== 1) {
    var ee = u.contexts[e.NODE], Y = e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE], re = u.contexts[e.DRAG], ne = e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG], he = function(Z, X, q) {
      Z.setTransform(1, 0, 0, 1, 0, 0), q || !y ? Z.clearRect(0, 0, e.canvasWidth, e.canvasHeight) : A(Z, 0, 0, e.canvasWidth, e.canvasHeight);
      var J = p;
      Z.drawImage(
        X,
        // img
        0,
        0,
        // sx, sy
        e.canvasWidth * J,
        e.canvasHeight * J,
        // sw, sh
        0,
        0,
        // x, y
        e.canvasWidth,
        e.canvasHeight
        // w, h
      );
    };
    (h[e.NODE] || F[e.NODE]) && (he(ee, Y, F[e.NODE]), h[e.NODE] = !1), (h[e.DRAG] || F[e.DRAG]) && (he(re, ne, F[e.DRAG]), h[e.DRAG] = !1);
  }
  e.prevViewport = k, e.clearingMotionBlur && (e.clearingMotionBlur = !1, e.motionBlurCleared = !0, e.motionBlur = !0), f && (e.motionBlurTimeout = setTimeout(function() {
    e.motionBlurTimeout = null, e.clearedForMotionBlur[e.NODE] = !1, e.clearedForMotionBlur[e.DRAG] = !1, e.motionBlur = !1, e.clearingMotionBlur = !d, e.mbFrames = 0, h[e.NODE] = !0, h[e.DRAG] = !0, e.redraw();
  }, i4e)), n || r.emit("render");
};
var c0;
Ji.drawSelectionRectangle = function(t, e) {
  var r = this, n = r.cy, i = r.data, a = n.style(), s = t.drawOnlyNodeLayer, o = t.drawAllLayers, l = i.canvasNeedsRedraw, u = t.forcedContext;
  if (r.showFps || !s && l[r.SELECT_BOX] && !o) {
    var h = u || i.contexts[r.SELECT_BOX];
    if (e(h), r.selection[4] == 1 && (r.hoverData.selecting || r.touchData.selecting)) {
      var d = r.cy.zoom(), f = a.core("selection-box-border-width").value / d;
      h.lineWidth = f, h.fillStyle = "rgba(" + a.core("selection-box-color").value[0] + "," + a.core("selection-box-color").value[1] + "," + a.core("selection-box-color").value[2] + "," + a.core("selection-box-opacity").value + ")", h.fillRect(r.selection[0], r.selection[1], r.selection[2] - r.selection[0], r.selection[3] - r.selection[1]), f > 0 && (h.strokeStyle = "rgba(" + a.core("selection-box-border-color").value[0] + "," + a.core("selection-box-border-color").value[1] + "," + a.core("selection-box-border-color").value[2] + "," + a.core("selection-box-opacity").value + ")", h.strokeRect(r.selection[0], r.selection[1], r.selection[2] - r.selection[0], r.selection[3] - r.selection[1]));
    }
    if (i.bgActivePosistion && !r.hoverData.selecting) {
      var d = r.cy.zoom(), p = i.bgActivePosistion;
      h.fillStyle = "rgba(" + a.core("active-bg-color").value[0] + "," + a.core("active-bg-color").value[1] + "," + a.core("active-bg-color").value[2] + "," + a.core("active-bg-opacity").value + ")", h.beginPath(), h.arc(p.x, p.y, a.core("active-bg-size").pfValue / d, 0, 2 * Math.PI), h.fill();
    }
    var g = r.lastRedrawTime;
    if (r.showFps && g) {
      g = Math.round(g);
      var m = Math.round(1e3 / g), v = "1 frame = " + g + " ms = " + m + " fps";
      if (h.setTransform(1, 0, 0, 1, 0, 0), h.fillStyle = "rgba(255, 0, 0, 0.75)", h.strokeStyle = "rgba(255, 0, 0, 0.75)", h.font = "30px Arial", !c0) {
        var y = h.measureText(v);
        c0 = y.actualBoundingBoxAscent;
      }
      h.fillText(v, 0, c0);
      var b = 60;
      h.strokeRect(0, c0 + 10, 250, 20), h.fillRect(0, c0 + 10, 250 * Math.min(m / b, 1), 20);
    }
    o || (l[r.SELECT_BOX] = !1);
  }
};
function J9(t, e, r) {
  var n = t.createShader(e);
  if (t.shaderSource(n, r), t.compileShader(n), !t.getShaderParameter(n, t.COMPILE_STATUS))
    throw new Error(t.getShaderInfoLog(n));
  return n;
}
function a4e(t, e, r) {
  var n = J9(t, t.VERTEX_SHADER, e), i = J9(t, t.FRAGMENT_SHADER, r), a = t.createProgram();
  if (t.attachShader(a, n), t.attachShader(a, i), t.linkProgram(a), !t.getProgramParameter(a, t.LINK_STATUS))
    throw new Error("Could not initialize shaders");
  return a;
}
function s4e(t, e, r) {
  r === void 0 && (r = e);
  var n = t.makeOffscreenCanvas(e, r), i = n.context = n.getContext("2d");
  return n.clear = function() {
    return i.clearRect(0, 0, n.width, n.height);
  }, n.clear(), n;
}
function dS(t) {
  var e = t.pixelRatio, r = t.cy.zoom(), n = t.cy.pan();
  return {
    zoom: r * e,
    pan: {
      x: n.x * e,
      y: n.y * e
    }
  };
}
function o4e(t) {
  var e = t.pixelRatio, r = t.cy.zoom();
  return r * e;
}
function l4e(t, e, r, n, i) {
  var a = n * r + e.x, s = i * r + e.y;
  return s = Math.round(t.canvasHeight - s), [a, s];
}
function c4e(t) {
  return t.pstyle("background-fill").value !== "solid" || t.pstyle("background-image").strValue !== "none" ? !1 : t.pstyle("border-width").value === 0 || t.pstyle("border-opacity").value === 0 ? !0 : t.pstyle("border-style").value === "solid";
}
function u4e(t, e) {
  if (t.length !== e.length)
    return !1;
  for (var r = 0; r < t.length; r++)
    if (t[r] !== e[r])
      return !1;
  return !0;
}
function Lc(t, e, r) {
  var n = t[0] / 255, i = t[1] / 255, a = t[2] / 255, s = e, o = r || new Array(4);
  return o[0] = n * s, o[1] = i * s, o[2] = a * s, o[3] = s, o;
}
function ih(t, e) {
  var r = e || new Array(4);
  return r[0] = (t >> 0 & 255) / 255, r[1] = (t >> 8 & 255) / 255, r[2] = (t >> 16 & 255) / 255, r[3] = (t >> 24 & 255) / 255, r;
}
function h4e(t) {
  return t[0] + (t[1] << 8) + (t[2] << 16) + (t[3] << 24);
}
function d4e(t, e) {
  var r = t.createTexture();
  return r.buffer = function(n) {
    t.bindTexture(t.TEXTURE_2D, r), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.LINEAR), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR_MIPMAP_NEAREST), t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, n), t.generateMipmap(t.TEXTURE_2D), t.bindTexture(t.TEXTURE_2D, null);
  }, r.deleteTexture = function() {
    t.deleteTexture(r);
  }, r;
}
function OG(t, e) {
  switch (e) {
    case "float":
      return [1, t.FLOAT, 4];
    case "vec2":
      return [2, t.FLOAT, 4];
    case "vec3":
      return [3, t.FLOAT, 4];
    case "vec4":
      return [4, t.FLOAT, 4];
    case "int":
      return [1, t.INT, 4];
    case "ivec2":
      return [2, t.INT, 4];
  }
}
function PG(t, e, r) {
  switch (e) {
    case t.FLOAT:
      return new Float32Array(r);
    case t.INT:
      return new Int32Array(r);
  }
}
function f4e(t, e, r, n, i, a) {
  switch (e) {
    case t.FLOAT:
      return new Float32Array(r.buffer, a * n, i);
    case t.INT:
      return new Int32Array(r.buffer, a * n, i);
  }
}
function p4e(t, e, r, n) {
  var i = OG(t, e), a = Tn(i, 2), s = a[0], o = a[1], l = PG(t, o, n), u = t.createBuffer();
  return t.bindBuffer(t.ARRAY_BUFFER, u), t.bufferData(t.ARRAY_BUFFER, l, t.STATIC_DRAW), o === t.FLOAT ? t.vertexAttribPointer(r, s, o, !1, 0, 0) : o === t.INT && t.vertexAttribIPointer(r, s, o, 0, 0), t.enableVertexAttribArray(r), t.bindBuffer(t.ARRAY_BUFFER, null), u;
}
function Ds(t, e, r, n) {
  var i = OG(t, r), a = Tn(i, 3), s = a[0], o = a[1], l = a[2], u = PG(t, o, e * s), h = s * l, d = t.createBuffer();
  t.bindBuffer(t.ARRAY_BUFFER, d), t.bufferData(t.ARRAY_BUFFER, e * h, t.DYNAMIC_DRAW), t.enableVertexAttribArray(n), o === t.FLOAT ? t.vertexAttribPointer(n, s, o, !1, h, 0) : o === t.INT && t.vertexAttribIPointer(n, s, o, h, 0), t.vertexAttribDivisor(n, 1), t.bindBuffer(t.ARRAY_BUFFER, null);
  for (var f = new Array(e), p = 0; p < e; p++)
    f[p] = f4e(t, o, u, h, s, p);
  return d.dataArray = u, d.stride = h, d.size = s, d.getView = function(g) {
    return f[g];
  }, d.setPoint = function(g, m, v) {
    var y = f[g];
    y[0] = m, y[1] = v;
  }, d.bufferSubData = function(g) {
    t.bindBuffer(t.ARRAY_BUFFER, d), g ? t.bufferSubData(t.ARRAY_BUFFER, 0, u, 0, g * s) : t.bufferSubData(t.ARRAY_BUFFER, 0, u);
  }, d;
}
function g4e(t, e, r) {
  for (var n = 9, i = new Float32Array(e * n), a = new Array(e), s = 0; s < e; s++) {
    var o = s * n * 4;
    a[s] = new Float32Array(i.buffer, o, n);
  }
  var l = t.createBuffer();
  t.bindBuffer(t.ARRAY_BUFFER, l), t.bufferData(t.ARRAY_BUFFER, i.byteLength, t.DYNAMIC_DRAW);
  for (var u = 0; u < 3; u++) {
    var h = r + u;
    t.enableVertexAttribArray(h), t.vertexAttribPointer(h, 3, t.FLOAT, !1, 3 * 12, u * 12), t.vertexAttribDivisor(h, 1);
  }
  return t.bindBuffer(t.ARRAY_BUFFER, null), l.getMatrixView = function(d) {
    return a[d];
  }, l.setData = function(d, f) {
    a[f].set(d, 0);
  }, l.bufferSubData = function() {
    t.bindBuffer(t.ARRAY_BUFFER, l), t.bufferSubData(t.ARRAY_BUFFER, 0, i);
  }, l;
}
function m4e(t) {
  var e = t.createFramebuffer();
  t.bindFramebuffer(t.FRAMEBUFFER, e);
  var r = t.createTexture();
  return t.bindTexture(t.TEXTURE_2D, r), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.LINEAR), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, r, 0), t.bindFramebuffer(t.FRAMEBUFFER, null), e.setFramebufferAttachmentSizes = function(n, i) {
    t.bindTexture(t.TEXTURE_2D, r), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, n, i, 0, t.RGBA, t.UNSIGNED_BYTE, null);
  }, e;
}
var eL = typeof Float32Array < "u" ? Float32Array : Array;
Math.hypot || (Math.hypot = function() {
  for (var t = 0, e = arguments.length; e--; )
    t += arguments[e] * arguments[e];
  return Math.sqrt(t);
});
function K3() {
  var t = new eL(9);
  return eL != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[0] = 1, t[4] = 1, t[8] = 1, t;
}
function tL(t) {
  return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t;
}
function v4e(t, e, r) {
  var n = e[0], i = e[1], a = e[2], s = e[3], o = e[4], l = e[5], u = e[6], h = e[7], d = e[8], f = r[0], p = r[1], g = r[2], m = r[3], v = r[4], y = r[5], b = r[6], w = r[7], T = r[8];
  return t[0] = f * n + p * s + g * u, t[1] = f * i + p * o + g * h, t[2] = f * a + p * l + g * d, t[3] = m * n + v * s + y * u, t[4] = m * i + v * o + y * h, t[5] = m * a + v * l + y * d, t[6] = b * n + w * s + T * u, t[7] = b * i + w * o + T * h, t[8] = b * a + w * l + T * d, t;
}
function hv(t, e, r) {
  var n = e[0], i = e[1], a = e[2], s = e[3], o = e[4], l = e[5], u = e[6], h = e[7], d = e[8], f = r[0], p = r[1];
  return t[0] = n, t[1] = i, t[2] = a, t[3] = s, t[4] = o, t[5] = l, t[6] = f * n + p * s + u, t[7] = f * i + p * o + h, t[8] = f * a + p * l + d, t;
}
function rL(t, e, r) {
  var n = e[0], i = e[1], a = e[2], s = e[3], o = e[4], l = e[5], u = e[6], h = e[7], d = e[8], f = Math.sin(r), p = Math.cos(r);
  return t[0] = p * n + f * s, t[1] = p * i + f * o, t[2] = p * a + f * l, t[3] = p * s - f * n, t[4] = p * o - f * i, t[5] = p * l - f * a, t[6] = u, t[7] = h, t[8] = d, t;
}
function TT(t, e, r) {
  var n = r[0], i = r[1];
  return t[0] = n * e[0], t[1] = n * e[1], t[2] = n * e[2], t[3] = i * e[3], t[4] = i * e[4], t[5] = i * e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t;
}
function y4e(t, e, r) {
  return t[0] = 2 / e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = -2 / r, t[5] = 0, t[6] = -1, t[7] = 1, t[8] = 1, t;
}
var x4e = /* @__PURE__ */ function() {
  function t(e, r, n, i) {
    sc(this, t), this.debugID = Math.floor(Math.random() * 1e4), this.r = e, this.texSize = r, this.texRows = n, this.texHeight = Math.floor(r / n), this.enableWrapping = !0, this.locked = !1, this.texture = null, this.needsBuffer = !0, this.freePointer = {
      x: 0,
      row: 0
    }, this.keyToLocation = /* @__PURE__ */ new Map(), this.canvas = i(e, r, r), this.scratch = i(e, r, this.texHeight, "scratch");
  }
  return oc(t, [{
    key: "lock",
    value: function() {
      this.locked = !0;
    }
  }, {
    key: "getKeys",
    value: function() {
      return new Set(this.keyToLocation.keys());
    }
  }, {
    key: "getScale",
    value: function(r) {
      var n = r.w, i = r.h, a = this.texHeight, s = this.texSize, o = a / i, l = n * o, u = i * o;
      return l > s && (o = s / n, l = n * o, u = i * o), {
        scale: o,
        texW: l,
        texH: u
      };
    }
  }, {
    key: "draw",
    value: function(r, n, i) {
      var a = this;
      if (this.locked) throw new Error("can't draw, atlas is locked");
      var s = this.texSize, o = this.texRows, l = this.texHeight, u = this.getScale(n), h = u.scale, d = u.texW, f = u.texH, p = function(w, T) {
        if (i && T) {
          var E = T.context, C = w.x, k = w.row, _ = C, L = l * k;
          E.save(), E.translate(_, L), E.scale(h, h), i(E, n), E.restore();
        }
      }, g = [null, null], m = function() {
        p(a.freePointer, a.canvas), g[0] = {
          x: a.freePointer.x,
          y: a.freePointer.row * l,
          w: d,
          h: f
        }, g[1] = {
          // create a second location with a width of 0, for convenience
          x: a.freePointer.x + d,
          y: a.freePointer.row * l,
          w: 0,
          h: f
        }, a.freePointer.x += d, a.freePointer.x == s && (a.freePointer.x = 0, a.freePointer.row++);
      }, v = function() {
        var w = a.scratch, T = a.canvas;
        w.clear(), p({
          x: 0,
          row: 0
        }, w);
        var E = s - a.freePointer.x, C = d - E, k = l;
        {
          var _ = a.freePointer.x, L = a.freePointer.row * l, N = E;
          T.context.drawImage(w, 0, 0, N, k, _, L, N, k), g[0] = {
            x: _,
            y: L,
            w: N,
            h: f
          };
        }
        {
          var A = E, O = (a.freePointer.row + 1) * l, P = C;
          T && T.context.drawImage(w, A, 0, P, k, 0, O, P, k), g[1] = {
            x: 0,
            y: O,
            w: P,
            h: f
          };
        }
        a.freePointer.x = C, a.freePointer.row++;
      }, y = function() {
        a.freePointer.x = 0, a.freePointer.row++;
      };
      if (this.freePointer.x + d <= s)
        m();
      else {
        if (this.freePointer.row >= o - 1)
          return !1;
        this.freePointer.x === s ? (y(), m()) : this.enableWrapping ? v() : (y(), m());
      }
      return this.keyToLocation.set(r, g), this.needsBuffer = !0, g;
    }
  }, {
    key: "getOffsets",
    value: function(r) {
      return this.keyToLocation.get(r);
    }
  }, {
    key: "isEmpty",
    value: function() {
      return this.freePointer.x === 0 && this.freePointer.row === 0;
    }
  }, {
    key: "canFit",
    value: function(r) {
      if (this.locked) return !1;
      var n = this.texSize, i = this.texRows, a = this.getScale(r), s = a.texW;
      return this.freePointer.x + s > n ? this.freePointer.row < i - 1 : !0;
    }
    // called on every frame
  }, {
    key: "bufferIfNeeded",
    value: function(r) {
      this.texture || (this.texture = d4e(r, this.debugID)), this.needsBuffer && (this.texture.buffer(this.canvas), this.needsBuffer = !1, this.locked && (this.canvas = null, this.scratch = null));
    }
  }, {
    key: "dispose",
    value: function() {
      this.texture && (this.texture.deleteTexture(), this.texture = null), this.canvas = null, this.scratch = null, this.locked = !0;
    }
  }]);
}(), b4e = /* @__PURE__ */ function() {
  function t(e, r, n, i) {
    sc(this, t), this.r = e, this.texSize = r, this.texRows = n, this.createTextureCanvas = i, this.atlases = [], this.styleKeyToAtlas = /* @__PURE__ */ new Map(), this.markedKeys = /* @__PURE__ */ new Set();
  }
  return oc(t, [{
    key: "getKeys",
    value: function() {
      return new Set(this.styleKeyToAtlas.keys());
    }
  }, {
    key: "_createAtlas",
    value: function() {
      var r = this.r, n = this.texSize, i = this.texRows, a = this.createTextureCanvas;
      return new x4e(r, n, i, a);
    }
  }, {
    key: "_getScratchCanvas",
    value: function() {
      if (!this.scratch) {
        var r = this.r, n = this.texSize, i = this.texRows, a = this.createTextureCanvas, s = Math.floor(n / i);
        this.scratch = a(r, n, s, "scratch");
      }
      return this.scratch;
    }
  }, {
    key: "draw",
    value: function(r, n, i) {
      var a = this.styleKeyToAtlas.get(r);
      return a || (a = this.atlases[this.atlases.length - 1], (!a || !a.canFit(n)) && (a && a.lock(), a = this._createAtlas(), this.atlases.push(a)), a.draw(r, n, i), this.styleKeyToAtlas.set(r, a)), a;
    }
  }, {
    key: "getAtlas",
    value: function(r) {
      return this.styleKeyToAtlas.get(r);
    }
  }, {
    key: "hasAtlas",
    value: function(r) {
      return this.styleKeyToAtlas.has(r);
    }
  }, {
    key: "markKeyForGC",
    value: function(r) {
      this.markedKeys.add(r);
    }
  }, {
    key: "gc",
    value: function() {
      var r = this, n = this.markedKeys;
      if (n.size === 0) {
        console.log("nothing to garbage collect");
        return;
      }
      var i = [], a = /* @__PURE__ */ new Map(), s = null, o = ca(this.atlases), l;
      try {
        var u = function() {
          var d = l.value, f = d.getKeys(), p = w4e(n, f);
          if (p.size === 0)
            return i.push(d), f.forEach(function(E) {
              return a.set(E, d);
            }), 1;
          s || (s = r._createAtlas(), i.push(s));
          var g = ca(f), m;
          try {
            for (g.s(); !(m = g.n()).done; ) {
              var v = m.value;
              if (!p.has(v)) {
                var y = d.getOffsets(v), b = Tn(y, 2), w = b[0], T = b[1];
                s.canFit({
                  w: w.w + T.w,
                  h: w.h
                }) || (s.lock(), s = r._createAtlas(), i.push(s)), d.canvas && (r._copyTextureToNewAtlas(v, d, s), a.set(v, s));
              }
            }
          } catch (E) {
            g.e(E);
          } finally {
            g.f();
          }
          d.dispose();
        };
        for (o.s(); !(l = o.n()).done; )
          u();
      } catch (h) {
        o.e(h);
      } finally {
        o.f();
      }
      this.atlases = i, this.styleKeyToAtlas = a, this.markedKeys = /* @__PURE__ */ new Set();
    }
  }, {
    key: "_copyTextureToNewAtlas",
    value: function(r, n, i) {
      var a = n.getOffsets(r), s = Tn(a, 2), o = s[0], l = s[1];
      if (l.w === 0)
        i.draw(r, o, function(f) {
          f.drawImage(n.canvas, o.x, o.y, o.w, o.h, 0, 0, o.w, o.h);
        });
      else {
        var u = this._getScratchCanvas();
        u.clear(), u.context.drawImage(n.canvas, o.x, o.y, o.w, o.h, 0, 0, o.w, o.h), u.context.drawImage(n.canvas, l.x, l.y, l.w, l.h, o.w, 0, l.w, l.h);
        var h = o.w + l.w, d = o.h;
        i.draw(r, {
          w: h,
          h: d
        }, function(f) {
          f.drawImage(
            u,
            0,
            0,
            h,
            d,
            0,
            0,
            h,
            d
            // the destination context has already been translated to the correct position
          );
        });
      }
    }
  }, {
    key: "getCounts",
    value: function() {
      return {
        keyCount: this.styleKeyToAtlas.size,
        atlasCount: new Set(this.styleKeyToAtlas.values()).size
      };
    }
  }]);
}();
function w4e(t, e) {
  return t.intersection ? t.intersection(e) : new Set(Dy(t).filter(function(r) {
    return e.has(r);
  }));
}
var T4e = /* @__PURE__ */ function() {
  function t(e, r) {
    sc(this, t), this.r = e, this.globalOptions = r, this.atlasSize = r.webglTexSize, this.maxAtlasesPerBatch = r.webglTexPerBatch, this.renderTypes = /* @__PURE__ */ new Map(), this.collections = /* @__PURE__ */ new Map(), this.typeAndIdToKey = /* @__PURE__ */ new Map();
  }
  return oc(t, [{
    key: "getAtlasSize",
    value: function() {
      return this.atlasSize;
    }
  }, {
    key: "addAtlasCollection",
    value: function(r, n) {
      var i = this.globalOptions, a = i.webglTexSize, s = i.createTextureCanvas, o = n.texRows, l = this._cacheScratchCanvas(s), u = new b4e(this.r, a, o, l);
      this.collections.set(r, u);
    }
  }, {
    key: "addRenderType",
    value: function(r, n) {
      var i = n.collection;
      if (!this.collections.has(i)) throw new Error("invalid atlas collection name '".concat(i, "'"));
      var a = this.collections.get(i), s = Gt({
        type: r,
        atlasCollection: a
      }, n);
      this.renderTypes.set(r, s);
    }
  }, {
    key: "getRenderTypeOpts",
    value: function(r) {
      return this.renderTypes.get(r);
    }
  }, {
    key: "getAtlasCollection",
    value: function(r) {
      return this.collections.get(r);
    }
  }, {
    key: "_cacheScratchCanvas",
    value: function(r) {
      var n = -1, i = -1, a = null;
      return function(s, o, l, u) {
        return u ? ((!a || o != n || l != i) && (n = o, i = l, a = r(s, o, l)), a) : r(s, o, l);
      };
    }
  }, {
    key: "_key",
    value: function(r, n) {
      return "".concat(r, "-").concat(n);
    }
    /** Marks textues associated with the element for garbage collection. */
  }, {
    key: "invalidate",
    value: function(r) {
      var n = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = i.forceRedraw, s = a === void 0 ? !1 : a, o = i.filterEle, l = o === void 0 ? function() {
        return !0;
      } : o, u = i.filterType, h = u === void 0 ? function() {
        return !0;
      } : u, d = !1, f = !1, p = ca(r), g;
      try {
        for (p.s(); !(g = p.n()).done; ) {
          var m = g.value;
          if (l(m)) {
            var v = ca(this.renderTypes.values()), y;
            try {
              var b = function() {
                var T = y.value, E = T.type;
                if (h(E)) {
                  var C = n.collections.get(T.collection), k = T.getKey(m), _ = Array.isArray(k) ? k : [k];
                  if (s)
                    _.forEach(function(O) {
                      return C.markKeyForGC(O);
                    }), f = !0;
                  else {
                    var L = T.getID ? T.getID(m) : m.id(), N = n._key(E, L), A = n.typeAndIdToKey.get(N);
                    A !== void 0 && !u4e(_, A) && (d = !0, n.typeAndIdToKey.delete(N), A.forEach(function(O) {
                      return C.markKeyForGC(O);
                    }));
                  }
                }
              };
              for (v.s(); !(y = v.n()).done; )
                b();
            } catch (w) {
              v.e(w);
            } finally {
              v.f();
            }
          }
        }
      } catch (w) {
        p.e(w);
      } finally {
        p.f();
      }
      return f && (this.gc(), d = !1), d;
    }
    /** Garbage collect */
  }, {
    key: "gc",
    value: function() {
      var r = ca(this.collections.values()), n;
      try {
        for (r.s(); !(n = r.n()).done; ) {
          var i = n.value;
          i.gc();
        }
      } catch (a) {
        r.e(a);
      } finally {
        r.f();
      }
    }
  }, {
    key: "getOrCreateAtlas",
    value: function(r, n, i, a) {
      var s = this.renderTypes.get(n), o = this.collections.get(s.collection), l = !1, u = o.draw(a, i, function(f) {
        s.drawClipped ? (f.save(), f.beginPath(), f.rect(0, 0, i.w, i.h), f.clip(), s.drawElement(f, r, i, !0, !0), f.restore()) : s.drawElement(f, r, i, !0, !0), l = !0;
      });
      if (l) {
        var h = s.getID ? s.getID(r) : r.id(), d = this._key(n, h);
        this.typeAndIdToKey.has(d) ? this.typeAndIdToKey.get(d).push(a) : this.typeAndIdToKey.set(d, [a]);
      }
      return u;
    }
  }, {
    key: "getAtlasInfo",
    value: function(r, n) {
      var i = this, a = this.renderTypes.get(n), s = a.getKey(r), o = Array.isArray(s) ? s : [s];
      return o.map(function(l) {
        var u = a.getBoundingBox(r, l), h = i.getOrCreateAtlas(r, n, u, l), d = h.getOffsets(l), f = Tn(d, 2), p = f[0], g = f[1];
        return {
          atlas: h,
          tex: p,
          tex1: p,
          tex2: g,
          bb: u
        };
      });
    }
  }, {
    key: "getDebugInfo",
    value: function() {
      var r = [], n = ca(this.collections), i;
      try {
        for (n.s(); !(i = n.n()).done; ) {
          var a = Tn(i.value, 2), s = a[0], o = a[1], l = o.getCounts(), u = l.keyCount, h = l.atlasCount;
          r.push({
            type: s,
            keyCount: u,
            atlasCount: h
          });
        }
      } catch (d) {
        n.e(d);
      } finally {
        n.f();
      }
      return r;
    }
  }]);
}(), E4e = /* @__PURE__ */ function() {
  function t(e) {
    sc(this, t), this.globalOptions = e, this.atlasSize = e.webglTexSize, this.maxAtlasesPerBatch = e.webglTexPerBatch, this.batchAtlases = [];
  }
  return oc(t, [{
    key: "getMaxAtlasesPerBatch",
    value: function() {
      return this.maxAtlasesPerBatch;
    }
  }, {
    key: "getAtlasSize",
    value: function() {
      return this.atlasSize;
    }
  }, {
    key: "getIndexArray",
    value: function() {
      return Array.from({
        length: this.maxAtlasesPerBatch
      }, function(r, n) {
        return n;
      });
    }
  }, {
    key: "startBatch",
    value: function() {
      this.batchAtlases = [];
    }
  }, {
    key: "getAtlasCount",
    value: function() {
      return this.batchAtlases.length;
    }
  }, {
    key: "getAtlases",
    value: function() {
      return this.batchAtlases;
    }
  }, {
    key: "canAddToCurrentBatch",
    value: function(r) {
      return this.batchAtlases.length === this.maxAtlasesPerBatch ? this.batchAtlases.includes(r) : !0;
    }
  }, {
    key: "getAtlasIndexForBatch",
    value: function(r) {
      var n = this.batchAtlases.indexOf(r);
      if (n < 0) {
        if (this.batchAtlases.length === this.maxAtlasesPerBatch)
          throw new Error("cannot add more atlases to batch");
        this.batchAtlases.push(r), n = this.batchAtlases.length - 1;
      }
      return n;
    }
  }]);
}(), k4e = `
  float circleSD(vec2 p, float r) {
    return distance(vec2(0), p) - r; // signed distance
  }
`, S4e = `
  float rectangleSD(vec2 p, vec2 b) {
    vec2 d = abs(p)-b;
    return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
  }
`, C4e = `
  float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
    cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
    cr.x  = (p.y > 0.0) ? cr.x  : cr.y;
    vec2 q = abs(p) - b + cr.x;
    return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
  }
`, A4e = `
  float ellipseSD(vec2 p, vec2 ab) {
    p = abs( p ); // symmetry

    // find root with Newton solver
    vec2 q = ab*(p-ab);
    float w = (q.x<q.y)? 1.570796327 : 0.0;
    for( int i=0; i<5; i++ ) {
      vec2 cs = vec2(cos(w),sin(w));
      vec2 u = ab*vec2( cs.x,cs.y);
      vec2 v = ab*vec2(-cs.y,cs.x);
      w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
    }
    
    // compute final point and distance
    float d = length(p-ab*vec2(cos(w),sin(w)));
    
    // return signed distance
    return (dot(p/ab,p/ab)>1.0) ? d : -d;
  }
`, Rp = {
  SCREEN: {
    name: "screen",
    screen: !0
  },
  PICKING: {
    name: "picking",
    picking: !0
  }
}, Hy = {
  // render the texture just like in RENDER_TARGET.SCREEN mode
  IGNORE: 1,
  // don't render the texture at all
  USE_BB: 2
  // render the bounding box as an opaque rectangle
}, Z3 = 0, nL = 1, iL = 2, Q3 = 3, ah = 4, om = 5, u0 = 6, h0 = 7, _4e = /* @__PURE__ */ function() {
  function t(e, r, n) {
    sc(this, t), this.r = e, this.gl = r, this.maxInstances = n.webglBatchSize, this.atlasSize = n.webglTexSize, this.bgColor = n.bgColor, this.debug = n.webglDebug, this.batchDebugInfo = [], n.enableWrapping = !0, n.createTextureCanvas = s4e, this.atlasManager = new T4e(e, n), this.batchManager = new E4e(n), this.simpleShapeOptions = /* @__PURE__ */ new Map(), this.program = this._createShaderProgram(Rp.SCREEN), this.pickingProgram = this._createShaderProgram(Rp.PICKING), this.vao = this._createVAO();
  }
  return oc(t, [{
    key: "addAtlasCollection",
    value: function(r, n) {
      this.atlasManager.addAtlasCollection(r, n);
    }
    /**
     * @typedef { Object } TextureRenderTypeOpts
     * @property { string } collection - name of atlas collection to render textures to
     * @property { function } getKey - returns the "style key" for an element, may be a single value or an array for multi-line lables
     * @property { function } drawElement - uses a canvas renderer to draw the element to the texture atlas
     * @property { boolean  } drawClipped - if true the context will be clipped to the bounding box before drawElement() is called, may affect performance
     * @property { function } getBoundingBox - returns the bounding box for an element
     * @property { function } getRotation
     * @property { function } getRotationPoint
     * @property { function } getRotationOffset
     * @property { function } isVisible - an extra check for visibility in addition to ele.visible()
     * @property { function } getTexPickingMode - returns a value from the TEX_PICKING_MODE enum
     */
    /**
     * @param { string } typeName
     * @param { TextureRenderTypeOpts } opts
     */
  }, {
    key: "addTextureAtlasRenderType",
    value: function(r, n) {
      this.atlasManager.addRenderType(r, n);
    }
    /**
     * @typedef { Object } SimpleShapeRenderTypeOpts
     * @property { function } getBoundingBox - returns the bounding box for an element
     * @property { function } isVisible - this is an extra check for visibility in addition to ele.visible()
     * @property { function } isSimple - check if element is a simple shape, or if it needs to fall back to texture rendering
     * @property { ShapeVisualProperties } shapeProps
     */
    /**
     * @typedef { Object } ShapeVisualProperties
     * @property { string } shape
     * @property { string } color
     * @property { string } opacity
     * @property { string } padding
     * @property { string } radius
     * @property { boolean } border
    */
    /**
     * @param { string } typeName
     * @param { SimpleShapeRenderTypeOpts } opts
     */
  }, {
    key: "addSimpleShapeRenderType",
    value: function(r, n) {
      this.simpleShapeOptions.set(r, n);
    }
    /**
     * Inform the atlasManager when element style keys may have changed.
     * The atlasManager can then mark unused textures for "garbage collection".
     */
  }, {
    key: "invalidate",
    value: function(r) {
      var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = n.type, a = this.atlasManager;
      return i ? a.invalidate(r, {
        filterType: function(o) {
          return o === i;
        },
        forceRedraw: !0
      }) : a.invalidate(r);
    }
    /**
     * Run texture garbage collection.
     */
  }, {
    key: "gc",
    value: function() {
      this.atlasManager.gc();
    }
  }, {
    key: "_createShaderProgram",
    value: function(r) {
      var n = this.gl, i = `#version 300 es
      precision highp float;

      uniform mat3 uPanZoomMatrix;
      uniform int  uAtlasSize;
      
      // instanced
      in vec2 aPosition; // a vertex from the unit square
      
      in mat3 aTransform; // used to transform verticies, eg into a bounding box
      in int aVertType; // the type of thing we are rendering

      // the z-index that is output when using picking mode
      in vec4 aIndex;
      
      // For textures
      in int aAtlasId; // which shader unit/atlas to use
      in vec4 aTex; // x/y/w/h of texture in atlas

      // for edges
      in vec4 aPointAPointB;
      in vec4 aPointCPointD;
      in vec2 aLineWidth; // also used for node border width

      // simple shapes
      in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
      in vec4 aColor; // also used for edges
      in vec4 aBorderColor; // aLineWidth is used for border width

      // output values passed to the fragment shader
      out vec2 vTexCoord;
      out vec4 vColor;
      out vec2 vPosition;
      // flat values are not interpolated
      flat out int vAtlasId; 
      flat out int vVertType;
      flat out vec2 vTopRight;
      flat out vec2 vBotLeft;
      flat out vec4 vCornerRadius;
      flat out vec4 vBorderColor;
      flat out vec2 vBorderWidth;
      flat out vec4 vIndex;
      
      void main(void) {
        int vid = gl_VertexID;
        vec2 position = aPosition; // TODO make this a vec3, simplifies some code below

        if(aVertType == `.concat(Z3, `) {
          float texX = aTex.x; // texture coordinates
          float texY = aTex.y;
          float texW = aTex.z;
          float texH = aTex.w;

          if(vid == 1 || vid == 2 || vid == 4) {
            texX += texW;
          }
          if(vid == 2 || vid == 4 || vid == 5) {
            texY += texH;
          }

          float d = float(uAtlasSize);
          vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1

          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
        }
        else if(aVertType == `).concat(ah, " || aVertType == ").concat(h0, ` 
             || aVertType == `).concat(om, " || aVertType == ").concat(u0, `) { // simple shapes

          // the bounding box is needed by the fragment shader
          vBotLeft  = (aTransform * vec3(0, 0, 1)).xy; // flat
          vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
          vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated

          // calculations are done in the fragment shader, just pass these along
          vColor = aColor;
          vCornerRadius = aCornerRadius;
          vBorderColor = aBorderColor;
          vBorderWidth = aLineWidth;

          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
        }
        else if(aVertType == `).concat(nL, `) {
          vec2 source = aPointAPointB.xy;
          vec2 target = aPointAPointB.zw;

          // adjust the geometry so that the line is centered on the edge
          position.y = position.y - 0.5;

          // stretch the unit square into a long skinny rectangle
          vec2 xBasis = target - source;
          vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
          vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;

          gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
          vColor = aColor;
        } 
        else if(aVertType == `).concat(iL, `) {
          vec2 pointA = aPointAPointB.xy;
          vec2 pointB = aPointAPointB.zw;
          vec2 pointC = aPointCPointD.xy;
          vec2 pointD = aPointCPointD.zw;

          // adjust the geometry so that the line is centered on the edge
          position.y = position.y - 0.5;

          vec2 p0, p1, p2, pos;
          if(position.x == 0.0) { // The left side of the unit square
            p0 = pointA;
            p1 = pointB;
            p2 = pointC;
            pos = position;
          } else { // The right side of the unit square, use same approach but flip the geometry upside down
            p0 = pointD;
            p1 = pointC;
            p2 = pointB;
            pos = vec2(0.0, -position.y);
          }

          vec2 p01 = p1 - p0;
          vec2 p12 = p2 - p1;
          vec2 p21 = p1 - p2;

          // Find the normal vector.
          vec2 tangent = normalize(normalize(p12) + normalize(p01));
          vec2 normal = vec2(-tangent.y, tangent.x);

          // Find the vector perpendicular to p0 -> p1.
          vec2 p01Norm = normalize(vec2(-p01.y, p01.x));

          // Determine the bend direction.
          float sigma = sign(dot(p01 + p21, normal));
          float width = aLineWidth[0];

          if(sign(pos.y) == -sigma) {
            // This is an intersecting vertex. Adjust the position so that there's no overlap.
            vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
            gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
          } else {
            // This is a non-intersecting vertex. Treat it like a mitre join.
            vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
            gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
          }

          vColor = aColor;
        } 
        else if(aVertType == `).concat(Q3, ` && vid < 3) {
          // massage the first triangle into an edge arrow
          if(vid == 0)
            position = vec2(-0.15, -0.3);
          if(vid == 1)
            position = vec2(  0.0,  0.0);
          if(vid == 2)
            position = vec2( 0.15, -0.3);

          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
          vColor = aColor;
        }
        else {
          gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
        }

        vAtlasId = aAtlasId;
        vVertType = aVertType;
        vIndex = aIndex;
      }
    `), a = this.batchManager.getIndexArray(), s = `#version 300 es
      precision highp float;

      // declare texture unit for each texture atlas in the batch
      `.concat(a.map(function(u) {
        return "uniform sampler2D uTexture".concat(u, ";");
      }).join(`
	`), `

      uniform vec4 uBGColor;
      uniform float uZoom;

      in vec2 vTexCoord;
      in vec4 vColor;
      in vec2 vPosition; // model coordinates

      flat in int vAtlasId;
      flat in vec4 vIndex;
      flat in int vVertType;
      flat in vec2 vTopRight;
      flat in vec2 vBotLeft;
      flat in vec4 vCornerRadius;
      flat in vec4 vBorderColor;
      flat in vec2 vBorderWidth;

      out vec4 outColor;

      `).concat(k4e, `
      `).concat(S4e, `
      `).concat(C4e, `
      `).concat(A4e, `

      vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
        return vec4( 
          top.rgb + (bot.rgb * (1.0 - top.a)),
          top.a   + (bot.a   * (1.0 - top.a)) 
        );
      }

      vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
        // scale to the zoom level so that borders don't look blurry when zoomed in
        // note 1.5 is an aribitrary value chosen because it looks good
        return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); 
      }

      void main(void) {
        if(vVertType == `).concat(Z3, `) {
          // look up the texel from the texture unit
          `).concat(a.map(function(u) {
        return "if(vAtlasId == ".concat(u, ") outColor = texture(uTexture").concat(u, ", vTexCoord);");
      }).join(`
	else `), `
        } 
        else if(vVertType == `).concat(Q3, `) {
          // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
          outColor = blend(vColor, uBGColor);
          outColor.a = 1.0; // make opaque, masks out line under arrow
        }
        else if(vVertType == `).concat(ah, ` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
          outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
        }
        else if(vVertType == `).concat(ah, " || vVertType == ").concat(h0, ` 
          || vVertType == `).concat(om, " || vVertType == ").concat(u0, `) { // use SDF

          float outerBorder = vBorderWidth[0];
          float innerBorder = vBorderWidth[1];
          float borderPadding = outerBorder * 2.0;
          float w = vTopRight.x - vBotLeft.x - borderPadding;
          float h = vTopRight.y - vBotLeft.y - borderPadding;
          vec2 b = vec2(w/2.0, h/2.0); // half width, half height
          vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center

          float d; // signed distance
          if(vVertType == `).concat(ah, `) {
            d = rectangleSD(p, b);
          } else if(vVertType == `).concat(h0, ` && w == h) {
            d = circleSD(p, b.x); // faster than ellipse
          } else if(vVertType == `).concat(h0, `) {
            d = ellipseSD(p, b);
          } else {
            d = roundRectangleSD(p, b, vCornerRadius.wzyx);
          }

          // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
          // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
          if(d > 0.0) {
            if(d > outerBorder) {
              discard;
            } else {
              outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
            }
          } else {
            if(d > innerBorder) {
              vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
              vec4 innerBorderColor = blend(vBorderColor, vColor);
              outColor = distInterp(innerBorderColor, outerColor, d);
            } 
            else {
              vec4 outerColor;
              if(innerBorder == 0.0 && outerBorder == 0.0) {
                outerColor = vec4(0);
              } else if(innerBorder == 0.0) {
                outerColor = vBorderColor;
              } else {
                outerColor = blend(vBorderColor, vColor);
              }
              outColor = distInterp(vColor, outerColor, d - innerBorder);
            }
          }
        }
        else {
          outColor = vColor;
        }

        `).concat(r.picking ? `if(outColor.a == 0.0) discard;
             else outColor = vIndex;` : "", `
      }
    `), o = a4e(n, i, s);
      o.aPosition = n.getAttribLocation(o, "aPosition"), o.aIndex = n.getAttribLocation(o, "aIndex"), o.aVertType = n.getAttribLocation(o, "aVertType"), o.aTransform = n.getAttribLocation(o, "aTransform"), o.aAtlasId = n.getAttribLocation(o, "aAtlasId"), o.aTex = n.getAttribLocation(o, "aTex"), o.aPointAPointB = n.getAttribLocation(o, "aPointAPointB"), o.aPointCPointD = n.getAttribLocation(o, "aPointCPointD"), o.aLineWidth = n.getAttribLocation(o, "aLineWidth"), o.aColor = n.getAttribLocation(o, "aColor"), o.aCornerRadius = n.getAttribLocation(o, "aCornerRadius"), o.aBorderColor = n.getAttribLocation(o, "aBorderColor"), o.uPanZoomMatrix = n.getUniformLocation(o, "uPanZoomMatrix"), o.uAtlasSize = n.getUniformLocation(o, "uAtlasSize"), o.uBGColor = n.getUniformLocation(o, "uBGColor"), o.uZoom = n.getUniformLocation(o, "uZoom"), o.uTextures = [];
      for (var l = 0; l < this.batchManager.getMaxAtlasesPerBatch(); l++)
        o.uTextures.push(n.getUniformLocation(o, "uTexture".concat(l)));
      return o;
    }
  }, {
    key: "_createVAO",
    value: function() {
      var r = [0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1];
      this.vertexCount = r.length / 2;
      var n = this.maxInstances, i = this.gl, a = this.program, s = i.createVertexArray();
      return i.bindVertexArray(s), p4e(i, "vec2", a.aPosition, r), this.transformBuffer = g4e(i, n, a.aTransform), this.indexBuffer = Ds(i, n, "vec4", a.aIndex), this.vertTypeBuffer = Ds(i, n, "int", a.aVertType), this.atlasIdBuffer = Ds(i, n, "int", a.aAtlasId), this.texBuffer = Ds(i, n, "vec4", a.aTex), this.pointAPointBBuffer = Ds(i, n, "vec4", a.aPointAPointB), this.pointCPointDBuffer = Ds(i, n, "vec4", a.aPointCPointD), this.lineWidthBuffer = Ds(i, n, "vec2", a.aLineWidth), this.colorBuffer = Ds(i, n, "vec4", a.aColor), this.cornerRadiusBuffer = Ds(i, n, "vec4", a.aCornerRadius), this.borderColorBuffer = Ds(i, n, "vec4", a.aBorderColor), i.bindVertexArray(null), s;
    }
  }, {
    key: "buffers",
    get: function() {
      var r = this;
      return this._buffers || (this._buffers = Object.keys(this).filter(function(n) {
        return El(n, "Buffer");
      }).map(function(n) {
        return r[n];
      })), this._buffers;
    }
  }, {
    key: "startFrame",
    value: function(r) {
      var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Rp.SCREEN;
      this.panZoomMatrix = r, this.renderTarget = n, this.batchDebugInfo = [], this.wrappedCount = 0, this.simpleCount = 0, this.startBatch();
    }
  }, {
    key: "startBatch",
    value: function() {
      this.instanceCount = 0, this.batchManager.startBatch();
    }
  }, {
    key: "endFrame",
    value: function() {
      this.endBatch();
    }
  }, {
    key: "_isVisible",
    value: function(r, n) {
      return r.visible() ? n && n.isVisible ? n.isVisible(r) : !0 : !1;
    }
    /**
     * Draws a texture using the texture atlas.
     */
  }, {
    key: "drawTexture",
    value: function(r, n, i) {
      var a = this.atlasManager, s = this.batchManager, o = a.getRenderTypeOpts(i);
      if (this._isVisible(r, o) && !(r.isEdge() && !this._isValidEdge(r))) {
        if (this.renderTarget.picking && o.getTexPickingMode) {
          var l = o.getTexPickingMode(r);
          if (l === Hy.IGNORE)
            return;
          if (l == Hy.USE_BB) {
            this.drawPickingRectangle(r, n, i);
            return;
          }
        }
        var u = a.getAtlasInfo(r, i), h = ca(u), d;
        try {
          for (h.s(); !(d = h.n()).done; ) {
            var f = d.value, p = f.atlas, g = f.tex1, m = f.tex2;
            s.canAddToCurrentBatch(p) || this.endBatch();
            for (var v = s.getAtlasIndexForBatch(p), y = 0, b = [[g, !0], [m, !1]]; y < b.length; y++) {
              var w = Tn(b[y], 2), T = w[0], E = w[1];
              if (T.w != 0) {
                var C = this.instanceCount;
                this.vertTypeBuffer.getView(C)[0] = Z3;
                var k = this.indexBuffer.getView(C);
                ih(n, k);
                var _ = this.atlasIdBuffer.getView(C);
                _[0] = v;
                var L = this.texBuffer.getView(C);
                L[0] = T.x, L[1] = T.y, L[2] = T.w, L[3] = T.h;
                var N = this.transformBuffer.getMatrixView(C);
                this.setTransformMatrix(r, N, o, f, E), this.instanceCount++, E || this.wrappedCount++, this.instanceCount >= this.maxInstances && this.endBatch();
              }
            }
          }
        } catch (A) {
          h.e(A);
        } finally {
          h.f();
        }
      }
    }
    /**
     * matrix is expected to be a 9 element array
     * this function follows same pattern as CRp.drawCachedElementPortion(...)
     */
  }, {
    key: "setTransformMatrix",
    value: function(r, n, i, a) {
      var s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, o = 0;
      if (i.shapeProps && i.shapeProps.padding && (o = r.pstyle(i.shapeProps.padding).pfValue), a) {
        var l = a.bb, u = a.tex1, h = a.tex2, d = u.w / (u.w + h.w);
        s || (d = 1 - d);
        var f = this._getAdjustedBB(l, o, s, d);
        this._applyTransformMatrix(n, f, i, r);
      } else {
        var p = i.getBoundingBox(r), g = this._getAdjustedBB(p, o, !0, 1);
        this._applyTransformMatrix(n, g, i, r);
      }
    }
  }, {
    key: "_applyTransformMatrix",
    value: function(r, n, i, a) {
      var s, o;
      tL(r);
      var l = i.getRotation ? i.getRotation(a) : 0;
      if (l !== 0) {
        var u = i.getRotationPoint(a), h = u.x, d = u.y;
        hv(r, r, [h, d]), rL(r, r, l);
        var f = i.getRotationOffset(a);
        s = f.x + (n.xOffset || 0), o = f.y + (n.yOffset || 0);
      } else
        s = n.x1, o = n.y1;
      hv(r, r, [s, o]), TT(r, r, [n.w, n.h]);
    }
    /**
     * Adjusts a node or label BB to accomodate padding and split for wrapped textures.
     * @param bb - the original bounding box
     * @param padding - the padding to add to the bounding box
     * @param first - whether this is the first part of a wrapped texture
     * @param ratio - the ratio of the texture width of part of the text to the entire texture
     */
  }, {
    key: "_getAdjustedBB",
    value: function(r, n, i, a) {
      var s = r.x1, o = r.y1, l = r.w, u = r.h, h = r.yOffset;
      n && (s -= n, o -= n, l += 2 * n, u += 2 * n);
      var d = 0, f = l * a;
      return i && a < 1 ? l = f : !i && a < 1 && (d = l - f, s += d, l = f), {
        x1: s,
        y1: o,
        w: l,
        h: u,
        xOffset: d,
        yOffset: h
      };
    }
    /**
     * Draw a solid opaque rectangle matching the element's Bounding Box.
     * Used by the PICKING mode to make the entire BB of a label clickable.
     */
  }, {
    key: "drawPickingRectangle",
    value: function(r, n, i) {
      var a = this.atlasManager.getRenderTypeOpts(i), s = this.instanceCount;
      this.vertTypeBuffer.getView(s)[0] = ah;
      var o = this.indexBuffer.getView(s);
      ih(n, o);
      var l = this.colorBuffer.getView(s);
      Lc([0, 0, 0], 1, l);
      var u = this.transformBuffer.getMatrixView(s);
      this.setTransformMatrix(r, u, a), this.simpleCount++, this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch();
    }
    /**
     * Draw a node using either a texture or a "simple shape".
     */
  }, {
    key: "drawNode",
    value: function(r, n, i) {
      var a = this.simpleShapeOptions.get(i);
      if (this._isVisible(r, a)) {
        var s = a.shapeProps, o = this._getVertTypeForShape(r, s.shape);
        if (o === void 0 || a.isSimple && !a.isSimple(r)) {
          this.drawTexture(r, n, i);
          return;
        }
        var l = this.instanceCount;
        if (this.vertTypeBuffer.getView(l)[0] = o, o === om || o === u0) {
          var u = a.getBoundingBox(r), h = this._getCornerRadius(r, s.radius, u), d = this.cornerRadiusBuffer.getView(l);
          d[0] = h, d[1] = h, d[2] = h, d[3] = h, o === u0 && (d[0] = 0, d[2] = 0);
        }
        var f = this.indexBuffer.getView(l);
        ih(n, f);
        var p = r.pstyle(s.color).value, g = r.pstyle(s.opacity).value, m = this.colorBuffer.getView(l);
        Lc(p, g, m);
        var v = this.lineWidthBuffer.getView(l);
        if (v[0] = 0, v[1] = 0, s.border) {
          var y = r.pstyle("border-width").value;
          if (y > 0) {
            var b = r.pstyle("border-color").value, w = r.pstyle("border-opacity").value, T = this.borderColorBuffer.getView(l);
            Lc(b, w, T);
            var E = r.pstyle("border-position").value;
            if (E === "inside")
              v[0] = 0, v[1] = -y;
            else if (E === "outside")
              v[0] = y, v[1] = 0;
            else {
              var C = y / 2;
              v[0] = C, v[1] = -C;
            }
          }
        }
        var k = this.transformBuffer.getMatrixView(l);
        this.setTransformMatrix(r, k, a), this.simpleCount++, this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch();
      }
    }
  }, {
    key: "_getVertTypeForShape",
    value: function(r, n) {
      var i = r.pstyle(n).value;
      switch (i) {
        case "rectangle":
          return ah;
        case "ellipse":
          return h0;
        case "roundrectangle":
        case "round-rectangle":
          return om;
        case "bottom-round-rectangle":
          return u0;
        default:
          return;
      }
    }
  }, {
    key: "_getCornerRadius",
    value: function(r, n, i) {
      var a = i.w, s = i.h;
      if (r.pstyle(n).value === "auto")
        return Wl(a, s);
      var o = r.pstyle(n).pfValue, l = a / 2, u = s / 2;
      return Math.min(o, u, l);
    }
    /**
     * Only supports drawing triangles at the moment.
     */
  }, {
    key: "drawEdgeArrow",
    value: function(r, n, i) {
      if (r.visible()) {
        var a = r._private.rscratch, s, o, l;
        if (i === "source" ? (s = a.arrowStartX, o = a.arrowStartY, l = a.srcArrowAngle) : (s = a.arrowEndX, o = a.arrowEndY, l = a.tgtArrowAngle), !(isNaN(s) || s == null || isNaN(o) || o == null || isNaN(l) || l == null)) {
          var u = r.pstyle(i + "-arrow-shape").value;
          if (u !== "none") {
            var h = r.pstyle(i + "-arrow-color").value, d = r.pstyle("opacity").value, f = r.pstyle("line-opacity").value, p = d * f, g = r.pstyle("width").pfValue, m = r.pstyle("arrow-scale").value, v = this.r.getArrowWidth(g, m), y = this.instanceCount, b = this.transformBuffer.getMatrixView(y);
            tL(b), hv(b, b, [s, o]), TT(b, b, [v, v]), rL(b, b, l), this.vertTypeBuffer.getView(y)[0] = Q3;
            var w = this.indexBuffer.getView(y);
            ih(n, w);
            var T = this.colorBuffer.getView(y);
            Lc(h, p, T), this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch();
          }
        }
      }
    }
    /**
     * Draw straight-line or bezier curve edges.
     */
  }, {
    key: "drawEdgeLine",
    value: function(r, n) {
      if (r.visible()) {
        var i = this._getEdgePoints(r);
        if (i) {
          var a = r.pstyle("opacity").value, s = r.pstyle("line-opacity").value, o = r.pstyle("width").pfValue, l = r.pstyle("line-color").value, u = a * s;
          if (i.length / 2 + this.instanceCount > this.maxInstances && this.endBatch(), i.length == 4) {
            var h = this.instanceCount;
            this.vertTypeBuffer.getView(h)[0] = nL;
            var d = this.indexBuffer.getView(h);
            ih(n, d);
            var f = this.colorBuffer.getView(h);
            Lc(l, u, f);
            var p = this.lineWidthBuffer.getView(h);
            p[0] = o;
            var g = this.pointAPointBBuffer.getView(h);
            g[0] = i[0], g[1] = i[1], g[2] = i[2], g[3] = i[3], this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch();
          } else
            for (var m = 0; m < i.length - 2; m += 2) {
              var v = this.instanceCount;
              this.vertTypeBuffer.getView(v)[0] = iL;
              var y = this.indexBuffer.getView(v);
              ih(n, y);
              var b = this.colorBuffer.getView(v);
              Lc(l, u, b);
              var w = this.lineWidthBuffer.getView(v);
              w[0] = o;
              var T = i[m - 2], E = i[m - 1], C = i[m], k = i[m + 1], _ = i[m + 2], L = i[m + 3], N = i[m + 4], A = i[m + 5];
              m == 0 && (T = 2 * C - _ + 1e-3, E = 2 * k - L + 1e-3), m == i.length - 4 && (N = 2 * _ - C + 1e-3, A = 2 * L - k + 1e-3);
              var O = this.pointAPointBBuffer.getView(v);
              O[0] = T, O[1] = E, O[2] = C, O[3] = k;
              var P = this.pointCPointDBuffer.getView(v);
              P[0] = _, P[1] = L, P[2] = N, P[3] = A, this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch();
            }
        }
      }
    }
  }, {
    key: "_isValidEdge",
    value: function(r) {
      var n = r._private.rscratch;
      return !(n.badLine || n.allpts == null || isNaN(n.allpts[0]));
    }
  }, {
    key: "_getEdgePoints",
    value: function(r) {
      var n = r._private.rscratch;
      if (this._isValidEdge(r)) {
        var i = n.allpts;
        if (i.length == 4)
          return i;
        var a = this._getNumSegments(r);
        return this._getCurveSegmentPoints(i, a);
      }
    }
  }, {
    key: "_getNumSegments",
    value: function(r) {
      var n = 15;
      return Math.min(Math.max(n, 5), this.maxInstances);
    }
  }, {
    key: "_getCurveSegmentPoints",
    value: function(r, n) {
      if (r.length == 4)
        return r;
      for (var i = Array((n + 1) * 2), a = 0; a <= n; a++)
        if (a == 0)
          i[0] = r[0], i[1] = r[1];
        else if (a == n)
          i[a * 2] = r[r.length - 2], i[a * 2 + 1] = r[r.length - 1];
        else {
          var s = a / n;
          this._setCurvePoint(r, s, i, a * 2);
        }
      return i;
    }
  }, {
    key: "_setCurvePoint",
    value: function(r, n, i, a) {
      if (r.length <= 2)
        i[a] = r[0], i[a + 1] = r[1];
      else {
        for (var s = Array(r.length - 2), o = 0; o < s.length; o += 2) {
          var l = (1 - n) * r[o] + n * r[o + 2], u = (1 - n) * r[o + 1] + n * r[o + 3];
          s[o] = l, s[o + 1] = u;
        }
        return this._setCurvePoint(s, n, i, a);
      }
    }
  }, {
    key: "endBatch",
    value: function() {
      var r = this.gl, n = this.vao, i = this.vertexCount, a = this.instanceCount;
      if (a !== 0) {
        var s = this.renderTarget.picking ? this.pickingProgram : this.program;
        r.useProgram(s), r.bindVertexArray(n);
        var o = ca(this.buffers), l;
        try {
          for (o.s(); !(l = o.n()).done; ) {
            var u = l.value;
            u.bufferSubData(a);
          }
        } catch (g) {
          o.e(g);
        } finally {
          o.f();
        }
        for (var h = this.batchManager.getAtlases(), d = 0; d < h.length; d++)
          h[d].bufferIfNeeded(r);
        for (var f = 0; f < h.length; f++)
          r.activeTexture(r.TEXTURE0 + f), r.bindTexture(r.TEXTURE_2D, h[f].texture), r.uniform1i(s.uTextures[f], f);
        r.uniform1f(s.uZoom, o4e(this.r)), r.uniformMatrix3fv(s.uPanZoomMatrix, !1, this.panZoomMatrix), r.uniform1i(s.uAtlasSize, this.batchManager.getAtlasSize());
        var p = Lc(this.bgColor, 1);
        r.uniform4fv(s.uBGColor, p), r.drawArraysInstanced(r.TRIANGLES, 0, i, a), r.bindVertexArray(null), r.bindTexture(r.TEXTURE_2D, null), this.debug && this.batchDebugInfo.push({
          count: a,
          // instance count
          atlasCount: h.length
        }), this.startBatch();
      }
    }
  }, {
    key: "getDebugInfo",
    value: function() {
      var r = this.atlasManager.getDebugInfo(), n = r.reduce(function(s, o) {
        return s + o.atlasCount;
      }, 0), i = this.batchDebugInfo, a = i.reduce(function(s, o) {
        return s + o.count;
      }, 0);
      return {
        atlasInfo: r,
        totalAtlases: n,
        wrappedCount: this.wrappedCount,
        simpleCount: this.simpleCount,
        batchCount: i.length,
        batchInfo: i,
        totalInstances: a
      };
    }
  }]);
}(), BG = {};
BG.initWebgl = function(t, e) {
  var r = this, n = r.data.contexts[r.WEBGL];
  t.bgColor = L4e(r), t.webglTexSize = Math.min(t.webglTexSize, n.getParameter(n.MAX_TEXTURE_SIZE)), t.webglTexRows = Math.min(t.webglTexRows, 54), t.webglTexRowsNodes = Math.min(t.webglTexRowsNodes, 54), t.webglBatchSize = Math.min(t.webglBatchSize, 16384), t.webglTexPerBatch = Math.min(t.webglTexPerBatch, n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)), r.webglDebug = t.webglDebug, r.webglDebugShowAtlases = t.webglDebugShowAtlases, r.pickingFrameBuffer = m4e(n), r.pickingFrameBuffer.needsDraw = !0, r.drawing = new _4e(r, n, t);
  var i = function(d) {
    return function(f) {
      return r.getTextAngle(f, d);
    };
  }, a = function(d) {
    return function(f) {
      var p = f.pstyle(d);
      return p && p.value;
    };
  }, s = function(d) {
    return function(f) {
      return f.pstyle("".concat(d, "-opacity")).value > 0;
    };
  }, o = function(d) {
    var f = d.pstyle("text-events").strValue === "yes";
    return f ? Hy.USE_BB : Hy.IGNORE;
  }, l = function(d) {
    var f = d.position(), p = f.x, g = f.y, m = d.outerWidth(), v = d.outerHeight();
    return {
      w: m,
      h: v,
      x1: p - m / 2,
      y1: g - v / 2
    };
  };
  r.drawing.addAtlasCollection("node", {
    texRows: t.webglTexRowsNodes
  }), r.drawing.addAtlasCollection("label", {
    texRows: t.webglTexRows
  }), r.drawing.addTextureAtlasRenderType("node-body", {
    collection: "node",
    getKey: e.getStyleKey,
    getBoundingBox: e.getElementBox,
    drawElement: e.drawElement
  }), r.drawing.addSimpleShapeRenderType("node-body", {
    getBoundingBox: l,
    isSimple: c4e,
    shapeProps: {
      shape: "shape",
      color: "background-color",
      opacity: "background-opacity",
      radius: "corner-radius",
      border: !0
    }
  }), r.drawing.addSimpleShapeRenderType("node-overlay", {
    getBoundingBox: l,
    isVisible: s("overlay"),
    shapeProps: {
      shape: "overlay-shape",
      color: "overlay-color",
      opacity: "overlay-opacity",
      padding: "overlay-padding",
      radius: "overlay-corner-radius"
    }
  }), r.drawing.addSimpleShapeRenderType("node-underlay", {
    getBoundingBox: l,
    isVisible: s("underlay"),
    shapeProps: {
      shape: "underlay-shape",
      color: "underlay-color",
      opacity: "underlay-opacity",
      padding: "underlay-padding",
      radius: "underlay-corner-radius"
    }
  }), r.drawing.addTextureAtlasRenderType("label", {
    // node label or edge mid label
    collection: "label",
    getTexPickingMode: o,
    getKey: J3(e.getLabelKey, null),
    getBoundingBox: e5(e.getLabelBox, null),
    drawClipped: !0,
    drawElement: e.drawLabel,
    getRotation: i(null),
    getRotationPoint: e.getLabelRotationPoint,
    getRotationOffset: e.getLabelRotationOffset,
    isVisible: a("label")
  }), r.drawing.addTextureAtlasRenderType("edge-source-label", {
    collection: "label",
    getTexPickingMode: o,
    getKey: J3(e.getSourceLabelKey, "source"),
    getBoundingBox: e5(e.getSourceLabelBox, "source"),
    drawClipped: !0,
    drawElement: e.drawSourceLabel,
    getRotation: i("source"),
    getRotationPoint: e.getSourceLabelRotationPoint,
    getRotationOffset: e.getSourceLabelRotationOffset,
    isVisible: a("source-label")
  }), r.drawing.addTextureAtlasRenderType("edge-target-label", {
    collection: "label",
    getTexPickingMode: o,
    getKey: J3(e.getTargetLabelKey, "target"),
    getBoundingBox: e5(e.getTargetLabelBox, "target"),
    drawClipped: !0,
    drawElement: e.drawTargetLabel,
    getRotation: i("target"),
    getRotationPoint: e.getTargetLabelRotationPoint,
    getRotationOffset: e.getTargetLabelRotationOffset,
    isVisible: a("target-label")
  });
  var u = t1(function() {
    console.log("garbage collect flag set"), r.data.gc = !0;
  }, 1e4);
  r.onUpdateEleCalcs(function(h, d) {
    var f = !1;
    d && d.length > 0 && (f |= r.drawing.invalidate(d)), f && u();
  }), R4e(r);
};
function L4e(t) {
  var e = t.cy.container(), r = e && e.style && e.style.backgroundColor || "white";
  return hV(r);
}
function FG(t, e) {
  var r = t._private.rscratch;
  return aa(r, "labelWrapCachedLines", e) || [];
}
var J3 = function(e, r) {
  return function(n) {
    var i = e(n), a = FG(n, r);
    return a.length > 1 ? a.map(function(s, o) {
      return "".concat(i, "_").concat(o);
    }) : i;
  };
}, e5 = function(e, r) {
  return function(n, i) {
    var a = e(n);
    if (typeof i == "string") {
      var s = i.indexOf("_");
      if (s > 0) {
        var o = Number(i.substring(s + 1)), l = FG(n, r), u = a.h / l.length, h = u * o, d = a.y1 + h;
        return {
          x1: a.x1,
          w: a.w,
          y1: d,
          h: u,
          yOffset: h
        };
      }
    }
    return a;
  };
};
function R4e(t) {
  {
    var e = t.render;
    t.render = function(a) {
      a = a || {};
      var s = t.cy;
      t.webgl && (s.zoom() > RG ? (N4e(t), e.call(t, a)) : (M4e(t), zG(t, a, Rp.SCREEN)));
    };
  }
  {
    var r = t.matchCanvasSize;
    t.matchCanvasSize = function(a) {
      r.call(t, a), t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth, t.canvasHeight), t.pickingFrameBuffer.needsDraw = !0;
    };
  }
  t.findNearestElements = function(a, s, o, l) {
    return F4e(t, a, s);
  };
  {
    var n = t.invalidateCachedZSortedEles;
    t.invalidateCachedZSortedEles = function() {
      n.call(t), t.pickingFrameBuffer.needsDraw = !0;
    };
  }
  {
    var i = t.notify;
    t.notify = function(a, s) {
      i.call(t, a, s), a === "viewport" || a === "bounds" ? t.pickingFrameBuffer.needsDraw = !0 : a === "background" && t.drawing.invalidate(s, {
        type: "node-body"
      });
    };
  }
}
function N4e(t) {
  var e = t.data.contexts[t.WEBGL];
  e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
}
function M4e(t) {
  var e = function(n) {
    n.save(), n.setTransform(1, 0, 0, 1, 0, 0), n.clearRect(0, 0, t.canvasWidth, t.canvasHeight), n.restore();
  };
  e(t.data.contexts[t.NODE]), e(t.data.contexts[t.DRAG]);
}
function D4e(t) {
  var e = t.canvasWidth, r = t.canvasHeight, n = dS(t), i = n.pan, a = n.zoom, s = K3();
  hv(s, s, [i.x, i.y]), TT(s, s, [a, a]);
  var o = K3();
  y4e(o, e, r);
  var l = K3();
  return v4e(l, o, s), l;
}
function $G(t, e) {
  var r = t.canvasWidth, n = t.canvasHeight, i = dS(t), a = i.pan, s = i.zoom;
  e.setTransform(1, 0, 0, 1, 0, 0), e.clearRect(0, 0, r, n), e.translate(a.x, a.y), e.scale(s, s);
}
function I4e(t, e) {
  t.drawSelectionRectangle(e, function(r) {
    return $G(t, r);
  });
}
function O4e(t) {
  var e = t.data.contexts[t.NODE];
  e.save(), $G(t, e), e.strokeStyle = "rgba(0, 0, 0, 0.3)", e.beginPath(), e.moveTo(-1e3, 0), e.lineTo(1e3, 0), e.stroke(), e.beginPath(), e.moveTo(0, -1e3), e.lineTo(0, 1e3), e.stroke(), e.restore();
}
function P4e(t) {
  var e = function(i, a, s) {
    for (var o = i.atlasManager.getAtlasCollection(a), l = t.data.contexts[t.NODE], u = o.atlases, h = 0; h < u.length; h++) {
      var d = u[h], f = d.canvas;
      if (f) {
        var p = f.width, g = f.height, m = p * h, v = f.height * s, y = 0.4;
        l.save(), l.scale(y, y), l.drawImage(f, m, v), l.strokeStyle = "black", l.rect(m, v, p, g), l.stroke(), l.restore();
      }
    }
  }, r = 0;
  e(t.drawing, "node", r++), e(t.drawing, "label", r++);
}
function B4e(t, e, r, n, i) {
  var a, s, o, l, u = dS(t), h = u.pan, d = u.zoom;
  {
    var f = l4e(t, h, d, e, r), p = Tn(f, 2), g = p[0], m = p[1], v = 6;
    a = g - v / 2, s = m - v / 2, o = v, l = v;
  }
  if (o === 0 || l === 0)
    return [];
  var y = t.data.contexts[t.WEBGL];
  y.bindFramebuffer(y.FRAMEBUFFER, t.pickingFrameBuffer), t.pickingFrameBuffer.needsDraw && (y.viewport(0, 0, y.canvas.width, y.canvas.height), zG(t, null, Rp.PICKING), t.pickingFrameBuffer.needsDraw = !1);
  var b = o * l, w = new Uint8Array(b * 4);
  y.readPixels(a, s, o, l, y.RGBA, y.UNSIGNED_BYTE, w), y.bindFramebuffer(y.FRAMEBUFFER, null);
  for (var T = /* @__PURE__ */ new Set(), E = 0; E < b; E++) {
    var C = w.slice(E * 4, E * 4 + 4), k = h4e(C) - 1;
    k >= 0 && T.add(k);
  }
  return T;
}
function F4e(t, e, r) {
  var n = B4e(t, e, r), i = t.getCachedZSortedEles(), a, s, o = ca(n), l;
  try {
    for (o.s(); !(l = o.n()).done; ) {
      var u = l.value, h = i[u];
      if (!a && h.isNode() && (a = h), !s && h.isEdge() && (s = h), a && s)
        break;
    }
  } catch (d) {
    o.e(d);
  } finally {
    o.f();
  }
  return [a, s].filter(Boolean);
}
function t5(t, e, r) {
  var n = t.drawing;
  e += 1, r.isNode() ? (n.drawNode(r, e, "node-underlay"), n.drawNode(r, e, "node-body"), n.drawTexture(r, e, "label"), n.drawNode(r, e, "node-overlay")) : (n.drawEdgeLine(r, e), n.drawEdgeArrow(r, e, "source"), n.drawEdgeArrow(r, e, "target"), n.drawTexture(r, e, "label"), n.drawTexture(r, e, "edge-source-label"), n.drawTexture(r, e, "edge-target-label"));
}
function zG(t, e, r) {
  var n;
  t.webglDebug && (n = performance.now());
  var i = t.drawing, a = 0;
  if (r.screen && t.data.canvasNeedsRedraw[t.SELECT_BOX] && I4e(t, e), t.data.canvasNeedsRedraw[t.NODE] || r.picking) {
    var s = t.data.contexts[t.WEBGL];
    r.screen ? (s.clearColor(0, 0, 0, 0), s.enable(s.BLEND), s.blendFunc(s.ONE, s.ONE_MINUS_SRC_ALPHA)) : s.disable(s.BLEND), s.clear(s.COLOR_BUFFER_BIT | s.DEPTH_BUFFER_BIT), s.viewport(0, 0, s.canvas.width, s.canvas.height);
    var o = D4e(t), l = t.getCachedZSortedEles();
    if (a = l.length, i.startFrame(o, r), r.screen) {
      for (var u = 0; u < l.nondrag.length; u++)
        t5(t, u, l.nondrag[u]);
      for (var h = 0; h < l.drag.length; h++)
        t5(t, h, l.drag[h]);
    } else if (r.picking)
      for (var d = 0; d < l.length; d++)
        t5(t, d, l[d]);
    i.endFrame(), r.screen && t.webglDebugShowAtlases && (O4e(t), P4e(t)), t.data.canvasNeedsRedraw[t.NODE] = !1, t.data.canvasNeedsRedraw[t.DRAG] = !1;
  }
  if (t.webglDebug) {
    var f = performance.now(), p = !1, g = Math.ceil(f - n), m = i.getDebugInfo(), v = ["".concat(a, " elements"), "".concat(m.totalInstances, " instances"), "".concat(m.batchCount, " batches"), "".concat(m.totalAtlases, " atlases"), "".concat(m.wrappedCount, " wrapped textures"), "".concat(m.simpleCount, " simple shapes")].join(", ");
    if (p)
      console.log("WebGL (".concat(r.name, ") - time ").concat(g, "ms, ").concat(v));
    else {
      console.log("WebGL (".concat(r.name, ") - frame time ").concat(g, "ms")), console.log("Totals:"), console.log("  ".concat(v)), console.log("Texture Atlases Used:");
      var y = m.atlasInfo, b = ca(y), w;
      try {
        for (b.s(); !(w = b.n()).done; ) {
          var T = w.value;
          console.log("  ".concat(T.type, ": ").concat(T.keyCount, " keys, ").concat(T.atlasCount, " atlases"));
        }
      } catch (E) {
        b.e(E);
      } finally {
        b.f();
      }
      console.log("");
    }
  }
  t.data.gc && (console.log("Garbage Collect!"), t.data.gc = !1, i.gc());
}
var uc = {};
uc.drawPolygonPath = function(t, e, r, n, i, a) {
  var s = n / 2, o = i / 2;
  t.beginPath && t.beginPath(), t.moveTo(e + s * a[0], r + o * a[1]);
  for (var l = 1; l < a.length / 2; l++)
    t.lineTo(e + s * a[l * 2], r + o * a[l * 2 + 1]);
  t.closePath();
};
uc.drawRoundPolygonPath = function(t, e, r, n, i, a, s) {
  s.forEach(function(o) {
    return wG(t, o);
  }), t.closePath();
};
uc.drawRoundRectanglePath = function(t, e, r, n, i, a) {
  var s = n / 2, o = i / 2, l = a === "auto" ? Wl(n, i) : Math.min(a, o, s);
  t.beginPath && t.beginPath(), t.moveTo(e, r - o), t.arcTo(e + s, r - o, e + s, r, l), t.arcTo(e + s, r + o, e, r + o, l), t.arcTo(e - s, r + o, e - s, r, l), t.arcTo(e - s, r - o, e, r - o, l), t.lineTo(e, r - o), t.closePath();
};
uc.drawBottomRoundRectanglePath = function(t, e, r, n, i, a) {
  var s = n / 2, o = i / 2, l = a === "auto" ? Wl(n, i) : a;
  t.beginPath && t.beginPath(), t.moveTo(e, r - o), t.lineTo(e + s, r - o), t.lineTo(e + s, r), t.arcTo(e + s, r + o, e, r + o, l), t.arcTo(e - s, r + o, e - s, r, l), t.lineTo(e - s, r - o), t.lineTo(e, r - o), t.closePath();
};
uc.drawCutRectanglePath = function(t, e, r, n, i, a, s) {
  var o = n / 2, l = i / 2, u = s === "auto" ? Qk() : s;
  t.beginPath && t.beginPath(), t.moveTo(e - o + u, r - l), t.lineTo(e + o - u, r - l), t.lineTo(e + o, r - l + u), t.lineTo(e + o, r + l - u), t.lineTo(e + o - u, r + l), t.lineTo(e - o + u, r + l), t.lineTo(e - o, r + l - u), t.lineTo(e - o, r - l + u), t.closePath();
};
uc.drawBarrelPath = function(t, e, r, n, i) {
  var a = n / 2, s = i / 2, o = e - a, l = e + a, u = r - s, h = r + s, d = lT(n, i), f = d.widthOffset, p = d.heightOffset, g = d.ctrlPtOffsetPct * f;
  t.beginPath && t.beginPath(), t.moveTo(o, u + p), t.lineTo(o, h - p), t.quadraticCurveTo(o + g, h, o + f, h), t.lineTo(l - f, h), t.quadraticCurveTo(l - g, h, l, h - p), t.lineTo(l, u + p), t.quadraticCurveTo(l - g, u, l - f, u), t.lineTo(o + f, u), t.quadraticCurveTo(o + g, u, o, u + p), t.closePath();
};
var aL = Math.sin(0), sL = Math.cos(0), ET = {}, kT = {}, VG = Math.PI / 40;
for (var sh = 0 * Math.PI; sh < 2 * Math.PI; sh += VG)
  ET[sh] = Math.sin(sh), kT[sh] = Math.cos(sh);
uc.drawEllipsePath = function(t, e, r, n, i) {
  if (t.beginPath && t.beginPath(), t.ellipse)
    t.ellipse(e, r, n / 2, i / 2, 0, 0, 2 * Math.PI);
  else
    for (var a, s, o = n / 2, l = i / 2, u = 0 * Math.PI; u < 2 * Math.PI; u += VG)
      a = e - o * ET[u] * aL + o * kT[u] * sL, s = r + l * kT[u] * aL + l * ET[u] * sL, u === 0 ? t.moveTo(a, s) : t.lineTo(a, s);
  t.closePath();
};
var o1 = {};
o1.createBuffer = function(t, e) {
  var r = document.createElement("canvas");
  return r.width = t, r.height = e, [r, r.getContext("2d")];
};
o1.bufferCanvasImage = function(t) {
  var e = this.cy, r = e.mutableElements(), n = r.boundingBox(), i = this.findContainerClientCoords(), a = t.full ? Math.ceil(n.w) : i[2], s = t.full ? Math.ceil(n.h) : i[3], o = vt(t.maxWidth) || vt(t.maxHeight), l = this.getPixelRatio(), u = 1;
  if (t.scale !== void 0)
    a *= t.scale, s *= t.scale, u = t.scale;
  else if (o) {
    var h = 1 / 0, d = 1 / 0;
    vt(t.maxWidth) && (h = u * t.maxWidth / a), vt(t.maxHeight) && (d = u * t.maxHeight / s), u = Math.min(h, d), a *= u, s *= u;
  }
  o || (a *= l, s *= l, u *= l);
  var f = document.createElement("canvas");
  f.width = a, f.height = s, f.style.width = a + "px", f.style.height = s + "px";
  var p = f.getContext("2d");
  if (a > 0 && s > 0) {
    p.clearRect(0, 0, a, s), p.globalCompositeOperation = "source-over";
    var g = this.getCachedZSortedEles();
    if (t.full)
      p.translate(-n.x1 * u, -n.y1 * u), p.scale(u, u), this.drawElements(p, g), p.scale(1 / u, 1 / u), p.translate(n.x1 * u, n.y1 * u);
    else {
      var m = e.pan(), v = {
        x: m.x * u,
        y: m.y * u
      };
      u *= e.zoom(), p.translate(v.x, v.y), p.scale(u, u), this.drawElements(p, g), p.scale(1 / u, 1 / u), p.translate(-v.x, -v.y);
    }
    t.bg && (p.globalCompositeOperation = "destination-over", p.fillStyle = t.bg, p.rect(0, 0, a, s), p.fill());
  }
  return f;
};
function $4e(t, e) {
  for (var r = atob(t), n = new ArrayBuffer(r.length), i = new Uint8Array(n), a = 0; a < r.length; a++)
    i[a] = r.charCodeAt(a);
  return new Blob([n], {
    type: e
  });
}
function oL(t) {
  var e = t.indexOf(",");
  return t.substr(e + 1);
}
function GG(t, e, r) {
  var n = function() {
    return e.toDataURL(r, t.quality);
  };
  switch (t.output) {
    case "blob-promise":
      return new Df(function(i, a) {
        try {
          e.toBlob(function(s) {
            s != null ? i(s) : a(new Error("`canvas.toBlob()` sent a null value in its callback"));
          }, r, t.quality);
        } catch (s) {
          a(s);
        }
      });
    case "blob":
      return $4e(oL(n()), r);
    case "base64":
      return oL(n());
    case "base64uri":
    default:
      return n();
  }
}
o1.png = function(t) {
  return GG(t, this.bufferCanvasImage(t), "image/png");
};
o1.jpg = function(t) {
  return GG(t, this.bufferCanvasImage(t), "image/jpeg");
};
var UG = {};
UG.nodeShapeImpl = function(t, e, r, n, i, a, s, o) {
  switch (t) {
    case "ellipse":
      return this.drawEllipsePath(e, r, n, i, a);
    case "polygon":
      return this.drawPolygonPath(e, r, n, i, a, s);
    case "round-polygon":
      return this.drawRoundPolygonPath(e, r, n, i, a, s, o);
    case "roundrectangle":
    case "round-rectangle":
      return this.drawRoundRectanglePath(e, r, n, i, a, o);
    case "cutrectangle":
    case "cut-rectangle":
      return this.drawCutRectanglePath(e, r, n, i, a, s, o);
    case "bottomroundrectangle":
    case "bottom-round-rectangle":
      return this.drawBottomRoundRectanglePath(e, r, n, i, a, o);
    case "barrel":
      return this.drawBarrelPath(e, r, n, i, a);
  }
};
var z4e = WG, Jt = WG.prototype;
Jt.CANVAS_LAYERS = 3;
Jt.SELECT_BOX = 0;
Jt.DRAG = 1;
Jt.NODE = 2;
Jt.WEBGL = 3;
Jt.CANVAS_TYPES = ["2d", "2d", "2d", "webgl2"];
Jt.BUFFER_COUNT = 3;
Jt.TEXTURE_BUFFER = 0;
Jt.MOTIONBLUR_BUFFER_NODE = 1;
Jt.MOTIONBLUR_BUFFER_DRAG = 2;
function WG(t) {
  var e = this, r = e.cy.window(), n = r.document;
  t.webgl && (Jt.CANVAS_LAYERS = e.CANVAS_LAYERS = 4, console.log("webgl rendering enabled")), e.data = {
    canvases: new Array(Jt.CANVAS_LAYERS),
    contexts: new Array(Jt.CANVAS_LAYERS),
    canvasNeedsRedraw: new Array(Jt.CANVAS_LAYERS),
    bufferCanvases: new Array(Jt.BUFFER_COUNT),
    bufferContexts: new Array(Jt.CANVAS_LAYERS)
  };
  var i = "-webkit-tap-highlight-color", a = "rgba(0,0,0,0)";
  e.data.canvasContainer = n.createElement("div");
  var s = e.data.canvasContainer.style;
  e.data.canvasContainer.style[i] = a, s.position = "relative", s.zIndex = "0", s.overflow = "hidden";
  var o = t.cy.container();
  o.appendChild(e.data.canvasContainer), o.style[i] = a;
  var l = {
    "-webkit-user-select": "none",
    "-moz-user-select": "-moz-none",
    "user-select": "none",
    "-webkit-tap-highlight-color": "rgba(0,0,0,0)",
    "outline-style": "none"
  };
  Ime() && (l["-ms-touch-action"] = "none", l["touch-action"] = "none");
  for (var u = 0; u < Jt.CANVAS_LAYERS; u++) {
    var h = e.data.canvases[u] = n.createElement("canvas"), d = Jt.CANVAS_TYPES[u];
    e.data.contexts[u] = h.getContext(d), e.data.contexts[u] || Kr("Could not create canvas of type " + d), Object.keys(l).forEach(function(K) {
      h.style[K] = l[K];
    }), h.style.position = "absolute", h.setAttribute("data-id", "layer" + u), h.style.zIndex = String(Jt.CANVAS_LAYERS - u), e.data.canvasContainer.appendChild(h), e.data.canvasNeedsRedraw[u] = !1;
  }
  e.data.topCanvas = e.data.canvases[0], e.data.canvases[Jt.NODE].setAttribute("data-id", "layer" + Jt.NODE + "-node"), e.data.canvases[Jt.SELECT_BOX].setAttribute("data-id", "layer" + Jt.SELECT_BOX + "-selectbox"), e.data.canvases[Jt.DRAG].setAttribute("data-id", "layer" + Jt.DRAG + "-drag"), e.data.canvases[Jt.WEBGL] && e.data.canvases[Jt.WEBGL].setAttribute("data-id", "layer" + Jt.WEBGL + "-webgl");
  for (var u = 0; u < Jt.BUFFER_COUNT; u++)
    e.data.bufferCanvases[u] = n.createElement("canvas"), e.data.bufferContexts[u] = e.data.bufferCanvases[u].getContext("2d"), e.data.bufferCanvases[u].style.position = "absolute", e.data.bufferCanvases[u].setAttribute("data-id", "buffer" + u), e.data.bufferCanvases[u].style.zIndex = String(-u - 1), e.data.bufferCanvases[u].style.visibility = "hidden";
  e.pathsEnabled = !0;
  var f = Yi(), p = function(Z) {
    return {
      x: (Z.x1 + Z.x2) / 2,
      y: (Z.y1 + Z.y2) / 2
    };
  }, g = function(Z) {
    return {
      x: -Z.w / 2,
      y: -Z.h / 2
    };
  }, m = function(Z) {
    var X = Z[0]._private, q = X.oldBackgroundTimestamp === X.backgroundTimestamp;
    return !q;
  }, v = function(Z) {
    return Z[0]._private.nodeKey;
  }, y = function(Z) {
    return Z[0]._private.labelStyleKey;
  }, b = function(Z) {
    return Z[0]._private.sourceLabelStyleKey;
  }, w = function(Z) {
    return Z[0]._private.targetLabelStyleKey;
  }, T = function(Z, X, q, J, j) {
    return e.drawElement(Z, X, q, !1, !1, j);
  }, E = function(Z, X, q, J, j) {
    return e.drawElementText(Z, X, q, J, "main", j);
  }, C = function(Z, X, q, J, j) {
    return e.drawElementText(Z, X, q, J, "source", j);
  }, k = function(Z, X, q, J, j) {
    return e.drawElementText(Z, X, q, J, "target", j);
  }, _ = function(Z) {
    return Z.boundingBox(), Z[0]._private.bodyBounds;
  }, L = function(Z) {
    return Z.boundingBox(), Z[0]._private.labelBounds.main || f;
  }, N = function(Z) {
    return Z.boundingBox(), Z[0]._private.labelBounds.source || f;
  }, A = function(Z) {
    return Z.boundingBox(), Z[0]._private.labelBounds.target || f;
  }, O = function(Z, X) {
    return X;
  }, P = function(Z) {
    return p(_(Z));
  }, S = function(Z, X, q) {
    var J = Z ? Z + "-" : "";
    return {
      x: X.x + q.pstyle(J + "text-margin-x").pfValue,
      y: X.y + q.pstyle(J + "text-margin-y").pfValue
    };
  }, R = function(Z, X, q) {
    var J = Z[0]._private.rscratch;
    return {
      x: J[X],
      y: J[q]
    };
  }, I = function(Z) {
    return S("", R(Z, "labelX", "labelY"), Z);
  }, D = function(Z) {
    return S("source", R(Z, "sourceLabelX", "sourceLabelY"), Z);
  }, M = function(Z) {
    return S("target", R(Z, "targetLabelX", "targetLabelY"), Z);
  }, B = function(Z) {
    return g(_(Z));
  }, $ = function(Z) {
    return g(N(Z));
  }, F = function(Z) {
    return g(A(Z));
  }, G = function(Z) {
    var X = L(Z), q = g(L(Z));
    if (Z.isNode()) {
      switch (Z.pstyle("text-halign").value) {
        case "left":
          q.x = -X.w - (X.leftPad || 0);
          break;
        case "right":
          q.x = -(X.rightPad || 0);
          break;
      }
      switch (Z.pstyle("text-valign").value) {
        case "top":
          q.y = -X.h - (X.topPad || 0);
          break;
        case "bottom":
          q.y = -(X.botPad || 0);
          break;
      }
    }
    return q;
  }, H = e.data.eleTxrCache = new R0(e, {
    getKey: v,
    doesEleInvalidateKey: m,
    drawElement: T,
    getBoundingBox: _,
    getRotationPoint: P,
    getRotationOffset: B,
    allowEdgeTxrCaching: !1,
    allowParentTxrCaching: !1
  }), ee = e.data.lblTxrCache = new R0(e, {
    getKey: y,
    drawElement: E,
    getBoundingBox: L,
    getRotationPoint: I,
    getRotationOffset: G,
    isVisible: O
  }), Y = e.data.slbTxrCache = new R0(e, {
    getKey: b,
    drawElement: C,
    getBoundingBox: N,
    getRotationPoint: D,
    getRotationOffset: $,
    isVisible: O
  }), re = e.data.tlbTxrCache = new R0(e, {
    getKey: w,
    drawElement: k,
    getBoundingBox: A,
    getRotationPoint: M,
    getRotationOffset: F,
    isVisible: O
  }), ne = e.data.lyrTxrCache = new NG(e);
  e.onUpdateEleCalcs(function(Z, X) {
    H.invalidateElements(X), ee.invalidateElements(X), Y.invalidateElements(X), re.invalidateElements(X), ne.invalidateElements(X);
    for (var q = 0; q < X.length; q++) {
      var J = X[q]._private;
      J.oldBackgroundTimestamp = J.backgroundTimestamp;
    }
  });
  var he = function(Z) {
    for (var X = 0; X < Z.length; X++)
      ne.enqueueElementRefinement(Z[X].ele);
  };
  H.onDequeue(he), ee.onDequeue(he), Y.onDequeue(he), re.onDequeue(he), t.webgl && e.initWebgl(t, {
    getStyleKey: v,
    getLabelKey: y,
    getSourceLabelKey: b,
    getTargetLabelKey: w,
    drawElement: T,
    drawLabel: E,
    drawSourceLabel: C,
    drawTargetLabel: k,
    getElementBox: _,
    getLabelBox: L,
    getSourceLabelBox: N,
    getTargetLabelBox: A,
    getElementRotationPoint: P,
    getElementRotationOffset: B,
    getLabelRotationPoint: I,
    getSourceLabelRotationPoint: D,
    getTargetLabelRotationPoint: M,
    getLabelRotationOffset: G,
    getSourceLabelRotationOffset: $,
    getTargetLabelRotationOffset: F
  });
}
Jt.redrawHint = function(t, e) {
  var r = this;
  switch (t) {
    case "eles":
      r.data.canvasNeedsRedraw[Jt.NODE] = e;
      break;
    case "drag":
      r.data.canvasNeedsRedraw[Jt.DRAG] = e;
      break;
    case "select":
      r.data.canvasNeedsRedraw[Jt.SELECT_BOX] = e;
      break;
    case "gc":
      r.data.gc = !0;
      break;
  }
};
var V4e = typeof Path2D < "u";
Jt.path2dEnabled = function(t) {
  if (t === void 0)
    return this.pathsEnabled;
  this.pathsEnabled = !!t;
};
Jt.usePaths = function() {
  return V4e && this.pathsEnabled;
};
Jt.setImgSmoothing = function(t, e) {
  t.imageSmoothingEnabled != null ? t.imageSmoothingEnabled = e : (t.webkitImageSmoothingEnabled = e, t.mozImageSmoothingEnabled = e, t.msImageSmoothingEnabled = e);
};
Jt.getImgSmoothing = function(t) {
  return t.imageSmoothingEnabled != null ? t.imageSmoothingEnabled : t.webkitImageSmoothingEnabled || t.mozImageSmoothingEnabled || t.msImageSmoothingEnabled;
};
Jt.makeOffscreenCanvas = function(t, e) {
  var r;
  if ((typeof OffscreenCanvas > "u" ? "undefined" : zn(OffscreenCanvas)) !== "undefined")
    r = new OffscreenCanvas(t, e);
  else {
    var n = this.cy.window(), i = n.document;
    r = i.createElement("canvas"), r.width = t, r.height = e;
  }
  return r;
};
[MG, uo, ol, hS, $u, cc, Ji, BG, uc, o1, UG].forEach(function(t) {
  Gt(Jt, t);
});
var G4e = [{
  name: "null",
  impl: yG
}, {
  name: "base",
  impl: _G
}, {
  name: "canvas",
  impl: z4e
}], U4e = [{
  type: "layout",
  extensions: pbe
}, {
  type: "renderer",
  extensions: G4e
}], HG = {}, qG = {};
function YG(t, e, r) {
  var n = r, i = function(_) {
    Nr("Can not register `" + e + "` for `" + t + "` since `" + _ + "` already exists in the prototype and can not be overridden");
  };
  if (t === "core") {
    if (dg.prototype[e])
      return i(e);
    dg.prototype[e] = r;
  } else if (t === "collection") {
    if (ui.prototype[e])
      return i(e);
    ui.prototype[e] = r;
  } else if (t === "layout") {
    for (var a = function(_) {
      this.options = _, r.call(this, _), vr(this._private) || (this._private = {}), this._private.cy = _.cy, this._private.listeners = [], this.createEmitter();
    }, s = a.prototype = Object.create(r.prototype), o = [], l = 0; l < o.length; l++) {
      var u = o[l];
      s[u] = s[u] || function() {
        return this;
      };
    }
    s.start && !s.run ? s.run = function() {
      return this.start(), this;
    } : !s.start && s.run && (s.start = function() {
      return this.run(), this;
    });
    var h = r.prototype.stop;
    s.stop = function() {
      var k = this.options;
      if (k && k.animate) {
        var _ = this.animations;
        if (_)
          for (var L = 0; L < _.length; L++)
            _[L].stop();
      }
      return h ? h.call(this) : this.emit("layoutstop"), this;
    }, s.destroy || (s.destroy = function() {
      return this;
    }), s.cy = function() {
      return this._private.cy;
    };
    var d = function(_) {
      return _._private.cy;
    }, f = {
      addEventFields: function(_, L) {
        L.layout = _, L.cy = d(_), L.target = _;
      },
      bubble: function() {
        return !0;
      },
      parent: function(_) {
        return d(_);
      }
    };
    Gt(s, {
      createEmitter: function() {
        return this._private.emitter = new $x(f, this), this;
      },
      emitter: function() {
        return this._private.emitter;
      },
      on: function(_, L) {
        return this.emitter().on(_, L), this;
      },
      one: function(_, L) {
        return this.emitter().one(_, L), this;
      },
      once: function(_, L) {
        return this.emitter().one(_, L), this;
      },
      removeListener: function(_, L) {
        return this.emitter().removeListener(_, L), this;
      },
      removeAllListeners: function() {
        return this.emitter().removeAllListeners(), this;
      },
      emit: function(_, L) {
        return this.emitter().emit(_, L), this;
      }
    }), _r.eventAliasesOn(s), n = a;
  } else if (t === "renderer" && e !== "null" && e !== "base") {
    var p = XG("renderer", "base"), g = p.prototype, m = r, v = r.prototype, y = function() {
      p.apply(this, arguments), m.apply(this, arguments);
    }, b = y.prototype;
    for (var w in g) {
      var T = g[w], E = v[w] != null;
      if (E)
        return i(w);
      b[w] = T;
    }
    for (var C in v)
      b[C] = v[C];
    g.clientFunctions.forEach(function(k) {
      b[k] = b[k] || function() {
        Kr("Renderer does not implement `renderer." + k + "()` on its prototype");
      };
    }), n = y;
  } else if (t === "__proto__" || t === "constructor" || t === "prototype")
    return Kr(t + " is an illegal type to be registered, possibly lead to prototype pollutions");
  return dV({
    map: HG,
    keys: [t, e],
    value: n
  });
}
function XG(t, e) {
  return fV({
    map: HG,
    keys: [t, e]
  });
}
function W4e(t, e, r, n, i) {
  return dV({
    map: qG,
    keys: [t, e, r, n],
    value: i
  });
}
function H4e(t, e, r, n) {
  return fV({
    map: qG,
    keys: [t, e, r, n]
  });
}
var ST = function() {
  if (arguments.length === 2)
    return XG.apply(null, arguments);
  if (arguments.length === 3)
    return YG.apply(null, arguments);
  if (arguments.length === 4)
    return H4e.apply(null, arguments);
  if (arguments.length === 5)
    return W4e.apply(null, arguments);
  Kr("Invalid extension access syntax");
};
dg.prototype.extension = ST;
U4e.forEach(function(t) {
  t.extensions.forEach(function(e) {
    YG(t.type, e.name, e.impl);
  });
});
var qy = function() {
  if (!(this instanceof qy))
    return new qy();
  this.length = 0;
}, xu = qy.prototype;
xu.instanceString = function() {
  return "stylesheet";
};
xu.selector = function(t) {
  var e = this.length++;
  return this[e] = {
    selector: t,
    properties: []
  }, this;
};
xu.css = function(t, e) {
  var r = this.length - 1;
  if (Bt(t))
    this[r].properties.push({
      name: t,
      value: e
    });
  else if (vr(t))
    for (var n = t, i = Object.keys(n), a = 0; a < i.length; a++) {
      var s = i[a], o = n[s];
      if (o != null) {
        var l = Kn.properties[s] || Kn.properties[Lx(s)];
        if (l != null) {
          var u = l.name, h = o;
          this[r].properties.push({
            name: u,
            value: h
          });
        }
      }
    }
  return this;
};
xu.style = xu.css;
xu.generateStyle = function(t) {
  var e = new Kn(t);
  return this.appendToStyle(e);
};
xu.appendToStyle = function(t) {
  for (var e = 0; e < this.length; e++) {
    var r = this[e], n = r.selector, i = r.properties;
    t.selector(n);
    for (var a = 0; a < i.length; a++) {
      var s = i[a];
      t.css(s.name, s.value);
    }
  }
  return t;
};
var q4e = "3.33.1", eo = function(e) {
  if (e === void 0 && (e = {}), vr(e))
    return new dg(e);
  if (Bt(e))
    return ST.apply(ST, arguments);
};
eo.use = function(t) {
  var e = Array.prototype.slice.call(arguments, 1);
  return e.unshift(eo), t.apply(null, e), this;
};
eo.warnings = function(t) {
  return bV(t);
};
eo.version = q4e;
eo.stylesheet = eo.Stylesheet = qy;
var jG = { exports: {} }, r5 = { exports: {} }, n5 = { exports: {} }, lL;
function Y4e() {
  return lL || (lL = 1, function(t, e) {
    (function(n, i) {
      t.exports = i();
    })(ro, function() {
      return (
        /******/
        function(r) {
          var n = {};
          function i(a) {
            if (n[a])
              return n[a].exports;
            var s = n[a] = {
              /******/
              i: a,
              /******/
              l: !1,
              /******/
              exports: {}
              /******/
            };
            return r[a].call(s.exports, s, s.exports, i), s.l = !0, s.exports;
          }
          return i.m = r, i.c = n, i.i = function(a) {
            return a;
          }, i.d = function(a, s, o) {
            i.o(a, s) || Object.defineProperty(a, s, {
              /******/
              configurable: !1,
              /******/
              enumerable: !0,
              /******/
              get: o
              /******/
            });
          }, i.n = function(a) {
            var s = a && a.__esModule ? (
              /******/
              function() {
                return a.default;
              }
            ) : (
              /******/
              function() {
                return a;
              }
            );
            return i.d(s, "a", s), s;
          }, i.o = function(a, s) {
            return Object.prototype.hasOwnProperty.call(a, s);
          }, i.p = "", i(i.s = 26);
        }([
          /* 0 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.QUALITY = 1, a.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, a.DEFAULT_INCREMENTAL = !1, a.DEFAULT_ANIMATION_ON_LAYOUT = !0, a.DEFAULT_ANIMATION_DURING_LAYOUT = !1, a.DEFAULT_ANIMATION_PERIOD = 50, a.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, a.DEFAULT_GRAPH_MARGIN = 15, a.NODE_DIMENSIONS_INCLUDE_LABELS = !1, a.SIMPLE_NODE_SIZE = 40, a.SIMPLE_NODE_HALF_SIZE = a.SIMPLE_NODE_SIZE / 2, a.EMPTY_COMPOUND_NODE_SIZE = 40, a.MIN_EDGE_LENGTH = 1, a.WORLD_BOUNDARY = 1e6, a.INITIAL_WORLD_BOUNDARY = a.WORLD_BOUNDARY / 1e3, a.WORLD_CENTER_X = 1200, a.WORLD_CENTER_Y = 900, r.exports = a;
          },
          /* 1 */
          /***/
          function(r, n, i) {
            var a = i(2), s = i(8), o = i(9);
            function l(h, d, f) {
              a.call(this, f), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = f, this.bendpoints = [], this.source = h, this.target = d;
            }
            l.prototype = Object.create(a.prototype);
            for (var u in a)
              l[u] = a[u];
            l.prototype.getSource = function() {
              return this.source;
            }, l.prototype.getTarget = function() {
              return this.target;
            }, l.prototype.isInterGraph = function() {
              return this.isInterGraph;
            }, l.prototype.getLength = function() {
              return this.length;
            }, l.prototype.isOverlapingSourceAndTarget = function() {
              return this.isOverlapingSourceAndTarget;
            }, l.prototype.getBendpoints = function() {
              return this.bendpoints;
            }, l.prototype.getLca = function() {
              return this.lca;
            }, l.prototype.getSourceInLca = function() {
              return this.sourceInLca;
            }, l.prototype.getTargetInLca = function() {
              return this.targetInLca;
            }, l.prototype.getOtherEnd = function(h) {
              if (this.source === h)
                return this.target;
              if (this.target === h)
                return this.source;
              throw "Node is not incident with this edge";
            }, l.prototype.getOtherEndInGraph = function(h, d) {
              for (var f = this.getOtherEnd(h), p = d.getGraphManager().getRoot(); ; ) {
                if (f.getOwner() == d)
                  return f;
                if (f.getOwner() == p)
                  break;
                f = f.getOwner().getParent();
              }
              return null;
            }, l.prototype.updateLength = function() {
              var h = new Array(4);
              this.isOverlapingSourceAndTarget = s.getIntersection(this.target.getRect(), this.source.getRect(), h), this.isOverlapingSourceAndTarget || (this.lengthX = h[0] - h[2], this.lengthY = h[1] - h[3], Math.abs(this.lengthX) < 1 && (this.lengthX = o.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = o.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY));
            }, l.prototype.updateLengthSimple = function() {
              this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = o.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = o.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
            }, r.exports = l;
          },
          /* 2 */
          /***/
          function(r, n, i) {
            function a(s) {
              this.vGraphObject = s;
            }
            r.exports = a;
          },
          /* 3 */
          /***/
          function(r, n, i) {
            var a = i(2), s = i(10), o = i(13), l = i(0), u = i(16), h = i(4);
            function d(p, g, m, v) {
              m == null && v == null && (v = g), a.call(this, v), p.graphManager != null && (p = p.graphManager), this.estimatedSize = s.MIN_VALUE, this.inclusionTreeDepth = s.MAX_VALUE, this.vGraphObject = v, this.edges = [], this.graphManager = p, m != null && g != null ? this.rect = new o(g.x, g.y, m.width, m.height) : this.rect = new o();
            }
            d.prototype = Object.create(a.prototype);
            for (var f in a)
              d[f] = a[f];
            d.prototype.getEdges = function() {
              return this.edges;
            }, d.prototype.getChild = function() {
              return this.child;
            }, d.prototype.getOwner = function() {
              return this.owner;
            }, d.prototype.getWidth = function() {
              return this.rect.width;
            }, d.prototype.setWidth = function(p) {
              this.rect.width = p;
            }, d.prototype.getHeight = function() {
              return this.rect.height;
            }, d.prototype.setHeight = function(p) {
              this.rect.height = p;
            }, d.prototype.getCenterX = function() {
              return this.rect.x + this.rect.width / 2;
            }, d.prototype.getCenterY = function() {
              return this.rect.y + this.rect.height / 2;
            }, d.prototype.getCenter = function() {
              return new h(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
            }, d.prototype.getLocation = function() {
              return new h(this.rect.x, this.rect.y);
            }, d.prototype.getRect = function() {
              return this.rect;
            }, d.prototype.getDiagonal = function() {
              return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
            }, d.prototype.getHalfTheDiagonal = function() {
              return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
            }, d.prototype.setRect = function(p, g) {
              this.rect.x = p.x, this.rect.y = p.y, this.rect.width = g.width, this.rect.height = g.height;
            }, d.prototype.setCenter = function(p, g) {
              this.rect.x = p - this.rect.width / 2, this.rect.y = g - this.rect.height / 2;
            }, d.prototype.setLocation = function(p, g) {
              this.rect.x = p, this.rect.y = g;
            }, d.prototype.moveBy = function(p, g) {
              this.rect.x += p, this.rect.y += g;
            }, d.prototype.getEdgeListToNode = function(p) {
              var g = [], m = this;
              return m.edges.forEach(function(v) {
                if (v.target == p) {
                  if (v.source != m) throw "Incorrect edge source!";
                  g.push(v);
                }
              }), g;
            }, d.prototype.getEdgesBetween = function(p) {
              var g = [], m = this;
              return m.edges.forEach(function(v) {
                if (!(v.source == m || v.target == m)) throw "Incorrect edge source and/or target";
                (v.target == p || v.source == p) && g.push(v);
              }), g;
            }, d.prototype.getNeighborsList = function() {
              var p = /* @__PURE__ */ new Set(), g = this;
              return g.edges.forEach(function(m) {
                if (m.source == g)
                  p.add(m.target);
                else {
                  if (m.target != g)
                    throw "Incorrect incidency!";
                  p.add(m.source);
                }
              }), p;
            }, d.prototype.withChildren = function() {
              var p = /* @__PURE__ */ new Set(), g, m;
              if (p.add(this), this.child != null)
                for (var v = this.child.getNodes(), y = 0; y < v.length; y++)
                  g = v[y], m = g.withChildren(), m.forEach(function(b) {
                    p.add(b);
                  });
              return p;
            }, d.prototype.getNoOfChildren = function() {
              var p = 0, g;
              if (this.child == null)
                p = 1;
              else
                for (var m = this.child.getNodes(), v = 0; v < m.length; v++)
                  g = m[v], p += g.getNoOfChildren();
              return p == 0 && (p = 1), p;
            }, d.prototype.getEstimatedSize = function() {
              if (this.estimatedSize == s.MIN_VALUE)
                throw "assert failed";
              return this.estimatedSize;
            }, d.prototype.calcEstimatedSize = function() {
              return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize);
            }, d.prototype.scatter = function() {
              var p, g, m = -l.INITIAL_WORLD_BOUNDARY, v = l.INITIAL_WORLD_BOUNDARY;
              p = l.WORLD_CENTER_X + u.nextDouble() * (v - m) + m;
              var y = -l.INITIAL_WORLD_BOUNDARY, b = l.INITIAL_WORLD_BOUNDARY;
              g = l.WORLD_CENTER_Y + u.nextDouble() * (b - y) + y, this.rect.x = p, this.rect.y = g;
            }, d.prototype.updateBounds = function() {
              if (this.getChild() == null)
                throw "assert failed";
              if (this.getChild().getNodes().length != 0) {
                var p = this.getChild();
                if (p.updateBounds(!0), this.rect.x = p.getLeft(), this.rect.y = p.getTop(), this.setWidth(p.getRight() - p.getLeft()), this.setHeight(p.getBottom() - p.getTop()), l.NODE_DIMENSIONS_INCLUDE_LABELS) {
                  var g = p.getRight() - p.getLeft(), m = p.getBottom() - p.getTop();
                  this.labelWidth > g && (this.rect.x -= (this.labelWidth - g) / 2, this.setWidth(this.labelWidth)), this.labelHeight > m && (this.labelPos == "center" ? this.rect.y -= (this.labelHeight - m) / 2 : this.labelPos == "top" && (this.rect.y -= this.labelHeight - m), this.setHeight(this.labelHeight));
                }
              }
            }, d.prototype.getInclusionTreeDepth = function() {
              if (this.inclusionTreeDepth == s.MAX_VALUE)
                throw "assert failed";
              return this.inclusionTreeDepth;
            }, d.prototype.transform = function(p) {
              var g = this.rect.x;
              g > l.WORLD_BOUNDARY ? g = l.WORLD_BOUNDARY : g < -l.WORLD_BOUNDARY && (g = -l.WORLD_BOUNDARY);
              var m = this.rect.y;
              m > l.WORLD_BOUNDARY ? m = l.WORLD_BOUNDARY : m < -l.WORLD_BOUNDARY && (m = -l.WORLD_BOUNDARY);
              var v = new h(g, m), y = p.inverseTransformPoint(v);
              this.setLocation(y.x, y.y);
            }, d.prototype.getLeft = function() {
              return this.rect.x;
            }, d.prototype.getRight = function() {
              return this.rect.x + this.rect.width;
            }, d.prototype.getTop = function() {
              return this.rect.y;
            }, d.prototype.getBottom = function() {
              return this.rect.y + this.rect.height;
            }, d.prototype.getParent = function() {
              return this.owner == null ? null : this.owner.getParent();
            }, r.exports = d;
          },
          /* 4 */
          /***/
          function(r, n, i) {
            function a(s, o) {
              s == null && o == null ? (this.x = 0, this.y = 0) : (this.x = s, this.y = o);
            }
            a.prototype.getX = function() {
              return this.x;
            }, a.prototype.getY = function() {
              return this.y;
            }, a.prototype.setX = function(s) {
              this.x = s;
            }, a.prototype.setY = function(s) {
              this.y = s;
            }, a.prototype.getDifference = function(s) {
              return new DimensionD(this.x - s.x, this.y - s.y);
            }, a.prototype.getCopy = function() {
              return new a(this.x, this.y);
            }, a.prototype.translate = function(s) {
              return this.x += s.width, this.y += s.height, this;
            }, r.exports = a;
          },
          /* 5 */
          /***/
          function(r, n, i) {
            var a = i(2), s = i(10), o = i(0), l = i(6), u = i(3), h = i(1), d = i(13), f = i(12), p = i(11);
            function g(v, y, b) {
              a.call(this, b), this.estimatedSize = s.MIN_VALUE, this.margin = o.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = v, y != null && y instanceof l ? this.graphManager = y : y != null && y instanceof Layout && (this.graphManager = y.graphManager);
            }
            g.prototype = Object.create(a.prototype);
            for (var m in a)
              g[m] = a[m];
            g.prototype.getNodes = function() {
              return this.nodes;
            }, g.prototype.getEdges = function() {
              return this.edges;
            }, g.prototype.getGraphManager = function() {
              return this.graphManager;
            }, g.prototype.getParent = function() {
              return this.parent;
            }, g.prototype.getLeft = function() {
              return this.left;
            }, g.prototype.getRight = function() {
              return this.right;
            }, g.prototype.getTop = function() {
              return this.top;
            }, g.prototype.getBottom = function() {
              return this.bottom;
            }, g.prototype.isConnected = function() {
              return this.isConnected;
            }, g.prototype.add = function(v, y, b) {
              if (y == null && b == null) {
                var w = v;
                if (this.graphManager == null)
                  throw "Graph has no graph mgr!";
                if (this.getNodes().indexOf(w) > -1)
                  throw "Node already in graph!";
                return w.owner = this, this.getNodes().push(w), w;
              } else {
                var T = v;
                if (!(this.getNodes().indexOf(y) > -1 && this.getNodes().indexOf(b) > -1))
                  throw "Source or target not in graph!";
                if (!(y.owner == b.owner && y.owner == this))
                  throw "Both owners must be this graph!";
                return y.owner != b.owner ? null : (T.source = y, T.target = b, T.isInterGraph = !1, this.getEdges().push(T), y.edges.push(T), b != y && b.edges.push(T), T);
              }
            }, g.prototype.remove = function(v) {
              var y = v;
              if (v instanceof u) {
                if (y == null)
                  throw "Node is null!";
                if (!(y.owner != null && y.owner == this))
                  throw "Owner graph is invalid!";
                if (this.graphManager == null)
                  throw "Owner graph manager is invalid!";
                for (var b = y.edges.slice(), w, T = b.length, E = 0; E < T; E++)
                  w = b[E], w.isInterGraph ? this.graphManager.remove(w) : w.source.owner.remove(w);
                var C = this.nodes.indexOf(y);
                if (C == -1)
                  throw "Node not in owner node list!";
                this.nodes.splice(C, 1);
              } else if (v instanceof h) {
                var w = v;
                if (w == null)
                  throw "Edge is null!";
                if (!(w.source != null && w.target != null))
                  throw "Source and/or target is null!";
                if (!(w.source.owner != null && w.target.owner != null && w.source.owner == this && w.target.owner == this))
                  throw "Source and/or target owner is invalid!";
                var k = w.source.edges.indexOf(w), _ = w.target.edges.indexOf(w);
                if (!(k > -1 && _ > -1))
                  throw "Source and/or target doesn't know this edge!";
                w.source.edges.splice(k, 1), w.target != w.source && w.target.edges.splice(_, 1);
                var C = w.source.owner.getEdges().indexOf(w);
                if (C == -1)
                  throw "Not in owner's edge list!";
                w.source.owner.getEdges().splice(C, 1);
              }
            }, g.prototype.updateLeftTop = function() {
              for (var v = s.MAX_VALUE, y = s.MAX_VALUE, b, w, T, E = this.getNodes(), C = E.length, k = 0; k < C; k++) {
                var _ = E[k];
                b = _.getTop(), w = _.getLeft(), v > b && (v = b), y > w && (y = w);
              }
              return v == s.MAX_VALUE ? null : (E[0].getParent().paddingLeft != null ? T = E[0].getParent().paddingLeft : T = this.margin, this.left = y - T, this.top = v - T, new f(this.left, this.top));
            }, g.prototype.updateBounds = function(v) {
              for (var y = s.MAX_VALUE, b = -s.MAX_VALUE, w = s.MAX_VALUE, T = -s.MAX_VALUE, E, C, k, _, L, N = this.nodes, A = N.length, O = 0; O < A; O++) {
                var P = N[O];
                v && P.child != null && P.updateBounds(), E = P.getLeft(), C = P.getRight(), k = P.getTop(), _ = P.getBottom(), y > E && (y = E), b < C && (b = C), w > k && (w = k), T < _ && (T = _);
              }
              var S = new d(y, w, b - y, T - w);
              y == s.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), N[0].getParent().paddingLeft != null ? L = N[0].getParent().paddingLeft : L = this.margin, this.left = S.x - L, this.right = S.x + S.width + L, this.top = S.y - L, this.bottom = S.y + S.height + L;
            }, g.calculateBounds = function(v) {
              for (var y = s.MAX_VALUE, b = -s.MAX_VALUE, w = s.MAX_VALUE, T = -s.MAX_VALUE, E, C, k, _, L = v.length, N = 0; N < L; N++) {
                var A = v[N];
                E = A.getLeft(), C = A.getRight(), k = A.getTop(), _ = A.getBottom(), y > E && (y = E), b < C && (b = C), w > k && (w = k), T < _ && (T = _);
              }
              var O = new d(y, w, b - y, T - w);
              return O;
            }, g.prototype.getInclusionTreeDepth = function() {
              return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
            }, g.prototype.getEstimatedSize = function() {
              if (this.estimatedSize == s.MIN_VALUE)
                throw "assert failed";
              return this.estimatedSize;
            }, g.prototype.calcEstimatedSize = function() {
              for (var v = 0, y = this.nodes, b = y.length, w = 0; w < b; w++) {
                var T = y[w];
                v += T.calcEstimatedSize();
              }
              return v == 0 ? this.estimatedSize = o.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = v / Math.sqrt(this.nodes.length), this.estimatedSize;
            }, g.prototype.updateConnected = function() {
              var v = this;
              if (this.nodes.length == 0) {
                this.isConnected = !0;
                return;
              }
              var y = new p(), b = /* @__PURE__ */ new Set(), w = this.nodes[0], T, E, C = w.withChildren();
              for (C.forEach(function(O) {
                y.push(O), b.add(O);
              }); y.length !== 0; ) {
                w = y.shift(), T = w.getEdges();
                for (var k = T.length, _ = 0; _ < k; _++) {
                  var L = T[_];
                  if (E = L.getOtherEndInGraph(w, this), E != null && !b.has(E)) {
                    var N = E.withChildren();
                    N.forEach(function(O) {
                      y.push(O), b.add(O);
                    });
                  }
                }
              }
              if (this.isConnected = !1, b.size >= this.nodes.length) {
                var A = 0;
                b.forEach(function(O) {
                  O.owner == v && A++;
                }), A == this.nodes.length && (this.isConnected = !0);
              }
            }, r.exports = g;
          },
          /* 6 */
          /***/
          function(r, n, i) {
            var a, s = i(1);
            function o(l) {
              a = i(5), this.layout = l, this.graphs = [], this.edges = [];
            }
            o.prototype.addRoot = function() {
              var l = this.layout.newGraph(), u = this.layout.newNode(null), h = this.add(l, u);
              return this.setRootGraph(h), this.rootGraph;
            }, o.prototype.add = function(l, u, h, d, f) {
              if (h == null && d == null && f == null) {
                if (l == null)
                  throw "Graph is null!";
                if (u == null)
                  throw "Parent node is null!";
                if (this.graphs.indexOf(l) > -1)
                  throw "Graph already in this graph mgr!";
                if (this.graphs.push(l), l.parent != null)
                  throw "Already has a parent!";
                if (u.child != null)
                  throw "Already has a child!";
                return l.parent = u, u.child = l, l;
              } else {
                f = h, d = u, h = l;
                var p = d.getOwner(), g = f.getOwner();
                if (!(p != null && p.getGraphManager() == this))
                  throw "Source not in this graph mgr!";
                if (!(g != null && g.getGraphManager() == this))
                  throw "Target not in this graph mgr!";
                if (p == g)
                  return h.isInterGraph = !1, p.add(h, d, f);
                if (h.isInterGraph = !0, h.source = d, h.target = f, this.edges.indexOf(h) > -1)
                  throw "Edge already in inter-graph edge list!";
                if (this.edges.push(h), !(h.source != null && h.target != null))
                  throw "Edge source and/or target is null!";
                if (!(h.source.edges.indexOf(h) == -1 && h.target.edges.indexOf(h) == -1))
                  throw "Edge already in source and/or target incidency list!";
                return h.source.edges.push(h), h.target.edges.push(h), h;
              }
            }, o.prototype.remove = function(l) {
              if (l instanceof a) {
                var u = l;
                if (u.getGraphManager() != this)
                  throw "Graph not in this graph mgr";
                if (!(u == this.rootGraph || u.parent != null && u.parent.graphManager == this))
                  throw "Invalid parent node!";
                var h = [];
                h = h.concat(u.getEdges());
                for (var d, f = h.length, p = 0; p < f; p++)
                  d = h[p], u.remove(d);
                var g = [];
                g = g.concat(u.getNodes());
                var m;
                f = g.length;
                for (var p = 0; p < f; p++)
                  m = g[p], u.remove(m);
                u == this.rootGraph && this.setRootGraph(null);
                var v = this.graphs.indexOf(u);
                this.graphs.splice(v, 1), u.parent = null;
              } else if (l instanceof s) {
                if (d = l, d == null)
                  throw "Edge is null!";
                if (!d.isInterGraph)
                  throw "Not an inter-graph edge!";
                if (!(d.source != null && d.target != null))
                  throw "Source and/or target is null!";
                if (!(d.source.edges.indexOf(d) != -1 && d.target.edges.indexOf(d) != -1))
                  throw "Source and/or target doesn't know this edge!";
                var v = d.source.edges.indexOf(d);
                if (d.source.edges.splice(v, 1), v = d.target.edges.indexOf(d), d.target.edges.splice(v, 1), !(d.source.owner != null && d.source.owner.getGraphManager() != null))
                  throw "Edge owner graph or owner graph manager is null!";
                if (d.source.owner.getGraphManager().edges.indexOf(d) == -1)
                  throw "Not in owner graph manager's edge list!";
                var v = d.source.owner.getGraphManager().edges.indexOf(d);
                d.source.owner.getGraphManager().edges.splice(v, 1);
              }
            }, o.prototype.updateBounds = function() {
              this.rootGraph.updateBounds(!0);
            }, o.prototype.getGraphs = function() {
              return this.graphs;
            }, o.prototype.getAllNodes = function() {
              if (this.allNodes == null) {
                for (var l = [], u = this.getGraphs(), h = u.length, d = 0; d < h; d++)
                  l = l.concat(u[d].getNodes());
                this.allNodes = l;
              }
              return this.allNodes;
            }, o.prototype.resetAllNodes = function() {
              this.allNodes = null;
            }, o.prototype.resetAllEdges = function() {
              this.allEdges = null;
            }, o.prototype.resetAllNodesToApplyGravitation = function() {
              this.allNodesToApplyGravitation = null;
            }, o.prototype.getAllEdges = function() {
              if (this.allEdges == null) {
                var l = [], u = this.getGraphs();
                u.length;
                for (var h = 0; h < u.length; h++)
                  l = l.concat(u[h].getEdges());
                l = l.concat(this.edges), this.allEdges = l;
              }
              return this.allEdges;
            }, o.prototype.getAllNodesToApplyGravitation = function() {
              return this.allNodesToApplyGravitation;
            }, o.prototype.setAllNodesToApplyGravitation = function(l) {
              if (this.allNodesToApplyGravitation != null)
                throw "assert failed";
              this.allNodesToApplyGravitation = l;
            }, o.prototype.getRoot = function() {
              return this.rootGraph;
            }, o.prototype.setRootGraph = function(l) {
              if (l.getGraphManager() != this)
                throw "Root not in this graph mgr!";
              this.rootGraph = l, l.parent == null && (l.parent = this.layout.newNode("Root node"));
            }, o.prototype.getLayout = function() {
              return this.layout;
            }, o.prototype.isOneAncestorOfOther = function(l, u) {
              if (!(l != null && u != null))
                throw "assert failed";
              if (l == u)
                return !0;
              var h = l.getOwner(), d;
              do {
                if (d = h.getParent(), d == null)
                  break;
                if (d == u)
                  return !0;
                if (h = d.getOwner(), h == null)
                  break;
              } while (!0);
              h = u.getOwner();
              do {
                if (d = h.getParent(), d == null)
                  break;
                if (d == l)
                  return !0;
                if (h = d.getOwner(), h == null)
                  break;
              } while (!0);
              return !1;
            }, o.prototype.calcLowestCommonAncestors = function() {
              for (var l, u, h, d, f, p = this.getAllEdges(), g = p.length, m = 0; m < g; m++) {
                if (l = p[m], u = l.source, h = l.target, l.lca = null, l.sourceInLca = u, l.targetInLca = h, u == h) {
                  l.lca = u.getOwner();
                  continue;
                }
                for (d = u.getOwner(); l.lca == null; ) {
                  for (l.targetInLca = h, f = h.getOwner(); l.lca == null; ) {
                    if (f == d) {
                      l.lca = f;
                      break;
                    }
                    if (f == this.rootGraph)
                      break;
                    if (l.lca != null)
                      throw "assert failed";
                    l.targetInLca = f.getParent(), f = l.targetInLca.getOwner();
                  }
                  if (d == this.rootGraph)
                    break;
                  l.lca == null && (l.sourceInLca = d.getParent(), d = l.sourceInLca.getOwner());
                }
                if (l.lca == null)
                  throw "assert failed";
              }
            }, o.prototype.calcLowestCommonAncestor = function(l, u) {
              if (l == u)
                return l.getOwner();
              var h = l.getOwner();
              do {
                if (h == null)
                  break;
                var d = u.getOwner();
                do {
                  if (d == null)
                    break;
                  if (d == h)
                    return d;
                  d = d.getParent().getOwner();
                } while (!0);
                h = h.getParent().getOwner();
              } while (!0);
              return h;
            }, o.prototype.calcInclusionTreeDepths = function(l, u) {
              l == null && u == null && (l = this.rootGraph, u = 1);
              for (var h, d = l.getNodes(), f = d.length, p = 0; p < f; p++)
                h = d[p], h.inclusionTreeDepth = u, h.child != null && this.calcInclusionTreeDepths(h.child, u + 1);
            }, o.prototype.includesInvalidEdge = function() {
              for (var l, u = this.edges.length, h = 0; h < u; h++)
                if (l = this.edges[h], this.isOneAncestorOfOther(l.source, l.target))
                  return !0;
              return !1;
            }, r.exports = o;
          },
          /* 7 */
          /***/
          function(r, n, i) {
            var a = i(0);
            function s() {
            }
            for (var o in a)
              s[o] = a[o];
            s.MAX_ITERATIONS = 2500, s.DEFAULT_EDGE_LENGTH = 50, s.DEFAULT_SPRING_STRENGTH = 0.45, s.DEFAULT_REPULSION_STRENGTH = 4500, s.DEFAULT_GRAVITY_STRENGTH = 0.4, s.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, s.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, s.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3, s.COOLING_ADAPTATION_FACTOR = 0.33, s.ADAPTATION_LOWER_NODE_LIMIT = 1e3, s.ADAPTATION_UPPER_NODE_LIMIT = 5e3, s.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, s.MAX_NODE_DISPLACEMENT = s.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, s.MIN_REPULSION_DIST = s.DEFAULT_EDGE_LENGTH / 10, s.CONVERGENCE_CHECK_PERIOD = 100, s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1, s.MIN_EDGE_LENGTH = 1, s.GRID_CALCULATION_CHECK_PERIOD = 10, r.exports = s;
          },
          /* 8 */
          /***/
          function(r, n, i) {
            var a = i(12);
            function s() {
            }
            s.calcSeparationAmount = function(o, l, u, h) {
              if (!o.intersects(l))
                throw "assert failed";
              var d = new Array(2);
              this.decideDirectionsForOverlappingNodes(o, l, d), u[0] = Math.min(o.getRight(), l.getRight()) - Math.max(o.x, l.x), u[1] = Math.min(o.getBottom(), l.getBottom()) - Math.max(o.y, l.y), o.getX() <= l.getX() && o.getRight() >= l.getRight() ? u[0] += Math.min(l.getX() - o.getX(), o.getRight() - l.getRight()) : l.getX() <= o.getX() && l.getRight() >= o.getRight() && (u[0] += Math.min(o.getX() - l.getX(), l.getRight() - o.getRight())), o.getY() <= l.getY() && o.getBottom() >= l.getBottom() ? u[1] += Math.min(l.getY() - o.getY(), o.getBottom() - l.getBottom()) : l.getY() <= o.getY() && l.getBottom() >= o.getBottom() && (u[1] += Math.min(o.getY() - l.getY(), l.getBottom() - o.getBottom()));
              var f = Math.abs((l.getCenterY() - o.getCenterY()) / (l.getCenterX() - o.getCenterX()));
              l.getCenterY() === o.getCenterY() && l.getCenterX() === o.getCenterX() && (f = 1);
              var p = f * u[0], g = u[1] / f;
              u[0] < g ? g = u[0] : p = u[1], u[0] = -1 * d[0] * (g / 2 + h), u[1] = -1 * d[1] * (p / 2 + h);
            }, s.decideDirectionsForOverlappingNodes = function(o, l, u) {
              o.getCenterX() < l.getCenterX() ? u[0] = -1 : u[0] = 1, o.getCenterY() < l.getCenterY() ? u[1] = -1 : u[1] = 1;
            }, s.getIntersection2 = function(o, l, u) {
              var h = o.getCenterX(), d = o.getCenterY(), f = l.getCenterX(), p = l.getCenterY();
              if (o.intersects(l))
                return u[0] = h, u[1] = d, u[2] = f, u[3] = p, !0;
              var g = o.getX(), m = o.getY(), v = o.getRight(), y = o.getX(), b = o.getBottom(), w = o.getRight(), T = o.getWidthHalf(), E = o.getHeightHalf(), C = l.getX(), k = l.getY(), _ = l.getRight(), L = l.getX(), N = l.getBottom(), A = l.getRight(), O = l.getWidthHalf(), P = l.getHeightHalf(), S = !1, R = !1;
              if (h === f) {
                if (d > p)
                  return u[0] = h, u[1] = m, u[2] = f, u[3] = N, !1;
                if (d < p)
                  return u[0] = h, u[1] = b, u[2] = f, u[3] = k, !1;
              } else if (d === p) {
                if (h > f)
                  return u[0] = g, u[1] = d, u[2] = _, u[3] = p, !1;
                if (h < f)
                  return u[0] = v, u[1] = d, u[2] = C, u[3] = p, !1;
              } else {
                var I = o.height / o.width, D = l.height / l.width, M = (p - d) / (f - h), B = void 0, $ = void 0, F = void 0, G = void 0, H = void 0, ee = void 0;
                if (-I === M ? h > f ? (u[0] = y, u[1] = b, S = !0) : (u[0] = v, u[1] = m, S = !0) : I === M && (h > f ? (u[0] = g, u[1] = m, S = !0) : (u[0] = w, u[1] = b, S = !0)), -D === M ? f > h ? (u[2] = L, u[3] = N, R = !0) : (u[2] = _, u[3] = k, R = !0) : D === M && (f > h ? (u[2] = C, u[3] = k, R = !0) : (u[2] = A, u[3] = N, R = !0)), S && R)
                  return !1;
                if (h > f ? d > p ? (B = this.getCardinalDirection(I, M, 4), $ = this.getCardinalDirection(D, M, 2)) : (B = this.getCardinalDirection(-I, M, 3), $ = this.getCardinalDirection(-D, M, 1)) : d > p ? (B = this.getCardinalDirection(-I, M, 1), $ = this.getCardinalDirection(-D, M, 3)) : (B = this.getCardinalDirection(I, M, 2), $ = this.getCardinalDirection(D, M, 4)), !S)
                  switch (B) {
                    case 1:
                      G = m, F = h + -E / M, u[0] = F, u[1] = G;
                      break;
                    case 2:
                      F = w, G = d + T * M, u[0] = F, u[1] = G;
                      break;
                    case 3:
                      G = b, F = h + E / M, u[0] = F, u[1] = G;
                      break;
                    case 4:
                      F = y, G = d + -T * M, u[0] = F, u[1] = G;
                      break;
                  }
                if (!R)
                  switch ($) {
                    case 1:
                      ee = k, H = f + -P / M, u[2] = H, u[3] = ee;
                      break;
                    case 2:
                      H = A, ee = p + O * M, u[2] = H, u[3] = ee;
                      break;
                    case 3:
                      ee = N, H = f + P / M, u[2] = H, u[3] = ee;
                      break;
                    case 4:
                      H = L, ee = p + -O * M, u[2] = H, u[3] = ee;
                      break;
                  }
              }
              return !1;
            }, s.getCardinalDirection = function(o, l, u) {
              return o > l ? u : 1 + u % 4;
            }, s.getIntersection = function(o, l, u, h) {
              if (h == null)
                return this.getIntersection2(o, l, u);
              var d = o.x, f = o.y, p = l.x, g = l.y, m = u.x, v = u.y, y = h.x, b = h.y, w = void 0, T = void 0, E = void 0, C = void 0, k = void 0, _ = void 0, L = void 0, N = void 0, A = void 0;
              return E = g - f, k = d - p, L = p * f - d * g, C = b - v, _ = m - y, N = y * v - m * b, A = E * _ - C * k, A === 0 ? null : (w = (k * N - _ * L) / A, T = (C * L - E * N) / A, new a(w, T));
            }, s.angleOfVector = function(o, l, u, h) {
              var d = void 0;
              return o !== u ? (d = Math.atan((h - l) / (u - o)), u < o ? d += Math.PI : h < l && (d += this.TWO_PI)) : h < l ? d = this.ONE_AND_HALF_PI : d = this.HALF_PI, d;
            }, s.doIntersect = function(o, l, u, h) {
              var d = o.x, f = o.y, p = l.x, g = l.y, m = u.x, v = u.y, y = h.x, b = h.y, w = (p - d) * (b - v) - (y - m) * (g - f);
              if (w === 0)
                return !1;
              var T = ((b - v) * (y - d) + (m - y) * (b - f)) / w, E = ((f - g) * (y - d) + (p - d) * (b - f)) / w;
              return 0 < T && T < 1 && 0 < E && E < 1;
            }, s.HALF_PI = 0.5 * Math.PI, s.ONE_AND_HALF_PI = 1.5 * Math.PI, s.TWO_PI = 2 * Math.PI, s.THREE_PI = 3 * Math.PI, r.exports = s;
          },
          /* 9 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.sign = function(s) {
              return s > 0 ? 1 : s < 0 ? -1 : 0;
            }, a.floor = function(s) {
              return s < 0 ? Math.ceil(s) : Math.floor(s);
            }, a.ceil = function(s) {
              return s < 0 ? Math.floor(s) : Math.ceil(s);
            }, r.exports = a;
          },
          /* 10 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.MAX_VALUE = 2147483647, a.MIN_VALUE = -2147483648, r.exports = a;
          },
          /* 11 */
          /***/
          function(r, n, i) {
            var a = /* @__PURE__ */ function() {
              function d(f, p) {
                for (var g = 0; g < p.length; g++) {
                  var m = p[g];
                  m.enumerable = m.enumerable || !1, m.configurable = !0, "value" in m && (m.writable = !0), Object.defineProperty(f, m.key, m);
                }
              }
              return function(f, p, g) {
                return p && d(f.prototype, p), g && d(f, g), f;
              };
            }();
            function s(d, f) {
              if (!(d instanceof f))
                throw new TypeError("Cannot call a class as a function");
            }
            var o = function(f) {
              return { value: f, next: null, prev: null };
            }, l = function(f, p, g, m) {
              return f !== null ? f.next = p : m.head = p, g !== null ? g.prev = p : m.tail = p, p.prev = f, p.next = g, m.length++, p;
            }, u = function(f, p) {
              var g = f.prev, m = f.next;
              return g !== null ? g.next = m : p.head = m, m !== null ? m.prev = g : p.tail = g, f.prev = f.next = null, p.length--, f;
            }, h = function() {
              function d(f) {
                var p = this;
                s(this, d), this.length = 0, this.head = null, this.tail = null, f != null && f.forEach(function(g) {
                  return p.push(g);
                });
              }
              return a(d, [{
                key: "size",
                value: function() {
                  return this.length;
                }
              }, {
                key: "insertBefore",
                value: function(p, g) {
                  return l(g.prev, o(p), g, this);
                }
              }, {
                key: "insertAfter",
                value: function(p, g) {
                  return l(g, o(p), g.next, this);
                }
              }, {
                key: "insertNodeBefore",
                value: function(p, g) {
                  return l(g.prev, p, g, this);
                }
              }, {
                key: "insertNodeAfter",
                value: function(p, g) {
                  return l(g, p, g.next, this);
                }
              }, {
                key: "push",
                value: function(p) {
                  return l(this.tail, o(p), null, this);
                }
              }, {
                key: "unshift",
                value: function(p) {
                  return l(null, o(p), this.head, this);
                }
              }, {
                key: "remove",
                value: function(p) {
                  return u(p, this);
                }
              }, {
                key: "pop",
                value: function() {
                  return u(this.tail, this).value;
                }
              }, {
                key: "popNode",
                value: function() {
                  return u(this.tail, this);
                }
              }, {
                key: "shift",
                value: function() {
                  return u(this.head, this).value;
                }
              }, {
                key: "shiftNode",
                value: function() {
                  return u(this.head, this);
                }
              }, {
                key: "get_object_at",
                value: function(p) {
                  if (p <= this.length()) {
                    for (var g = 1, m = this.head; g < p; )
                      m = m.next, g++;
                    return m.value;
                  }
                }
              }, {
                key: "set_object_at",
                value: function(p, g) {
                  if (p <= this.length()) {
                    for (var m = 1, v = this.head; m < p; )
                      v = v.next, m++;
                    v.value = g;
                  }
                }
              }]), d;
            }();
            r.exports = h;
          },
          /* 12 */
          /***/
          function(r, n, i) {
            function a(s, o, l) {
              this.x = null, this.y = null, s == null && o == null && l == null ? (this.x = 0, this.y = 0) : typeof s == "number" && typeof o == "number" && l == null ? (this.x = s, this.y = o) : s.constructor.name == "Point" && o == null && l == null && (l = s, this.x = l.x, this.y = l.y);
            }
            a.prototype.getX = function() {
              return this.x;
            }, a.prototype.getY = function() {
              return this.y;
            }, a.prototype.getLocation = function() {
              return new a(this.x, this.y);
            }, a.prototype.setLocation = function(s, o, l) {
              s.constructor.name == "Point" && o == null && l == null ? (l = s, this.setLocation(l.x, l.y)) : typeof s == "number" && typeof o == "number" && l == null && (parseInt(s) == s && parseInt(o) == o ? this.move(s, o) : (this.x = Math.floor(s + 0.5), this.y = Math.floor(o + 0.5)));
            }, a.prototype.move = function(s, o) {
              this.x = s, this.y = o;
            }, a.prototype.translate = function(s, o) {
              this.x += s, this.y += o;
            }, a.prototype.equals = function(s) {
              if (s.constructor.name == "Point") {
                var o = s;
                return this.x == o.x && this.y == o.y;
              }
              return this == s;
            }, a.prototype.toString = function() {
              return new a().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
            }, r.exports = a;
          },
          /* 13 */
          /***/
          function(r, n, i) {
            function a(s, o, l, u) {
              this.x = 0, this.y = 0, this.width = 0, this.height = 0, s != null && o != null && l != null && u != null && (this.x = s, this.y = o, this.width = l, this.height = u);
            }
            a.prototype.getX = function() {
              return this.x;
            }, a.prototype.setX = function(s) {
              this.x = s;
            }, a.prototype.getY = function() {
              return this.y;
            }, a.prototype.setY = function(s) {
              this.y = s;
            }, a.prototype.getWidth = function() {
              return this.width;
            }, a.prototype.setWidth = function(s) {
              this.width = s;
            }, a.prototype.getHeight = function() {
              return this.height;
            }, a.prototype.setHeight = function(s) {
              this.height = s;
            }, a.prototype.getRight = function() {
              return this.x + this.width;
            }, a.prototype.getBottom = function() {
              return this.y + this.height;
            }, a.prototype.intersects = function(s) {
              return !(this.getRight() < s.x || this.getBottom() < s.y || s.getRight() < this.x || s.getBottom() < this.y);
            }, a.prototype.getCenterX = function() {
              return this.x + this.width / 2;
            }, a.prototype.getMinX = function() {
              return this.getX();
            }, a.prototype.getMaxX = function() {
              return this.getX() + this.width;
            }, a.prototype.getCenterY = function() {
              return this.y + this.height / 2;
            }, a.prototype.getMinY = function() {
              return this.getY();
            }, a.prototype.getMaxY = function() {
              return this.getY() + this.height;
            }, a.prototype.getWidthHalf = function() {
              return this.width / 2;
            }, a.prototype.getHeightHalf = function() {
              return this.height / 2;
            }, r.exports = a;
          },
          /* 14 */
          /***/
          function(r, n, i) {
            var a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
              return typeof o;
            } : function(o) {
              return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
            };
            function s() {
            }
            s.lastID = 0, s.createID = function(o) {
              return s.isPrimitive(o) ? o : (o.uniqueID != null || (o.uniqueID = s.getString(), s.lastID++), o.uniqueID);
            }, s.getString = function(o) {
              return o == null && (o = s.lastID), "Object#" + o;
            }, s.isPrimitive = function(o) {
              var l = typeof o > "u" ? "undefined" : a(o);
              return o == null || l != "object" && l != "function";
            }, r.exports = s;
          },
          /* 15 */
          /***/
          function(r, n, i) {
            function a(m) {
              if (Array.isArray(m)) {
                for (var v = 0, y = Array(m.length); v < m.length; v++)
                  y[v] = m[v];
                return y;
              } else
                return Array.from(m);
            }
            var s = i(0), o = i(6), l = i(3), u = i(1), h = i(5), d = i(4), f = i(17), p = i(27);
            function g(m) {
              p.call(this), this.layoutQuality = s.QUALITY, this.createBendsAsNeeded = s.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = s.DEFAULT_INCREMENTAL, this.animationOnLayout = s.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = s.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = s.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = s.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new o(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, m != null && (this.isRemoteUse = m);
            }
            g.RANDOM_SEED = 1, g.prototype = Object.create(p.prototype), g.prototype.getGraphManager = function() {
              return this.graphManager;
            }, g.prototype.getAllNodes = function() {
              return this.graphManager.getAllNodes();
            }, g.prototype.getAllEdges = function() {
              return this.graphManager.getAllEdges();
            }, g.prototype.getAllNodesToApplyGravitation = function() {
              return this.graphManager.getAllNodesToApplyGravitation();
            }, g.prototype.newGraphManager = function() {
              var m = new o(this);
              return this.graphManager = m, m;
            }, g.prototype.newGraph = function(m) {
              return new h(null, this.graphManager, m);
            }, g.prototype.newNode = function(m) {
              return new l(this.graphManager, m);
            }, g.prototype.newEdge = function(m) {
              return new u(null, null, m);
            }, g.prototype.checkLayoutSuccess = function() {
              return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
            }, g.prototype.runLayout = function() {
              this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters();
              var m;
              return this.checkLayoutSuccess() ? m = !1 : m = this.layout(), s.ANIMATE === "during" ? !1 : (m && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, m);
            }, g.prototype.doPostLayout = function() {
              this.incremental || this.transform(), this.update();
            }, g.prototype.update2 = function() {
              if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) {
                for (var m = this.graphManager.getAllEdges(), v = 0; v < m.length; v++)
                  m[v];
                for (var y = this.graphManager.getRoot().getNodes(), v = 0; v < y.length; v++)
                  y[v];
                this.update(this.graphManager.getRoot());
              }
            }, g.prototype.update = function(m) {
              if (m == null)
                this.update2();
              else if (m instanceof l) {
                var v = m;
                if (v.getChild() != null)
                  for (var y = v.getChild().getNodes(), b = 0; b < y.length; b++)
                    update(y[b]);
                if (v.vGraphObject != null) {
                  var w = v.vGraphObject;
                  w.update(v);
                }
              } else if (m instanceof u) {
                var T = m;
                if (T.vGraphObject != null) {
                  var E = T.vGraphObject;
                  E.update(T);
                }
              } else if (m instanceof h) {
                var C = m;
                if (C.vGraphObject != null) {
                  var k = C.vGraphObject;
                  k.update(C);
                }
              }
            }, g.prototype.initParameters = function() {
              this.isSubLayout || (this.layoutQuality = s.QUALITY, this.animationDuringLayout = s.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = s.DEFAULT_ANIMATION_PERIOD, this.animationOnLayout = s.DEFAULT_ANIMATION_ON_LAYOUT, this.incremental = s.DEFAULT_INCREMENTAL, this.createBendsAsNeeded = s.DEFAULT_CREATE_BENDS_AS_NEEDED, this.uniformLeafNodeSizes = s.DEFAULT_UNIFORM_LEAF_NODE_SIZES), this.animationDuringLayout && (this.animationOnLayout = !1);
            }, g.prototype.transform = function(m) {
              if (m == null)
                this.transform(new d(0, 0));
              else {
                var v = new f(), y = this.graphManager.getRoot().updateLeftTop();
                if (y != null) {
                  v.setWorldOrgX(m.x), v.setWorldOrgY(m.y), v.setDeviceOrgX(y.x), v.setDeviceOrgY(y.y);
                  for (var b = this.getAllNodes(), w, T = 0; T < b.length; T++)
                    w = b[T], w.transform(v);
                }
              }
            }, g.prototype.positionNodesRandomly = function(m) {
              if (m == null)
                this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0);
              else
                for (var v, y, b = m.getNodes(), w = 0; w < b.length; w++)
                  v = b[w], y = v.getChild(), y == null || y.getNodes().length == 0 ? v.scatter() : (this.positionNodesRandomly(y), v.updateBounds());
            }, g.prototype.getFlatForest = function() {
              for (var m = [], v = !0, y = this.graphManager.getRoot().getNodes(), b = !0, w = 0; w < y.length; w++)
                y[w].getChild() != null && (b = !1);
              if (!b)
                return m;
              var T = /* @__PURE__ */ new Set(), E = [], C = /* @__PURE__ */ new Map(), k = [];
              for (k = k.concat(y); k.length > 0 && v; ) {
                for (E.push(k[0]); E.length > 0 && v; ) {
                  var _ = E[0];
                  E.splice(0, 1), T.add(_);
                  for (var L = _.getEdges(), w = 0; w < L.length; w++) {
                    var N = L[w].getOtherEnd(_);
                    if (C.get(_) != N)
                      if (!T.has(N))
                        E.push(N), C.set(N, _);
                      else {
                        v = !1;
                        break;
                      }
                  }
                }
                if (!v)
                  m = [];
                else {
                  var A = [].concat(a(T));
                  m.push(A);
                  for (var w = 0; w < A.length; w++) {
                    var O = A[w], P = k.indexOf(O);
                    P > -1 && k.splice(P, 1);
                  }
                  T = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map();
                }
              }
              return m;
            }, g.prototype.createDummyNodesForBendpoints = function(m) {
              for (var v = [], y = m.source, b = this.graphManager.calcLowestCommonAncestor(m.source, m.target), w = 0; w < m.bendpoints.length; w++) {
                var T = this.newNode(null);
                T.setRect(new Point(0, 0), new Dimension(1, 1)), b.add(T);
                var E = this.newEdge(null);
                this.graphManager.add(E, y, T), v.add(T), y = T;
              }
              var E = this.newEdge(null);
              return this.graphManager.add(E, y, m.target), this.edgeToDummyNodes.set(m, v), m.isInterGraph() ? this.graphManager.remove(m) : b.remove(m), v;
            }, g.prototype.createBendpointsFromDummyNodes = function() {
              var m = [];
              m = m.concat(this.graphManager.getAllEdges()), m = [].concat(a(this.edgeToDummyNodes.keys())).concat(m);
              for (var v = 0; v < m.length; v++) {
                var y = m[v];
                if (y.bendpoints.length > 0) {
                  for (var b = this.edgeToDummyNodes.get(y), w = 0; w < b.length; w++) {
                    var T = b[w], E = new d(T.getCenterX(), T.getCenterY()), C = y.bendpoints.get(w);
                    C.x = E.x, C.y = E.y, T.getOwner().remove(T);
                  }
                  this.graphManager.add(y, y.source, y.target);
                }
              }
            }, g.transform = function(m, v, y, b) {
              if (y != null && b != null) {
                var w = v;
                if (m <= 50) {
                  var T = v / y;
                  w -= (v - T) / 50 * (50 - m);
                } else {
                  var E = v * b;
                  w += (E - v) / 50 * (m - 50);
                }
                return w;
              } else {
                var C, k;
                return m <= 50 ? (C = 9 * v / 500, k = v / 10) : (C = 9 * v / 50, k = -8 * v), C * m + k;
              }
            }, g.findCenterOfTree = function(m) {
              var v = [];
              v = v.concat(m);
              var y = [], b = /* @__PURE__ */ new Map(), w = !1, T = null;
              (v.length == 1 || v.length == 2) && (w = !0, T = v[0]);
              for (var E = 0; E < v.length; E++) {
                var C = v[E], k = C.getNeighborsList().size;
                b.set(C, C.getNeighborsList().size), k == 1 && y.push(C);
              }
              var _ = [];
              for (_ = _.concat(y); !w; ) {
                var L = [];
                L = L.concat(_), _ = [];
                for (var E = 0; E < v.length; E++) {
                  var C = v[E], N = v.indexOf(C);
                  N >= 0 && v.splice(N, 1);
                  var A = C.getNeighborsList();
                  A.forEach(function(S) {
                    if (y.indexOf(S) < 0) {
                      var R = b.get(S), I = R - 1;
                      I == 1 && _.push(S), b.set(S, I);
                    }
                  });
                }
                y = y.concat(_), (v.length == 1 || v.length == 2) && (w = !0, T = v[0]);
              }
              return T;
            }, g.prototype.setGraphManager = function(m) {
              this.graphManager = m;
            }, r.exports = g;
          },
          /* 16 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.seed = 1, a.x = 0, a.nextDouble = function() {
              return a.x = Math.sin(a.seed++) * 1e4, a.x - Math.floor(a.x);
            }, r.exports = a;
          },
          /* 17 */
          /***/
          function(r, n, i) {
            var a = i(4);
            function s(o, l) {
              this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1;
            }
            s.prototype.getWorldOrgX = function() {
              return this.lworldOrgX;
            }, s.prototype.setWorldOrgX = function(o) {
              this.lworldOrgX = o;
            }, s.prototype.getWorldOrgY = function() {
              return this.lworldOrgY;
            }, s.prototype.setWorldOrgY = function(o) {
              this.lworldOrgY = o;
            }, s.prototype.getWorldExtX = function() {
              return this.lworldExtX;
            }, s.prototype.setWorldExtX = function(o) {
              this.lworldExtX = o;
            }, s.prototype.getWorldExtY = function() {
              return this.lworldExtY;
            }, s.prototype.setWorldExtY = function(o) {
              this.lworldExtY = o;
            }, s.prototype.getDeviceOrgX = function() {
              return this.ldeviceOrgX;
            }, s.prototype.setDeviceOrgX = function(o) {
              this.ldeviceOrgX = o;
            }, s.prototype.getDeviceOrgY = function() {
              return this.ldeviceOrgY;
            }, s.prototype.setDeviceOrgY = function(o) {
              this.ldeviceOrgY = o;
            }, s.prototype.getDeviceExtX = function() {
              return this.ldeviceExtX;
            }, s.prototype.setDeviceExtX = function(o) {
              this.ldeviceExtX = o;
            }, s.prototype.getDeviceExtY = function() {
              return this.ldeviceExtY;
            }, s.prototype.setDeviceExtY = function(o) {
              this.ldeviceExtY = o;
            }, s.prototype.transformX = function(o) {
              var l = 0, u = this.lworldExtX;
              return u != 0 && (l = this.ldeviceOrgX + (o - this.lworldOrgX) * this.ldeviceExtX / u), l;
            }, s.prototype.transformY = function(o) {
              var l = 0, u = this.lworldExtY;
              return u != 0 && (l = this.ldeviceOrgY + (o - this.lworldOrgY) * this.ldeviceExtY / u), l;
            }, s.prototype.inverseTransformX = function(o) {
              var l = 0, u = this.ldeviceExtX;
              return u != 0 && (l = this.lworldOrgX + (o - this.ldeviceOrgX) * this.lworldExtX / u), l;
            }, s.prototype.inverseTransformY = function(o) {
              var l = 0, u = this.ldeviceExtY;
              return u != 0 && (l = this.lworldOrgY + (o - this.ldeviceOrgY) * this.lworldExtY / u), l;
            }, s.prototype.inverseTransformPoint = function(o) {
              var l = new a(this.inverseTransformX(o.x), this.inverseTransformY(o.y));
              return l;
            }, r.exports = s;
          },
          /* 18 */
          /***/
          function(r, n, i) {
            function a(p) {
              if (Array.isArray(p)) {
                for (var g = 0, m = Array(p.length); g < p.length; g++)
                  m[g] = p[g];
                return m;
              } else
                return Array.from(p);
            }
            var s = i(15), o = i(7), l = i(0), u = i(8), h = i(9);
            function d() {
              s.call(this), this.useSmartIdealEdgeLengthCalculation = o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.idealEdgeLength = o.DEFAULT_EDGE_LENGTH, this.springConstant = o.DEFAULT_SPRING_STRENGTH, this.repulsionConstant = o.DEFAULT_REPULSION_STRENGTH, this.gravityConstant = o.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = o.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = o.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.displacementThresholdPerNode = 3 * o.DEFAULT_EDGE_LENGTH / 100, this.coolingFactor = o.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.initialCoolingFactor = o.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.totalDisplacement = 0, this.oldTotalDisplacement = 0, this.maxIterations = o.MAX_ITERATIONS;
            }
            d.prototype = Object.create(s.prototype);
            for (var f in s)
              d[f] = s[f];
            d.prototype.initParameters = function() {
              s.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = [];
            }, d.prototype.calcIdealEdgeLengths = function() {
              for (var p, g, m, v, y, b, w = this.getGraphManager().getAllEdges(), T = 0; T < w.length; T++)
                p = w[T], p.idealLength = this.idealEdgeLength, p.isInterGraph && (m = p.getSource(), v = p.getTarget(), y = p.getSourceInLca().getEstimatedSize(), b = p.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (p.idealLength += y + b - 2 * l.SIMPLE_NODE_SIZE), g = p.getLca().getInclusionTreeDepth(), p.idealLength += o.DEFAULT_EDGE_LENGTH * o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (m.getInclusionTreeDepth() + v.getInclusionTreeDepth() - 2 * g));
            }, d.prototype.initSpringEmbedder = function() {
              var p = this.getAllNodes().length;
              this.incremental ? (p > o.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * o.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (p - o.ADAPTATION_LOWER_NODE_LIMIT) / (o.ADAPTATION_UPPER_NODE_LIMIT - o.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - o.COOLING_ADAPTATION_FACTOR))), this.maxNodeDisplacement = o.MAX_NODE_DISPLACEMENT_INCREMENTAL) : (p > o.ADAPTATION_LOWER_NODE_LIMIT ? this.coolingFactor = Math.max(o.COOLING_ADAPTATION_FACTOR, 1 - (p - o.ADAPTATION_LOWER_NODE_LIMIT) / (o.ADAPTATION_UPPER_NODE_LIMIT - o.ADAPTATION_LOWER_NODE_LIMIT) * (1 - o.COOLING_ADAPTATION_FACTOR)) : this.coolingFactor = 1, this.initialCoolingFactor = this.coolingFactor, this.maxNodeDisplacement = o.MAX_NODE_DISPLACEMENT), this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations), this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length, this.repulsionRange = this.calcRepulsionRange();
            }, d.prototype.calcSpringForces = function() {
              for (var p = this.getAllEdges(), g, m = 0; m < p.length; m++)
                g = p[m], this.calcSpringForce(g, g.idealLength);
            }, d.prototype.calcRepulsionForces = function() {
              var p = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, m, v, y, b, w = this.getAllNodes(), T;
              if (this.useFRGridVariant)
                for (this.totalIterations % o.GRID_CALCULATION_CHECK_PERIOD == 1 && p && this.updateGrid(), T = /* @__PURE__ */ new Set(), m = 0; m < w.length; m++)
                  y = w[m], this.calculateRepulsionForceOfANode(y, T, p, g), T.add(y);
              else
                for (m = 0; m < w.length; m++)
                  for (y = w[m], v = m + 1; v < w.length; v++)
                    b = w[v], y.getOwner() == b.getOwner() && this.calcRepulsionForce(y, b);
            }, d.prototype.calcGravitationalForces = function() {
              for (var p, g = this.getAllNodesToApplyGravitation(), m = 0; m < g.length; m++)
                p = g[m], this.calcGravitationalForce(p);
            }, d.prototype.moveNodes = function() {
              for (var p = this.getAllNodes(), g, m = 0; m < p.length; m++)
                g = p[m], g.move();
            }, d.prototype.calcSpringForce = function(p, g) {
              var m = p.getSource(), v = p.getTarget(), y, b, w, T;
              if (this.uniformLeafNodeSizes && m.getChild() == null && v.getChild() == null)
                p.updateLengthSimple();
              else if (p.updateLength(), p.isOverlapingSourceAndTarget)
                return;
              y = p.getLength(), y != 0 && (b = this.springConstant * (y - g), w = b * (p.lengthX / y), T = b * (p.lengthY / y), m.springForceX += w, m.springForceY += T, v.springForceX -= w, v.springForceY -= T);
            }, d.prototype.calcRepulsionForce = function(p, g) {
              var m = p.getRect(), v = g.getRect(), y = new Array(2), b = new Array(4), w, T, E, C, k, _, L;
              if (m.intersects(v)) {
                u.calcSeparationAmount(m, v, y, o.DEFAULT_EDGE_LENGTH / 2), _ = 2 * y[0], L = 2 * y[1];
                var N = p.noOfChildren * g.noOfChildren / (p.noOfChildren + g.noOfChildren);
                p.repulsionForceX -= N * _, p.repulsionForceY -= N * L, g.repulsionForceX += N * _, g.repulsionForceY += N * L;
              } else
                this.uniformLeafNodeSizes && p.getChild() == null && g.getChild() == null ? (w = v.getCenterX() - m.getCenterX(), T = v.getCenterY() - m.getCenterY()) : (u.getIntersection(m, v, b), w = b[2] - b[0], T = b[3] - b[1]), Math.abs(w) < o.MIN_REPULSION_DIST && (w = h.sign(w) * o.MIN_REPULSION_DIST), Math.abs(T) < o.MIN_REPULSION_DIST && (T = h.sign(T) * o.MIN_REPULSION_DIST), E = w * w + T * T, C = Math.sqrt(E), k = this.repulsionConstant * p.noOfChildren * g.noOfChildren / E, _ = k * w / C, L = k * T / C, p.repulsionForceX -= _, p.repulsionForceY -= L, g.repulsionForceX += _, g.repulsionForceY += L;
            }, d.prototype.calcGravitationalForce = function(p) {
              var g, m, v, y, b, w, T, E;
              g = p.getOwner(), m = (g.getRight() + g.getLeft()) / 2, v = (g.getTop() + g.getBottom()) / 2, y = p.getCenterX() - m, b = p.getCenterY() - v, w = Math.abs(y) + p.getWidth() / 2, T = Math.abs(b) + p.getHeight() / 2, p.getOwner() == this.graphManager.getRoot() ? (E = g.getEstimatedSize() * this.gravityRangeFactor, (w > E || T > E) && (p.gravitationForceX = -this.gravityConstant * y, p.gravitationForceY = -this.gravityConstant * b)) : (E = g.getEstimatedSize() * this.compoundGravityRangeFactor, (w > E || T > E) && (p.gravitationForceX = -this.gravityConstant * y * this.compoundGravityConstant, p.gravitationForceY = -this.gravityConstant * b * this.compoundGravityConstant));
            }, d.prototype.isConverged = function() {
              var p, g = !1;
              return this.totalIterations > this.maxIterations / 3 && (g = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), p = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, p || g;
            }, d.prototype.animate = function() {
              this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++);
            }, d.prototype.calcNoOfChildrenForAllNodes = function() {
              for (var p, g = this.graphManager.getAllNodes(), m = 0; m < g.length; m++)
                p = g[m], p.noOfChildren = p.getNoOfChildren();
            }, d.prototype.calcGrid = function(p) {
              var g = 0, m = 0;
              g = parseInt(Math.ceil((p.getRight() - p.getLeft()) / this.repulsionRange)), m = parseInt(Math.ceil((p.getBottom() - p.getTop()) / this.repulsionRange));
              for (var v = new Array(g), y = 0; y < g; y++)
                v[y] = new Array(m);
              for (var y = 0; y < g; y++)
                for (var b = 0; b < m; b++)
                  v[y][b] = new Array();
              return v;
            }, d.prototype.addNodeToGrid = function(p, g, m) {
              var v = 0, y = 0, b = 0, w = 0;
              v = parseInt(Math.floor((p.getRect().x - g) / this.repulsionRange)), y = parseInt(Math.floor((p.getRect().width + p.getRect().x - g) / this.repulsionRange)), b = parseInt(Math.floor((p.getRect().y - m) / this.repulsionRange)), w = parseInt(Math.floor((p.getRect().height + p.getRect().y - m) / this.repulsionRange));
              for (var T = v; T <= y; T++)
                for (var E = b; E <= w; E++)
                  this.grid[T][E].push(p), p.setGridCoordinates(v, y, b, w);
            }, d.prototype.updateGrid = function() {
              var p, g, m = this.getAllNodes();
              for (this.grid = this.calcGrid(this.graphManager.getRoot()), p = 0; p < m.length; p++)
                g = m[p], this.addNodeToGrid(g, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
            }, d.prototype.calculateRepulsionForceOfANode = function(p, g, m, v) {
              if (this.totalIterations % o.GRID_CALCULATION_CHECK_PERIOD == 1 && m || v) {
                var y = /* @__PURE__ */ new Set();
                p.surrounding = new Array();
                for (var b, w = this.grid, T = p.startX - 1; T < p.finishX + 2; T++)
                  for (var E = p.startY - 1; E < p.finishY + 2; E++)
                    if (!(T < 0 || E < 0 || T >= w.length || E >= w[0].length)) {
                      for (var C = 0; C < w[T][E].length; C++)
                        if (b = w[T][E][C], !(p.getOwner() != b.getOwner() || p == b) && !g.has(b) && !y.has(b)) {
                          var k = Math.abs(p.getCenterX() - b.getCenterX()) - (p.getWidth() / 2 + b.getWidth() / 2), _ = Math.abs(p.getCenterY() - b.getCenterY()) - (p.getHeight() / 2 + b.getHeight() / 2);
                          k <= this.repulsionRange && _ <= this.repulsionRange && y.add(b);
                        }
                    }
                p.surrounding = [].concat(a(y));
              }
              for (T = 0; T < p.surrounding.length; T++)
                this.calcRepulsionForce(p, p.surrounding[T]);
            }, d.prototype.calcRepulsionRange = function() {
              return 0;
            }, r.exports = d;
          },
          /* 19 */
          /***/
          function(r, n, i) {
            var a = i(1), s = i(7);
            function o(u, h, d) {
              a.call(this, u, h, d), this.idealLength = s.DEFAULT_EDGE_LENGTH;
            }
            o.prototype = Object.create(a.prototype);
            for (var l in a)
              o[l] = a[l];
            r.exports = o;
          },
          /* 20 */
          /***/
          function(r, n, i) {
            var a = i(3);
            function s(l, u, h, d) {
              a.call(this, l, u, h, d), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0, this.startX = 0, this.finishX = 0, this.startY = 0, this.finishY = 0, this.surrounding = [];
            }
            s.prototype = Object.create(a.prototype);
            for (var o in a)
              s[o] = a[o];
            s.prototype.setGridCoordinates = function(l, u, h, d) {
              this.startX = l, this.finishX = u, this.startY = h, this.finishY = d;
            }, r.exports = s;
          },
          /* 21 */
          /***/
          function(r, n, i) {
            function a(s, o) {
              this.width = 0, this.height = 0, s !== null && o !== null && (this.height = o, this.width = s);
            }
            a.prototype.getWidth = function() {
              return this.width;
            }, a.prototype.setWidth = function(s) {
              this.width = s;
            }, a.prototype.getHeight = function() {
              return this.height;
            }, a.prototype.setHeight = function(s) {
              this.height = s;
            }, r.exports = a;
          },
          /* 22 */
          /***/
          function(r, n, i) {
            var a = i(14);
            function s() {
              this.map = {}, this.keys = [];
            }
            s.prototype.put = function(o, l) {
              var u = a.createID(o);
              this.contains(u) || (this.map[u] = l, this.keys.push(o));
            }, s.prototype.contains = function(o) {
              return a.createID(o), this.map[o] != null;
            }, s.prototype.get = function(o) {
              var l = a.createID(o);
              return this.map[l];
            }, s.prototype.keySet = function() {
              return this.keys;
            }, r.exports = s;
          },
          /* 23 */
          /***/
          function(r, n, i) {
            var a = i(14);
            function s() {
              this.set = {};
            }
            s.prototype.add = function(o) {
              var l = a.createID(o);
              this.contains(l) || (this.set[l] = o);
            }, s.prototype.remove = function(o) {
              delete this.set[a.createID(o)];
            }, s.prototype.clear = function() {
              this.set = {};
            }, s.prototype.contains = function(o) {
              return this.set[a.createID(o)] == o;
            }, s.prototype.isEmpty = function() {
              return this.size() === 0;
            }, s.prototype.size = function() {
              return Object.keys(this.set).length;
            }, s.prototype.addAllTo = function(o) {
              for (var l = Object.keys(this.set), u = l.length, h = 0; h < u; h++)
                o.push(this.set[l[h]]);
            }, s.prototype.size = function() {
              return Object.keys(this.set).length;
            }, s.prototype.addAll = function(o) {
              for (var l = o.length, u = 0; u < l; u++) {
                var h = o[u];
                this.add(h);
              }
            }, r.exports = s;
          },
          /* 24 */
          /***/
          function(r, n, i) {
            var a = /* @__PURE__ */ function() {
              function u(h, d) {
                for (var f = 0; f < d.length; f++) {
                  var p = d[f];
                  p.enumerable = p.enumerable || !1, p.configurable = !0, "value" in p && (p.writable = !0), Object.defineProperty(h, p.key, p);
                }
              }
              return function(h, d, f) {
                return d && u(h.prototype, d), f && u(h, f), h;
              };
            }();
            function s(u, h) {
              if (!(u instanceof h))
                throw new TypeError("Cannot call a class as a function");
            }
            var o = i(11), l = function() {
              function u(h, d) {
                s(this, u), (d !== null || d !== void 0) && (this.compareFunction = this._defaultCompareFunction);
                var f = void 0;
                h instanceof o ? f = h.size() : f = h.length, this._quicksort(h, 0, f - 1);
              }
              return a(u, [{
                key: "_quicksort",
                value: function(d, f, p) {
                  if (f < p) {
                    var g = this._partition(d, f, p);
                    this._quicksort(d, f, g), this._quicksort(d, g + 1, p);
                  }
                }
              }, {
                key: "_partition",
                value: function(d, f, p) {
                  for (var g = this._get(d, f), m = f, v = p; ; ) {
                    for (; this.compareFunction(g, this._get(d, v)); )
                      v--;
                    for (; this.compareFunction(this._get(d, m), g); )
                      m++;
                    if (m < v)
                      this._swap(d, m, v), m++, v--;
                    else return v;
                  }
                }
              }, {
                key: "_get",
                value: function(d, f) {
                  return d instanceof o ? d.get_object_at(f) : d[f];
                }
              }, {
                key: "_set",
                value: function(d, f, p) {
                  d instanceof o ? d.set_object_at(f, p) : d[f] = p;
                }
              }, {
                key: "_swap",
                value: function(d, f, p) {
                  var g = this._get(d, f);
                  this._set(d, f, this._get(d, p)), this._set(d, p, g);
                }
              }, {
                key: "_defaultCompareFunction",
                value: function(d, f) {
                  return f > d;
                }
              }]), u;
            }();
            r.exports = l;
          },
          /* 25 */
          /***/
          function(r, n, i) {
            var a = /* @__PURE__ */ function() {
              function l(u, h) {
                for (var d = 0; d < h.length; d++) {
                  var f = h[d];
                  f.enumerable = f.enumerable || !1, f.configurable = !0, "value" in f && (f.writable = !0), Object.defineProperty(u, f.key, f);
                }
              }
              return function(u, h, d) {
                return h && l(u.prototype, h), d && l(u, d), u;
              };
            }();
            function s(l, u) {
              if (!(l instanceof u))
                throw new TypeError("Cannot call a class as a function");
            }
            var o = function() {
              function l(u, h) {
                var d = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, f = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, p = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
                s(this, l), this.sequence1 = u, this.sequence2 = h, this.match_score = d, this.mismatch_penalty = f, this.gap_penalty = p, this.iMax = u.length + 1, this.jMax = h.length + 1, this.grid = new Array(this.iMax);
                for (var g = 0; g < this.iMax; g++) {
                  this.grid[g] = new Array(this.jMax);
                  for (var m = 0; m < this.jMax; m++)
                    this.grid[g][m] = 0;
                }
                this.tracebackGrid = new Array(this.iMax);
                for (var v = 0; v < this.iMax; v++) {
                  this.tracebackGrid[v] = new Array(this.jMax);
                  for (var y = 0; y < this.jMax; y++)
                    this.tracebackGrid[v][y] = [null, null, null];
                }
                this.alignments = [], this.score = -1, this.computeGrids();
              }
              return a(l, [{
                key: "getScore",
                value: function() {
                  return this.score;
                }
              }, {
                key: "getAlignments",
                value: function() {
                  return this.alignments;
                }
                // Main dynamic programming procedure
              }, {
                key: "computeGrids",
                value: function() {
                  for (var h = 1; h < this.jMax; h++)
                    this.grid[0][h] = this.grid[0][h - 1] + this.gap_penalty, this.tracebackGrid[0][h] = [!1, !1, !0];
                  for (var d = 1; d < this.iMax; d++)
                    this.grid[d][0] = this.grid[d - 1][0] + this.gap_penalty, this.tracebackGrid[d][0] = [!1, !0, !1];
                  for (var f = 1; f < this.iMax; f++)
                    for (var p = 1; p < this.jMax; p++) {
                      var g = void 0;
                      this.sequence1[f - 1] === this.sequence2[p - 1] ? g = this.grid[f - 1][p - 1] + this.match_score : g = this.grid[f - 1][p - 1] + this.mismatch_penalty;
                      var m = this.grid[f - 1][p] + this.gap_penalty, v = this.grid[f][p - 1] + this.gap_penalty, y = [g, m, v], b = this.arrayAllMaxIndexes(y);
                      this.grid[f][p] = y[b[0]], this.tracebackGrid[f][p] = [b.includes(0), b.includes(1), b.includes(2)];
                    }
                  this.score = this.grid[this.iMax - 1][this.jMax - 1];
                }
                // Gets all possible valid sequence combinations
              }, {
                key: "alignmentTraceback",
                value: function() {
                  var h = [];
                  for (h.push({
                    pos: [this.sequence1.length, this.sequence2.length],
                    seq1: "",
                    seq2: ""
                  }); h[0]; ) {
                    var d = h[0], f = this.tracebackGrid[d.pos[0]][d.pos[1]];
                    f[0] && h.push({
                      pos: [d.pos[0] - 1, d.pos[1] - 1],
                      seq1: this.sequence1[d.pos[0] - 1] + d.seq1,
                      seq2: this.sequence2[d.pos[1] - 1] + d.seq2
                    }), f[1] && h.push({
                      pos: [d.pos[0] - 1, d.pos[1]],
                      seq1: this.sequence1[d.pos[0] - 1] + d.seq1,
                      seq2: "-" + d.seq2
                    }), f[2] && h.push({
                      pos: [d.pos[0], d.pos[1] - 1],
                      seq1: "-" + d.seq1,
                      seq2: this.sequence2[d.pos[1] - 1] + d.seq2
                    }), d.pos[0] === 0 && d.pos[1] === 0 && this.alignments.push({
                      sequence1: d.seq1,
                      sequence2: d.seq2
                    }), h.shift();
                  }
                  return this.alignments;
                }
                // Helper Functions
              }, {
                key: "getAllIndexes",
                value: function(h, d) {
                  for (var f = [], p = -1; (p = h.indexOf(d, p + 1)) !== -1; )
                    f.push(p);
                  return f;
                }
              }, {
                key: "arrayAllMaxIndexes",
                value: function(h) {
                  return this.getAllIndexes(h, Math.max.apply(null, h));
                }
              }]), l;
            }();
            r.exports = o;
          },
          /* 26 */
          /***/
          function(r, n, i) {
            var a = function() {
            };
            a.FDLayout = i(18), a.FDLayoutConstants = i(7), a.FDLayoutEdge = i(19), a.FDLayoutNode = i(20), a.DimensionD = i(21), a.HashMap = i(22), a.HashSet = i(23), a.IGeometry = i(8), a.IMath = i(9), a.Integer = i(10), a.Point = i(12), a.PointD = i(4), a.RandomSeed = i(16), a.RectangleD = i(13), a.Transform = i(17), a.UniqueIDGeneretor = i(14), a.Quicksort = i(24), a.LinkedList = i(11), a.LGraphObject = i(2), a.LGraph = i(5), a.LEdge = i(1), a.LGraphManager = i(6), a.LNode = i(3), a.Layout = i(15), a.LayoutConstants = i(0), a.NeedlemanWunsch = i(25), r.exports = a;
          },
          /* 27 */
          /***/
          function(r, n, i) {
            function a() {
              this.listeners = [];
            }
            var s = a.prototype;
            s.addListener = function(o, l) {
              this.listeners.push({
                event: o,
                callback: l
              });
            }, s.removeListener = function(o, l) {
              for (var u = this.listeners.length; u >= 0; u--) {
                var h = this.listeners[u];
                h.event === o && h.callback === l && this.listeners.splice(u, 1);
              }
            }, s.emit = function(o, l) {
              for (var u = 0; u < this.listeners.length; u++) {
                var h = this.listeners[u];
                o === h.event && h.callback(l);
              }
            }, r.exports = a;
          }
          /******/
        ])
      );
    });
  }(n5)), n5.exports;
}
var cL;
function X4e() {
  return cL || (cL = 1, function(t, e) {
    (function(n, i) {
      t.exports = i(Y4e());
    })(ro, function(r) {
      return (
        /******/
        function(n) {
          var i = {};
          function a(s) {
            if (i[s])
              return i[s].exports;
            var o = i[s] = {
              /******/
              i: s,
              /******/
              l: !1,
              /******/
              exports: {}
              /******/
            };
            return n[s].call(o.exports, o, o.exports, a), o.l = !0, o.exports;
          }
          return a.m = n, a.c = i, a.i = function(s) {
            return s;
          }, a.d = function(s, o, l) {
            a.o(s, o) || Object.defineProperty(s, o, {
              /******/
              configurable: !1,
              /******/
              enumerable: !0,
              /******/
              get: l
              /******/
            });
          }, a.n = function(s) {
            var o = s && s.__esModule ? (
              /******/
              function() {
                return s.default;
              }
            ) : (
              /******/
              function() {
                return s;
              }
            );
            return a.d(o, "a", o), o;
          }, a.o = function(s, o) {
            return Object.prototype.hasOwnProperty.call(s, o);
          }, a.p = "", a(a.s = 7);
        }([
          /* 0 */
          /***/
          function(n, i) {
            n.exports = r;
          },
          /* 1 */
          /***/
          function(n, i, a) {
            var s = a(0).FDLayoutConstants;
            function o() {
            }
            for (var l in s)
              o[l] = s[l];
            o.DEFAULT_USE_MULTI_LEVEL_SCALING = !1, o.DEFAULT_RADIAL_SEPARATION = s.DEFAULT_EDGE_LENGTH, o.DEFAULT_COMPONENT_SEPERATION = 60, o.TILE = !0, o.TILING_PADDING_VERTICAL = 10, o.TILING_PADDING_HORIZONTAL = 10, o.TREE_REDUCTION_ON_INCREMENTAL = !1, n.exports = o;
          },
          /* 2 */
          /***/
          function(n, i, a) {
            var s = a(0).FDLayoutEdge;
            function o(u, h, d) {
              s.call(this, u, h, d);
            }
            o.prototype = Object.create(s.prototype);
            for (var l in s)
              o[l] = s[l];
            n.exports = o;
          },
          /* 3 */
          /***/
          function(n, i, a) {
            var s = a(0).LGraph;
            function o(u, h, d) {
              s.call(this, u, h, d);
            }
            o.prototype = Object.create(s.prototype);
            for (var l in s)
              o[l] = s[l];
            n.exports = o;
          },
          /* 4 */
          /***/
          function(n, i, a) {
            var s = a(0).LGraphManager;
            function o(u) {
              s.call(this, u);
            }
            o.prototype = Object.create(s.prototype);
            for (var l in s)
              o[l] = s[l];
            n.exports = o;
          },
          /* 5 */
          /***/
          function(n, i, a) {
            var s = a(0).FDLayoutNode, o = a(0).IMath;
            function l(h, d, f, p) {
              s.call(this, h, d, f, p);
            }
            l.prototype = Object.create(s.prototype);
            for (var u in s)
              l[u] = s[u];
            l.prototype.move = function() {
              var h = this.graphManager.getLayout();
              this.displacementX = h.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY = h.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren, Math.abs(this.displacementX) > h.coolingFactor * h.maxNodeDisplacement && (this.displacementX = h.coolingFactor * h.maxNodeDisplacement * o.sign(this.displacementX)), Math.abs(this.displacementY) > h.coolingFactor * h.maxNodeDisplacement && (this.displacementY = h.coolingFactor * h.maxNodeDisplacement * o.sign(this.displacementY)), this.child == null ? this.moveBy(this.displacementX, this.displacementY) : this.child.getNodes().length == 0 ? this.moveBy(this.displacementX, this.displacementY) : this.propogateDisplacementToChildren(this.displacementX, this.displacementY), h.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0;
            }, l.prototype.propogateDisplacementToChildren = function(h, d) {
              for (var f = this.getChild().getNodes(), p, g = 0; g < f.length; g++)
                p = f[g], p.getChild() == null ? (p.moveBy(h, d), p.displacementX += h, p.displacementY += d) : p.propogateDisplacementToChildren(h, d);
            }, l.prototype.setPred1 = function(h) {
              this.pred1 = h;
            }, l.prototype.getPred1 = function() {
              return pred1;
            }, l.prototype.getPred2 = function() {
              return pred2;
            }, l.prototype.setNext = function(h) {
              this.next = h;
            }, l.prototype.getNext = function() {
              return next;
            }, l.prototype.setProcessed = function(h) {
              this.processed = h;
            }, l.prototype.isProcessed = function() {
              return processed;
            }, n.exports = l;
          },
          /* 6 */
          /***/
          function(n, i, a) {
            var s = a(0).FDLayout, o = a(4), l = a(3), u = a(5), h = a(2), d = a(1), f = a(0).FDLayoutConstants, p = a(0).LayoutConstants, g = a(0).Point, m = a(0).PointD, v = a(0).Layout, y = a(0).Integer, b = a(0).IGeometry, w = a(0).LGraph, T = a(0).Transform;
            function E() {
              s.call(this), this.toBeTiled = {};
            }
            E.prototype = Object.create(s.prototype);
            for (var C in s)
              E[C] = s[C];
            E.prototype.newGraphManager = function() {
              var k = new o(this);
              return this.graphManager = k, k;
            }, E.prototype.newGraph = function(k) {
              return new l(null, this.graphManager, k);
            }, E.prototype.newNode = function(k) {
              return new u(this.graphManager, k);
            }, E.prototype.newEdge = function(k) {
              return new h(null, null, k);
            }, E.prototype.initParameters = function() {
              s.prototype.initParameters.call(this, arguments), this.isSubLayout || (d.DEFAULT_EDGE_LENGTH < 10 ? this.idealEdgeLength = 10 : this.idealEdgeLength = d.DEFAULT_EDGE_LENGTH, this.useSmartIdealEdgeLengthCalculation = d.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.springConstant = f.DEFAULT_SPRING_STRENGTH, this.repulsionConstant = f.DEFAULT_REPULSION_STRENGTH, this.gravityConstant = f.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = f.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = f.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.prunedNodesAll = [], this.growTreeIterations = 0, this.afterGrowthIterations = 0, this.isTreeGrowing = !1, this.isGrowthFinished = !1, this.coolingCycle = 0, this.maxCoolingCycle = this.maxIterations / f.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = f.CONVERGENCE_CHECK_PERIOD / this.maxIterations, this.coolingAdjuster = 1);
            }, E.prototype.layout = function() {
              var k = p.DEFAULT_CREATE_BENDS_AS_NEEDED;
              return k && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout();
            }, E.prototype.classicLayout = function() {
              if (this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(), this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity), this.calcNoOfChildrenForAllNodes(), this.graphManager.calcLowestCommonAncestors(), this.graphManager.calcInclusionTreeDepths(), this.graphManager.getRoot().calcEstimatedSize(), this.calcIdealEdgeLengths(), this.incremental) {
                if (d.TREE_REDUCTION_ON_INCREMENTAL) {
                  this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
                  var _ = new Set(this.getAllNodes()), L = this.nodesWithGravity.filter(function(O) {
                    return _.has(O);
                  });
                  this.graphManager.setAllNodesToApplyGravitation(L);
                }
              } else {
                var k = this.getFlatForest();
                if (k.length > 0)
                  this.positionNodesRadially(k);
                else {
                  this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
                  var _ = new Set(this.getAllNodes()), L = this.nodesWithGravity.filter(function(N) {
                    return _.has(N);
                  });
                  this.graphManager.setAllNodesToApplyGravitation(L), this.positionNodesRandomly();
                }
              }
              return this.initSpringEmbedder(), this.runSpringEmbedder(), !0;
            }, E.prototype.tick = function() {
              if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished)
                if (this.prunedNodesAll.length > 0)
                  this.isTreeGrowing = !0;
                else
                  return !0;
              if (this.totalIterations % f.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
                if (this.isConverged())
                  if (this.prunedNodesAll.length > 0)
                    this.isTreeGrowing = !0;
                  else
                    return !0;
                this.coolingCycle++, this.layoutQuality == 0 ? this.coolingAdjuster = this.coolingCycle : this.layoutQuality == 1 && (this.coolingAdjuster = this.coolingCycle / 3), this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature), this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
              }
              if (this.isTreeGrowing) {
                if (this.growTreeIterations % 10 == 0)
                  if (this.prunedNodesAll.length > 0) {
                    this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation();
                    var k = new Set(this.getAllNodes()), _ = this.nodesWithGravity.filter(function(A) {
                      return k.has(A);
                    });
                    this.graphManager.setAllNodesToApplyGravitation(_), this.graphManager.updateBounds(), this.updateGrid(), this.coolingFactor = f.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                  } else
                    this.isTreeGrowing = !1, this.isGrowthFinished = !0;
                this.growTreeIterations++;
              }
              if (this.isGrowthFinished) {
                if (this.isConverged())
                  return !0;
                this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), this.coolingFactor = f.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++;
              }
              var L = !this.isTreeGrowing && !this.isGrowthFinished, N = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
              return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(L, N), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1;
            }, E.prototype.getPositionsData = function() {
              for (var k = this.graphManager.getAllNodes(), _ = {}, L = 0; L < k.length; L++) {
                var N = k[L].rect, A = k[L].id;
                _[A] = {
                  id: A,
                  x: N.getCenterX(),
                  y: N.getCenterY(),
                  w: N.width,
                  h: N.height
                };
              }
              return _;
            }, E.prototype.runSpringEmbedder = function() {
              this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod;
              var k = !1;
              if (f.ANIMATE === "during")
                this.emit("layoutstarted");
              else {
                for (; !k; )
                  k = this.tick();
                this.graphManager.updateBounds();
              }
            }, E.prototype.calculateNodesToApplyGravitationTo = function() {
              var k = [], _, L = this.graphManager.getGraphs(), N = L.length, A;
              for (A = 0; A < N; A++)
                _ = L[A], _.updateConnected(), _.isConnected || (k = k.concat(_.getNodes()));
              return k;
            }, E.prototype.createBendpoints = function() {
              var k = [];
              k = k.concat(this.graphManager.getAllEdges());
              var _ = /* @__PURE__ */ new Set(), L;
              for (L = 0; L < k.length; L++) {
                var N = k[L];
                if (!_.has(N)) {
                  var A = N.getSource(), O = N.getTarget();
                  if (A == O)
                    N.getBendpoints().push(new m()), N.getBendpoints().push(new m()), this.createDummyNodesForBendpoints(N), _.add(N);
                  else {
                    var P = [];
                    if (P = P.concat(A.getEdgeListToNode(O)), P = P.concat(O.getEdgeListToNode(A)), !_.has(P[0])) {
                      if (P.length > 1) {
                        var S;
                        for (S = 0; S < P.length; S++) {
                          var R = P[S];
                          R.getBendpoints().push(new m()), this.createDummyNodesForBendpoints(R);
                        }
                      }
                      P.forEach(function(I) {
                        _.add(I);
                      });
                    }
                  }
                }
                if (_.size == k.length)
                  break;
              }
            }, E.prototype.positionNodesRadially = function(k) {
              for (var _ = new g(0, 0), L = Math.ceil(Math.sqrt(k.length)), N = 0, A = 0, O = 0, P = new m(0, 0), S = 0; S < k.length; S++) {
                S % L == 0 && (O = 0, A = N, S != 0 && (A += d.DEFAULT_COMPONENT_SEPERATION), N = 0);
                var R = k[S], I = v.findCenterOfTree(R);
                _.x = O, _.y = A, P = E.radialLayout(R, I, _), P.y > N && (N = Math.floor(P.y)), O = Math.floor(P.x + d.DEFAULT_COMPONENT_SEPERATION);
              }
              this.transform(new m(p.WORLD_CENTER_X - P.x / 2, p.WORLD_CENTER_Y - P.y / 2));
            }, E.radialLayout = function(k, _, L) {
              var N = Math.max(this.maxDiagonalInTree(k), d.DEFAULT_RADIAL_SEPARATION);
              E.branchRadialLayout(_, null, 0, 359, 0, N);
              var A = w.calculateBounds(k), O = new T();
              O.setDeviceOrgX(A.getMinX()), O.setDeviceOrgY(A.getMinY()), O.setWorldOrgX(L.x), O.setWorldOrgY(L.y);
              for (var P = 0; P < k.length; P++) {
                var S = k[P];
                S.transform(O);
              }
              var R = new m(A.getMaxX(), A.getMaxY());
              return O.inverseTransformPoint(R);
            }, E.branchRadialLayout = function(k, _, L, N, A, O) {
              var P = (N - L + 1) / 2;
              P < 0 && (P += 180);
              var S = (P + L) % 360, R = S * b.TWO_PI / 360, I = A * Math.cos(R), D = A * Math.sin(R);
              k.setCenter(I, D);
              var M = [];
              M = M.concat(k.getEdges());
              var B = M.length;
              _ != null && B--;
              for (var $ = 0, F = M.length, G, H = k.getEdgesBetween(_); H.length > 1; ) {
                var ee = H[0];
                H.splice(0, 1);
                var Y = M.indexOf(ee);
                Y >= 0 && M.splice(Y, 1), F--, B--;
              }
              _ != null ? G = (M.indexOf(H[0]) + 1) % F : G = 0;
              for (var re = Math.abs(N - L) / B, ne = G; $ != B; ne = ++ne % F) {
                var he = M[ne].getOtherEnd(k);
                if (he != _) {
                  var K = (L + $ * re) % 360, Z = (K + re) % 360;
                  E.branchRadialLayout(he, k, K, Z, A + O, O), $++;
                }
              }
            }, E.maxDiagonalInTree = function(k) {
              for (var _ = y.MIN_VALUE, L = 0; L < k.length; L++) {
                var N = k[L], A = N.getDiagonal();
                A > _ && (_ = A);
              }
              return _;
            }, E.prototype.calcRepulsionRange = function() {
              return 2 * (this.level + 1) * this.idealEdgeLength;
            }, E.prototype.groupZeroDegreeMembers = function() {
              var k = this, _ = {};
              this.memberGroups = {}, this.idToDummyNode = {};
              for (var L = [], N = this.graphManager.getAllNodes(), A = 0; A < N.length; A++) {
                var O = N[A], P = O.getParent();
                this.getNodeDegreeWithChildren(O) === 0 && (P.id == null || !this.getToBeTiled(P)) && L.push(O);
              }
              for (var A = 0; A < L.length; A++) {
                var O = L[A], S = O.getParent().id;
                typeof _[S] > "u" && (_[S] = []), _[S] = _[S].concat(O);
              }
              Object.keys(_).forEach(function(R) {
                if (_[R].length > 1) {
                  var I = "DummyCompound_" + R;
                  k.memberGroups[I] = _[R];
                  var D = _[R][0].getParent(), M = new u(k.graphManager);
                  M.id = I, M.paddingLeft = D.paddingLeft || 0, M.paddingRight = D.paddingRight || 0, M.paddingBottom = D.paddingBottom || 0, M.paddingTop = D.paddingTop || 0, k.idToDummyNode[I] = M;
                  var B = k.getGraphManager().add(k.newGraph(), M), $ = D.getChild();
                  $.add(M);
                  for (var F = 0; F < _[R].length; F++) {
                    var G = _[R][F];
                    $.remove(G), B.add(G);
                  }
                }
              });
            }, E.prototype.clearCompounds = function() {
              var k = {}, _ = {};
              this.performDFSOnCompounds();
              for (var L = 0; L < this.compoundOrder.length; L++)
                _[this.compoundOrder[L].id] = this.compoundOrder[L], k[this.compoundOrder[L].id] = [].concat(this.compoundOrder[L].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[L].getChild()), this.compoundOrder[L].child = null;
              this.graphManager.resetAllNodes(), this.tileCompoundMembers(k, _);
            }, E.prototype.clearZeroDegreeMembers = function() {
              var k = this, _ = this.tiledZeroDegreePack = [];
              Object.keys(this.memberGroups).forEach(function(L) {
                var N = k.idToDummyNode[L];
                _[L] = k.tileNodes(k.memberGroups[L], N.paddingLeft + N.paddingRight), N.rect.width = _[L].width, N.rect.height = _[L].height;
              });
            }, E.prototype.repopulateCompounds = function() {
              for (var k = this.compoundOrder.length - 1; k >= 0; k--) {
                var _ = this.compoundOrder[k], L = _.id, N = _.paddingLeft, A = _.paddingTop;
                this.adjustLocations(this.tiledMemberPack[L], _.rect.x, _.rect.y, N, A);
              }
            }, E.prototype.repopulateZeroDegreeMembers = function() {
              var k = this, _ = this.tiledZeroDegreePack;
              Object.keys(_).forEach(function(L) {
                var N = k.idToDummyNode[L], A = N.paddingLeft, O = N.paddingTop;
                k.adjustLocations(_[L], N.rect.x, N.rect.y, A, O);
              });
            }, E.prototype.getToBeTiled = function(k) {
              var _ = k.id;
              if (this.toBeTiled[_] != null)
                return this.toBeTiled[_];
              var L = k.getChild();
              if (L == null)
                return this.toBeTiled[_] = !1, !1;
              for (var N = L.getNodes(), A = 0; A < N.length; A++) {
                var O = N[A];
                if (this.getNodeDegree(O) > 0)
                  return this.toBeTiled[_] = !1, !1;
                if (O.getChild() == null) {
                  this.toBeTiled[O.id] = !1;
                  continue;
                }
                if (!this.getToBeTiled(O))
                  return this.toBeTiled[_] = !1, !1;
              }
              return this.toBeTiled[_] = !0, !0;
            }, E.prototype.getNodeDegree = function(k) {
              k.id;
              for (var _ = k.getEdges(), L = 0, N = 0; N < _.length; N++) {
                var A = _[N];
                A.getSource().id !== A.getTarget().id && (L = L + 1);
              }
              return L;
            }, E.prototype.getNodeDegreeWithChildren = function(k) {
              var _ = this.getNodeDegree(k);
              if (k.getChild() == null)
                return _;
              for (var L = k.getChild().getNodes(), N = 0; N < L.length; N++) {
                var A = L[N];
                _ += this.getNodeDegreeWithChildren(A);
              }
              return _;
            }, E.prototype.performDFSOnCompounds = function() {
              this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
            }, E.prototype.fillCompexOrderByDFS = function(k) {
              for (var _ = 0; _ < k.length; _++) {
                var L = k[_];
                L.getChild() != null && this.fillCompexOrderByDFS(L.getChild().getNodes()), this.getToBeTiled(L) && this.compoundOrder.push(L);
              }
            }, E.prototype.adjustLocations = function(k, _, L, N, A) {
              _ += N, L += A;
              for (var O = _, P = 0; P < k.rows.length; P++) {
                var S = k.rows[P];
                _ = O;
                for (var R = 0, I = 0; I < S.length; I++) {
                  var D = S[I];
                  D.rect.x = _, D.rect.y = L, _ += D.rect.width + k.horizontalPadding, D.rect.height > R && (R = D.rect.height);
                }
                L += R + k.verticalPadding;
              }
            }, E.prototype.tileCompoundMembers = function(k, _) {
              var L = this;
              this.tiledMemberPack = [], Object.keys(k).forEach(function(N) {
                var A = _[N];
                L.tiledMemberPack[N] = L.tileNodes(k[N], A.paddingLeft + A.paddingRight), A.rect.width = L.tiledMemberPack[N].width, A.rect.height = L.tiledMemberPack[N].height;
              });
            }, E.prototype.tileNodes = function(k, _) {
              var L = d.TILING_PADDING_VERTICAL, N = d.TILING_PADDING_HORIZONTAL, A = {
                rows: [],
                rowWidth: [],
                rowHeight: [],
                width: 0,
                height: _,
                // assume minHeight equals to minWidth
                verticalPadding: L,
                horizontalPadding: N
              };
              k.sort(function(S, R) {
                return S.rect.width * S.rect.height > R.rect.width * R.rect.height ? -1 : S.rect.width * S.rect.height < R.rect.width * R.rect.height ? 1 : 0;
              });
              for (var O = 0; O < k.length; O++) {
                var P = k[O];
                A.rows.length == 0 ? this.insertNodeToRow(A, P, 0, _) : this.canAddHorizontal(A, P.rect.width, P.rect.height) ? this.insertNodeToRow(A, P, this.getShortestRowIndex(A), _) : this.insertNodeToRow(A, P, A.rows.length, _), this.shiftToLastRow(A);
              }
              return A;
            }, E.prototype.insertNodeToRow = function(k, _, L, N) {
              var A = N;
              if (L == k.rows.length) {
                var O = [];
                k.rows.push(O), k.rowWidth.push(A), k.rowHeight.push(0);
              }
              var P = k.rowWidth[L] + _.rect.width;
              k.rows[L].length > 0 && (P += k.horizontalPadding), k.rowWidth[L] = P, k.width < P && (k.width = P);
              var S = _.rect.height;
              L > 0 && (S += k.verticalPadding);
              var R = 0;
              S > k.rowHeight[L] && (R = k.rowHeight[L], k.rowHeight[L] = S, R = k.rowHeight[L] - R), k.height += R, k.rows[L].push(_);
            }, E.prototype.getShortestRowIndex = function(k) {
              for (var _ = -1, L = Number.MAX_VALUE, N = 0; N < k.rows.length; N++)
                k.rowWidth[N] < L && (_ = N, L = k.rowWidth[N]);
              return _;
            }, E.prototype.getLongestRowIndex = function(k) {
              for (var _ = -1, L = Number.MIN_VALUE, N = 0; N < k.rows.length; N++)
                k.rowWidth[N] > L && (_ = N, L = k.rowWidth[N]);
              return _;
            }, E.prototype.canAddHorizontal = function(k, _, L) {
              var N = this.getShortestRowIndex(k);
              if (N < 0)
                return !0;
              var A = k.rowWidth[N];
              if (A + k.horizontalPadding + _ <= k.width) return !0;
              var O = 0;
              k.rowHeight[N] < L && N > 0 && (O = L + k.verticalPadding - k.rowHeight[N]);
              var P;
              k.width - A >= _ + k.horizontalPadding ? P = (k.height + O) / (A + _ + k.horizontalPadding) : P = (k.height + O) / k.width, O = L + k.verticalPadding;
              var S;
              return k.width < _ ? S = (k.height + O) / _ : S = (k.height + O) / k.width, S < 1 && (S = 1 / S), P < 1 && (P = 1 / P), P < S;
            }, E.prototype.shiftToLastRow = function(k) {
              var _ = this.getLongestRowIndex(k), L = k.rowWidth.length - 1, N = k.rows[_], A = N[N.length - 1], O = A.width + k.horizontalPadding;
              if (k.width - k.rowWidth[L] > O && _ != L) {
                N.splice(-1, 1), k.rows[L].push(A), k.rowWidth[_] = k.rowWidth[_] - O, k.rowWidth[L] = k.rowWidth[L] + O, k.width = k.rowWidth[instance.getLongestRowIndex(k)];
                for (var P = Number.MIN_VALUE, S = 0; S < N.length; S++)
                  N[S].height > P && (P = N[S].height);
                _ > 0 && (P += k.verticalPadding);
                var R = k.rowHeight[_] + k.rowHeight[L];
                k.rowHeight[_] = P, k.rowHeight[L] < A.height + k.verticalPadding && (k.rowHeight[L] = A.height + k.verticalPadding);
                var I = k.rowHeight[_] + k.rowHeight[L];
                k.height += I - R, this.shiftToLastRow(k);
              }
            }, E.prototype.tilingPreLayout = function() {
              d.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers());
            }, E.prototype.tilingPostLayout = function() {
              d.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds());
            }, E.prototype.reduceTrees = function() {
              for (var k = [], _ = !0, L; _; ) {
                var N = this.graphManager.getAllNodes(), A = [];
                _ = !1;
                for (var O = 0; O < N.length; O++)
                  L = N[O], L.getEdges().length == 1 && !L.getEdges()[0].isInterGraph && L.getChild() == null && (A.push([L, L.getEdges()[0], L.getOwner()]), _ = !0);
                if (_ == !0) {
                  for (var P = [], S = 0; S < A.length; S++)
                    A[S][0].getEdges().length == 1 && (P.push(A[S]), A[S][0].getOwner().remove(A[S][0]));
                  k.push(P), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
                }
              }
              this.prunedNodesAll = k;
            }, E.prototype.growTree = function(k) {
              for (var _ = k.length, L = k[_ - 1], N, A = 0; A < L.length; A++)
                N = L[A], this.findPlaceforPrunedNode(N), N[2].add(N[0]), N[2].add(N[1], N[1].source, N[1].target);
              k.splice(k.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
            }, E.prototype.findPlaceforPrunedNode = function(k) {
              var _, L, N = k[0];
              N == k[1].source ? L = k[1].target : L = k[1].source;
              var A = L.startX, O = L.finishX, P = L.startY, S = L.finishY, R = 0, I = 0, D = 0, M = 0, B = [R, D, I, M];
              if (P > 0)
                for (var $ = A; $ <= O; $++)
                  B[0] += this.grid[$][P - 1].length + this.grid[$][P].length - 1;
              if (O < this.grid.length - 1)
                for (var $ = P; $ <= S; $++)
                  B[1] += this.grid[O + 1][$].length + this.grid[O][$].length - 1;
              if (S < this.grid[0].length - 1)
                for (var $ = A; $ <= O; $++)
                  B[2] += this.grid[$][S + 1].length + this.grid[$][S].length - 1;
              if (A > 0)
                for (var $ = P; $ <= S; $++)
                  B[3] += this.grid[A - 1][$].length + this.grid[A][$].length - 1;
              for (var F = y.MAX_VALUE, G, H, ee = 0; ee < B.length; ee++)
                B[ee] < F ? (F = B[ee], G = 1, H = ee) : B[ee] == F && G++;
              if (G == 3 && F == 0)
                B[0] == 0 && B[1] == 0 && B[2] == 0 ? _ = 1 : B[0] == 0 && B[1] == 0 && B[3] == 0 ? _ = 0 : B[0] == 0 && B[2] == 0 && B[3] == 0 ? _ = 3 : B[1] == 0 && B[2] == 0 && B[3] == 0 && (_ = 2);
              else if (G == 2 && F == 0) {
                var Y = Math.floor(Math.random() * 2);
                B[0] == 0 && B[1] == 0 ? Y == 0 ? _ = 0 : _ = 1 : B[0] == 0 && B[2] == 0 ? Y == 0 ? _ = 0 : _ = 2 : B[0] == 0 && B[3] == 0 ? Y == 0 ? _ = 0 : _ = 3 : B[1] == 0 && B[2] == 0 ? Y == 0 ? _ = 1 : _ = 2 : B[1] == 0 && B[3] == 0 ? Y == 0 ? _ = 1 : _ = 3 : Y == 0 ? _ = 2 : _ = 3;
              } else if (G == 4 && F == 0) {
                var Y = Math.floor(Math.random() * 4);
                _ = Y;
              } else
                _ = H;
              _ == 0 ? N.setCenter(L.getCenterX(), L.getCenterY() - L.getHeight() / 2 - f.DEFAULT_EDGE_LENGTH - N.getHeight() / 2) : _ == 1 ? N.setCenter(L.getCenterX() + L.getWidth() / 2 + f.DEFAULT_EDGE_LENGTH + N.getWidth() / 2, L.getCenterY()) : _ == 2 ? N.setCenter(L.getCenterX(), L.getCenterY() + L.getHeight() / 2 + f.DEFAULT_EDGE_LENGTH + N.getHeight() / 2) : N.setCenter(L.getCenterX() - L.getWidth() / 2 - f.DEFAULT_EDGE_LENGTH - N.getWidth() / 2, L.getCenterY());
            }, n.exports = E;
          },
          /* 7 */
          /***/
          function(n, i, a) {
            var s = {};
            s.layoutBase = a(0), s.CoSEConstants = a(1), s.CoSEEdge = a(2), s.CoSEGraph = a(3), s.CoSEGraphManager = a(4), s.CoSELayout = a(6), s.CoSENode = a(5), n.exports = s;
          }
          /******/
        ])
      );
    });
  }(r5)), r5.exports;
}
(function(t, e) {
  (function(n, i) {
    t.exports = i(X4e());
  })(ro, function(r) {
    return (
      /******/
      function(n) {
        var i = {};
        function a(s) {
          if (i[s])
            return i[s].exports;
          var o = i[s] = {
            /******/
            i: s,
            /******/
            l: !1,
            /******/
            exports: {}
            /******/
          };
          return n[s].call(o.exports, o, o.exports, a), o.l = !0, o.exports;
        }
        return a.m = n, a.c = i, a.i = function(s) {
          return s;
        }, a.d = function(s, o, l) {
          a.o(s, o) || Object.defineProperty(s, o, {
            /******/
            configurable: !1,
            /******/
            enumerable: !0,
            /******/
            get: l
            /******/
          });
        }, a.n = function(s) {
          var o = s && s.__esModule ? (
            /******/
            function() {
              return s.default;
            }
          ) : (
            /******/
            function() {
              return s;
            }
          );
          return a.d(o, "a", o), o;
        }, a.o = function(s, o) {
          return Object.prototype.hasOwnProperty.call(s, o);
        }, a.p = "", a(a.s = 1);
      }([
        /* 0 */
        /***/
        function(n, i) {
          n.exports = r;
        },
        /* 1 */
        /***/
        function(n, i, a) {
          var s = a(0).layoutBase.LayoutConstants, o = a(0).layoutBase.FDLayoutConstants, l = a(0).CoSEConstants, u = a(0).CoSELayout, h = a(0).CoSENode, d = a(0).layoutBase.PointD, f = a(0).layoutBase.DimensionD, p = {
            // Called on `layoutready`
            ready: function() {
            },
            // Called on `layoutstop`
            stop: function() {
            },
            // 'draft', 'default' or 'proof" 
            // - 'draft' fast cooling rate 
            // - 'default' moderate cooling rate 
            // - "proof" slow cooling rate
            quality: "default",
            // include labels in node dimensions
            nodeDimensionsIncludeLabels: !1,
            // number of ticks per frame; higher is faster but more jerky
            refresh: 30,
            // Whether to fit the network view after when done
            fit: !0,
            // Padding on fit
            padding: 10,
            // Whether to enable incremental mode
            randomize: !0,
            // Node repulsion (non overlapping) multiplier
            nodeRepulsion: 4500,
            // Ideal edge (non nested) length
            idealEdgeLength: 50,
            // Divisor to compute edge forces
            edgeElasticity: 0.45,
            // Nesting factor (multiplier) to compute ideal edge length for nested edges
            nestingFactor: 0.1,
            // Gravity force (constant)
            gravity: 0.25,
            // Maximum number of iterations to perform
            numIter: 2500,
            // For enabling tiling
            tile: !0,
            // Type of layout animation. The option set is {'during', 'end', false}
            animate: "end",
            // Duration for animate:end
            animationDuration: 500,
            // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
            tilingPaddingVertical: 10,
            // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
            tilingPaddingHorizontal: 10,
            // Gravity range (constant) for compounds
            gravityRangeCompound: 1.5,
            // Gravity force (constant) for compounds
            gravityCompound: 1,
            // Gravity range (constant)
            gravityRange: 3.8,
            // Initial cooling factor for incremental layout
            initialEnergyOnIncremental: 0.5
          };
          function g(b, w) {
            var T = {};
            for (var E in b)
              T[E] = b[E];
            for (var E in w)
              T[E] = w[E];
            return T;
          }
          function m(b) {
            this.options = g(p, b), v(this.options);
          }
          var v = function(w) {
            w.nodeRepulsion != null && (l.DEFAULT_REPULSION_STRENGTH = o.DEFAULT_REPULSION_STRENGTH = w.nodeRepulsion), w.idealEdgeLength != null && (l.DEFAULT_EDGE_LENGTH = o.DEFAULT_EDGE_LENGTH = w.idealEdgeLength), w.edgeElasticity != null && (l.DEFAULT_SPRING_STRENGTH = o.DEFAULT_SPRING_STRENGTH = w.edgeElasticity), w.nestingFactor != null && (l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = w.nestingFactor), w.gravity != null && (l.DEFAULT_GRAVITY_STRENGTH = o.DEFAULT_GRAVITY_STRENGTH = w.gravity), w.numIter != null && (l.MAX_ITERATIONS = o.MAX_ITERATIONS = w.numIter), w.gravityRange != null && (l.DEFAULT_GRAVITY_RANGE_FACTOR = o.DEFAULT_GRAVITY_RANGE_FACTOR = w.gravityRange), w.gravityCompound != null && (l.DEFAULT_COMPOUND_GRAVITY_STRENGTH = o.DEFAULT_COMPOUND_GRAVITY_STRENGTH = w.gravityCompound), w.gravityRangeCompound != null && (l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = w.gravityRangeCompound), w.initialEnergyOnIncremental != null && (l.DEFAULT_COOLING_FACTOR_INCREMENTAL = o.DEFAULT_COOLING_FACTOR_INCREMENTAL = w.initialEnergyOnIncremental), w.quality == "draft" ? s.QUALITY = 0 : w.quality == "proof" ? s.QUALITY = 2 : s.QUALITY = 1, l.NODE_DIMENSIONS_INCLUDE_LABELS = o.NODE_DIMENSIONS_INCLUDE_LABELS = s.NODE_DIMENSIONS_INCLUDE_LABELS = w.nodeDimensionsIncludeLabels, l.DEFAULT_INCREMENTAL = o.DEFAULT_INCREMENTAL = s.DEFAULT_INCREMENTAL = !w.randomize, l.ANIMATE = o.ANIMATE = s.ANIMATE = w.animate, l.TILE = w.tile, l.TILING_PADDING_VERTICAL = typeof w.tilingPaddingVertical == "function" ? w.tilingPaddingVertical.call() : w.tilingPaddingVertical, l.TILING_PADDING_HORIZONTAL = typeof w.tilingPaddingHorizontal == "function" ? w.tilingPaddingHorizontal.call() : w.tilingPaddingHorizontal;
          };
          m.prototype.run = function() {
            var b, w, T = this.options;
            this.idToLNode = {};
            var E = this.layout = new u(), C = this;
            C.stopped = !1, this.cy = this.options.cy, this.cy.trigger({ type: "layoutstart", layout: this });
            var k = E.newGraphManager();
            this.gm = k;
            var _ = this.options.eles.nodes(), L = this.options.eles.edges();
            this.root = k.addRoot(), this.processChildrenList(this.root, this.getTopMostNodes(_), E);
            for (var N = 0; N < L.length; N++) {
              var A = L[N], O = this.idToLNode[A.data("source")], P = this.idToLNode[A.data("target")];
              if (O !== P && O.getEdgesBetween(P).length == 0) {
                var S = k.add(E.newEdge(), O, P);
                S.id = A.id();
              }
            }
            var R = function(M, B) {
              typeof M == "number" && (M = B);
              var $ = M.data("id"), F = C.idToLNode[$];
              return {
                x: F.getRect().getCenterX(),
                y: F.getRect().getCenterY()
              };
            }, I = function D() {
              for (var M = function() {
                T.fit && T.cy.fit(T.eles, T.padding), b || (b = !0, C.cy.one("layoutready", T.ready), C.cy.trigger({ type: "layoutready", layout: C }));
              }, B = C.options.refresh, $, F = 0; F < B && !$; F++)
                $ = C.stopped || C.layout.tick();
              if ($) {
                E.checkLayoutSuccess() && !E.isSubLayout && E.doPostLayout(), E.tilingPostLayout && E.tilingPostLayout(), E.isLayoutFinished = !0, C.options.eles.nodes().positions(R), M(), C.cy.one("layoutstop", C.options.stop), C.cy.trigger({ type: "layoutstop", layout: C }), w && cancelAnimationFrame(w), b = !1;
                return;
              }
              var G = C.layout.getPositionsData();
              T.eles.nodes().positions(function(H, ee) {
                if (typeof H == "number" && (H = ee), !H.isParent()) {
                  for (var Y = H.id(), re = G[Y], ne = H; re == null && (re = G[ne.data("parent")] || G["DummyCompound_" + ne.data("parent")], G[Y] = re, ne = ne.parent()[0], ne != null); )
                    ;
                  return re != null ? {
                    x: re.x,
                    y: re.y
                  } : {
                    x: H.position("x"),
                    y: H.position("y")
                  };
                }
              }), M(), w = requestAnimationFrame(D);
            };
            return E.addListener("layoutstarted", function() {
              C.options.animate === "during" && (w = requestAnimationFrame(I));
            }), E.runLayout(), this.options.animate !== "during" && (C.options.eles.nodes().not(":parent").layoutPositions(C, C.options, R), b = !1), this;
          }, m.prototype.getTopMostNodes = function(b) {
            for (var w = {}, T = 0; T < b.length; T++)
              w[b[T].id()] = !0;
            var E = b.filter(function(C, k) {
              typeof C == "number" && (C = k);
              for (var _ = C.parent()[0]; _ != null; ) {
                if (w[_.id()])
                  return !1;
                _ = _.parent()[0];
              }
              return !0;
            });
            return E;
          }, m.prototype.processChildrenList = function(b, w, T) {
            for (var E = w.length, C = 0; C < E; C++) {
              var k = w[C], _ = k.children(), L, N = k.layoutDimensions({
                nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels
              });
              if (k.outerWidth() != null && k.outerHeight() != null ? L = b.add(new h(T.graphManager, new d(k.position("x") - N.w / 2, k.position("y") - N.h / 2), new f(parseFloat(N.w), parseFloat(N.h)))) : L = b.add(new h(this.graphManager)), L.id = k.data("id"), L.paddingLeft = parseInt(k.css("padding")), L.paddingTop = parseInt(k.css("padding")), L.paddingRight = parseInt(k.css("padding")), L.paddingBottom = parseInt(k.css("padding")), this.options.nodeDimensionsIncludeLabels && k.isParent()) {
                var A = k.boundingBox({ includeLabels: !0, includeNodes: !1 }).w, O = k.boundingBox({ includeLabels: !0, includeNodes: !1 }).h, P = k.css("text-halign");
                L.labelWidth = A, L.labelHeight = O, L.labelPos = P;
              }
              if (this.idToLNode[k.data("id")] = L, isNaN(L.rect.x) && (L.rect.x = 0), isNaN(L.rect.y) && (L.rect.y = 0), _ != null && _.length > 0) {
                var S;
                S = T.getGraphManager().add(T.newGraph(), L), this.processChildrenList(S, _, T);
              }
            }
          }, m.prototype.stop = function() {
            return this.stopped = !0, this;
          };
          var y = function(w) {
            w("layout", "cose-bilkent", m);
          };
          typeof cytoscape < "u" && y(cytoscape), n.exports = y;
        }
        /******/
      ])
    );
  });
})(jG);
var j4e = jG.exports;
const K4e = /* @__PURE__ */ bf(j4e);
eo.use(K4e);
function KG(t, e) {
  t.forEach((r) => {
    const n = {
      id: r.id,
      labelText: r.label,
      height: r.height,
      width: r.width,
      padding: r.padding ?? 0
    };
    Object.keys(r).forEach((i) => {
      ["id", "label", "height", "width", "padding", "x", "y"].includes(i) || (n[i] = r[i]);
    }), e.add({
      group: "nodes",
      data: n,
      position: {
        x: r.x ?? 0,
        y: r.y ?? 0
      }
    });
  });
}
x(KG, "addNodes");
function ZG(t, e) {
  t.forEach((r) => {
    const n = {
      id: r.id,
      source: r.start,
      target: r.end
    };
    Object.keys(r).forEach((i) => {
      ["id", "start", "end"].includes(i) || (n[i] = r[i]);
    }), e.add({
      group: "edges",
      data: n
    });
  });
}
x(ZG, "addEdges");
function QG(t) {
  return new Promise((e) => {
    const r = Qe("body").append("div").attr("id", "cy").attr("style", "display:none"), n = eo({
      container: document.getElementById("cy"),
      // container to render in
      style: [
        {
          selector: "edge",
          style: {
            "curve-style": "bezier"
          }
        }
      ]
    });
    r.remove(), KG(t.nodes, n), ZG(t.edges, n), n.nodes().forEach(function(a) {
      a.layoutDimensions = () => {
        const s = a.data();
        return { w: s.width, h: s.height };
      };
    });
    const i = {
      name: "cose-bilkent",
      // @ts-ignore Types for cose-bilkent are not correct?
      quality: "proof",
      styleEnabled: !1,
      animate: !1
    };
    n.layout(i).run(), n.ready((a) => {
      ae.info("Cytoscape ready", a), e(n);
    });
  });
}
x(QG, "createCytoscapeInstance");
function JG(t) {
  return t.nodes().map((e) => {
    const r = e.data(), n = e.position(), i = {
      id: r.id,
      x: n.x,
      y: n.y
    };
    return Object.keys(r).forEach((a) => {
      a !== "id" && (i[a] = r[a]);
    }), i;
  });
}
x(JG, "extractPositionedNodes");
function eU(t) {
  return t.edges().map((e) => {
    const r = e.data(), n = e._private.rscratch, i = {
      id: r.id,
      source: r.source,
      target: r.target,
      startX: n.startX,
      startY: n.startY,
      midX: n.midX,
      midY: n.midY,
      endX: n.endX,
      endY: n.endY
    };
    return Object.keys(r).forEach((a) => {
      ["id", "source", "target"].includes(a) || (i[a] = r[a]);
    }), i;
  });
}
x(eU, "extractPositionedEdges");
async function tU(t, e) {
  ae.debug("Starting cose-bilkent layout algorithm");
  try {
    rU(t);
    const r = await QG(t), n = JG(r), i = eU(r);
    return ae.debug(`Layout completed: ${n.length} nodes, ${i.length} edges`), {
      nodes: n,
      edges: i
    };
  } catch (r) {
    throw ae.error("Error in cose-bilkent layout algorithm:", r), r;
  }
}
x(tU, "executeCoseBilkentLayout");
function rU(t) {
  if (!t)
    throw new Error("Layout data is required");
  if (!t.config)
    throw new Error("Configuration is required in layout data");
  if (!t.rootNode)
    throw new Error("Root node is required");
  if (!t.nodes || !Array.isArray(t.nodes))
    throw new Error("No nodes found in layout data");
  if (!Array.isArray(t.edges))
    throw new Error("Edges array is required in layout data");
  return !0;
}
x(rU, "validateLayoutData");
var Z4e = /* @__PURE__ */ x(async (t, e, {
  insertCluster: r,
  insertEdge: n,
  insertEdgeLabel: i,
  insertMarkers: a,
  insertNode: s,
  log: o,
  positionEdgeLabel: l
}, { algorithm: u }) => {
  const h = {}, d = {}, f = e.select("g");
  a(f, t.markers, t.type, t.diagramId);
  const p = f.insert("g").attr("class", "subgraphs"), g = f.insert("g").attr("class", "edgePaths"), m = f.insert("g").attr("class", "edgeLabels"), v = f.insert("g").attr("class", "nodes");
  o.debug("Inserting nodes into DOM for dimension calculation"), await Promise.all(
    t.nodes.map(async (w) => {
      if (w.isGroup) {
        const T = { ...w };
        d[w.id] = T, h[w.id] = T, await r(p, w);
      } else {
        const T = { ...w };
        h[w.id] = T;
        const E = await s(v, w, {
          config: t.config,
          dir: t.direction || "TB"
        }), C = E.node().getBBox();
        T.width = C.width, T.height = C.height, T.domId = E, o.debug(`Node ${w.id} dimensions: ${C.width}x${C.height}`);
      }
    })
  ), o.debug("Running cose-bilkent layout algorithm");
  const y = {
    ...t,
    nodes: t.nodes.map((w) => {
      const T = h[w.id];
      return {
        ...w,
        width: T.width,
        height: T.height
      };
    })
  }, b = await tU(y, t.config);
  o.debug("Positioning nodes based on layout results"), b.nodes.forEach((w) => {
    const T = h[w.id];
    T != null && T.domId && (T.domId.attr(
      "transform",
      `translate(${w.x}, ${w.y})`
    ), T.x = w.x, T.y = w.y, o.debug(`Positioned node ${T.id} at center (${w.x}, ${w.y})`));
  }), b.edges.forEach((w) => {
    const T = t.edges.find((E) => E.id === w.id);
    T && (T.points = [
      { x: w.startX, y: w.startY },
      { x: w.midX, y: w.midY },
      { x: w.endX, y: w.endY }
    ]);
  }), o.debug("Inserting and positioning edges"), await Promise.all(
    t.edges.map(async (w) => {
      await i(m, w);
      const T = h[w.start ?? ""], E = h[w.end ?? ""];
      if (T && E) {
        const C = b.edges.find((k) => k.id === w.id);
        if (C) {
          o.debug("APA01 positionedEdge", C);
          const k = { ...w }, _ = n(
            g,
            k,
            d,
            t.type,
            T,
            E,
            t.diagramId
          );
          l(k, _);
        } else {
          const k = {
            ...w,
            points: [
              { x: T.x || 0, y: T.y || 0 },
              { x: E.x || 0, y: E.y || 0 }
            ]
          }, _ = n(
            g,
            k,
            d,
            t.type,
            T,
            E,
            t.diagramId
          );
          l(k, _);
        }
      }
    })
  ), o.debug("Cose-bilkent rendering completed");
}, "render"), Q4e = Z4e;
const J4e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  render: Q4e
}, Symbol.toStringTag, { value: "Module" }));
var Yx = /* @__PURE__ */ x((t, e) => {
  const r = t.append("rect");
  if (r.attr("x", e.x), r.attr("y", e.y), r.attr("fill", e.fill), r.attr("stroke", e.stroke), r.attr("width", e.width), r.attr("height", e.height), e.name && r.attr("name", e.name), e.rx && r.attr("rx", e.rx), e.ry && r.attr("ry", e.ry), e.attrs !== void 0)
    for (const n in e.attrs)
      r.attr(n, e.attrs[n]);
  return e.class && r.attr("class", e.class), r;
}, "drawRect"), nU = /* @__PURE__ */ x((t, e) => {
  const r = {
    x: e.startx,
    y: e.starty,
    width: e.stopx - e.startx,
    height: e.stopy - e.starty,
    fill: e.fill,
    stroke: e.stroke,
    class: "rect"
  };
  Yx(t, r).lower();
}, "drawBackgroundRect"), e3e = /* @__PURE__ */ x((t, e) => {
  const r = e.text.replace(wf, " "), n = t.append("text");
  n.attr("x", e.x), n.attr("y", e.y), n.attr("class", "legend"), n.style("text-anchor", e.anchor), e.class && n.attr("class", e.class);
  const i = n.append("tspan");
  return i.attr("x", e.x + e.textMargin * 2), i.text(r), n;
}, "drawText"), fS = /* @__PURE__ */ x((t, e, r, n) => {
  const i = t.append("image");
  i.attr("x", e), i.attr("y", r);
  const a = rc(n);
  i.attr("xlink:href", a);
}, "drawImage"), pS = /* @__PURE__ */ x((t, e, r, n) => {
  const i = t.append("use");
  i.attr("x", e), i.attr("y", r);
  const a = rc(n);
  i.attr("xlink:href", `#${a}`);
}, "drawEmbeddedImage"), Ia = /* @__PURE__ */ x(() => ({
  x: 0,
  y: 0,
  width: 100,
  height: 100,
  fill: "#EDF2AE",
  stroke: "#666",
  anchor: "start",
  rx: 0,
  ry: 0
}), "getNoteRect"), gS = /* @__PURE__ */ x(() => ({
  x: 0,
  y: 0,
  width: 100,
  height: 100,
  "text-anchor": "start",
  style: "#666",
  textMargin: 0,
  rx: 0,
  ry: 0,
  tspan: !0
}), "getTextObj"), Yy = function() {
  var t = /* @__PURE__ */ x(function(Ue, ke, Pe, Se) {
    for (Pe = Pe || {}, Se = Ue.length; Se--; Pe[Ue[Se]] = ke) ;
    return Pe;
  }, "o"), e = [1, 24], r = [1, 25], n = [1, 26], i = [1, 27], a = [1, 28], s = [1, 63], o = [1, 64], l = [1, 65], u = [1, 66], h = [1, 67], d = [1, 68], f = [1, 69], p = [1, 29], g = [1, 30], m = [1, 31], v = [1, 32], y = [1, 33], b = [1, 34], w = [1, 35], T = [1, 36], E = [1, 37], C = [1, 38], k = [1, 39], _ = [1, 40], L = [1, 41], N = [1, 42], A = [1, 43], O = [1, 44], P = [1, 45], S = [1, 46], R = [1, 47], I = [1, 48], D = [1, 50], M = [1, 51], B = [1, 52], $ = [1, 53], F = [1, 54], G = [1, 55], H = [1, 56], ee = [1, 57], Y = [1, 58], re = [1, 59], ne = [1, 60], he = [14, 42], K = [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], X = [1, 82], q = [1, 83], J = [1, 84], j = [1, 85], pe = [12, 14, 42], te = [12, 14, 33, 42], Ae = [12, 14, 33, 42, 76, 77, 79, 80], W = [12, 33], Oe = [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], ue = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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: /* @__PURE__ */ x(function(ke, Pe, Se, _e, ze, me, Me) {
      var Q = me.length - 1;
      switch (ze) {
        case 3:
          _e.setDirection("TB");
          break;
        case 4:
          _e.setDirection("BT");
          break;
        case 5:
          _e.setDirection("RL");
          break;
        case 6:
          _e.setDirection("LR");
          break;
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
          _e.setC4Type(me[Q - 3]);
          break;
        case 19:
          _e.setTitle(me[Q].substring(6)), this.$ = me[Q].substring(6);
          break;
        case 20:
          _e.setAccDescription(me[Q].substring(15)), this.$ = me[Q].substring(15);
          break;
        case 21:
          this.$ = me[Q].trim(), _e.setTitle(this.$);
          break;
        case 22:
        case 23:
          this.$ = me[Q].trim(), _e.setAccDescription(this.$);
          break;
        case 28:
          me[Q].splice(2, 0, "ENTERPRISE"), _e.addPersonOrSystemBoundary(...me[Q]), this.$ = me[Q];
          break;
        case 29:
          me[Q].splice(2, 0, "SYSTEM"), _e.addPersonOrSystemBoundary(...me[Q]), this.$ = me[Q];
          break;
        case 30:
          _e.addPersonOrSystemBoundary(...me[Q]), this.$ = me[Q];
          break;
        case 31:
          me[Q].splice(2, 0, "CONTAINER"), _e.addContainerBoundary(...me[Q]), this.$ = me[Q];
          break;
        case 32:
          _e.addDeploymentNode("node", ...me[Q]), this.$ = me[Q];
          break;
        case 33:
          _e.addDeploymentNode("nodeL", ...me[Q]), this.$ = me[Q];
          break;
        case 34:
          _e.addDeploymentNode("nodeR", ...me[Q]), this.$ = me[Q];
          break;
        case 35:
          _e.popBoundaryParseStack();
          break;
        case 39:
          _e.addPersonOrSystem("person", ...me[Q]), this.$ = me[Q];
          break;
        case 40:
          _e.addPersonOrSystem("external_person", ...me[Q]), this.$ = me[Q];
          break;
        case 41:
          _e.addPersonOrSystem("system", ...me[Q]), this.$ = me[Q];
          break;
        case 42:
          _e.addPersonOrSystem("system_db", ...me[Q]), this.$ = me[Q];
          break;
        case 43:
          _e.addPersonOrSystem("system_queue", ...me[Q]), this.$ = me[Q];
          break;
        case 44:
          _e.addPersonOrSystem("external_system", ...me[Q]), this.$ = me[Q];
          break;
        case 45:
          _e.addPersonOrSystem("external_system_db", ...me[Q]), this.$ = me[Q];
          break;
        case 46:
          _e.addPersonOrSystem("external_system_queue", ...me[Q]), this.$ = me[Q];
          break;
        case 47:
          _e.addContainer("container", ...me[Q]), this.$ = me[Q];
          break;
        case 48:
          _e.addContainer("container_db", ...me[Q]), this.$ = me[Q];
          break;
        case 49:
          _e.addContainer("container_queue", ...me[Q]), this.$ = me[Q];
          break;
        case 50:
          _e.addContainer("external_container", ...me[Q]), this.$ = me[Q];
          break;
        case 51:
          _e.addContainer("external_container_db", ...me[Q]), this.$ = me[Q];
          break;
        case 52:
          _e.addContainer("external_container_queue", ...me[Q]), this.$ = me[Q];
          break;
        case 53:
          _e.addComponent("component", ...me[Q]), this.$ = me[Q];
          break;
        case 54:
          _e.addComponent("component_db", ...me[Q]), this.$ = me[Q];
          break;
        case 55:
          _e.addComponent("component_queue", ...me[Q]), this.$ = me[Q];
          break;
        case 56:
          _e.addComponent("external_component", ...me[Q]), this.$ = me[Q];
          break;
        case 57:
          _e.addComponent("external_component_db", ...me[Q]), this.$ = me[Q];
          break;
        case 58:
          _e.addComponent("external_component_queue", ...me[Q]), this.$ = me[Q];
          break;
        case 60:
          _e.addRel("rel", ...me[Q]), this.$ = me[Q];
          break;
        case 61:
          _e.addRel("birel", ...me[Q]), this.$ = me[Q];
          break;
        case 62:
          _e.addRel("rel_u", ...me[Q]), this.$ = me[Q];
          break;
        case 63:
          _e.addRel("rel_d", ...me[Q]), this.$ = me[Q];
          break;
        case 64:
          _e.addRel("rel_l", ...me[Q]), this.$ = me[Q];
          break;
        case 65:
          _e.addRel("rel_r", ...me[Q]), this.$ = me[Q];
          break;
        case 66:
          _e.addRel("rel_b", ...me[Q]), this.$ = me[Q];
          break;
        case 67:
          me[Q].splice(0, 1), _e.addRel("rel", ...me[Q]), this.$ = me[Q];
          break;
        case 68:
          _e.updateElStyle("update_el_style", ...me[Q]), this.$ = me[Q];
          break;
        case 69:
          _e.updateRelStyle("update_rel_style", ...me[Q]), this.$ = me[Q];
          break;
        case 70:
          _e.updateLayoutConfig("update_layout_config", ...me[Q]), this.$ = me[Q];
          break;
        case 71:
          this.$ = [me[Q]];
          break;
        case 72:
          me[Q].unshift(me[Q - 1]), this.$ = me[Q];
          break;
        case 73:
        case 75:
          this.$ = me[Q].trim();
          break;
        case 74:
          let ce = {};
          ce[me[Q - 1].trim()] = me[Q].trim(), this.$ = ce;
          break;
        case 76:
          this.$ = "";
          break;
      }
    }, "anonymous"),
    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: r, 24: n, 26: i, 28: a, 29: 49, 30: 61, 32: 62, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 43: 23, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: e, 23: r, 24: n, 26: i, 28: a, 29: 49, 30: 61, 32: 62, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 43: 23, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: e, 23: r, 24: n, 26: i, 28: a, 29: 49, 30: 61, 32: 62, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 43: 23, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: e, 23: r, 24: n, 26: i, 28: a, 29: 49, 30: 61, 32: 62, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 43: 23, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: e, 23: r, 24: n, 26: i, 28: a, 29: 49, 30: 61, 32: 62, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 43: 23, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }, { 14: [1, 74] }, t(he, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }), t(he, [2, 14]), t(K, [2, 16], { 12: [1, 76] }), t(he, [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: X, 77: q, 79: J, 80: j }, { 35: 86, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 87, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 88, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 89, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 90, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 91, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 92, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 93, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 94, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 95, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 96, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 97, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 98, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 99, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 100, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 101, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 102, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 103, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 104, 75: 81, 76: X, 77: q, 79: J, 80: j }, t(pe, [2, 59]), { 35: 105, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 106, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 107, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 108, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 109, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 110, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 111, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 112, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 113, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 114, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 115, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 43: 23, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 120, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 121, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 122, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 123, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 124, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 35: 125, 75: 81, 76: X, 77: q, 79: J, 80: j }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, t(he, [2, 15]), t(K, [2, 17], { 21: 22, 19: 130, 22: e, 23: r, 24: n, 26: i, 28: a }), t(he, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: e, 23: r, 24: n, 26: i, 28: a, 34: s, 36: o, 37: l, 38: u, 39: h, 40: d, 41: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w, 51: T, 52: E, 53: C, 54: k, 55: _, 56: L, 57: N, 58: A, 59: O, 60: P, 61: S, 62: R, 63: I, 64: D, 65: M, 66: B, 67: $, 68: F, 69: G, 70: H, 71: ee, 72: Y, 73: re, 74: ne }), t(Z, [2, 21]), t(Z, [2, 22]), t(pe, [2, 39]), t(te, [2, 71], { 75: 81, 35: 132, 76: X, 77: q, 79: J, 80: j }), t(Ae, [2, 73]), { 78: [1, 133] }, t(Ae, [2, 75]), t(Ae, [2, 76]), t(pe, [2, 40]), t(pe, [2, 41]), t(pe, [2, 42]), t(pe, [2, 43]), t(pe, [2, 44]), t(pe, [2, 45]), t(pe, [2, 46]), t(pe, [2, 47]), t(pe, [2, 48]), t(pe, [2, 49]), t(pe, [2, 50]), t(pe, [2, 51]), t(pe, [2, 52]), t(pe, [2, 53]), t(pe, [2, 54]), t(pe, [2, 55]), t(pe, [2, 56]), t(pe, [2, 57]), t(pe, [2, 58]), t(pe, [2, 60]), t(pe, [2, 61]), t(pe, [2, 62]), t(pe, [2, 63]), t(pe, [2, 64]), t(pe, [2, 65]), t(pe, [2, 66]), t(pe, [2, 67]), t(pe, [2, 68]), t(pe, [2, 69]), t(pe, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, t(W, [2, 28]), t(W, [2, 29]), t(W, [2, 30]), t(W, [2, 31]), t(W, [2, 32]), t(W, [2, 33]), t(W, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, t(K, [2, 18]), t(he, [2, 38]), t(te, [2, 72]), t(Ae, [2, 74]), t(pe, [2, 24]), t(pe, [2, 35]), t(Oe, [2, 25]), t(Oe, [2, 26], { 12: [1, 138] }), t(Oe, [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: /* @__PURE__ */ x(function(ke, Pe) {
      if (Pe.recoverable)
        this.trace(ke);
      else {
        var Se = new Error(ke);
        throw Se.hash = Pe, Se;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(ke) {
      var Pe = this, Se = [0], _e = [], ze = [null], me = [], Me = this.table, Q = "", ce = 0, z = 0, oe = 2, se = 1, ge = me.slice.call(arguments, 1), de = Object.create(this.lexer), be = { yy: {} };
      for (var Ce in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Ce) && (be.yy[Ce] = this.yy[Ce]);
      de.setInput(ke, be.yy), be.yy.lexer = de, be.yy.parser = this, typeof de.yylloc > "u" && (de.yylloc = {});
      var Te = de.yylloc;
      me.push(Te);
      var Ne = de.options && de.options.ranges;
      typeof be.yy.parseError == "function" ? this.parseError = be.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Xe(ct) {
        Se.length = Se.length - 2 * ct, ze.length = ze.length - ct, me.length = me.length - ct;
      }
      x(Xe, "popStack");
      function Ye() {
        var ct;
        return ct = _e.pop() || de.lex() || se, typeof ct != "number" && (ct instanceof Array && (_e = ct, ct = _e.pop()), ct = Pe.symbols_[ct] || ct), ct;
      }
      x(Ye, "lex");
      for (var Ke, Ze, Be, He, ht = {}, st, We, kt, qe; ; ) {
        if (Ze = Se[Se.length - 1], this.defaultActions[Ze] ? Be = this.defaultActions[Ze] : ((Ke === null || typeof Ke > "u") && (Ke = Ye()), Be = Me[Ze] && Me[Ze][Ke]), typeof Be > "u" || !Be.length || !Be[0]) {
          var rt = "";
          qe = [];
          for (st in Me[Ze])
            this.terminals_[st] && st > oe && qe.push("'" + this.terminals_[st] + "'");
          de.showPosition ? rt = "Parse error on line " + (ce + 1) + `:
` + de.showPosition() + `
Expecting ` + qe.join(", ") + ", got '" + (this.terminals_[Ke] || Ke) + "'" : rt = "Parse error on line " + (ce + 1) + ": Unexpected " + (Ke == se ? "end of input" : "'" + (this.terminals_[Ke] || Ke) + "'"), this.parseError(rt, {
            text: de.match,
            token: this.terminals_[Ke] || Ke,
            line: de.yylineno,
            loc: Te,
            expected: qe
          });
        }
        if (Be[0] instanceof Array && Be.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Ze + ", token: " + Ke);
        switch (Be[0]) {
          case 1:
            Se.push(Ke), ze.push(de.yytext), me.push(de.yylloc), Se.push(Be[1]), Ke = null, z = de.yyleng, Q = de.yytext, ce = de.yylineno, Te = de.yylloc;
            break;
          case 2:
            if (We = this.productions_[Be[1]][1], ht.$ = ze[ze.length - We], ht._$ = {
              first_line: me[me.length - (We || 1)].first_line,
              last_line: me[me.length - 1].last_line,
              first_column: me[me.length - (We || 1)].first_column,
              last_column: me[me.length - 1].last_column
            }, Ne && (ht._$.range = [
              me[me.length - (We || 1)].range[0],
              me[me.length - 1].range[1]
            ]), He = this.performAction.apply(ht, [
              Q,
              z,
              ce,
              be.yy,
              Be[1],
              ze,
              me
            ].concat(ge)), typeof He < "u")
              return He;
            We && (Se = Se.slice(0, -1 * We * 2), ze = ze.slice(0, -1 * We), me = me.slice(0, -1 * We)), Se.push(this.productions_[Be[1]][0]), ze.push(ht.$), me.push(ht._$), kt = Me[Se[Se.length - 2]][Se[Se.length - 1]], Se.push(kt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, Ve = /* @__PURE__ */ function() {
    var Ue = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(Pe, Se) {
        if (this.yy.parser)
          this.yy.parser.parseError(Pe, Se);
        else
          throw new Error(Pe);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(ke, Pe) {
        return this.yy = Pe || this.yy || {}, this._input = ke, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var ke = this._input[0];
        this.yytext += ke, this.yyleng++, this.offset++, this.match += ke, this.matched += ke;
        var Pe = ke.match(/(?:\r\n?|\n).*/g);
        return Pe ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), ke;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(ke) {
        var Pe = ke.length, Se = ke.split(/(?:\r\n?|\n)/g);
        this._input = ke + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - Pe), this.offset -= Pe;
        var _e = 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), Se.length - 1 && (this.yylineno -= Se.length - 1);
        var ze = 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: Se ? (Se.length === _e.length ? this.yylloc.first_column : 0) + _e[_e.length - Se.length].length - Se[0].length : this.yylloc.first_column - Pe
        }, this.options.ranges && (this.yylloc.range = [ze[0], ze[0] + this.yyleng - Pe]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(ke) {
        this.unput(this.match.slice(ke));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var ke = this.matched.substr(0, this.matched.length - this.match.length);
        return (ke.length > 20 ? "..." : "") + ke.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var ke = this.match;
        return ke.length < 20 && (ke += this._input.substr(0, 20 - ke.length)), (ke.substr(0, 20) + (ke.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var ke = this.pastInput(), Pe = new Array(ke.length + 1).join("-");
        return ke + this.upcomingInput() + `
` + Pe + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(ke, Pe) {
        var Se, _e, ze;
        if (this.options.backtrack_lexer && (ze = {
          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 && (ze.yylloc.range = this.yylloc.range.slice(0))), _e = ke[0].match(/(?:\r\n?|\n).*/g), _e && (this.yylineno += _e.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: _e ? _e[_e.length - 1].length - _e[_e.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + ke[0].length
        }, this.yytext += ke[0], this.match += ke[0], this.matches = ke, 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(ke[0].length), this.matched += ke[0], Se = this.performAction.call(this, this.yy, this, Pe, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), Se)
          return Se;
        if (this._backtrack) {
          for (var me in ze)
            this[me] = ze[me];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var ke, Pe, Se, _e;
        this._more || (this.yytext = "", this.match = "");
        for (var ze = this._currentRules(), me = 0; me < ze.length; me++)
          if (Se = this._input.match(this.rules[ze[me]]), Se && (!Pe || Se[0].length > Pe[0].length)) {
            if (Pe = Se, _e = me, this.options.backtrack_lexer) {
              if (ke = this.test_match(Se, ze[me]), ke !== !1)
                return ke;
              if (this._backtrack) {
                Pe = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return Pe ? (ke = this.test_match(Pe, ze[_e]), ke !== !1 ? ke : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var Pe = this.next();
        return Pe || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(Pe) {
        this.conditionStack.push(Pe);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var Pe = this.conditionStack.length - 1;
        return Pe > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(Pe) {
        return Pe = this.conditionStack.length - 1 - Math.abs(Pe || 0), Pe >= 0 ? this.conditionStack[Pe] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(Pe) {
        this.begin(Pe);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: {},
      performAction: /* @__PURE__ */ x(function(Pe, Se, _e, ze) {
        switch (_e) {
          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;
        }
      }, "anonymous"),
      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 Ue;
  }();
  ue.lexer = Ve;
  function Ge() {
    this.yy = {};
  }
  return x(Ge, "Parser"), Ge.prototype = ue, ue.Parser = Ge, new Ge();
}();
Yy.parser = Yy;
var t3e = Yy, Ss = [], Ml = [""], Ui = "global", bs = "", to = [
  {
    alias: "global",
    label: { text: "global" },
    type: { text: "global" },
    tags: null,
    link: null,
    parentBoundary: ""
  }
], pg = [], mS = "", vS = !1, Xy = 4, jy = 2, iU, r3e = /* @__PURE__ */ x(function() {
  return iU;
}, "getC4Type"), n3e = /* @__PURE__ */ x(function(t) {
  iU = fr(t, we());
}, "setC4Type"), i3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o, l) {
  if (t == null || e === void 0 || e === null || r === void 0 || r === null || n === void 0 || n === null)
    return;
  let u = {};
  const h = pg.find((d) => d.from === e && d.to === r);
  if (h ? u = h : pg.push(u), u.type = t, u.from = e, u.to = r, u.label = { text: n }, i == null)
    u.techn = { text: "" };
  else if (typeof i == "object") {
    let [d, f] = Object.entries(i)[0];
    u[d] = { text: f };
  } else
    u.techn = { text: i };
  if (a == null)
    u.descr = { text: "" };
  else if (typeof a == "object") {
    let [d, f] = Object.entries(a)[0];
    u[d] = { text: f };
  } else
    u.descr = { text: a };
  if (typeof s == "object") {
    let [d, f] = Object.entries(s)[0];
    u[d] = f;
  } else
    u.sprite = s;
  if (typeof o == "object") {
    let [d, f] = Object.entries(o)[0];
    u[d] = f;
  } else
    u.tags = o;
  if (typeof l == "object") {
    let [d, f] = Object.entries(l)[0];
    u[d] = f;
  } else
    u.link = l;
  u.wrap = hc();
}, "addRel"), a3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s) {
  if (e === null || r === null)
    return;
  let o = {};
  const l = Ss.find((u) => u.alias === e);
  if (l && e === l.alias ? o = l : (o.alias = e, Ss.push(o)), r == null ? o.label = { text: "" } : o.label = { text: r }, n == null)
    o.descr = { text: "" };
  else if (typeof n == "object") {
    let [u, h] = Object.entries(n)[0];
    o[u] = { text: h };
  } else
    o.descr = { text: n };
  if (typeof i == "object") {
    let [u, h] = Object.entries(i)[0];
    o[u] = h;
  } else
    o.sprite = i;
  if (typeof a == "object") {
    let [u, h] = Object.entries(a)[0];
    o[u] = h;
  } else
    o.tags = a;
  if (typeof s == "object") {
    let [u, h] = Object.entries(s)[0];
    o[u] = h;
  } else
    o.link = s;
  o.typeC4Shape = { text: t }, o.parentBoundary = Ui, o.wrap = hc();
}, "addPersonOrSystem"), s3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o) {
  if (e === null || r === null)
    return;
  let l = {};
  const u = Ss.find((h) => h.alias === e);
  if (u && e === u.alias ? l = u : (l.alias = e, Ss.push(l)), r == null ? l.label = { text: "" } : l.label = { text: r }, n == null)
    l.techn = { text: "" };
  else if (typeof n == "object") {
    let [h, d] = Object.entries(n)[0];
    l[h] = { text: d };
  } else
    l.techn = { text: n };
  if (i == null)
    l.descr = { text: "" };
  else if (typeof i == "object") {
    let [h, d] = Object.entries(i)[0];
    l[h] = { text: d };
  } else
    l.descr = { text: i };
  if (typeof a == "object") {
    let [h, d] = Object.entries(a)[0];
    l[h] = d;
  } else
    l.sprite = a;
  if (typeof s == "object") {
    let [h, d] = Object.entries(s)[0];
    l[h] = d;
  } else
    l.tags = s;
  if (typeof o == "object") {
    let [h, d] = Object.entries(o)[0];
    l[h] = d;
  } else
    l.link = o;
  l.wrap = hc(), l.typeC4Shape = { text: t }, l.parentBoundary = Ui;
}, "addContainer"), o3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o) {
  if (e === null || r === null)
    return;
  let l = {};
  const u = Ss.find((h) => h.alias === e);
  if (u && e === u.alias ? l = u : (l.alias = e, Ss.push(l)), r == null ? l.label = { text: "" } : l.label = { text: r }, n == null)
    l.techn = { text: "" };
  else if (typeof n == "object") {
    let [h, d] = Object.entries(n)[0];
    l[h] = { text: d };
  } else
    l.techn = { text: n };
  if (i == null)
    l.descr = { text: "" };
  else if (typeof i == "object") {
    let [h, d] = Object.entries(i)[0];
    l[h] = { text: d };
  } else
    l.descr = { text: i };
  if (typeof a == "object") {
    let [h, d] = Object.entries(a)[0];
    l[h] = d;
  } else
    l.sprite = a;
  if (typeof s == "object") {
    let [h, d] = Object.entries(s)[0];
    l[h] = d;
  } else
    l.tags = s;
  if (typeof o == "object") {
    let [h, d] = Object.entries(o)[0];
    l[h] = d;
  } else
    l.link = o;
  l.wrap = hc(), l.typeC4Shape = { text: t }, l.parentBoundary = Ui;
}, "addComponent"), l3e = /* @__PURE__ */ x(function(t, e, r, n, i) {
  if (t === null || e === null)
    return;
  let a = {};
  const s = to.find((o) => o.alias === t);
  if (s && t === s.alias ? a = s : (a.alias = t, to.push(a)), e == null ? a.label = { text: "" } : a.label = { text: e }, r == null)
    a.type = { text: "system" };
  else if (typeof r == "object") {
    let [o, l] = Object.entries(r)[0];
    a[o] = { text: l };
  } else
    a.type = { text: r };
  if (typeof n == "object") {
    let [o, l] = Object.entries(n)[0];
    a[o] = l;
  } else
    a.tags = n;
  if (typeof i == "object") {
    let [o, l] = Object.entries(i)[0];
    a[o] = l;
  } else
    a.link = i;
  a.parentBoundary = Ui, a.wrap = hc(), bs = Ui, Ui = t, Ml.push(bs);
}, "addPersonOrSystemBoundary"), c3e = /* @__PURE__ */ x(function(t, e, r, n, i) {
  if (t === null || e === null)
    return;
  let a = {};
  const s = to.find((o) => o.alias === t);
  if (s && t === s.alias ? a = s : (a.alias = t, to.push(a)), e == null ? a.label = { text: "" } : a.label = { text: e }, r == null)
    a.type = { text: "container" };
  else if (typeof r == "object") {
    let [o, l] = Object.entries(r)[0];
    a[o] = { text: l };
  } else
    a.type = { text: r };
  if (typeof n == "object") {
    let [o, l] = Object.entries(n)[0];
    a[o] = l;
  } else
    a.tags = n;
  if (typeof i == "object") {
    let [o, l] = Object.entries(i)[0];
    a[o] = l;
  } else
    a.link = i;
  a.parentBoundary = Ui, a.wrap = hc(), bs = Ui, Ui = t, Ml.push(bs);
}, "addContainerBoundary"), u3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o) {
  if (e === null || r === null)
    return;
  let l = {};
  const u = to.find((h) => h.alias === e);
  if (u && e === u.alias ? l = u : (l.alias = e, to.push(l)), r == null ? l.label = { text: "" } : l.label = { text: r }, n == null)
    l.type = { text: "node" };
  else if (typeof n == "object") {
    let [h, d] = Object.entries(n)[0];
    l[h] = { text: d };
  } else
    l.type = { text: n };
  if (i == null)
    l.descr = { text: "" };
  else if (typeof i == "object") {
    let [h, d] = Object.entries(i)[0];
    l[h] = { text: d };
  } else
    l.descr = { text: i };
  if (typeof s == "object") {
    let [h, d] = Object.entries(s)[0];
    l[h] = d;
  } else
    l.tags = s;
  if (typeof o == "object") {
    let [h, d] = Object.entries(o)[0];
    l[h] = d;
  } else
    l.link = o;
  l.nodeType = t, l.parentBoundary = Ui, l.wrap = hc(), bs = Ui, Ui = e, Ml.push(bs);
}, "addDeploymentNode"), h3e = /* @__PURE__ */ x(function() {
  Ui = bs, Ml.pop(), bs = Ml.pop(), Ml.push(bs);
}, "popBoundaryParseStack"), d3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o, l, u, h) {
  let d = Ss.find((f) => f.alias === e);
  if (!(d === void 0 && (d = to.find((f) => f.alias === e), d === void 0))) {
    if (r != null)
      if (typeof r == "object") {
        let [f, p] = Object.entries(r)[0];
        d[f] = p;
      } else
        d.bgColor = r;
    if (n != null)
      if (typeof n == "object") {
        let [f, p] = Object.entries(n)[0];
        d[f] = p;
      } else
        d.fontColor = n;
    if (i != null)
      if (typeof i == "object") {
        let [f, p] = Object.entries(i)[0];
        d[f] = p;
      } else
        d.borderColor = i;
    if (a != null)
      if (typeof a == "object") {
        let [f, p] = Object.entries(a)[0];
        d[f] = p;
      } else
        d.shadowing = a;
    if (s != null)
      if (typeof s == "object") {
        let [f, p] = Object.entries(s)[0];
        d[f] = p;
      } else
        d.shape = s;
    if (o != null)
      if (typeof o == "object") {
        let [f, p] = Object.entries(o)[0];
        d[f] = p;
      } else
        d.sprite = o;
    if (l != null)
      if (typeof l == "object") {
        let [f, p] = Object.entries(l)[0];
        d[f] = p;
      } else
        d.techn = l;
    if (u != null)
      if (typeof u == "object") {
        let [f, p] = Object.entries(u)[0];
        d[f] = p;
      } else
        d.legendText = u;
    if (h != null)
      if (typeof h == "object") {
        let [f, p] = Object.entries(h)[0];
        d[f] = p;
      } else
        d.legendSprite = h;
  }
}, "updateElStyle"), f3e = /* @__PURE__ */ x(function(t, e, r, n, i, a, s) {
  const o = pg.find((l) => l.from === e && l.to === r);
  if (o !== void 0) {
    if (n != null)
      if (typeof n == "object") {
        let [l, u] = Object.entries(n)[0];
        o[l] = u;
      } else
        o.textColor = n;
    if (i != null)
      if (typeof i == "object") {
        let [l, u] = Object.entries(i)[0];
        o[l] = u;
      } else
        o.lineColor = i;
    if (a != null)
      if (typeof a == "object") {
        let [l, u] = Object.entries(a)[0];
        o[l] = parseInt(u);
      } else
        o.offsetX = parseInt(a);
    if (s != null)
      if (typeof s == "object") {
        let [l, u] = Object.entries(s)[0];
        o[l] = parseInt(u);
      } else
        o.offsetY = parseInt(s);
  }
}, "updateRelStyle"), p3e = /* @__PURE__ */ x(function(t, e, r) {
  let n = Xy, i = jy;
  if (typeof e == "object") {
    const a = Object.values(e)[0];
    n = parseInt(a);
  } else
    n = parseInt(e);
  if (typeof r == "object") {
    const a = Object.values(r)[0];
    i = parseInt(a);
  } else
    i = parseInt(r);
  n >= 1 && (Xy = n), i >= 1 && (jy = i);
}, "updateLayoutConfig"), g3e = /* @__PURE__ */ x(function() {
  return Xy;
}, "getC4ShapeInRow"), m3e = /* @__PURE__ */ x(function() {
  return jy;
}, "getC4BoundaryInRow"), v3e = /* @__PURE__ */ x(function() {
  return Ui;
}, "getCurrentBoundaryParse"), y3e = /* @__PURE__ */ x(function() {
  return bs;
}, "getParentBoundaryParse"), aU = /* @__PURE__ */ x(function(t) {
  return t == null ? Ss : Ss.filter((e) => e.parentBoundary === t);
}, "getC4ShapeArray"), x3e = /* @__PURE__ */ x(function(t) {
  return Ss.find((e) => e.alias === t);
}, "getC4Shape"), b3e = /* @__PURE__ */ x(function(t) {
  return Object.keys(aU(t));
}, "getC4ShapeKeys"), sU = /* @__PURE__ */ x(function(t) {
  return t == null ? to : to.filter((e) => e.parentBoundary === t);
}, "getBoundaries"), w3e = sU, T3e = /* @__PURE__ */ x(function() {
  return pg;
}, "getRels"), E3e = /* @__PURE__ */ x(function() {
  return mS;
}, "getTitle"), k3e = /* @__PURE__ */ x(function(t) {
  vS = t;
}, "setWrap"), hc = /* @__PURE__ */ x(function() {
  return vS;
}, "autoWrap"), S3e = /* @__PURE__ */ x(function() {
  Ss = [], to = [
    {
      alias: "global",
      label: { text: "global" },
      type: { text: "global" },
      tags: null,
      link: null,
      parentBoundary: ""
    }
  ], bs = "", Ui = "global", Ml = [""], pg = [], Ml = [""], mS = "", vS = !1, Xy = 4, jy = 2;
}, "clear"), C3e = {
  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
}, A3e = {
  FILLED: 0,
  OPEN: 1
}, _3e = {
  LEFTOF: 0,
  RIGHTOF: 1,
  OVER: 2
}, L3e = /* @__PURE__ */ x(function(t) {
  mS = fr(t, we());
}, "setTitle"), CT = {
  addPersonOrSystem: a3e,
  addPersonOrSystemBoundary: l3e,
  addContainer: s3e,
  addContainerBoundary: c3e,
  addComponent: o3e,
  addDeploymentNode: u3e,
  popBoundaryParseStack: h3e,
  addRel: i3e,
  updateElStyle: d3e,
  updateRelStyle: f3e,
  updateLayoutConfig: p3e,
  autoWrap: hc,
  setWrap: k3e,
  getC4ShapeArray: aU,
  getC4Shape: x3e,
  getC4ShapeKeys: b3e,
  getBoundaries: sU,
  getBoundarys: w3e,
  getCurrentBoundaryParse: v3e,
  getParentBoundaryParse: y3e,
  getRels: T3e,
  getTitle: E3e,
  getC4Type: r3e,
  getC4ShapeInRow: g3e,
  getC4BoundaryInRow: m3e,
  setAccTitle: Cn,
  getAccTitle: Vn,
  getAccDescription: Un,
  setAccDescription: Gn,
  getConfig: /* @__PURE__ */ x(() => we().c4, "getConfig"),
  clear: S3e,
  LINETYPE: C3e,
  ARROWTYPE: A3e,
  PLACEMENT: _3e,
  setTitle: L3e,
  setC4Type: n3e
  // apply,
}, yS = /* @__PURE__ */ x(function(t, e) {
  return Yx(t, e);
}, "drawRect"), oU = /* @__PURE__ */ x(function(t, e, r, n, i, a) {
  const s = t.append("image");
  s.attr("width", e), s.attr("height", r), s.attr("x", n), s.attr("y", i);
  let o = a.startsWith("data:image/png;base64") ? a : rc(a);
  s.attr("xlink:href", o);
}, "drawImage"), R3e = /* @__PURE__ */ x((t, e, r) => {
  const n = t.append("g");
  let i = 0;
  for (let a of e) {
    let s = a.textColor ? a.textColor : "#444444", o = a.lineColor ? a.lineColor : "#444444", l = a.offsetX ? parseInt(a.offsetX) : 0, u = a.offsetY ? parseInt(a.offsetY) : 0, h = "";
    if (i === 0) {
      let f = n.append("line");
      f.attr("x1", a.startPoint.x), f.attr("y1", a.startPoint.y), f.attr("x2", a.endPoint.x), f.attr("y2", a.endPoint.y), f.attr("stroke-width", "1"), f.attr("stroke", o), f.style("fill", "none"), a.type !== "rel_b" && f.attr("marker-end", "url(" + h + "#arrowhead)"), (a.type === "birel" || a.type === "rel_b") && f.attr("marker-start", "url(" + h + "#arrowend)"), i = -1;
    } else {
      let f = n.append("path");
      f.attr("fill", "none").attr("stroke-width", "1").attr("stroke", o).attr(
        "d",
        "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", a.startPoint.x).replaceAll("starty", a.startPoint.y).replaceAll(
          "controlx",
          a.startPoint.x + (a.endPoint.x - a.startPoint.x) / 2 - (a.endPoint.x - a.startPoint.x) / 4
        ).replaceAll("controly", a.startPoint.y + (a.endPoint.y - a.startPoint.y) / 2).replaceAll("stopx", a.endPoint.x).replaceAll("stopy", a.endPoint.y)
      ), a.type !== "rel_b" && f.attr("marker-end", "url(" + h + "#arrowhead)"), (a.type === "birel" || a.type === "rel_b") && f.attr("marker-start", "url(" + h + "#arrowend)");
    }
    let d = r.messageFont();
    Oo(r)(
      a.label.text,
      n,
      Math.min(a.startPoint.x, a.endPoint.x) + Math.abs(a.endPoint.x - a.startPoint.x) / 2 + l,
      Math.min(a.startPoint.y, a.endPoint.y) + Math.abs(a.endPoint.y - a.startPoint.y) / 2 + u,
      a.label.width,
      a.label.height,
      { fill: s },
      d
    ), a.techn && a.techn.text !== "" && (d = r.messageFont(), Oo(r)(
      "[" + a.techn.text + "]",
      n,
      Math.min(a.startPoint.x, a.endPoint.x) + Math.abs(a.endPoint.x - a.startPoint.x) / 2 + l,
      Math.min(a.startPoint.y, a.endPoint.y) + Math.abs(a.endPoint.y - a.startPoint.y) / 2 + r.messageFontSize + 5 + u,
      Math.max(a.label.width, a.techn.width),
      a.techn.height,
      { fill: s, "font-style": "italic" },
      d
    ));
  }
}, "drawRels"), N3e = /* @__PURE__ */ x(function(t, e, r) {
  const n = t.append("g");
  let i = e.bgColor ? e.bgColor : "none", a = e.borderColor ? e.borderColor : "#444444", s = 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: i,
    stroke: a,
    width: e.width,
    height: e.height,
    rx: 2.5,
    ry: 2.5,
    attrs: o
  };
  yS(n, l);
  let u = r.boundaryFont();
  u.fontWeight = "bold", u.fontSize = u.fontSize + 2, u.fontColor = s, Oo(r)(
    e.label.text,
    n,
    e.x,
    e.y + e.label.Y,
    e.width,
    e.height,
    { fill: "#444444" },
    u
  ), e.type && e.type.text !== "" && (u = r.boundaryFont(), u.fontColor = s, Oo(r)(
    e.type.text,
    n,
    e.x,
    e.y + e.type.Y,
    e.width,
    e.height,
    { fill: "#444444" },
    u
  )), e.descr && e.descr.text !== "" && (u = r.boundaryFont(), u.fontSize = u.fontSize - 2, u.fontColor = s, Oo(r)(
    e.descr.text,
    n,
    e.x,
    e.y + e.descr.Y,
    e.width,
    e.height,
    { fill: "#444444" },
    u
  ));
}, "drawBoundary"), M3e = /* @__PURE__ */ x(function(t, e, r) {
  var d;
  let n = e.bgColor ? e.bgColor : r[e.typeC4Shape.text + "_bg_color"], i = e.borderColor ? e.borderColor : r[e.typeC4Shape.text + "_border_color"], a = e.fontColor ? e.fontColor : "#FFFFFF", s = "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":
      s = "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":
      s = "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 o = t.append("g");
  o.attr("class", "person-man");
  const l = Ia();
  switch (e.typeC4Shape.text) {
    case "person":
    case "external_person":
    case "system":
    case "external_system":
    case "container":
    case "external_container":
    case "component":
    case "external_component":
      l.x = e.x, l.y = e.y, l.fill = n, l.width = e.width, l.height = e.height, l.stroke = i, l.rx = 2.5, l.ry = 2.5, l.attrs = { "stroke-width": 0.5 }, yS(o, l);
      break;
    case "system_db":
    case "external_system_db":
    case "container_db":
    case "external_container_db":
    case "component_db":
    case "external_component_db":
      o.append("path").attr("fill", n).attr("stroke-width", "0.5").attr("stroke", i).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)
      ), o.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", i).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":
      o.append("path").attr("fill", n).attr("stroke-width", "0.5").attr("stroke", i).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)
      ), o.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", i).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 u = V3e(r, e.typeC4Shape.text);
  switch (o.append("text").attr("fill", a).attr("font-family", u.fontFamily).attr("font-size", u.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":
      oU(
        o,
        48,
        48,
        e.x + e.width / 2 - 24,
        e.y + e.image.Y,
        s
      );
      break;
  }
  let h = r[e.typeC4Shape.text + "Font"]();
  return h.fontWeight = "bold", h.fontSize = h.fontSize + 2, h.fontColor = a, Oo(r)(
    e.label.text,
    o,
    e.x,
    e.y + e.label.Y,
    e.width,
    e.height,
    { fill: a },
    h
  ), h = r[e.typeC4Shape.text + "Font"](), h.fontColor = a, e.techn && ((d = e.techn) == null ? void 0 : d.text) !== "" ? Oo(r)(
    e.techn.text,
    o,
    e.x,
    e.y + e.techn.Y,
    e.width,
    e.height,
    { fill: a, "font-style": "italic" },
    h
  ) : e.type && e.type.text !== "" && Oo(r)(
    e.type.text,
    o,
    e.x,
    e.y + e.type.Y,
    e.width,
    e.height,
    { fill: a, "font-style": "italic" },
    h
  ), e.descr && e.descr.text !== "" && (h = r.personFont(), h.fontColor = a, Oo(r)(
    e.descr.text,
    o,
    e.x,
    e.y + e.descr.Y,
    e.width,
    e.height,
    { fill: a },
    h
  )), e.height;
}, "drawC4Shape"), D3e = /* @__PURE__ */ x(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"
  );
}, "insertDatabaseIcon"), I3e = /* @__PURE__ */ x(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"
  );
}, "insertComputerIcon"), O3e = /* @__PURE__ */ x(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"
  );
}, "insertClockIcon"), P3e = /* @__PURE__ */ x(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");
}, "insertArrowHead"), B3e = /* @__PURE__ */ x(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");
}, "insertArrowEnd"), F3e = /* @__PURE__ */ x(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");
}, "insertArrowFilledHead"), $3e = /* @__PURE__ */ x(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);
}, "insertDynamicNumber"), z3e = /* @__PURE__ */ x(function(t) {
  const r = t.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4);
  r.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"), r.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");
}, "insertArrowCrossHead"), V3e = /* @__PURE__ */ x((t, e) => ({
  fontFamily: t[e + "FontFamily"],
  fontSize: t[e + "FontSize"],
  fontWeight: t[e + "FontWeight"]
}), "getC4ShapeFont"), Oo = /* @__PURE__ */ function() {
  function t(i, a, s, o, l, u, h) {
    const d = a.append("text").attr("x", s + l / 2).attr("y", o + u / 2 + 5).style("text-anchor", "middle").text(i);
    n(d, h);
  }
  x(t, "byText");
  function e(i, a, s, o, l, u, h, d) {
    const { fontSize: f, fontFamily: p, fontWeight: g } = d, m = i.split(at.lineBreakRegex);
    for (let v = 0; v < m.length; v++) {
      const y = v * f - f * (m.length - 1) / 2, b = a.append("text").attr("x", s + l / 2).attr("y", o).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", f).style("font-weight", g).style("font-family", p);
      b.append("tspan").attr("dy", y).text(m[v]).attr("alignment-baseline", "mathematical"), n(b, h);
    }
  }
  x(e, "byTspan");
  function r(i, a, s, o, l, u, h, d) {
    const f = a.append("switch"), g = f.append("foreignObject").attr("x", s).attr("y", o).attr("width", l).attr("height", u).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    g.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, f, s, o, l, u, h, d), n(g, h);
  }
  x(r, "byFo");
  function n(i, a) {
    for (const s in a)
      a.hasOwnProperty(s) && i.attr(s, a[s]);
  }
  return x(n, "_setTextAttrs"), function(i) {
    return i.textPlacement === "fo" ? r : i.textPlacement === "old" ? t : e;
  };
}(), $s = {
  drawRect: yS,
  drawBoundary: N3e,
  drawC4Shape: M3e,
  drawRels: R3e,
  drawImage: oU,
  insertArrowHead: P3e,
  insertArrowEnd: B3e,
  insertArrowFilledHead: F3e,
  insertDynamicNumber: $3e,
  insertArrowCrossHead: z3e,
  insertDatabaseIcon: D3e,
  insertComputerIcon: I3e,
  insertClockIcon: O3e
}, Ky = 0, Zy = 0, lU = 4, AT = 2;
Yy.yy = CT;
var Dt = {}, Zh, cU = (Zh = class {
  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, _T(e.db.getConfig());
  }
  setData(e, r, n, i) {
    this.nextData.startx = this.data.startx = e, this.nextData.stopx = this.data.stopx = r, this.nextData.starty = this.data.starty = n, this.nextData.stopy = this.data.stopy = i;
  }
  updateVal(e, r, n, i) {
    e[r] === void 0 ? e[r] = n : e[r] = i(n, e[r]);
  }
  insert(e) {
    this.nextData.cnt = this.nextData.cnt + 1;
    let r = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + e.margin : this.nextData.stopx + e.margin * 2, n = r + e.width, i = this.nextData.starty + e.margin * 2, a = i + e.height;
    (r >= this.data.widthLimit || n >= this.data.widthLimit || this.nextData.cnt > lU) && (r = this.nextData.startx + e.margin + Dt.nextLinePaddingX, i = this.nextData.stopy + e.margin * 2, this.nextData.stopx = n = r + e.width, this.nextData.starty = this.nextData.stopy, this.nextData.stopy = a = i + e.height, this.nextData.cnt = 1), e.x = r, e.y = i, this.updateVal(this.data, "startx", r, Math.min), this.updateVal(this.data, "starty", i, Math.min), this.updateVal(this.data, "stopx", n, Math.max), this.updateVal(this.data, "stopy", a, Math.max), this.updateVal(this.nextData, "startx", r, Math.min), this.updateVal(this.nextData, "starty", i, Math.min), this.updateVal(this.nextData, "stopx", n, Math.max), this.updateVal(this.nextData, "stopy", a, 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
    }, _T(e.db.getConfig());
  }
  bumpLastMargin(e) {
    this.data.stopx += e, this.data.stopy += e;
  }
}, x(Zh, "Bounds"), Zh), _T = /* @__PURE__ */ x(function(t) {
  mn(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);
}, "setConf"), d0 = /* @__PURE__ */ x((t, e) => ({
  fontFamily: t[e + "FontFamily"],
  fontSize: t[e + "FontSize"],
  fontWeight: t[e + "FontWeight"]
}), "c4ShapeFont"), dv = /* @__PURE__ */ x((t) => ({
  fontFamily: t.boundaryFontFamily,
  fontSize: t.boundaryFontSize,
  fontWeight: t.boundaryFontWeight
}), "boundaryFont"), G3e = /* @__PURE__ */ x((t) => ({
  fontFamily: t.messageFontFamily,
  fontSize: t.messageFontSize,
  fontWeight: t.messageFontWeight
}), "messageFont");
function Ka(t, e, r, n, i) {
  if (!e[t].width)
    if (r)
      e[t].text = aP(e[t].text, i, n), e[t].textLines = e[t].text.split(at.lineBreakRegex).length, e[t].width = i, e[t].height = py(e[t].text, n);
    else {
      let a = e[t].text.split(at.lineBreakRegex);
      e[t].textLines = a.length;
      let s = 0;
      e[t].height = 0, e[t].width = 0;
      for (const o of a)
        e[t].width = Math.max(
          Gi(o, n),
          e[t].width
        ), s = py(o, n), e[t].height = e[t].height + s;
    }
}
x(Ka, "calcC4ShapeTextWH");
var uU = /* @__PURE__ */ x(function(t, e, r) {
  e.x = r.data.startx, e.y = r.data.starty, e.width = r.data.stopx - r.data.startx, e.height = r.data.stopy - r.data.starty, e.label.y = Dt.c4ShapeMargin - 35;
  let n = e.wrap && Dt.wrap, i = dv(Dt);
  i.fontSize = i.fontSize + 2, i.fontWeight = "bold";
  let a = Gi(e.label.text, i);
  Ka("label", e, n, i, a), $s.drawBoundary(t, e, Dt);
}, "drawBoundary"), hU = /* @__PURE__ */ x(function(t, e, r, n) {
  let i = 0;
  for (const a of n) {
    i = 0;
    const s = r[a];
    let o = d0(Dt, s.typeC4Shape.text);
    switch (o.fontSize = o.fontSize - 2, s.typeC4Shape.width = Gi(
      "«" + s.typeC4Shape.text + "»",
      o
    ), s.typeC4Shape.height = o.fontSize + 2, s.typeC4Shape.Y = Dt.c4ShapePadding, i = s.typeC4Shape.Y + s.typeC4Shape.height - 4, s.image = { width: 0, height: 0, Y: 0 }, s.typeC4Shape.text) {
      case "person":
      case "external_person":
        s.image.width = 48, s.image.height = 48, s.image.Y = i, i = s.image.Y + s.image.height;
        break;
    }
    s.sprite && (s.image.width = 48, s.image.height = 48, s.image.Y = i, i = s.image.Y + s.image.height);
    let l = s.wrap && Dt.wrap, u = Dt.width - Dt.c4ShapePadding * 2, h = d0(Dt, s.typeC4Shape.text);
    if (h.fontSize = h.fontSize + 2, h.fontWeight = "bold", Ka("label", s, l, h, u), s.label.Y = i + 8, i = s.label.Y + s.label.height, s.type && s.type.text !== "") {
      s.type.text = "[" + s.type.text + "]";
      let p = d0(Dt, s.typeC4Shape.text);
      Ka("type", s, l, p, u), s.type.Y = i + 5, i = s.type.Y + s.type.height;
    } else if (s.techn && s.techn.text !== "") {
      s.techn.text = "[" + s.techn.text + "]";
      let p = d0(Dt, s.techn.text);
      Ka("techn", s, l, p, u), s.techn.Y = i + 5, i = s.techn.Y + s.techn.height;
    }
    let d = i, f = s.label.width;
    if (s.descr && s.descr.text !== "") {
      let p = d0(Dt, s.typeC4Shape.text);
      Ka("descr", s, l, p, u), s.descr.Y = i + 20, i = s.descr.Y + s.descr.height, f = Math.max(s.label.width, s.descr.width), d = i - s.descr.textLines * 5;
    }
    f = f + Dt.c4ShapePadding, s.width = Math.max(s.width || Dt.width, f, Dt.width), s.height = Math.max(s.height || Dt.height, d, Dt.height), s.margin = s.margin || Dt.c4ShapeMargin, t.insert(s), $s.drawC4Shape(e, s, Dt);
  }
  t.bumpLastMargin(Dt.c4ShapeMargin);
}, "drawC4ShapeArray"), Qh, za = (Qh = class {
  constructor(e, r) {
    this.x = e, this.y = r;
  }
}, x(Qh, "Point"), Qh), uL = /* @__PURE__ */ x(function(t, e) {
  let r = t.x, n = t.y, i = e.x, a = e.y, s = r + t.width / 2, o = n + t.height / 2, l = Math.abs(r - i), u = Math.abs(n - a), h = u / l, d = t.height / t.width, f = null;
  return n == a && r < i ? f = new za(r + t.width, o) : n == a && r > i ? f = new za(r, o) : r == i && n < a ? f = new za(s, n + t.height) : r == i && n > a && (f = new za(s, n)), r > i && n < a ? d >= h ? f = new za(r, o + h * t.width / 2) : f = new za(
    s - l / u * t.height / 2,
    n + t.height
  ) : r < i && n < a ? d >= h ? f = new za(r + t.width, o + h * t.width / 2) : f = new za(
    s + l / u * t.height / 2,
    n + t.height
  ) : r < i && n > a ? d >= h ? f = new za(r + t.width, o - h * t.width / 2) : f = new za(s + t.height / 2 * l / u, n) : r > i && n > a && (d >= h ? f = new za(r, o - t.width / 2 * h) : f = new za(s - t.height / 2 * l / u, n)), f;
}, "getIntersectPoint"), U3e = /* @__PURE__ */ x(function(t, e) {
  let r = { x: 0, y: 0 };
  r.x = e.x + e.width / 2, r.y = e.y + e.height / 2;
  let n = uL(t, r);
  r.x = t.x + t.width / 2, r.y = t.y + t.height / 2;
  let i = uL(e, r);
  return { startPoint: n, endPoint: i };
}, "getIntersectPoints"), W3e = /* @__PURE__ */ x(function(t, e, r, n) {
  let i = 0;
  for (let a of e) {
    i = i + 1;
    let s = a.wrap && Dt.wrap, o = G3e(Dt);
    n.db.getC4Type() === "C4Dynamic" && (a.label.text = i + ": " + a.label.text);
    let u = Gi(a.label.text, o);
    Ka("label", a, s, o, u), a.techn && a.techn.text !== "" && (u = Gi(a.techn.text, o), Ka("techn", a, s, o, u)), a.descr && a.descr.text !== "" && (u = Gi(a.descr.text, o), Ka("descr", a, s, o, u));
    let h = r(a.from), d = r(a.to), f = U3e(h, d);
    a.startPoint = f.startPoint, a.endPoint = f.endPoint;
  }
  $s.drawRels(t, e, Dt);
}, "drawRels");
function xS(t, e, r, n, i) {
  let a = new cU(i);
  a.data.widthLimit = r.data.widthLimit / Math.min(AT, n.length);
  for (let [s, o] of n.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 = dv(Dt);
    if (h.fontSize = h.fontSize + 2, h.fontWeight = "bold", Ka(
      "label",
      o,
      u,
      h,
      a.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 g = dv(Dt);
      Ka(
        "type",
        o,
        u,
        g,
        a.data.widthLimit
      ), o.type.Y = l + 5, l = o.type.Y + o.type.height;
    }
    if (o.descr && o.descr.text !== "") {
      let g = dv(Dt);
      g.fontSize = g.fontSize - 2, Ka(
        "descr",
        o,
        u,
        g,
        a.data.widthLimit
      ), o.descr.Y = l + 20, l = o.descr.Y + o.descr.height;
    }
    if (s == 0 || s % AT === 0) {
      let g = r.data.startx + Dt.diagramMarginX, m = r.data.stopy + Dt.diagramMarginY + l;
      a.setData(g, g, m, m);
    } else {
      let g = a.data.stopx !== a.data.startx ? a.data.stopx + Dt.diagramMarginX : a.data.startx, m = a.data.starty;
      a.setData(g, g, m, m);
    }
    a.name = o.alias;
    let d = i.db.getC4ShapeArray(o.alias), f = i.db.getC4ShapeKeys(o.alias);
    f.length > 0 && hU(
      a,
      t,
      d,
      f
    ), e = o.alias;
    let p = i.db.getBoundaries(e);
    p.length > 0 && xS(
      t,
      e,
      a,
      p,
      i
    ), o.alias !== "global" && uU(t, o, a), r.data.stopy = Math.max(
      a.data.stopy + Dt.c4ShapeMargin,
      r.data.stopy
    ), r.data.stopx = Math.max(
      a.data.stopx + Dt.c4ShapeMargin,
      r.data.stopx
    ), Ky = Math.max(Ky, r.data.stopx), Zy = Math.max(Zy, r.data.stopy);
  }
}
x(xS, "drawInsideBoundary");
var H3e = /* @__PURE__ */ x(function(t, e, r, n) {
  Dt = we().c4;
  const i = we().securityLevel;
  let a;
  i === "sandbox" && (a = Qe("#i" + e));
  const s = Qe(i === "sandbox" ? a.nodes()[0].contentDocument.body : "body");
  let o = n.db;
  n.db.setWrap(Dt.wrap), lU = o.getC4ShapeInRow(), AT = o.getC4BoundaryInRow(), ae.debug(`C:${JSON.stringify(Dt, null, 2)}`);
  const l = i === "sandbox" ? s.select(`[id="${e}"]`) : Qe(`[id="${e}"]`);
  $s.insertComputerIcon(l), $s.insertDatabaseIcon(l), $s.insertClockIcon(l);
  let u = new cU(n);
  u.setData(
    Dt.diagramMarginX,
    Dt.diagramMarginX,
    Dt.diagramMarginY,
    Dt.diagramMarginY
  ), u.data.widthLimit = screen.availWidth, Ky = Dt.diagramMarginX, Zy = Dt.diagramMarginY;
  const h = n.db.getTitle();
  let d = n.db.getBoundaries("");
  xS(l, "", u, d, n), $s.insertArrowHead(l), $s.insertArrowEnd(l), $s.insertArrowCrossHead(l), $s.insertArrowFilledHead(l), W3e(l, n.db.getRels(), n.db.getC4Shape, n), u.data.stopx = Ky, u.data.stopy = Zy;
  const f = u.data;
  let g = f.stopy - f.starty + 2 * Dt.diagramMarginY;
  const v = f.stopx - f.startx + 2 * Dt.diagramMarginX;
  h && l.append("text").text(h).attr("x", (f.stopx - f.startx) / 2 - 4 * Dt.diagramMarginX).attr("y", f.starty + Dt.diagramMarginY), Ki(l, g, v, Dt.useMaxWidth);
  const y = h ? 60 : 0;
  l.attr(
    "viewBox",
    f.startx - Dt.diagramMarginX + " -" + (Dt.diagramMarginY + y) + " " + v + " " + (g + y)
  ), ae.debug("models:", f);
}, "draw"), hL = {
  drawPersonOrSystemArray: hU,
  drawBoundary: uU,
  setConf: _T,
  draw: H3e
}, q3e = /* @__PURE__ */ x((t) => `.person {
    stroke: ${t.personBorder};
    fill: ${t.personBkg};
  }
`, "getStyles"), Y3e = q3e, X3e = {
  parser: t3e,
  db: CT,
  renderer: hL,
  styles: Y3e,
  init: /* @__PURE__ */ x(({ c4: t, wrap: e }) => {
    hL.setConf(t), CT.setWrap(e);
  }, "init")
};
const j3e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: X3e
}, Symbol.toStringTag, { value: "Module" }));
var l1 = /* @__PURE__ */ x(() => `
  /* Font Awesome icon styling - consolidated */
  .label-icon {
    display: inline-block;
    height: 1em;
    overflow: visible;
    vertical-align: -0.125em;
  }
  
  .node .label-icon path {
    fill: currentColor;
    stroke: revert;
    stroke-width: revert;
  }
`, "getIconStyles"), Ff = /* @__PURE__ */ x((t, e) => {
  let r;
  return e === "sandbox" && (r = Qe("#i" + t)), Qe(e === "sandbox" ? r.nodes()[0].contentDocument.body : "body").select(`[id="${t}"]`);
}, "getDiagramElement"), zu = /* @__PURE__ */ x((t, e, r, n) => {
  t.attr("class", r);
  const { width: i, height: a, x: s, y: o } = K3e(t, e);
  Ki(t, a, i, n);
  const l = Z3e(s, o, i, a, e);
  t.attr("viewBox", l), ae.debug(`viewBox configured: ${l} with padding: ${e}`);
}, "setupViewPortForSVG"), K3e = /* @__PURE__ */ x((t, e) => {
  var n;
  const r = ((n = t.node()) == null ? void 0 : n.getBBox()) || { width: 0, height: 0, x: 0, y: 0 };
  return {
    width: r.width + e * 2,
    height: r.height + e * 2,
    x: r.x,
    y: r.y
  };
}, "calculateDimensionsWithPadding"), Z3e = /* @__PURE__ */ x((t, e, r, n, i) => `${t - i} ${e - i} ${r} ${n}`, "createViewBox"), Q3e = "flowchart-", Jh, J3e = (Jh = class {
  // cspell:ignore funs
  constructor() {
    this.vertexCounter = 0, this.config = we(), this.vertices = /* @__PURE__ */ new Map(), this.edges = [], this.classes = /* @__PURE__ */ new Map(), this.subGraphs = [], this.subGraphLookup = /* @__PURE__ */ new Map(), this.tooltips = /* @__PURE__ */ new Map(), this.subCount = 0, this.firstGraphFlag = !0, this.secCount = -1, this.posCrossRef = [], this.funs = [], this.setAccTitle = Cn, this.setAccDescription = Gn, this.setDiagramTitle = Qn, this.getAccTitle = Vn, this.getAccDescription = Un, this.getDiagramTitle = Ln, this.funs.push(this.setupToolTips.bind(this)), this.addVertex = this.addVertex.bind(this), this.firstGraph = this.firstGraph.bind(this), this.setDirection = this.setDirection.bind(this), this.addSubGraph = this.addSubGraph.bind(this), this.addLink = this.addLink.bind(this), this.setLink = this.setLink.bind(this), this.updateLink = this.updateLink.bind(this), this.addClass = this.addClass.bind(this), this.setClass = this.setClass.bind(this), this.destructLink = this.destructLink.bind(this), this.setClickEvent = this.setClickEvent.bind(this), this.setTooltip = this.setTooltip.bind(this), this.updateLinkInterpolate = this.updateLinkInterpolate.bind(this), this.setClickFun = this.setClickFun.bind(this), this.bindFunctions = this.bindFunctions.bind(this), this.lex = {
      firstGraph: this.firstGraph.bind(this)
    }, this.clear(), this.setGen("gen-2");
  }
  sanitizeText(e) {
    return at.sanitizeText(e, this.config);
  }
  /**
   * Function to lookup domId from id in the graph definition.
   *
   * @param id - id of the node
   */
  lookUpDomId(e) {
    for (const r of this.vertices.values())
      if (r.id === e)
        return r.domId;
    return e;
  }
  /**
   * Function called by parser when a node definition has been found
   */
  addVertex(e, r, n, i, a, s, o = {}, l) {
    var p, g;
    if (!e || e.trim().length === 0)
      return;
    let u;
    if (l !== void 0) {
      let m;
      l.includes(`
`) ? m = l + `
` : m = `{
` + l + `
}`, u = Q2(m, { schema: Z2 });
    }
    const h = this.edges.find((m) => m.id === e);
    if (h) {
      const m = u;
      (m == null ? void 0 : m.animate) !== void 0 && (h.animate = m.animate), (m == null ? void 0 : m.animation) !== void 0 && (h.animation = m.animation), (m == null ? void 0 : m.curve) !== void 0 && (h.interpolate = m.curve);
      return;
    }
    let d, f = this.vertices.get(e);
    if (f === void 0 && (f = {
      id: e,
      labelType: "text",
      domId: Q3e + e + "-" + this.vertexCounter,
      styles: [],
      classes: []
    }, this.vertices.set(e, f)), this.vertexCounter++, r !== void 0 ? (this.config = we(), d = this.sanitizeText(r.text.trim()), f.labelType = r.type, d.startsWith('"') && d.endsWith('"') && (d = d.substring(1, d.length - 1)), f.text = d) : f.text === void 0 && (f.text = e), n !== void 0 && (f.type = n), i != null && i.forEach((m) => {
      f.styles.push(m);
    }), a != null && a.forEach((m) => {
      f.classes.push(m);
    }), s !== void 0 && (f.dir = s), f.props === void 0 ? f.props = o : o !== void 0 && Object.assign(f.props, o), u !== void 0) {
      if (u.shape) {
        if (u.shape !== u.shape.toLowerCase() || u.shape.includes("_"))
          throw new Error(`No such shape: ${u.shape}. Shape names should be lowercase.`);
        if (!oF(u.shape))
          throw new Error(`No such shape: ${u.shape}.`);
        f.type = u == null ? void 0 : u.shape;
      }
      u != null && u.label && (f.text = u == null ? void 0 : u.label), u != null && u.icon && (f.icon = u == null ? void 0 : u.icon, !((p = u.label) != null && p.trim()) && f.text === e && (f.text = "")), u != null && u.form && (f.form = u == null ? void 0 : u.form), u != null && u.pos && (f.pos = u == null ? void 0 : u.pos), u != null && u.img && (f.img = u == null ? void 0 : u.img, !((g = u.label) != null && g.trim()) && f.text === e && (f.text = "")), u != null && u.constraint && (f.constraint = u.constraint), u.w && (f.assetWidth = Number(u.w)), u.h && (f.assetHeight = Number(u.h));
    }
  }
  /**
   * Function called by parser when a link/edge definition has been found
   *
   */
  addSingleLink(e, r, n, i) {
    const o = {
      start: e,
      end: r,
      type: void 0,
      text: "",
      labelType: "text",
      classes: [],
      isUserDefinedId: !1,
      interpolate: this.edges.defaultInterpolate
    };
    ae.info("abc78 Got edge...", o);
    const l = n.text;
    if (l !== void 0 && (o.text = this.sanitizeText(l.text.trim()), o.text.startsWith('"') && o.text.endsWith('"') && (o.text = o.text.substring(1, o.text.length - 1)), o.labelType = l.type), n !== void 0 && (o.type = n.type, o.stroke = n.stroke, o.length = n.length > 10 ? 10 : n.length), i && !this.edges.some((u) => u.id === i))
      o.id = i, o.isUserDefinedId = !0;
    else {
      const u = this.edges.filter((h) => h.start === o.start && h.end === o.end);
      u.length === 0 ? o.id = Nh(o.start, o.end, { counter: 0, prefix: "L" }) : o.id = Nh(o.start, o.end, {
        counter: u.length + 1,
        prefix: "L"
      });
    }
    if (this.edges.length < (this.config.maxEdges ?? 500))
      ae.info("Pushing edge..."), this.edges.push(o);
    else
      throw new Error(
        `Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.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.`
      );
  }
  isLinkData(e) {
    return e !== null && typeof e == "object" && "id" in e && typeof e.id == "string";
  }
  addLink(e, r, n) {
    const i = this.isLinkData(n) ? n.id.replace("@", "") : void 0;
    ae.info("addLink", e, r, i);
    for (const a of e)
      for (const s of r) {
        const o = a === e[e.length - 1], l = s === r[0];
        o && l ? this.addSingleLink(a, s, n, i) : this.addSingleLink(a, s, n, void 0);
      }
  }
  /**
   * Updates a link's line interpolation algorithm
   */
  updateLinkInterpolate(e, r) {
    e.forEach((n) => {
      n === "default" ? this.edges.defaultInterpolate = r : this.edges[n].interpolate = r;
    });
  }
  /**
   * Updates a link with a style
   *
   */
  updateLink(e, r) {
    e.forEach((n) => {
      var i, a, s, o, l, u;
      if (typeof n == "number" && n >= this.edges.length)
        throw new Error(
          `The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)`
        );
      n === "default" ? this.edges.defaultStyle = r : (this.edges[n].style = r, (((a = (i = this.edges[n]) == null ? void 0 : i.style) == null ? void 0 : a.length) ?? 0) > 0 && !((o = (s = this.edges[n]) == null ? void 0 : s.style) != null && o.some((h) => h == null ? void 0 : h.startsWith("fill"))) && ((u = (l = this.edges[n]) == null ? void 0 : l.style) == null || u.push("fill:none")));
    });
  }
  addClass(e, r) {
    const n = r.join().replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
    e.split(",").forEach((i) => {
      let a = this.classes.get(i);
      a === void 0 && (a = { id: i, styles: [], textStyles: [] }, this.classes.set(i, a)), n != null && n.forEach((s) => {
        if (/color/.exec(s)) {
          const o = s.replace("fill", "bgFill");
          a.textStyles.push(o);
        }
        a.styles.push(s);
      });
    });
  }
  /**
   * Called by parser when a graph definition is found, stores the direction of the chart.
   *
   */
  setDirection(e) {
    this.direction = e.trim(), /.*</.exec(this.direction) && (this.direction = "RL"), /.*\^/.exec(this.direction) && (this.direction = "BT"), /.*>/.exec(this.direction) && (this.direction = "LR"), /.*v/.exec(this.direction) && (this.direction = "TB"), this.direction === "TD" && (this.direction = "TB");
  }
  /**
   * Called by parser when a special node is found, e.g. a clickable element.
   *
   * @param ids - Comma separated list of ids
   * @param className - Class to add
   */
  setClass(e, r) {
    for (const n of e.split(",")) {
      const i = this.vertices.get(n);
      i && i.classes.push(r);
      const a = this.edges.find((o) => o.id === n);
      a && a.classes.push(r);
      const s = this.subGraphLookup.get(n);
      s && s.classes.push(r);
    }
  }
  setTooltip(e, r) {
    if (r !== void 0) {
      r = this.sanitizeText(r);
      for (const n of e.split(","))
        this.tooltips.set(this.version === "gen-1" ? this.lookUpDomId(n) : n, r);
    }
  }
  setClickFun(e, r, n) {
    const i = this.lookUpDomId(e);
    if (we().securityLevel !== "loose" || r === void 0)
      return;
    let a = [];
    if (typeof n == "string") {
      a = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
      for (let o = 0; o < a.length; o++) {
        let l = a[o].trim();
        l.startsWith('"') && l.endsWith('"') && (l = l.substr(1, l.length - 2)), a[o] = l;
      }
    }
    a.length === 0 && a.push(e);
    const s = this.vertices.get(e);
    s && (s.haveCallback = !0, this.funs.push(() => {
      const o = document.querySelector(`[id="${i}"]`);
      o !== null && o.addEventListener(
        "click",
        () => {
          Kt.runFunc(r, ...a);
        },
        !1
      );
    }));
  }
  /**
   * Called by parser when a link is found. Adds the URL to the vertex data.
   *
   * @param ids - Comma separated list of ids
   * @param linkStr - URL to create a link for
   * @param target - Target attribute for the link
   */
  setLink(e, r, n) {
    e.split(",").forEach((i) => {
      const a = this.vertices.get(i);
      a !== void 0 && (a.link = Kt.formatUrl(r, this.config), a.linkTarget = n);
    }), this.setClass(e, "clickable");
  }
  getTooltip(e) {
    return this.tooltips.get(e);
  }
  /**
   * Called by parser when a click definition is found. Registers an event handler.
   *
   * @param ids - Comma separated list of ids
   * @param functionName - Function to be called on click
   * @param functionArgs - Arguments to be passed to the function
   */
  setClickEvent(e, r, n) {
    e.split(",").forEach((i) => {
      this.setClickFun(i, r, n);
    }), this.setClass(e, "clickable");
  }
  bindFunctions(e) {
    this.funs.forEach((r) => {
      r(e);
    });
  }
  getDirection() {
    var e;
    return (e = this.direction) == null ? void 0 : e.trim();
  }
  /**
   * Retrieval function for fetching the found nodes after parsing has completed.
   *
   */
  getVertices() {
    return this.vertices;
  }
  /**
   * Retrieval function for fetching the found links after parsing has completed.
   *
   */
  getEdges() {
    return this.edges;
  }
  /**
   * Retrieval function for fetching the found class definitions after parsing has completed.
   *
   */
  getClasses() {
    return this.classes;
  }
  setupToolTips(e) {
    let r = Qe(".mermaidTooltip");
    (r._groups || r)[0][0] === null && (r = Qe("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0)), Qe(e).select("svg").selectAll("g.node").on("mouseover", (a) => {
      var u;
      const s = Qe(a.currentTarget);
      if (s.attr("title") === null)
        return;
      const l = (u = a.currentTarget) == null ? void 0 : u.getBoundingClientRect();
      r.transition().duration(200).style("opacity", ".9"), r.text(s.attr("title")).style("left", window.scrollX + l.left + (l.right - l.left) / 2 + "px").style("top", window.scrollY + l.bottom + "px"), r.html(r.html().replace(/&lt;br\/&gt;/g, "<br/>")), s.classed("hover", !0);
    }).on("mouseout", (a) => {
      r.transition().duration(500).style("opacity", 0), Qe(a.currentTarget).classed("hover", !1);
    });
  }
  /**
   * Clears the internal graph db so that a new graph can be parsed.
   *
   */
  clear(e = "gen-2") {
    this.vertices = /* @__PURE__ */ new Map(), this.classes = /* @__PURE__ */ new Map(), this.edges = [], this.funs = [this.setupToolTips.bind(this)], this.subGraphs = [], this.subGraphLookup = /* @__PURE__ */ new Map(), this.subCount = 0, this.tooltips = /* @__PURE__ */ new Map(), this.firstGraphFlag = !0, this.version = e, this.config = we(), _n();
  }
  setGen(e) {
    this.version = e || "gen-2";
  }
  defaultStyle() {
    return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;";
  }
  addSubGraph(e, r, n) {
    let i = e.text.trim(), a = n.text;
    e === n && /\s/.exec(n.text) && (i = void 0);
    const o = (/* @__PURE__ */ x((f) => {
      const p = { boolean: {}, number: {}, string: {} }, g = [];
      let m;
      return { nodeList: f.filter(function(y) {
        const b = typeof y;
        return y.stmt && y.stmt === "dir" ? (m = y.value, !1) : y.trim() === "" ? !1 : b in p ? p[b].hasOwnProperty(y) ? !1 : p[b][y] = !0 : g.includes(y) ? !1 : g.push(y);
      }), dir: m };
    }, "uniq"))(r.flat()), l = o.nodeList;
    let u = o.dir;
    const h = we().flowchart ?? {};
    if (u = u ?? (h.inheritDir ? this.getDirection() ?? we().direction ?? void 0 : void 0), this.version === "gen-1")
      for (let f = 0; f < l.length; f++)
        l[f] = this.lookUpDomId(l[f]);
    i = i ?? "subGraph" + this.subCount, a = a || "", a = this.sanitizeText(a), this.subCount = this.subCount + 1;
    const d = {
      id: i,
      nodes: l,
      title: a.trim(),
      classes: [],
      dir: u,
      labelType: n.type
    };
    return ae.info("Adding", d.id, d.nodes, d.dir), d.nodes = this.makeUniq(d, this.subGraphs).nodes, this.subGraphs.push(d), this.subGraphLookup.set(i, d), i;
  }
  getPosForId(e) {
    for (const [r, n] of this.subGraphs.entries())
      if (n.id === e)
        return r;
    return -1;
  }
  indexNodes2(e, r) {
    const n = this.subGraphs[r].nodes;
    if (this.secCount = this.secCount + 1, this.secCount > 2e3)
      return {
        result: !1,
        count: 0
      };
    if (this.posCrossRef[this.secCount] = r, this.subGraphs[r].id === e)
      return {
        result: !0,
        count: 0
      };
    let i = 0, a = 1;
    for (; i < n.length; ) {
      const s = this.getPosForId(n[i]);
      if (s >= 0) {
        const o = this.indexNodes2(e, s);
        if (o.result)
          return {
            result: !0,
            count: a + o.count
          };
        a = a + o.count;
      }
      i = i + 1;
    }
    return {
      result: !1,
      count: a
    };
  }
  getDepthFirstPos(e) {
    return this.posCrossRef[e];
  }
  indexNodes() {
    this.secCount = -1, this.subGraphs.length > 0 && this.indexNodes2("none", this.subGraphs.length - 1);
  }
  getSubGraphs() {
    return this.subGraphs;
  }
  firstGraph() {
    return this.firstGraphFlag ? (this.firstGraphFlag = !1, !0) : !1;
  }
  destructStartLink(e) {
    let r = e.trim(), n = "arrow_open";
    switch (r[0]) {
      case "<":
        n = "arrow_point", r = r.slice(1);
        break;
      case "x":
        n = "arrow_cross", r = r.slice(1);
        break;
      case "o":
        n = "arrow_circle", r = r.slice(1);
        break;
    }
    let i = "normal";
    return r.includes("=") && (i = "thick"), r.includes(".") && (i = "dotted"), { type: n, stroke: i };
  }
  countChar(e, r) {
    const n = r.length;
    let i = 0;
    for (let a = 0; a < n; ++a)
      r[a] === e && ++i;
    return i;
  }
  destructEndLink(e) {
    const r = e.trim();
    let n = r.slice(0, -1), i = "arrow_open";
    switch (r.slice(-1)) {
      case "x":
        i = "arrow_cross", r.startsWith("x") && (i = "double_" + i, n = n.slice(1));
        break;
      case ">":
        i = "arrow_point", r.startsWith("<") && (i = "double_" + i, n = n.slice(1));
        break;
      case "o":
        i = "arrow_circle", r.startsWith("o") && (i = "double_" + i, n = n.slice(1));
        break;
    }
    let a = "normal", s = n.length - 1;
    n.startsWith("=") && (a = "thick"), n.startsWith("~") && (a = "invisible");
    const o = this.countChar(".", n);
    return o && (a = "dotted", s = o), { type: i, stroke: a, length: s };
  }
  destructLink(e, r) {
    const n = this.destructEndLink(e);
    let i;
    if (r) {
      if (i = this.destructStartLink(r), 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;
  }
  // Todo optimizer this by caching existing nodes
  exists(e, r) {
    for (const n of e)
      if (n.nodes.includes(r))
        return !0;
    return !1;
  }
  /**
   * Deletes an id from all subgraphs
   *
   */
  makeUniq(e, r) {
    const n = [];
    return e.nodes.forEach((i, a) => {
      this.exists(r, i) || n.push(e.nodes[a]);
    }), { nodes: n };
  }
  getTypeFromVertex(e) {
    if (e.img)
      return "imageSquare";
    if (e.icon)
      return e.form === "circle" ? "iconCircle" : e.form === "square" ? "iconSquare" : e.form === "rounded" ? "iconRounded" : "icon";
    switch (e.type) {
      case "square":
      case void 0:
        return "squareRect";
      case "round":
        return "roundedRect";
      case "ellipse":
        return "ellipse";
      default:
        return e.type;
    }
  }
  findNode(e, r) {
    return e.find((n) => n.id === r);
  }
  destructEdgeType(e) {
    let r = "none", n = "arrow_point";
    switch (e) {
      case "arrow_point":
      case "arrow_circle":
      case "arrow_cross":
        n = e;
        break;
      case "double_arrow_point":
      case "double_arrow_circle":
      case "double_arrow_cross":
        r = e.replace("double_", ""), n = r;
        break;
    }
    return { arrowTypeStart: r, arrowTypeEnd: n };
  }
  addNodeFromVertex(e, r, n, i, a, s) {
    var h;
    const o = n.get(e.id), l = i.get(e.id) ?? !1, u = this.findNode(r, e.id);
    if (u)
      u.cssStyles = e.styles, u.cssCompiledStyles = this.getCompiledStyles(e.classes), u.cssClasses = e.classes.join(" ");
    else {
      const d = {
        id: e.id,
        label: e.text,
        labelStyle: "",
        parentId: o,
        padding: ((h = a.flowchart) == null ? void 0 : h.padding) || 8,
        cssStyles: e.styles,
        cssCompiledStyles: this.getCompiledStyles(["default", "node", ...e.classes]),
        cssClasses: "default " + e.classes.join(" "),
        dir: e.dir,
        domId: e.domId,
        look: s,
        link: e.link,
        linkTarget: e.linkTarget,
        tooltip: this.getTooltip(e.id),
        icon: e.icon,
        pos: e.pos,
        img: e.img,
        assetWidth: e.assetWidth,
        assetHeight: e.assetHeight,
        constraint: e.constraint
      };
      l ? r.push({
        ...d,
        isGroup: !0,
        shape: "rect"
      }) : r.push({
        ...d,
        isGroup: !1,
        shape: this.getTypeFromVertex(e)
      });
    }
  }
  getCompiledStyles(e) {
    let r = [];
    for (const n of e) {
      const i = this.classes.get(n);
      i != null && i.styles && (r = [...r, ...i.styles ?? []].map((a) => a.trim())), i != null && i.textStyles && (r = [...r, ...i.textStyles ?? []].map((a) => a.trim()));
    }
    return r;
  }
  getData() {
    const e = we(), r = [], n = [], i = this.getSubGraphs(), a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
    for (let u = i.length - 1; u >= 0; u--) {
      const h = i[u];
      h.nodes.length > 0 && s.set(h.id, !0);
      for (const d of h.nodes)
        a.set(d, h.id);
    }
    for (let u = i.length - 1; u >= 0; u--) {
      const h = i[u];
      r.push({
        id: h.id,
        label: h.title,
        labelStyle: "",
        parentId: a.get(h.id),
        padding: 8,
        cssCompiledStyles: this.getCompiledStyles(h.classes),
        cssClasses: h.classes.join(" "),
        shape: "rect",
        dir: h.dir,
        isGroup: !0,
        look: e.look
      });
    }
    this.getVertices().forEach((u) => {
      this.addNodeFromVertex(u, r, a, s, e, e.look || "classic");
    });
    const l = this.getEdges();
    return l.forEach((u, h) => {
      var m;
      const { arrowTypeStart: d, arrowTypeEnd: f } = this.destructEdgeType(u.type), p = [...l.defaultStyle ?? []];
      u.style && p.push(...u.style);
      const g = {
        id: Nh(u.start, u.end, { counter: h, prefix: "L" }, u.id),
        isUserDefinedId: u.isUserDefinedId,
        start: u.start,
        end: u.end,
        type: u.type ?? "normal",
        label: u.text,
        labelpos: "c",
        thickness: u.stroke,
        minlen: u.length,
        classes: (u == null ? void 0 : u.stroke) === "invisible" ? "" : "edge-thickness-normal edge-pattern-solid flowchart-link",
        arrowTypeStart: (u == null ? void 0 : u.stroke) === "invisible" || (u == null ? void 0 : u.type) === "arrow_open" ? "none" : d,
        arrowTypeEnd: (u == null ? void 0 : u.stroke) === "invisible" || (u == null ? void 0 : u.type) === "arrow_open" ? "none" : f,
        arrowheadStyle: "fill: #333",
        cssCompiledStyles: this.getCompiledStyles(u.classes),
        labelStyle: p,
        style: p,
        pattern: u.stroke,
        look: e.look,
        animate: u.animate,
        animation: u.animation,
        curve: u.interpolate || this.edges.defaultInterpolate || ((m = e.flowchart) == null ? void 0 : m.curve)
      };
      n.push(g);
    }), { nodes: r, edges: n, other: {}, config: e };
  }
  defaultConfig() {
    return RM.flowchart;
  }
}, x(Jh, "FlowDB"), Jh), e5e = /* @__PURE__ */ x(function(t, e) {
  return e.db.getClasses();
}, "getClasses"), t5e = /* @__PURE__ */ x(async function(t, e, r, n) {
  var p;
  ae.info("REF0:"), ae.info("Drawing state diagram (v2)", e);
  const { securityLevel: i, flowchart: a, layout: s } = we();
  let o;
  i === "sandbox" && (o = Qe("#i" + e));
  const l = i === "sandbox" ? o.nodes()[0].contentDocument : document;
  ae.debug("Before getData: ");
  const u = n.db.getData();
  ae.debug("Data: ", u);
  const h = Ff(e, i), d = n.db.getDirection();
  u.type = n.type, u.layoutAlgorithm = Gg(s), u.layoutAlgorithm === "dagre" && s === "elk" && ae.warn(
    "flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."
  ), u.direction = d, u.nodeSpacing = (a == null ? void 0 : a.nodeSpacing) || 50, u.rankSpacing = (a == null ? void 0 : a.rankSpacing) || 50, u.markers = ["point", "circle", "cross"], u.diagramId = e, ae.debug("REF1:", u), await Af(u, h);
  const f = ((p = u.config.flowchart) == null ? void 0 : p.diagramPadding) ?? 8;
  Kt.insertTitle(
    h,
    "flowchartTitleText",
    (a == null ? void 0 : a.titleTopMargin) || 0,
    n.db.getDiagramTitle()
  ), zu(h, f, "flowchart", (a == null ? void 0 : a.useMaxWidth) || !1);
  for (const g of u.nodes) {
    const m = Qe(`#${e} [id="${g.id}"]`);
    if (!m || !g.link)
      continue;
    const v = l.createElementNS("http://www.w3.org/2000/svg", "a");
    v.setAttributeNS("http://www.w3.org/2000/svg", "class", g.cssClasses), v.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener"), i === "sandbox" ? v.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top") : g.linkTarget && v.setAttributeNS("http://www.w3.org/2000/svg", "target", g.linkTarget);
    const y = m.insert(function() {
      return v;
    }, ":first-child"), b = m.select(".label-container");
    b && y.append(function() {
      return b.node();
    });
    const w = m.select(".label");
    w && y.append(function() {
      return w.node();
    });
  }
}, "draw"), r5e = {
  getClasses: e5e,
  draw: t5e
}, LT = function() {
  var t = /* @__PURE__ */ x(function(bn, pt, Tt, lt) {
    for (Tt = Tt || {}, lt = bn.length; lt--; Tt[bn[lt]] = pt) ;
    return Tt;
  }, "o"), e = [1, 4], r = [1, 3], n = [1, 5], i = [1, 8, 9, 10, 11, 27, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124], a = [2, 2], s = [1, 13], o = [1, 14], l = [1, 15], u = [1, 16], h = [1, 23], d = [1, 25], f = [1, 26], p = [1, 27], g = [1, 49], m = [1, 48], v = [1, 29], y = [1, 30], b = [1, 31], w = [1, 32], T = [1, 33], E = [1, 44], C = [1, 46], k = [1, 42], _ = [1, 47], L = [1, 43], N = [1, 50], A = [1, 45], O = [1, 51], P = [1, 52], S = [1, 34], R = [1, 35], I = [1, 36], D = [1, 37], M = [1, 57], B = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124], $ = [1, 61], F = [1, 60], G = [1, 62], H = [8, 9, 11, 75, 77, 78], ee = [1, 78], Y = [1, 91], re = [1, 96], ne = [1, 95], he = [1, 92], K = [1, 88], Z = [1, 94], X = [1, 90], q = [1, 97], J = [1, 93], j = [1, 98], pe = [1, 89], te = [8, 9, 10, 11, 40, 75, 77, 78], Ae = [8, 9, 10, 11, 40, 46, 75, 77, 78], W = [8, 9, 10, 11, 29, 40, 44, 46, 48, 50, 52, 54, 56, 58, 60, 63, 65, 67, 68, 70, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], Oe = [8, 9, 11, 44, 60, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], ue = [44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], Ve = [1, 121], Ge = [1, 122], Ue = [1, 124], ke = [1, 123], Pe = [44, 60, 62, 74, 89, 102, 105, 106, 109, 111, 114, 115, 116], Se = [1, 133], _e = [1, 147], ze = [1, 148], me = [1, 149], Me = [1, 150], Q = [1, 135], ce = [1, 137], z = [1, 141], oe = [1, 142], se = [1, 143], ge = [1, 144], de = [1, 145], be = [1, 146], Ce = [1, 151], Te = [1, 152], Ne = [1, 131], Xe = [1, 132], Ye = [1, 139], Ke = [1, 134], Ze = [1, 138], Be = [1, 136], He = [8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124], ht = [1, 154], st = [1, 156], We = [8, 9, 11], kt = [8, 9, 10, 11, 14, 44, 60, 89, 105, 106, 109, 111, 114, 115, 116], qe = [1, 176], rt = [1, 172], ct = [1, 173], ut = [1, 177], nt = [1, 174], bt = [1, 175], Zt = [77, 116, 119], Ot = [8, 9, 10, 11, 12, 14, 27, 29, 32, 44, 60, 75, 84, 85, 86, 87, 88, 89, 90, 105, 109, 111, 114, 115, 116], tr = [10, 106], xr = [31, 49, 51, 53, 55, 57, 62, 64, 66, 67, 69, 71, 116, 117, 118], rr = [1, 247], Wt = [1, 245], lr = [1, 249], an = [1, 243], dt = [1, 244], Ee = [1, 246], Je = [1, 248], wt = [1, 250], sr = [1, 268], Ur = [8, 9, 11, 106], cr = [8, 9, 10, 11, 60, 84, 105, 106, 109, 110, 111, 112], Yr = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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, shapeData: 39, SHAPE_DATA: 40, link: 41, node: 42, styledVertex: 43, AMP: 44, vertex: 45, STYLE_SEPARATOR: 46, idString: 47, DOUBLECIRCLESTART: 48, DOUBLECIRCLEEND: 49, PS: 50, PE: 51, "(-": 52, "-)": 53, STADIUMSTART: 54, STADIUMEND: 55, SUBROUTINESTART: 56, SUBROUTINEEND: 57, VERTEX_WITH_PROPS_START: 58, "NODE_STRING[field]": 59, COLON: 60, "NODE_STRING[value]": 61, PIPE: 62, CYLINDERSTART: 63, CYLINDEREND: 64, DIAMOND_START: 65, DIAMOND_STOP: 66, TAGEND: 67, TRAPSTART: 68, TRAPEND: 69, INVTRAPSTART: 70, INVTRAPEND: 71, linkStatement: 72, arrowText: 73, TESTSTR: 74, START_LINK: 75, edgeText: 76, LINK: 77, LINK_ID: 78, edgeTextToken: 79, STR: 80, MD_STR: 81, textToken: 82, keywords: 83, STYLE: 84, LINKSTYLE: 85, CLASSDEF: 86, CLASS: 87, CLICK: 88, DOWN: 89, UP: 90, textNoTagsToken: 91, stylesOpt: 92, "idString[vertex]": 93, "idString[class]": 94, CALLBACKNAME: 95, CALLBACKARGS: 96, HREF: 97, LINK_TARGET: 98, "STR[link]": 99, "STR[tooltip]": 100, alphaNum: 101, DEFAULT: 102, numList: 103, INTERPOLATE: 104, NUM: 105, COMMA: 106, style: 107, styleComponent: 108, NODE_STRING: 109, UNIT: 110, BRKT: 111, PCT: 112, idStringToken: 113, MINUS: 114, MULT: 115, UNICODE_TEXT: 116, TEXT: 117, TAGSTART: 118, EDGE_TEXT: 119, alphaNumToken: 120, direction_tb: 121, direction_bt: 122, direction_rl: 123, direction_lr: 124, $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", 40: "SHAPE_DATA", 44: "AMP", 46: "STYLE_SEPARATOR", 48: "DOUBLECIRCLESTART", 49: "DOUBLECIRCLEEND", 50: "PS", 51: "PE", 52: "(-", 53: "-)", 54: "STADIUMSTART", 55: "STADIUMEND", 56: "SUBROUTINESTART", 57: "SUBROUTINEEND", 58: "VERTEX_WITH_PROPS_START", 59: "NODE_STRING[field]", 60: "COLON", 61: "NODE_STRING[value]", 62: "PIPE", 63: "CYLINDERSTART", 64: "CYLINDEREND", 65: "DIAMOND_START", 66: "DIAMOND_STOP", 67: "TAGEND", 68: "TRAPSTART", 69: "TRAPEND", 70: "INVTRAPSTART", 71: "INVTRAPEND", 74: "TESTSTR", 75: "START_LINK", 77: "LINK", 78: "LINK_ID", 80: "STR", 81: "MD_STR", 84: "STYLE", 85: "LINKSTYLE", 86: "CLASSDEF", 87: "CLASS", 88: "CLICK", 89: "DOWN", 90: "UP", 93: "idString[vertex]", 94: "idString[class]", 95: "CALLBACKNAME", 96: "CALLBACKARGS", 97: "HREF", 98: "LINK_TARGET", 99: "STR[link]", 100: "STR[tooltip]", 102: "DEFAULT", 104: "INTERPOLATE", 105: "NUM", 106: "COMMA", 109: "NODE_STRING", 110: "UNIT", 111: "BRKT", 112: "PCT", 114: "MINUS", 115: "MULT", 116: "UNICODE_TEXT", 117: "TEXT", 118: "TAGSTART", 119: "EDGE_TEXT", 121: "direction_tb", 122: "direction_bt", 123: "direction_rl", 124: "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], [39, 2], [39, 1], [20, 4], [20, 3], [20, 4], [20, 2], [20, 2], [20, 1], [42, 1], [42, 6], [42, 5], [43, 1], [43, 3], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 8], [45, 4], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 4], [45, 4], [45, 1], [41, 2], [41, 3], [41, 3], [41, 1], [41, 3], [41, 4], [76, 1], [76, 2], [76, 1], [76, 1], [72, 1], [72, 2], [73, 3], [30, 1], [30, 2], [30, 1], [30, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 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], [103, 1], [103, 3], [92, 1], [92, 3], [107, 1], [107, 2], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [82, 1], [82, 1], [82, 1], [82, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [79, 1], [79, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [47, 1], [47, 2], [101, 1], [101, 2], [33, 1], [33, 1], [33, 1], [33, 1]],
    performAction: /* @__PURE__ */ x(function(pt, Tt, lt, je, jt, fe, cl) {
      var ve = fe.length - 1;
      switch (jt) {
        case 2:
          this.$ = [];
          break;
        case 3:
          (!Array.isArray(fe[ve]) || fe[ve].length > 0) && fe[ve - 1].push(fe[ve]), this.$ = fe[ve - 1];
          break;
        case 4:
        case 183:
          this.$ = fe[ve];
          break;
        case 11:
          je.setDirection("TB"), this.$ = "TB";
          break;
        case 12:
          je.setDirection(fe[ve - 1]), this.$ = fe[ve - 1];
          break;
        case 27:
          this.$ = fe[ve - 1].nodes;
          break;
        case 28:
        case 29:
        case 30:
        case 31:
        case 32:
          this.$ = [];
          break;
        case 33:
          this.$ = je.addSubGraph(fe[ve - 6], fe[ve - 1], fe[ve - 4]);
          break;
        case 34:
          this.$ = je.addSubGraph(fe[ve - 3], fe[ve - 1], fe[ve - 3]);
          break;
        case 35:
          this.$ = je.addSubGraph(void 0, fe[ve - 1], void 0);
          break;
        case 37:
          this.$ = fe[ve].trim(), je.setAccTitle(this.$);
          break;
        case 38:
        case 39:
          this.$ = fe[ve].trim(), je.setAccDescription(this.$);
          break;
        case 43:
          this.$ = fe[ve - 1] + fe[ve];
          break;
        case 44:
          this.$ = fe[ve];
          break;
        case 45:
          je.addVertex(fe[ve - 1][fe[ve - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, fe[ve]), je.addLink(fe[ve - 3].stmt, fe[ve - 1], fe[ve - 2]), this.$ = { stmt: fe[ve - 1], nodes: fe[ve - 1].concat(fe[ve - 3].nodes) };
          break;
        case 46:
          je.addLink(fe[ve - 2].stmt, fe[ve], fe[ve - 1]), this.$ = { stmt: fe[ve], nodes: fe[ve].concat(fe[ve - 2].nodes) };
          break;
        case 47:
          je.addLink(fe[ve - 3].stmt, fe[ve - 1], fe[ve - 2]), this.$ = { stmt: fe[ve - 1], nodes: fe[ve - 1].concat(fe[ve - 3].nodes) };
          break;
        case 48:
          this.$ = { stmt: fe[ve - 1], nodes: fe[ve - 1] };
          break;
        case 49:
          je.addVertex(fe[ve - 1][fe[ve - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, fe[ve]), this.$ = { stmt: fe[ve - 1], nodes: fe[ve - 1], shapeData: fe[ve] };
          break;
        case 50:
          this.$ = { stmt: fe[ve], nodes: fe[ve] };
          break;
        case 51:
          this.$ = [fe[ve]];
          break;
        case 52:
          je.addVertex(fe[ve - 5][fe[ve - 5].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, fe[ve - 4]), this.$ = fe[ve - 5].concat(fe[ve]);
          break;
        case 53:
          this.$ = fe[ve - 4].concat(fe[ve]);
          break;
        case 54:
          this.$ = fe[ve];
          break;
        case 55:
          this.$ = fe[ve - 2], je.setClass(fe[ve - 2], fe[ve]);
          break;
        case 56:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "square");
          break;
        case 57:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "doublecircle");
          break;
        case 58:
          this.$ = fe[ve - 5], je.addVertex(fe[ve - 5], fe[ve - 2], "circle");
          break;
        case 59:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "ellipse");
          break;
        case 60:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "stadium");
          break;
        case 61:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "subroutine");
          break;
        case 62:
          this.$ = fe[ve - 7], je.addVertex(fe[ve - 7], fe[ve - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[fe[ve - 5], fe[ve - 3]]]));
          break;
        case 63:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "cylinder");
          break;
        case 64:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "round");
          break;
        case 65:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "diamond");
          break;
        case 66:
          this.$ = fe[ve - 5], je.addVertex(fe[ve - 5], fe[ve - 2], "hexagon");
          break;
        case 67:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "odd");
          break;
        case 68:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "trapezoid");
          break;
        case 69:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "inv_trapezoid");
          break;
        case 70:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "lean_right");
          break;
        case 71:
          this.$ = fe[ve - 3], je.addVertex(fe[ve - 3], fe[ve - 1], "lean_left");
          break;
        case 72:
          this.$ = fe[ve], je.addVertex(fe[ve]);
          break;
        case 73:
          fe[ve - 1].text = fe[ve], this.$ = fe[ve - 1];
          break;
        case 74:
        case 75:
          fe[ve - 2].text = fe[ve - 1], this.$ = fe[ve - 2];
          break;
        case 76:
          this.$ = fe[ve];
          break;
        case 77:
          var br = je.destructLink(fe[ve], fe[ve - 2]);
          this.$ = { type: br.type, stroke: br.stroke, length: br.length, text: fe[ve - 1] };
          break;
        case 78:
          var br = je.destructLink(fe[ve], fe[ve - 2]);
          this.$ = { type: br.type, stroke: br.stroke, length: br.length, text: fe[ve - 1], id: fe[ve - 3] };
          break;
        case 79:
          this.$ = { text: fe[ve], type: "text" };
          break;
        case 80:
          this.$ = { text: fe[ve - 1].text + "" + fe[ve], type: fe[ve - 1].type };
          break;
        case 81:
          this.$ = { text: fe[ve], type: "string" };
          break;
        case 82:
          this.$ = { text: fe[ve], type: "markdown" };
          break;
        case 83:
          var br = je.destructLink(fe[ve]);
          this.$ = { type: br.type, stroke: br.stroke, length: br.length };
          break;
        case 84:
          var br = je.destructLink(fe[ve]);
          this.$ = { type: br.type, stroke: br.stroke, length: br.length, id: fe[ve - 1] };
          break;
        case 85:
          this.$ = fe[ve - 1];
          break;
        case 86:
          this.$ = { text: fe[ve], type: "text" };
          break;
        case 87:
          this.$ = { text: fe[ve - 1].text + "" + fe[ve], type: fe[ve - 1].type };
          break;
        case 88:
          this.$ = { text: fe[ve], type: "string" };
          break;
        case 89:
        case 104:
          this.$ = { text: fe[ve], type: "markdown" };
          break;
        case 101:
          this.$ = { text: fe[ve], type: "text" };
          break;
        case 102:
          this.$ = { text: fe[ve - 1].text + "" + fe[ve], type: fe[ve - 1].type };
          break;
        case 103:
          this.$ = { text: fe[ve], type: "text" };
          break;
        case 105:
          this.$ = fe[ve - 4], je.addClass(fe[ve - 2], fe[ve]);
          break;
        case 106:
          this.$ = fe[ve - 4], je.setClass(fe[ve - 2], fe[ve]);
          break;
        case 107:
        case 115:
          this.$ = fe[ve - 1], je.setClickEvent(fe[ve - 1], fe[ve]);
          break;
        case 108:
        case 116:
          this.$ = fe[ve - 3], je.setClickEvent(fe[ve - 3], fe[ve - 2]), je.setTooltip(fe[ve - 3], fe[ve]);
          break;
        case 109:
          this.$ = fe[ve - 2], je.setClickEvent(fe[ve - 2], fe[ve - 1], fe[ve]);
          break;
        case 110:
          this.$ = fe[ve - 4], je.setClickEvent(fe[ve - 4], fe[ve - 3], fe[ve - 2]), je.setTooltip(fe[ve - 4], fe[ve]);
          break;
        case 111:
          this.$ = fe[ve - 2], je.setLink(fe[ve - 2], fe[ve]);
          break;
        case 112:
          this.$ = fe[ve - 4], je.setLink(fe[ve - 4], fe[ve - 2]), je.setTooltip(fe[ve - 4], fe[ve]);
          break;
        case 113:
          this.$ = fe[ve - 4], je.setLink(fe[ve - 4], fe[ve - 2], fe[ve]);
          break;
        case 114:
          this.$ = fe[ve - 6], je.setLink(fe[ve - 6], fe[ve - 4], fe[ve]), je.setTooltip(fe[ve - 6], fe[ve - 2]);
          break;
        case 117:
          this.$ = fe[ve - 1], je.setLink(fe[ve - 1], fe[ve]);
          break;
        case 118:
          this.$ = fe[ve - 3], je.setLink(fe[ve - 3], fe[ve - 2]), je.setTooltip(fe[ve - 3], fe[ve]);
          break;
        case 119:
          this.$ = fe[ve - 3], je.setLink(fe[ve - 3], fe[ve - 2], fe[ve]);
          break;
        case 120:
          this.$ = fe[ve - 5], je.setLink(fe[ve - 5], fe[ve - 4], fe[ve]), je.setTooltip(fe[ve - 5], fe[ve - 2]);
          break;
        case 121:
          this.$ = fe[ve - 4], je.addVertex(fe[ve - 2], void 0, void 0, fe[ve]);
          break;
        case 122:
          this.$ = fe[ve - 4], je.updateLink([fe[ve - 2]], fe[ve]);
          break;
        case 123:
          this.$ = fe[ve - 4], je.updateLink(fe[ve - 2], fe[ve]);
          break;
        case 124:
          this.$ = fe[ve - 8], je.updateLinkInterpolate([fe[ve - 6]], fe[ve - 2]), je.updateLink([fe[ve - 6]], fe[ve]);
          break;
        case 125:
          this.$ = fe[ve - 8], je.updateLinkInterpolate(fe[ve - 6], fe[ve - 2]), je.updateLink(fe[ve - 6], fe[ve]);
          break;
        case 126:
          this.$ = fe[ve - 6], je.updateLinkInterpolate([fe[ve - 4]], fe[ve]);
          break;
        case 127:
          this.$ = fe[ve - 6], je.updateLinkInterpolate(fe[ve - 4], fe[ve]);
          break;
        case 128:
        case 130:
          this.$ = [fe[ve]];
          break;
        case 129:
        case 131:
          fe[ve - 2].push(fe[ve]), this.$ = fe[ve - 2];
          break;
        case 133:
          this.$ = fe[ve - 1] + fe[ve];
          break;
        case 181:
          this.$ = fe[ve];
          break;
        case 182:
          this.$ = fe[ve - 1] + "" + fe[ve];
          break;
        case 184:
          this.$ = fe[ve - 1] + "" + fe[ve];
          break;
        case 185:
          this.$ = { stmt: "dir", value: "TB" };
          break;
        case 186:
          this.$ = { stmt: "dir", value: "BT" };
          break;
        case 187:
          this.$ = { stmt: "dir", value: "RL" };
          break;
        case 188:
          this.$ = { stmt: "dir", value: "LR" };
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: 2, 9: e, 10: r, 12: n }, { 1: [3] }, t(i, a, { 5: 6 }), { 4: 7, 9: e, 10: r, 12: n }, { 4: 8, 9: e, 10: r, 12: n }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: s, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 33: 24, 34: d, 36: f, 38: p, 42: 28, 43: 38, 44: g, 45: 39, 47: 40, 60: m, 84: v, 85: y, 86: b, 87: w, 88: T, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P, 121: S, 122: R, 123: I, 124: D }, t(i, [2, 9]), t(i, [2, 10]), t(i, [2, 11]), { 8: [1, 54], 9: [1, 55], 10: M, 15: 53, 18: 56 }, t(B, [2, 3]), t(B, [2, 4]), t(B, [2, 5]), t(B, [2, 6]), t(B, [2, 7]), t(B, [2, 8]), { 8: $, 9: F, 11: G, 21: 58, 41: 59, 72: 63, 75: [1, 64], 77: [1, 66], 78: [1, 65] }, { 8: $, 9: F, 11: G, 21: 67 }, { 8: $, 9: F, 11: G, 21: 68 }, { 8: $, 9: F, 11: G, 21: 69 }, { 8: $, 9: F, 11: G, 21: 70 }, { 8: $, 9: F, 11: G, 21: 71 }, { 8: $, 9: F, 10: [1, 72], 11: G, 21: 73 }, t(B, [2, 36]), { 35: [1, 74] }, { 37: [1, 75] }, t(B, [2, 39]), t(H, [2, 50], { 18: 76, 39: 77, 10: M, 40: ee }), { 10: [1, 79] }, { 10: [1, 80] }, { 10: [1, 81] }, { 10: [1, 82] }, { 14: Y, 44: re, 60: ne, 80: [1, 86], 89: he, 95: [1, 83], 97: [1, 84], 101: 85, 105: K, 106: Z, 109: X, 111: q, 114: J, 115: j, 116: pe, 120: 87 }, t(B, [2, 185]), t(B, [2, 186]), t(B, [2, 187]), t(B, [2, 188]), t(te, [2, 51]), t(te, [2, 54], { 46: [1, 99] }), t(Ae, [2, 72], { 113: 112, 29: [1, 100], 44: g, 48: [1, 101], 50: [1, 102], 52: [1, 103], 54: [1, 104], 56: [1, 105], 58: [1, 106], 60: m, 63: [1, 107], 65: [1, 108], 67: [1, 109], 68: [1, 110], 70: [1, 111], 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 114: A, 115: O, 116: P }), t(W, [2, 181]), t(W, [2, 142]), t(W, [2, 143]), t(W, [2, 144]), t(W, [2, 145]), t(W, [2, 146]), t(W, [2, 147]), t(W, [2, 148]), t(W, [2, 149]), t(W, [2, 150]), t(W, [2, 151]), t(W, [2, 152]), t(i, [2, 12]), t(i, [2, 18]), t(i, [2, 19]), { 9: [1, 113] }, t(Oe, [2, 26], { 18: 114, 10: M }), t(B, [2, 27]), { 42: 115, 43: 38, 44: g, 45: 39, 47: 40, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, t(B, [2, 40]), t(B, [2, 41]), t(B, [2, 42]), t(ue, [2, 76], { 73: 116, 62: [1, 118], 74: [1, 117] }), { 76: 119, 79: 120, 80: Ve, 81: Ge, 116: Ue, 119: ke }, { 75: [1, 125], 77: [1, 126] }, t(Pe, [2, 83]), t(B, [2, 28]), t(B, [2, 29]), t(B, [2, 30]), t(B, [2, 31]), t(B, [2, 32]), { 10: Se, 12: _e, 14: ze, 27: me, 28: 127, 32: Me, 44: Q, 60: ce, 75: z, 80: [1, 129], 81: [1, 130], 83: 140, 84: oe, 85: se, 86: ge, 87: de, 88: be, 89: Ce, 90: Te, 91: 128, 105: Ne, 109: Xe, 111: Ye, 114: Ke, 115: Ze, 116: Be }, t(He, a, { 5: 153 }), t(B, [2, 37]), t(B, [2, 38]), t(H, [2, 48], { 44: ht }), t(H, [2, 49], { 18: 155, 10: M, 40: st }), t(te, [2, 44]), { 44: g, 47: 157, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, { 102: [1, 158], 103: 159, 105: [1, 160] }, { 44: g, 47: 161, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, { 44: g, 47: 162, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, t(We, [2, 107], { 10: [1, 163], 96: [1, 164] }), { 80: [1, 165] }, t(We, [2, 115], { 120: 167, 10: [1, 166], 14: Y, 44: re, 60: ne, 89: he, 105: K, 106: Z, 109: X, 111: q, 114: J, 115: j, 116: pe }), t(We, [2, 117], { 10: [1, 168] }), t(kt, [2, 183]), t(kt, [2, 170]), t(kt, [2, 171]), t(kt, [2, 172]), t(kt, [2, 173]), t(kt, [2, 174]), t(kt, [2, 175]), t(kt, [2, 176]), t(kt, [2, 177]), t(kt, [2, 178]), t(kt, [2, 179]), t(kt, [2, 180]), { 44: g, 47: 169, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, { 30: 170, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 178, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 180, 50: [1, 179], 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 181, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 182, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 183, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 109: [1, 184] }, { 30: 185, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 186, 65: [1, 187], 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 188, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 189, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 30: 190, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, t(W, [2, 182]), t(i, [2, 20]), t(Oe, [2, 25]), t(H, [2, 46], { 39: 191, 18: 192, 10: M, 40: ee }), t(ue, [2, 73], { 10: [1, 193] }), { 10: [1, 194] }, { 30: 195, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 77: [1, 196], 79: 197, 116: Ue, 119: ke }, t(Zt, [2, 79]), t(Zt, [2, 81]), t(Zt, [2, 82]), t(Zt, [2, 168]), t(Zt, [2, 169]), { 76: 198, 79: 120, 80: Ve, 81: Ge, 116: Ue, 119: ke }, t(Pe, [2, 84]), { 8: $, 9: F, 10: Se, 11: G, 12: _e, 14: ze, 21: 200, 27: me, 29: [1, 199], 32: Me, 44: Q, 60: ce, 75: z, 83: 140, 84: oe, 85: se, 86: ge, 87: de, 88: be, 89: Ce, 90: Te, 91: 201, 105: Ne, 109: Xe, 111: Ye, 114: Ke, 115: Ze, 116: Be }, t(Ot, [2, 101]), t(Ot, [2, 103]), t(Ot, [2, 104]), t(Ot, [2, 157]), t(Ot, [2, 158]), t(Ot, [2, 159]), t(Ot, [2, 160]), t(Ot, [2, 161]), t(Ot, [2, 162]), t(Ot, [2, 163]), t(Ot, [2, 164]), t(Ot, [2, 165]), t(Ot, [2, 166]), t(Ot, [2, 167]), t(Ot, [2, 90]), t(Ot, [2, 91]), t(Ot, [2, 92]), t(Ot, [2, 93]), t(Ot, [2, 94]), t(Ot, [2, 95]), t(Ot, [2, 96]), t(Ot, [2, 97]), t(Ot, [2, 98]), t(Ot, [2, 99]), t(Ot, [2, 100]), { 6: 11, 7: 12, 8: s, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 32: [1, 202], 33: 24, 34: d, 36: f, 38: p, 42: 28, 43: 38, 44: g, 45: 39, 47: 40, 60: m, 84: v, 85: y, 86: b, 87: w, 88: T, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P, 121: S, 122: R, 123: I, 124: D }, { 10: M, 18: 203 }, { 44: [1, 204] }, t(te, [2, 43]), { 10: [1, 205], 44: g, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 112, 114: A, 115: O, 116: P }, { 10: [1, 206] }, { 10: [1, 207], 106: [1, 208] }, t(tr, [2, 128]), { 10: [1, 209], 44: g, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 112, 114: A, 115: O, 116: P }, { 10: [1, 210], 44: g, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 112, 114: A, 115: O, 116: P }, { 80: [1, 211] }, t(We, [2, 109], { 10: [1, 212] }), t(We, [2, 111], { 10: [1, 213] }), { 80: [1, 214] }, t(kt, [2, 184]), { 80: [1, 215], 98: [1, 216] }, t(te, [2, 55], { 113: 112, 44: g, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 114: A, 115: O, 116: P }), { 31: [1, 217], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, t(xr, [2, 86]), t(xr, [2, 88]), t(xr, [2, 89]), t(xr, [2, 153]), t(xr, [2, 154]), t(xr, [2, 155]), t(xr, [2, 156]), { 49: [1, 219], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 30: 220, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 51: [1, 221], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 53: [1, 222], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 55: [1, 223], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 57: [1, 224], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 60: [1, 225] }, { 64: [1, 226], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 66: [1, 227], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 30: 228, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, { 31: [1, 229], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 67: qe, 69: [1, 230], 71: [1, 231], 82: 218, 116: ut, 117: nt, 118: bt }, { 67: qe, 69: [1, 233], 71: [1, 232], 82: 218, 116: ut, 117: nt, 118: bt }, t(H, [2, 45], { 18: 155, 10: M, 40: st }), t(H, [2, 47], { 44: ht }), t(ue, [2, 75]), t(ue, [2, 74]), { 62: [1, 234], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, t(ue, [2, 77]), t(Zt, [2, 80]), { 77: [1, 235], 79: 197, 116: Ue, 119: ke }, { 30: 236, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, t(He, a, { 5: 237 }), t(Ot, [2, 102]), t(B, [2, 35]), { 43: 238, 44: g, 45: 39, 47: 40, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, { 10: M, 18: 239 }, { 10: rr, 60: Wt, 84: lr, 92: 240, 105: an, 107: 241, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, { 10: rr, 60: Wt, 84: lr, 92: 251, 104: [1, 252], 105: an, 107: 241, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, { 10: rr, 60: Wt, 84: lr, 92: 253, 104: [1, 254], 105: an, 107: 241, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, { 105: [1, 255] }, { 10: rr, 60: Wt, 84: lr, 92: 256, 105: an, 107: 241, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, { 44: g, 47: 257, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, t(We, [2, 108]), { 80: [1, 258] }, { 80: [1, 259], 98: [1, 260] }, t(We, [2, 116]), t(We, [2, 118], { 10: [1, 261] }), t(We, [2, 119]), t(Ae, [2, 56]), t(xr, [2, 87]), t(Ae, [2, 57]), { 51: [1, 262], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, t(Ae, [2, 64]), t(Ae, [2, 59]), t(Ae, [2, 60]), t(Ae, [2, 61]), { 109: [1, 263] }, t(Ae, [2, 63]), t(Ae, [2, 65]), { 66: [1, 264], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, t(Ae, [2, 67]), t(Ae, [2, 68]), t(Ae, [2, 70]), t(Ae, [2, 69]), t(Ae, [2, 71]), t([10, 44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], [2, 85]), t(ue, [2, 78]), { 31: [1, 265], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 6: 11, 7: 12, 8: s, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 32: [1, 266], 33: 24, 34: d, 36: f, 38: p, 42: 28, 43: 38, 44: g, 45: 39, 47: 40, 60: m, 84: v, 85: y, 86: b, 87: w, 88: T, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P, 121: S, 122: R, 123: I, 124: D }, t(te, [2, 53]), { 43: 267, 44: g, 45: 39, 47: 40, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P }, t(We, [2, 121], { 106: sr }), t(Ur, [2, 130], { 108: 269, 10: rr, 60: Wt, 84: lr, 105: an, 109: dt, 110: Ee, 111: Je, 112: wt }), t(cr, [2, 132]), t(cr, [2, 134]), t(cr, [2, 135]), t(cr, [2, 136]), t(cr, [2, 137]), t(cr, [2, 138]), t(cr, [2, 139]), t(cr, [2, 140]), t(cr, [2, 141]), t(We, [2, 122], { 106: sr }), { 10: [1, 270] }, t(We, [2, 123], { 106: sr }), { 10: [1, 271] }, t(tr, [2, 129]), t(We, [2, 105], { 106: sr }), t(We, [2, 106], { 113: 112, 44: g, 60: m, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 114: A, 115: O, 116: P }), t(We, [2, 110]), t(We, [2, 112], { 10: [1, 272] }), t(We, [2, 113]), { 98: [1, 273] }, { 51: [1, 274] }, { 62: [1, 275] }, { 66: [1, 276] }, { 8: $, 9: F, 11: G, 21: 277 }, t(B, [2, 34]), t(te, [2, 52]), { 10: rr, 60: Wt, 84: lr, 105: an, 107: 278, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, t(cr, [2, 133]), { 14: Y, 44: re, 60: ne, 89: he, 101: 279, 105: K, 106: Z, 109: X, 111: q, 114: J, 115: j, 116: pe, 120: 87 }, { 14: Y, 44: re, 60: ne, 89: he, 101: 280, 105: K, 106: Z, 109: X, 111: q, 114: J, 115: j, 116: pe, 120: 87 }, { 98: [1, 281] }, t(We, [2, 120]), t(Ae, [2, 58]), { 30: 282, 67: qe, 80: rt, 81: ct, 82: 171, 116: ut, 117: nt, 118: bt }, t(Ae, [2, 66]), t(He, a, { 5: 283 }), t(Ur, [2, 131], { 108: 269, 10: rr, 60: Wt, 84: lr, 105: an, 109: dt, 110: Ee, 111: Je, 112: wt }), t(We, [2, 126], { 120: 167, 10: [1, 284], 14: Y, 44: re, 60: ne, 89: he, 105: K, 106: Z, 109: X, 111: q, 114: J, 115: j, 116: pe }), t(We, [2, 127], { 120: 167, 10: [1, 285], 14: Y, 44: re, 60: ne, 89: he, 105: K, 106: Z, 109: X, 111: q, 114: J, 115: j, 116: pe }), t(We, [2, 114]), { 31: [1, 286], 67: qe, 82: 218, 116: ut, 117: nt, 118: bt }, { 6: 11, 7: 12, 8: s, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 32: [1, 287], 33: 24, 34: d, 36: f, 38: p, 42: 28, 43: 38, 44: g, 45: 39, 47: 40, 60: m, 84: v, 85: y, 86: b, 87: w, 88: T, 89: E, 102: C, 105: k, 106: _, 109: L, 111: N, 113: 41, 114: A, 115: O, 116: P, 121: S, 122: R, 123: I, 124: D }, { 10: rr, 60: Wt, 84: lr, 92: 288, 105: an, 107: 241, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, { 10: rr, 60: Wt, 84: lr, 92: 289, 105: an, 107: 241, 108: 242, 109: dt, 110: Ee, 111: Je, 112: wt }, t(Ae, [2, 62]), t(B, [2, 33]), t(We, [2, 124], { 106: sr }), t(We, [2, 125], { 106: sr })],
    defaultActions: {},
    parseError: /* @__PURE__ */ x(function(pt, Tt) {
      if (Tt.recoverable)
        this.trace(pt);
      else {
        var lt = new Error(pt);
        throw lt.hash = Tt, lt;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(pt) {
      var Tt = this, lt = [0], je = [], jt = [null], fe = [], cl = this.table, ve = "", br = 0, b1 = 0, C7 = 2, w1 = 1, KY = fe.slice.call(arguments, 1), qn = Object.create(this.lexer), wc = { yy: {} };
      for (var Tb in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Tb) && (wc.yy[Tb] = this.yy[Tb]);
      qn.setInput(pt, wc.yy), wc.yy.lexer = qn, wc.yy.parser = this, typeof qn.yylloc > "u" && (qn.yylloc = {});
      var Eb = qn.yylloc;
      fe.push(Eb);
      var ZY = qn.options && qn.options.ranges;
      typeof wc.yy.parseError == "function" ? this.parseError = wc.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function QY(ba) {
        lt.length = lt.length - 2 * ba, jt.length = jt.length - ba, fe.length = fe.length - ba;
      }
      x(QY, "popStack");
      function A7() {
        var ba;
        return ba = je.pop() || qn.lex() || w1, typeof ba != "number" && (ba instanceof Array && (je = ba, ba = je.pop()), ba = Tt.symbols_[ba] || ba), ba;
      }
      x(A7, "lex");
      for (var ea, Tc, Fa, kb, ju = {}, T1, po, _7, E1; ; ) {
        if (Tc = lt[lt.length - 1], this.defaultActions[Tc] ? Fa = this.defaultActions[Tc] : ((ea === null || typeof ea > "u") && (ea = A7()), Fa = cl[Tc] && cl[Tc][ea]), typeof Fa > "u" || !Fa.length || !Fa[0]) {
          var Sb = "";
          E1 = [];
          for (T1 in cl[Tc])
            this.terminals_[T1] && T1 > C7 && E1.push("'" + this.terminals_[T1] + "'");
          qn.showPosition ? Sb = "Parse error on line " + (br + 1) + `:
` + qn.showPosition() + `
Expecting ` + E1.join(", ") + ", got '" + (this.terminals_[ea] || ea) + "'" : Sb = "Parse error on line " + (br + 1) + ": Unexpected " + (ea == w1 ? "end of input" : "'" + (this.terminals_[ea] || ea) + "'"), this.parseError(Sb, {
            text: qn.match,
            token: this.terminals_[ea] || ea,
            line: qn.yylineno,
            loc: Eb,
            expected: E1
          });
        }
        if (Fa[0] instanceof Array && Fa.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Tc + ", token: " + ea);
        switch (Fa[0]) {
          case 1:
            lt.push(ea), jt.push(qn.yytext), fe.push(qn.yylloc), lt.push(Fa[1]), ea = null, b1 = qn.yyleng, ve = qn.yytext, br = qn.yylineno, Eb = qn.yylloc;
            break;
          case 2:
            if (po = this.productions_[Fa[1]][1], ju.$ = jt[jt.length - po], ju._$ = {
              first_line: fe[fe.length - (po || 1)].first_line,
              last_line: fe[fe.length - 1].last_line,
              first_column: fe[fe.length - (po || 1)].first_column,
              last_column: fe[fe.length - 1].last_column
            }, ZY && (ju._$.range = [
              fe[fe.length - (po || 1)].range[0],
              fe[fe.length - 1].range[1]
            ]), kb = this.performAction.apply(ju, [
              ve,
              b1,
              br,
              wc.yy,
              Fa[1],
              jt,
              fe
            ].concat(KY)), typeof kb < "u")
              return kb;
            po && (lt = lt.slice(0, -1 * po * 2), jt = jt.slice(0, -1 * po), fe = fe.slice(0, -1 * po)), lt.push(this.productions_[Fa[1]][0]), jt.push(ju.$), fe.push(ju._$), _7 = cl[lt[lt.length - 2]][lt[lt.length - 1]], lt.push(_7);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, pi = /* @__PURE__ */ function() {
    var bn = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(Tt, lt) {
        if (this.yy.parser)
          this.yy.parser.parseError(Tt, lt);
        else
          throw new Error(Tt);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(pt, Tt) {
        return this.yy = Tt || 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;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var pt = this._input[0];
        this.yytext += pt, this.yyleng++, this.offset++, this.match += pt, this.matched += pt;
        var Tt = pt.match(/(?:\r\n?|\n).*/g);
        return Tt ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), pt;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(pt) {
        var Tt = pt.length, lt = pt.split(/(?:\r\n?|\n)/g);
        this._input = pt + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - Tt), this.offset -= Tt;
        var je = 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), lt.length - 1 && (this.yylineno -= lt.length - 1);
        var jt = 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: lt ? (lt.length === je.length ? this.yylloc.first_column : 0) + je[je.length - lt.length].length - lt[0].length : this.yylloc.first_column - Tt
        }, this.options.ranges && (this.yylloc.range = [jt[0], jt[0] + this.yyleng - Tt]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(pt) {
        this.unput(this.match.slice(pt));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var pt = this.matched.substr(0, this.matched.length - this.match.length);
        return (pt.length > 20 ? "..." : "") + pt.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(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, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var pt = this.pastInput(), Tt = new Array(pt.length + 1).join("-");
        return pt + this.upcomingInput() + `
` + Tt + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(pt, Tt) {
        var lt, je, jt;
        if (this.options.backtrack_lexer && (jt = {
          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 && (jt.yylloc.range = this.yylloc.range.slice(0))), je = pt[0].match(/(?:\r\n?|\n).*/g), je && (this.yylineno += je.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: je ? je[je.length - 1].length - je[je.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], lt = this.performAction.call(this, this.yy, this, Tt, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), lt)
          return lt;
        if (this._backtrack) {
          for (var fe in jt)
            this[fe] = jt[fe];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var pt, Tt, lt, je;
        this._more || (this.yytext = "", this.match = "");
        for (var jt = this._currentRules(), fe = 0; fe < jt.length; fe++)
          if (lt = this._input.match(this.rules[jt[fe]]), lt && (!Tt || lt[0].length > Tt[0].length)) {
            if (Tt = lt, je = fe, this.options.backtrack_lexer) {
              if (pt = this.test_match(lt, jt[fe]), pt !== !1)
                return pt;
              if (this._backtrack) {
                Tt = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return Tt ? (pt = this.test_match(Tt, jt[je]), 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
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var Tt = this.next();
        return Tt || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(Tt) {
        this.conditionStack.push(Tt);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var Tt = this.conditionStack.length - 1;
        return Tt > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(Tt) {
        return Tt = this.conditionStack.length - 1 - Math.abs(Tt || 0), Tt >= 0 ? this.conditionStack[Tt] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(Tt) {
        this.begin(Tt);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: {},
      performAction: /* @__PURE__ */ x(function(Tt, lt, je, jt) {
        switch (je) {
          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:
            return this.pushState("shapeData"), lt.yytext = "", 40;
          case 8:
            return this.pushState("shapeDataStr"), 40;
          case 9:
            return this.popState(), 40;
          case 10:
            const fe = /\n\s*/g;
            return lt.yytext = lt.yytext.replace(fe, "<br/>"), 40;
          case 11:
            return 40;
          case 12:
            this.popState();
            break;
          case 13:
            this.begin("callbackname");
            break;
          case 14:
            this.popState();
            break;
          case 15:
            this.popState(), this.begin("callbackargs");
            break;
          case 16:
            return 95;
          case 17:
            this.popState();
            break;
          case 18:
            return 96;
          case 19:
            return "MD_STR";
          case 20:
            this.popState();
            break;
          case 21:
            this.begin("md_string");
            break;
          case 22:
            return "STR";
          case 23:
            this.popState();
            break;
          case 24:
            this.pushState("string");
            break;
          case 25:
            return 84;
          case 26:
            return 102;
          case 27:
            return 85;
          case 28:
            return 104;
          case 29:
            return 86;
          case 30:
            return 87;
          case 31:
            return 97;
          case 32:
            this.begin("click");
            break;
          case 33:
            this.popState();
            break;
          case 34:
            return 88;
          case 35:
            return Tt.lex.firstGraph() && this.begin("dir"), 12;
          case 36:
            return Tt.lex.firstGraph() && this.begin("dir"), 12;
          case 37:
            return Tt.lex.firstGraph() && this.begin("dir"), 12;
          case 38:
            return 27;
          case 39:
            return 32;
          case 40:
            return 98;
          case 41:
            return 98;
          case 42:
            return 98;
          case 43:
            return 98;
          case 44:
            return this.popState(), 13;
          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 this.popState(), 14;
          case 50:
            return this.popState(), 14;
          case 51:
            return this.popState(), 14;
          case 52:
            return this.popState(), 14;
          case 53:
            return this.popState(), 14;
          case 54:
            return this.popState(), 14;
          case 55:
            return 121;
          case 56:
            return 122;
          case 57:
            return 123;
          case 58:
            return 124;
          case 59:
            return 78;
          case 60:
            return 105;
          case 61:
            return 111;
          case 62:
            return 46;
          case 63:
            return 60;
          case 64:
            return 44;
          case 65:
            return 8;
          case 66:
            return 106;
          case 67:
            return 115;
          case 68:
            return this.popState(), 77;
          case 69:
            return this.pushState("edgeText"), 75;
          case 70:
            return 119;
          case 71:
            return this.popState(), 77;
          case 72:
            return this.pushState("thickEdgeText"), 75;
          case 73:
            return 119;
          case 74:
            return this.popState(), 77;
          case 75:
            return this.pushState("dottedEdgeText"), 75;
          case 76:
            return 119;
          case 77:
            return 77;
          case 78:
            return this.popState(), 53;
          case 79:
            return "TEXT";
          case 80:
            return this.pushState("ellipseText"), 52;
          case 81:
            return this.popState(), 55;
          case 82:
            return this.pushState("text"), 54;
          case 83:
            return this.popState(), 57;
          case 84:
            return this.pushState("text"), 56;
          case 85:
            return 58;
          case 86:
            return this.pushState("text"), 67;
          case 87:
            return this.popState(), 64;
          case 88:
            return this.pushState("text"), 63;
          case 89:
            return this.popState(), 49;
          case 90:
            return this.pushState("text"), 48;
          case 91:
            return this.popState(), 69;
          case 92:
            return this.popState(), 71;
          case 93:
            return 117;
          case 94:
            return this.pushState("trapText"), 68;
          case 95:
            return this.pushState("trapText"), 70;
          case 96:
            return 118;
          case 97:
            return 67;
          case 98:
            return 90;
          case 99:
            return "SEP";
          case 100:
            return 89;
          case 101:
            return 115;
          case 102:
            return 111;
          case 103:
            return 44;
          case 104:
            return 109;
          case 105:
            return 114;
          case 106:
            return 116;
          case 107:
            return this.popState(), 62;
          case 108:
            return this.pushState("text"), 62;
          case 109:
            return this.popState(), 51;
          case 110:
            return this.pushState("text"), 50;
          case 111:
            return this.popState(), 31;
          case 112:
            return this.pushState("text"), 29;
          case 113:
            return this.popState(), 66;
          case 114:
            return this.pushState("text"), 65;
          case 115:
            return "TEXT";
          case 116:
            return "QUOTE";
          case 117:
            return 9;
          case 118:
            return 10;
          case 119:
            return 11;
        }
      }, "anonymous"),
      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]*)/, /^(?:[^\s\"]+@(?=[^\{\"]))/, /^(?:[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: { shapeDataEndBracket: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, shapeDataStr: { rules: [9, 10, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, shapeData: { rules: [8, 11, 12, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, callbackargs: { rules: [17, 18, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, callbackname: { rules: [14, 15, 16, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, href: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, click: { rules: [21, 24, 33, 34, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, dottedEdgeText: { rules: [21, 24, 74, 76, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, thickEdgeText: { rules: [21, 24, 71, 73, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, edgeText: { rules: [21, 24, 68, 70, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, trapText: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 91, 92, 93, 94, 95, 108, 110, 112, 114], inclusive: !1 }, ellipseText: { rules: [21, 24, 77, 78, 79, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, text: { rules: [21, 24, 77, 80, 81, 82, 83, 84, 87, 88, 89, 90, 94, 95, 107, 108, 109, 110, 111, 112, 113, 114, 115], inclusive: !1 }, vertex: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, dir: { rules: [21, 24, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, acc_descr_multiline: { rules: [5, 6, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, acc_descr: { rules: [3, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, acc_title: { rules: [1, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, md_string: { rules: [19, 20, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, string: { rules: [21, 22, 23, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 13, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 74, 75, 77, 80, 82, 84, 85, 86, 88, 90, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 108, 110, 112, 114, 116, 117, 118, 119], inclusive: !0 } }
    };
    return bn;
  }();
  Yr.lexer = pi;
  function xn() {
    this.yy = {};
  }
  return x(xn, "Parser"), xn.prototype = Yr, Yr.Parser = xn, new xn();
}();
LT.parser = LT;
var dU = LT, fU = Object.assign({}, dU);
fU.parse = (t) => {
  const e = t.replace(/}\s*\n/g, `}
`);
  return dU.parse(e);
};
var n5e = fU, i5e = /* @__PURE__ */ x((t, e) => {
  const r = K6, n = r(t, "r"), i = r(t, "g"), a = r(t, "b");
  return _l(n, i, a, e);
}, "fade"), a5e = /* @__PURE__ */ x((t) => `.label {
    font-family: ${t.fontFamily};
    color: ${t.nodeTextColor || t.textColor};
  }
  .cluster-label text {
    fill: ${t.titleColor};
  }
  .cluster-label span {
    color: ${t.titleColor};
  }
  .cluster-label span p {
    background-color: transparent;
  }

  .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;
  }
  .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label {
    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;
  }

  .rough-node .label,.node .label, .image-shape .label, .icon-shape .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }


  .root .anchor path {
    fill: ${t.lineColor} !important;
    stroke-width: 0;
    stroke: ${t.lineColor};
  }

  .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};
    p {
      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: ${i5e(t.edgeLabelBackground, 0.5)};
    // background-color:
  }

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

  rect.text {
    fill: none;
    stroke-width: 0;
  }

  .icon-shape, .image-shape {
    background-color: ${t.edgeLabelBackground};
    p {
      background-color: ${t.edgeLabelBackground};
      padding: 2px;
    }
    rect {
      opacity: 0.5;
      background-color: ${t.edgeLabelBackground};
      fill: ${t.edgeLabelBackground};
    }
    text-align: center;
  }
  ${l1()}
`, "getStyles"), s5e = a5e, o5e = {
  parser: n5e,
  get db() {
    return new J3e();
  },
  renderer: r5e,
  styles: s5e,
  init: /* @__PURE__ */ x((t) => {
    t.flowchart || (t.flowchart = {}), t.layout && K5({ layout: t.layout }), t.flowchart.arrowMarkerAbsolute = t.arrowMarkerAbsolute, K5({ flowchart: { arrowMarkerAbsolute: t.arrowMarkerAbsolute } });
  }, "init")
};
const bS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: o5e
}, Symbol.toStringTag, { value: "Module" }));
var RT = function() {
  var t = /* @__PURE__ */ x(function(q, J, j, pe) {
    for (j = j || {}, pe = q.length; pe--; j[q[pe]] = J) ;
    return j;
  }, "o"), e = [6, 8, 10, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 50], r = [1, 10], n = [1, 11], i = [1, 12], a = [1, 13], s = [1, 20], o = [1, 21], l = [1, 22], u = [1, 23], h = [1, 24], d = [1, 19], f = [1, 25], p = [1, 26], g = [1, 18], m = [1, 33], v = [1, 34], y = [1, 35], b = [1, 36], w = [1, 37], T = [6, 8, 10, 13, 15, 17, 20, 21, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 50, 63, 64, 65, 66, 67], E = [1, 42], C = [1, 43], k = [1, 52], _ = [40, 50, 68, 69], L = [1, 63], N = [1, 61], A = [1, 58], O = [1, 62], P = [1, 64], S = [6, 8, 10, 13, 17, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 48, 49, 50, 63, 64, 65, 66, 67], R = [63, 64, 65, 66, 67], I = [1, 81], D = [1, 80], M = [1, 78], B = [1, 79], $ = [6, 10, 42, 47], F = [6, 10, 13, 41, 42, 47, 48, 49], G = [1, 89], H = [1, 88], ee = [1, 87], Y = [19, 56], re = [1, 98], ne = [1, 97], he = [19, 56, 58, 60], K = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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, COLON: 13, role: 14, STYLE_SEPARATOR: 15, idList: 16, BLOCK_START: 17, attributes: 18, BLOCK_STOP: 19, SQS: 20, SQE: 21, title: 22, title_value: 23, acc_title: 24, acc_title_value: 25, acc_descr: 26, acc_descr_value: 27, acc_descr_multiline_value: 28, direction: 29, classDefStatement: 30, classStatement: 31, styleStatement: 32, direction_tb: 33, direction_bt: 34, direction_rl: 35, direction_lr: 36, CLASSDEF: 37, stylesOpt: 38, separator: 39, UNICODE_TEXT: 40, STYLE_TEXT: 41, COMMA: 42, CLASS: 43, STYLE: 44, style: 45, styleComponent: 46, SEMI: 47, NUM: 48, BRKT: 49, ENTITY_NAME: 50, attribute: 51, attributeType: 52, attributeName: 53, attributeKeyTypeList: 54, attributeComment: 55, ATTRIBUTE_WORD: 56, attributeKeyType: 57, ",": 58, ATTRIBUTE_KEY: 59, COMMENT: 60, cardinality: 61, relType: 62, ZERO_OR_ONE: 63, ZERO_OR_MORE: 64, ONE_OR_MORE: 65, ONLY_ONE: 66, MD_PARENT: 67, NON_IDENTIFYING: 68, IDENTIFYING: 69, WORD: 70, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: "COLON", 15: "STYLE_SEPARATOR", 17: "BLOCK_START", 19: "BLOCK_STOP", 20: "SQS", 21: "SQE", 22: "title", 23: "title_value", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "direction_tb", 34: "direction_bt", 35: "direction_rl", 36: "direction_lr", 37: "CLASSDEF", 40: "UNICODE_TEXT", 41: "STYLE_TEXT", 42: "COMMA", 43: "CLASS", 44: "STYLE", 47: "SEMI", 48: "NUM", 49: "BRKT", 50: "ENTITY_NAME", 56: "ATTRIBUTE_WORD", 58: ",", 59: "ATTRIBUTE_KEY", 60: "COMMENT", 63: "ZERO_OR_ONE", 64: "ZERO_OR_MORE", 65: "ONE_OR_MORE", 66: "ONLY_ONE", 67: "MD_PARENT", 68: "NON_IDENTIFYING", 69: "IDENTIFYING", 70: "WORD" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 9], [9, 7], [9, 7], [9, 4], [9, 6], [9, 3], [9, 5], [9, 1], [9, 3], [9, 7], [9, 9], [9, 6], [9, 8], [9, 4], [9, 6], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [29, 1], [29, 1], [29, 1], [29, 1], [30, 4], [16, 1], [16, 1], [16, 3], [16, 3], [31, 3], [32, 4], [38, 1], [38, 3], [45, 1], [45, 2], [39, 1], [39, 1], [39, 1], [46, 1], [46, 1], [46, 1], [46, 1], [11, 1], [11, 1], [18, 1], [18, 2], [51, 2], [51, 3], [51, 3], [51, 4], [52, 1], [53, 1], [54, 1], [54, 3], [57, 1], [55, 1], [12, 3], [61, 1], [61, 1], [61, 1], [61, 1], [61, 1], [62, 1], [62, 1], [14, 1], [14, 1], [14, 1]],
    performAction: /* @__PURE__ */ x(function(J, j, pe, te, Ae, W, Oe) {
      var ue = W.length - 1;
      switch (Ae) {
        case 1:
          break;
        case 2:
          this.$ = [];
          break;
        case 3:
          W[ue - 1].push(W[ue]), this.$ = W[ue - 1];
          break;
        case 4:
        case 5:
          this.$ = W[ue];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          te.addEntity(W[ue - 4]), te.addEntity(W[ue - 2]), te.addRelationship(W[ue - 4], W[ue], W[ue - 2], W[ue - 3]);
          break;
        case 9:
          te.addEntity(W[ue - 8]), te.addEntity(W[ue - 4]), te.addRelationship(W[ue - 8], W[ue], W[ue - 4], W[ue - 5]), te.setClass([W[ue - 8]], W[ue - 6]), te.setClass([W[ue - 4]], W[ue - 2]);
          break;
        case 10:
          te.addEntity(W[ue - 6]), te.addEntity(W[ue - 2]), te.addRelationship(W[ue - 6], W[ue], W[ue - 2], W[ue - 3]), te.setClass([W[ue - 6]], W[ue - 4]);
          break;
        case 11:
          te.addEntity(W[ue - 6]), te.addEntity(W[ue - 4]), te.addRelationship(W[ue - 6], W[ue], W[ue - 4], W[ue - 5]), te.setClass([W[ue - 4]], W[ue - 2]);
          break;
        case 12:
          te.addEntity(W[ue - 3]), te.addAttributes(W[ue - 3], W[ue - 1]);
          break;
        case 13:
          te.addEntity(W[ue - 5]), te.addAttributes(W[ue - 5], W[ue - 1]), te.setClass([W[ue - 5]], W[ue - 3]);
          break;
        case 14:
          te.addEntity(W[ue - 2]);
          break;
        case 15:
          te.addEntity(W[ue - 4]), te.setClass([W[ue - 4]], W[ue - 2]);
          break;
        case 16:
          te.addEntity(W[ue]);
          break;
        case 17:
          te.addEntity(W[ue - 2]), te.setClass([W[ue - 2]], W[ue]);
          break;
        case 18:
          te.addEntity(W[ue - 6], W[ue - 4]), te.addAttributes(W[ue - 6], W[ue - 1]);
          break;
        case 19:
          te.addEntity(W[ue - 8], W[ue - 6]), te.addAttributes(W[ue - 8], W[ue - 1]), te.setClass([W[ue - 8]], W[ue - 3]);
          break;
        case 20:
          te.addEntity(W[ue - 5], W[ue - 3]);
          break;
        case 21:
          te.addEntity(W[ue - 7], W[ue - 5]), te.setClass([W[ue - 7]], W[ue - 2]);
          break;
        case 22:
          te.addEntity(W[ue - 3], W[ue - 1]);
          break;
        case 23:
          te.addEntity(W[ue - 5], W[ue - 3]), te.setClass([W[ue - 5]], W[ue]);
          break;
        case 24:
        case 25:
          this.$ = W[ue].trim(), te.setAccTitle(this.$);
          break;
        case 26:
        case 27:
          this.$ = W[ue].trim(), te.setAccDescription(this.$);
          break;
        case 32:
          te.setDirection("TB");
          break;
        case 33:
          te.setDirection("BT");
          break;
        case 34:
          te.setDirection("RL");
          break;
        case 35:
          te.setDirection("LR");
          break;
        case 36:
          this.$ = W[ue - 3], te.addClass(W[ue - 2], W[ue - 1]);
          break;
        case 37:
        case 38:
        case 56:
        case 64:
          this.$ = [W[ue]];
          break;
        case 39:
        case 40:
          this.$ = W[ue - 2].concat([W[ue]]);
          break;
        case 41:
          this.$ = W[ue - 2], te.setClass(W[ue - 1], W[ue]);
          break;
        case 42:
          this.$ = W[ue - 3], te.addCssStyles(W[ue - 2], W[ue - 1]);
          break;
        case 43:
          this.$ = [W[ue]];
          break;
        case 44:
          W[ue - 2].push(W[ue]), this.$ = W[ue - 2];
          break;
        case 46:
          this.$ = W[ue - 1] + W[ue];
          break;
        case 54:
        case 76:
        case 77:
          this.$ = W[ue].replace(/"/g, "");
          break;
        case 55:
        case 78:
          this.$ = W[ue];
          break;
        case 57:
          W[ue].push(W[ue - 1]), this.$ = W[ue];
          break;
        case 58:
          this.$ = { type: W[ue - 1], name: W[ue] };
          break;
        case 59:
          this.$ = { type: W[ue - 2], name: W[ue - 1], keys: W[ue] };
          break;
        case 60:
          this.$ = { type: W[ue - 2], name: W[ue - 1], comment: W[ue] };
          break;
        case 61:
          this.$ = { type: W[ue - 3], name: W[ue - 2], keys: W[ue - 1], comment: W[ue] };
          break;
        case 62:
        case 63:
        case 66:
          this.$ = W[ue];
          break;
        case 65:
          W[ue - 2].push(W[ue]), this.$ = W[ue - 2];
          break;
        case 67:
          this.$ = W[ue].replace(/"/g, "");
          break;
        case 68:
          this.$ = { cardA: W[ue], relType: W[ue - 1], cardB: W[ue - 2] };
          break;
        case 69:
          this.$ = te.Cardinality.ZERO_OR_ONE;
          break;
        case 70:
          this.$ = te.Cardinality.ZERO_OR_MORE;
          break;
        case 71:
          this.$ = te.Cardinality.ONE_OR_MORE;
          break;
        case 72:
          this.$ = te.Cardinality.ONLY_ONE;
          break;
        case 73:
          this.$ = te.Cardinality.MD_PARENT;
          break;
        case 74:
          this.$ = te.Identification.NON_IDENTIFYING;
          break;
        case 75:
          this.$ = te.Identification.IDENTIFYING;
          break;
      }
    }, "anonymous"),
    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, 22: r, 24: n, 26: i, 28: a, 29: 14, 30: 15, 31: 16, 32: 17, 33: s, 34: o, 35: l, 36: u, 37: h, 40: d, 43: f, 44: p, 50: g }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 27, 11: 9, 22: r, 24: n, 26: i, 28: a, 29: 14, 30: 15, 31: 16, 32: 17, 33: s, 34: o, 35: l, 36: u, 37: h, 40: d, 43: f, 44: p, 50: g }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 16], { 12: 28, 61: 32, 15: [1, 29], 17: [1, 30], 20: [1, 31], 63: m, 64: v, 65: y, 66: b, 67: w }), { 23: [1, 38] }, { 25: [1, 39] }, { 27: [1, 40] }, t(e, [2, 27]), t(e, [2, 28]), t(e, [2, 29]), t(e, [2, 30]), t(e, [2, 31]), t(T, [2, 54]), t(T, [2, 55]), t(e, [2, 32]), t(e, [2, 33]), t(e, [2, 34]), t(e, [2, 35]), { 16: 41, 40: E, 41: C }, { 16: 44, 40: E, 41: C }, { 16: 45, 40: E, 41: C }, t(e, [2, 4]), { 11: 46, 40: d, 50: g }, { 16: 47, 40: E, 41: C }, { 18: 48, 19: [1, 49], 51: 50, 52: 51, 56: k }, { 11: 53, 40: d, 50: g }, { 62: 54, 68: [1, 55], 69: [1, 56] }, t(_, [2, 69]), t(_, [2, 70]), t(_, [2, 71]), t(_, [2, 72]), t(_, [2, 73]), t(e, [2, 24]), t(e, [2, 25]), t(e, [2, 26]), { 13: L, 38: 57, 41: N, 42: A, 45: 59, 46: 60, 48: O, 49: P }, t(S, [2, 37]), t(S, [2, 38]), { 16: 65, 40: E, 41: C, 42: A }, { 13: L, 38: 66, 41: N, 42: A, 45: 59, 46: 60, 48: O, 49: P }, { 13: [1, 67], 15: [1, 68] }, t(e, [2, 17], { 61: 32, 12: 69, 17: [1, 70], 42: A, 63: m, 64: v, 65: y, 66: b, 67: w }), { 19: [1, 71] }, t(e, [2, 14]), { 18: 72, 19: [2, 56], 51: 50, 52: 51, 56: k }, { 53: 73, 56: [1, 74] }, { 56: [2, 62] }, { 21: [1, 75] }, { 61: 76, 63: m, 64: v, 65: y, 66: b, 67: w }, t(R, [2, 74]), t(R, [2, 75]), { 6: I, 10: D, 39: 77, 42: M, 47: B }, { 40: [1, 82], 41: [1, 83] }, t($, [2, 43], { 46: 84, 13: L, 41: N, 48: O, 49: P }), t(F, [2, 45]), t(F, [2, 50]), t(F, [2, 51]), t(F, [2, 52]), t(F, [2, 53]), t(e, [2, 41], { 42: A }), { 6: I, 10: D, 39: 85, 42: M, 47: B }, { 14: 86, 40: G, 50: H, 70: ee }, { 16: 90, 40: E, 41: C }, { 11: 91, 40: d, 50: g }, { 18: 92, 19: [1, 93], 51: 50, 52: 51, 56: k }, t(e, [2, 12]), { 19: [2, 57] }, t(Y, [2, 58], { 54: 94, 55: 95, 57: 96, 59: re, 60: ne }), t([19, 56, 59, 60], [2, 63]), t(e, [2, 22], { 15: [1, 100], 17: [1, 99] }), t([40, 50], [2, 68]), t(e, [2, 36]), { 13: L, 41: N, 45: 101, 46: 60, 48: O, 49: P }, t(e, [2, 47]), t(e, [2, 48]), t(e, [2, 49]), t(S, [2, 39]), t(S, [2, 40]), t(F, [2, 46]), t(e, [2, 42]), t(e, [2, 8]), t(e, [2, 76]), t(e, [2, 77]), t(e, [2, 78]), { 13: [1, 102], 42: A }, { 13: [1, 104], 15: [1, 103] }, { 19: [1, 105] }, t(e, [2, 15]), t(Y, [2, 59], { 55: 106, 58: [1, 107], 60: ne }), t(Y, [2, 60]), t(he, [2, 64]), t(Y, [2, 67]), t(he, [2, 66]), { 18: 108, 19: [1, 109], 51: 50, 52: 51, 56: k }, { 16: 110, 40: E, 41: C }, t($, [2, 44], { 46: 84, 13: L, 41: N, 48: O, 49: P }), { 14: 111, 40: G, 50: H, 70: ee }, { 16: 112, 40: E, 41: C }, { 14: 113, 40: G, 50: H, 70: ee }, t(e, [2, 13]), t(Y, [2, 61]), { 57: 114, 59: re }, { 19: [1, 115] }, t(e, [2, 20]), t(e, [2, 23], { 17: [1, 116], 42: A }), t(e, [2, 11]), { 13: [1, 117], 42: A }, t(e, [2, 10]), t(he, [2, 65]), t(e, [2, 18]), { 18: 118, 19: [1, 119], 51: 50, 52: 51, 56: k }, { 14: 120, 40: G, 50: H, 70: ee }, { 19: [1, 121] }, t(e, [2, 21]), t(e, [2, 9]), t(e, [2, 19])],
    defaultActions: { 52: [2, 62], 72: [2, 57] },
    parseError: /* @__PURE__ */ x(function(J, j) {
      if (j.recoverable)
        this.trace(J);
      else {
        var pe = new Error(J);
        throw pe.hash = j, pe;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(J) {
      var j = this, pe = [0], te = [], Ae = [null], W = [], Oe = this.table, ue = "", Ve = 0, Ge = 0, Ue = 2, ke = 1, Pe = W.slice.call(arguments, 1), Se = Object.create(this.lexer), _e = { yy: {} };
      for (var ze in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, ze) && (_e.yy[ze] = this.yy[ze]);
      Se.setInput(J, _e.yy), _e.yy.lexer = Se, _e.yy.parser = this, typeof Se.yylloc > "u" && (Se.yylloc = {});
      var me = Se.yylloc;
      W.push(me);
      var Me = Se.options && Se.options.ranges;
      typeof _e.yy.parseError == "function" ? this.parseError = _e.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Q(Ye) {
        pe.length = pe.length - 2 * Ye, Ae.length = Ae.length - Ye, W.length = W.length - Ye;
      }
      x(Q, "popStack");
      function ce() {
        var Ye;
        return Ye = te.pop() || Se.lex() || ke, typeof Ye != "number" && (Ye instanceof Array && (te = Ye, Ye = te.pop()), Ye = j.symbols_[Ye] || Ye), Ye;
      }
      x(ce, "lex");
      for (var z, oe, se, ge, de = {}, be, Ce, Te, Ne; ; ) {
        if (oe = pe[pe.length - 1], this.defaultActions[oe] ? se = this.defaultActions[oe] : ((z === null || typeof z > "u") && (z = ce()), se = Oe[oe] && Oe[oe][z]), typeof se > "u" || !se.length || !se[0]) {
          var Xe = "";
          Ne = [];
          for (be in Oe[oe])
            this.terminals_[be] && be > Ue && Ne.push("'" + this.terminals_[be] + "'");
          Se.showPosition ? Xe = "Parse error on line " + (Ve + 1) + `:
` + Se.showPosition() + `
Expecting ` + Ne.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Xe = "Parse error on line " + (Ve + 1) + ": Unexpected " + (z == ke ? "end of input" : "'" + (this.terminals_[z] || z) + "'"), this.parseError(Xe, {
            text: Se.match,
            token: this.terminals_[z] || z,
            line: Se.yylineno,
            loc: me,
            expected: Ne
          });
        }
        if (se[0] instanceof Array && se.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + oe + ", token: " + z);
        switch (se[0]) {
          case 1:
            pe.push(z), Ae.push(Se.yytext), W.push(Se.yylloc), pe.push(se[1]), z = null, Ge = Se.yyleng, ue = Se.yytext, Ve = Se.yylineno, me = Se.yylloc;
            break;
          case 2:
            if (Ce = this.productions_[se[1]][1], de.$ = Ae[Ae.length - Ce], de._$ = {
              first_line: W[W.length - (Ce || 1)].first_line,
              last_line: W[W.length - 1].last_line,
              first_column: W[W.length - (Ce || 1)].first_column,
              last_column: W[W.length - 1].last_column
            }, Me && (de._$.range = [
              W[W.length - (Ce || 1)].range[0],
              W[W.length - 1].range[1]
            ]), ge = this.performAction.apply(de, [
              ue,
              Ge,
              Ve,
              _e.yy,
              se[1],
              Ae,
              W
            ].concat(Pe)), typeof ge < "u")
              return ge;
            Ce && (pe = pe.slice(0, -1 * Ce * 2), Ae = Ae.slice(0, -1 * Ce), W = W.slice(0, -1 * Ce)), pe.push(this.productions_[se[1]][0]), Ae.push(de.$), W.push(de._$), Te = Oe[pe[pe.length - 2]][pe[pe.length - 1]], pe.push(Te);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, Z = /* @__PURE__ */ function() {
    var q = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(j, pe) {
        if (this.yy.parser)
          this.yy.parser.parseError(j, pe);
        else
          throw new Error(j);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(J, j) {
        return this.yy = j || this.yy || {}, this._input = J, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var J = this._input[0];
        this.yytext += J, this.yyleng++, this.offset++, this.match += J, this.matched += J;
        var j = J.match(/(?:\r\n?|\n).*/g);
        return j ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), J;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(J) {
        var j = J.length, pe = J.split(/(?:\r\n?|\n)/g);
        this._input = J + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - j), this.offset -= j;
        var te = 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), pe.length - 1 && (this.yylineno -= pe.length - 1);
        var Ae = 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: pe ? (pe.length === te.length ? this.yylloc.first_column : 0) + te[te.length - pe.length].length - pe[0].length : this.yylloc.first_column - j
        }, this.options.ranges && (this.yylloc.range = [Ae[0], Ae[0] + this.yyleng - j]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(J) {
        this.unput(this.match.slice(J));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var J = this.matched.substr(0, this.matched.length - this.match.length);
        return (J.length > 20 ? "..." : "") + J.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var J = this.match;
        return J.length < 20 && (J += this._input.substr(0, 20 - J.length)), (J.substr(0, 20) + (J.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var J = this.pastInput(), j = new Array(J.length + 1).join("-");
        return J + this.upcomingInput() + `
` + j + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(J, j) {
        var pe, te, Ae;
        if (this.options.backtrack_lexer && (Ae = {
          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 && (Ae.yylloc.range = this.yylloc.range.slice(0))), te = J[0].match(/(?:\r\n?|\n).*/g), te && (this.yylineno += te.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: te ? te[te.length - 1].length - te[te.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + J[0].length
        }, this.yytext += J[0], this.match += J[0], this.matches = J, 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(J[0].length), this.matched += J[0], pe = this.performAction.call(this, this.yy, this, j, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), pe)
          return pe;
        if (this._backtrack) {
          for (var W in Ae)
            this[W] = Ae[W];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var J, j, pe, te;
        this._more || (this.yytext = "", this.match = "");
        for (var Ae = this._currentRules(), W = 0; W < Ae.length; W++)
          if (pe = this._input.match(this.rules[Ae[W]]), pe && (!j || pe[0].length > j[0].length)) {
            if (j = pe, te = W, this.options.backtrack_lexer) {
              if (J = this.test_match(pe, Ae[W]), J !== !1)
                return J;
              if (this._backtrack) {
                j = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return j ? (J = this.test_match(j, Ae[te]), J !== !1 ? J : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var j = this.next();
        return j || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(j) {
        this.conditionStack.push(j);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var j = this.conditionStack.length - 1;
        return j > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(j) {
        return j = this.conditionStack.length - 1 - Math.abs(j || 0), j >= 0 ? this.conditionStack[j] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(j) {
        this.begin(j);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(j, pe, te, Ae) {
        switch (te) {
          case 0:
            return this.begin("acc_title"), 24;
          case 1:
            return this.popState(), "acc_title_value";
          case 2:
            return this.begin("acc_descr"), 26;
          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 33;
          case 8:
            return 34;
          case 9:
            return 35;
          case 10:
            return 36;
          case 11:
            return 10;
          case 12:
            break;
          case 13:
            return 8;
          case 14:
            return 50;
          case 15:
            return 70;
          case 16:
            return 4;
          case 17:
            return this.begin("block"), 17;
          case 18:
            return 49;
          case 19:
            return 49;
          case 20:
            return 42;
          case 21:
            return 15;
          case 22:
            return 13;
          case 23:
            break;
          case 24:
            return 59;
          case 25:
            return 56;
          case 26:
            return 56;
          case 27:
            return 60;
          case 28:
            break;
          case 29:
            return this.popState(), 19;
          case 30:
            return pe.yytext[0];
          case 31:
            return 20;
          case 32:
            return 21;
          case 33:
            return this.begin("style"), 44;
          case 34:
            return this.popState(), 10;
          case 35:
            break;
          case 36:
            return 13;
          case 37:
            return 42;
          case 38:
            return 49;
          case 39:
            return this.begin("style"), 37;
          case 40:
            return 43;
          case 41:
            return 63;
          case 42:
            return 65;
          case 43:
            return 65;
          case 44:
            return 65;
          case 45:
            return 63;
          case 46:
            return 63;
          case 47:
            return 64;
          case 48:
            return 64;
          case 49:
            return 64;
          case 50:
            return 64;
          case 51:
            return 64;
          case 52:
            return 65;
          case 53:
            return 64;
          case 54:
            return 65;
          case 55:
            return 66;
          case 56:
            return 66;
          case 57:
            return 66;
          case 58:
            return 66;
          case 59:
            return 63;
          case 60:
            return 64;
          case 61:
            return 65;
          case 62:
            return 67;
          case 63:
            return 68;
          case 64:
            return 69;
          case 65:
            return 69;
          case 66:
            return 68;
          case 67:
            return 68;
          case 68:
            return 68;
          case 69:
            return 41;
          case 70:
            return 47;
          case 71:
            return 40;
          case 72:
            return 48;
          case 73:
            return pe.yytext[0];
          case 74:
            return 6;
        }
      }, "anonymous"),
      rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:#)/i, /^(?:#)/i, /^(?:,)/i, /^(?::::)/i, /^(?::)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:([^\s]*)[~].*[~]([^\s]*))/i, /^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:style\b)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?::)/i, /^(?:,)/i, /^(?:#)/i, /^(?:classDef\b)/i, /^(?:class\b)/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, /^(?:([^\x00-\x7F]|\w|-|\*)+)/i, /^(?:;)/i, /^(?:([^\x00-\x7F]|\w|-|\*)+)/i, /^(?:[0-9])/i, /^(?:.)/i, /^(?:$)/i],
      conditions: { style: { rules: [34, 35, 36, 37, 38, 69, 70], inclusive: !1 }, acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, block: { rules: [23, 24, 25, 26, 27, 28, 29, 30], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31, 32, 33, 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, 65, 66, 67, 68, 71, 72, 73, 74], inclusive: !0 } }
    };
    return q;
  }();
  K.lexer = Z;
  function X() {
    this.yy = {};
  }
  return x(X, "Parser"), X.prototype = K, K.Parser = X, new X();
}();
RT.parser = RT;
var l5e = RT, ed, c5e = (ed = class {
  constructor() {
    this.entities = /* @__PURE__ */ new Map(), this.relationships = [], this.classes = /* @__PURE__ */ new Map(), this.direction = "TB", this.Cardinality = {
      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"
    }, this.Identification = {
      NON_IDENTIFYING: "NON_IDENTIFYING",
      IDENTIFYING: "IDENTIFYING"
    }, this.setAccTitle = Cn, this.getAccTitle = Vn, this.setAccDescription = Gn, this.getAccDescription = Un, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.getConfig = /* @__PURE__ */ x(() => we().er, "getConfig"), this.clear(), this.addEntity = this.addEntity.bind(this), this.addAttributes = this.addAttributes.bind(this), this.addRelationship = this.addRelationship.bind(this), this.setDirection = this.setDirection.bind(this), this.addCssStyles = this.addCssStyles.bind(this), this.addClass = this.addClass.bind(this), this.setClass = this.setClass.bind(this), this.setAccTitle = this.setAccTitle.bind(this), this.setAccDescription = this.setAccDescription.bind(this);
  }
  /**
   * Add entity
   * @param name - The name of the entity
   * @param alias - The alias of the entity
   */
  addEntity(e, r = "") {
    var n;
    return this.entities.has(e) ? !((n = this.entities.get(e)) != null && n.alias) && r && (this.entities.get(e).alias = r, ae.info(`Add alias '${r}' to entity '${e}'`)) : (this.entities.set(e, {
      id: `entity-${e}-${this.entities.size}`,
      label: e,
      attributes: [],
      alias: r,
      shape: "erBox",
      look: we().look ?? "default",
      cssClasses: "default",
      cssStyles: []
    }), ae.info("Added new entity :", e)), this.entities.get(e);
  }
  getEntity(e) {
    return this.entities.get(e);
  }
  getEntities() {
    return this.entities;
  }
  getClasses() {
    return this.classes;
  }
  addAttributes(e, r) {
    const n = this.addEntity(e);
    let i;
    for (i = r.length - 1; i >= 0; i--)
      r[i].keys || (r[i].keys = []), r[i].comment || (r[i].comment = ""), n.attributes.push(r[i]), ae.debug("Added attribute ", r[i].name);
  }
  /**
   * Add a relationship
   *
   * @param entA - The first entity in the relationship
   * @param rolA - The role played by the first entity in relation to the second
   * @param entB - The second entity in the relationship
   * @param rSpec - The details of the relationship between the two entities
   */
  addRelationship(e, r, n, i) {
    const a = this.entities.get(e), s = this.entities.get(n);
    if (!a || !s)
      return;
    const o = {
      entityA: a.id,
      roleA: r,
      entityB: s.id,
      relSpec: i
    };
    this.relationships.push(o), ae.debug("Added new relationship :", o);
  }
  getRelationships() {
    return this.relationships;
  }
  getDirection() {
    return this.direction;
  }
  setDirection(e) {
    this.direction = e;
  }
  getCompiledStyles(e) {
    let r = [];
    for (const n of e) {
      const i = this.classes.get(n);
      i != null && i.styles && (r = [...r, ...i.styles ?? []].map((a) => a.trim())), i != null && i.textStyles && (r = [...r, ...i.textStyles ?? []].map((a) => a.trim()));
    }
    return r;
  }
  addCssStyles(e, r) {
    for (const n of e) {
      const i = this.entities.get(n);
      if (!r || !i)
        return;
      for (const a of r)
        i.cssStyles.push(a);
    }
  }
  addClass(e, r) {
    e.forEach((n) => {
      let i = this.classes.get(n);
      i === void 0 && (i = { id: n, styles: [], textStyles: [] }, this.classes.set(n, i)), r && r.forEach(function(a) {
        if (/color/.exec(a)) {
          const s = a.replace("fill", "bgFill");
          i.textStyles.push(s);
        }
        i.styles.push(a);
      });
    });
  }
  setClass(e, r) {
    for (const n of e) {
      const i = this.entities.get(n);
      if (i)
        for (const a of r)
          i.cssClasses += " " + a;
    }
  }
  clear() {
    this.entities = /* @__PURE__ */ new Map(), this.classes = /* @__PURE__ */ new Map(), this.relationships = [], _n();
  }
  getData() {
    const e = [], r = [], n = we();
    for (const a of this.entities.keys()) {
      const s = this.entities.get(a);
      s && (s.cssCompiledStyles = this.getCompiledStyles(s.cssClasses.split(" ")), e.push(s));
    }
    let i = 0;
    for (const a of this.relationships) {
      const s = {
        id: Nh(a.entityA, a.entityB, {
          prefix: "id",
          counter: i++
        }),
        type: "normal",
        curve: "basis",
        start: a.entityA,
        end: a.entityB,
        label: a.roleA,
        labelpos: "c",
        thickness: "normal",
        classes: "relationshipLine",
        arrowTypeStart: a.relSpec.cardB.toLowerCase(),
        arrowTypeEnd: a.relSpec.cardA.toLowerCase(),
        pattern: a.relSpec.relType == "IDENTIFYING" ? "solid" : "dashed",
        look: n.look
      };
      r.push(s);
    }
    return { nodes: e, edges: r, other: {}, config: n, direction: "TB" };
  }
}, x(ed, "ErDB"), ed), pU = {};
I2(pU, {
  draw: () => u5e
});
var u5e = /* @__PURE__ */ x(async function(t, e, r, n) {
  ae.info("REF0:"), ae.info("Drawing er diagram (unified)", e);
  const { securityLevel: i, er: a, layout: s } = we(), o = n.db.getData(), l = Ff(e, i);
  o.type = n.type, o.layoutAlgorithm = Gg(s), o.config.flowchart.nodeSpacing = (a == null ? void 0 : a.nodeSpacing) || 140, o.config.flowchart.rankSpacing = (a == null ? void 0 : a.rankSpacing) || 80, o.direction = n.db.getDirection(), o.markers = ["only_one", "zero_or_one", "one_or_more", "zero_or_more"], o.diagramId = e, await Af(o, l), o.layoutAlgorithm === "elk" && l.select(".edges").lower();
  const u = l.selectAll('[id*="-background"]');
  Array.from(u).length > 0 && u.each(function() {
    const d = Qe(this), p = d.attr("id").replace("-background", ""), g = l.select(`#${CSS.escape(p)}`);
    if (!g.empty()) {
      const m = g.attr("transform");
      d.attr("transform", m);
    }
  });
  const h = 8;
  Kt.insertTitle(
    l,
    "erDiagramTitleText",
    (a == null ? void 0 : a.titleTopMargin) ?? 25,
    n.db.getDiagramTitle()
  ), zu(l, h, "erDiagram", (a == null ? void 0 : a.useMaxWidth) ?? !0);
}, "draw"), h5e = /* @__PURE__ */ x((t, e) => {
  const r = K6, n = r(t, "r"), i = r(t, "g"), a = r(t, "b");
  return _l(n, i, a, e);
}, "fade"), d5e = /* @__PURE__ */ x((t) => `
  .entityBox {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
  }

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

  .labelBkg {
    background-color: ${h5e(t.tertiaryColor, 0.5)};
  }

  .edgeLabel .label {
    fill: ${t.nodeBorder};
    font-size: 14px;
  }

  .label {
    font-family: ${t.fontFamily};
    color: ${t.nodeTextColor || t.textColor};
  }

  .edge-pattern-dashed {
    stroke-dasharray: 8,8;
  }

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

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

  .marker {
    fill: none !important;
    stroke: ${t.lineColor} !important;
    stroke-width: 1;
  }
`, "getStyles"), f5e = d5e, p5e = {
  parser: l5e,
  get db() {
    return new c5e();
  },
  renderer: pU,
  styles: f5e
};
const g5e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: p5e
}, Symbol.toStringTag, { value: "Module" }));
function Vu(t, e) {
  var r, n, i;
  t.accDescr && ((r = e.setAccDescription) == null || r.call(e, t.accDescr)), t.accTitle && ((n = e.setAccTitle) == null || n.call(e, t.accTitle)), t.title && ((i = e.setDiagramTitle) == null || i.call(e, t.title));
}
x(Vu, "populateCommonDb");
var td, gU = (td = class {
  /**
   * @param init - Function that creates the default state.
   */
  constructor(e) {
    this.init = e, this.records = this.init();
  }
  reset() {
    this.records = this.init();
  }
}, x(td, "ImperativeState"), td);
function ki(t) {
  return typeof t == "object" && t !== null && typeof t.$type == "string";
}
function qs(t) {
  return typeof t == "object" && t !== null && typeof t.$refText == "string";
}
function m5e(t) {
  return typeof t == "object" && t !== null && typeof t.name == "string" && typeof t.type == "string" && typeof t.path == "string";
}
function fv(t) {
  return typeof t == "object" && t !== null && ki(t.container) && qs(t.reference) && typeof t.message == "string";
}
class mU {
  constructor() {
    this.subtypes = {}, this.allSubtypes = {};
  }
  isInstance(e, r) {
    return ki(e) && this.isSubtype(e.$type, r);
  }
  isSubtype(e, r) {
    if (e === r)
      return !0;
    let n = this.subtypes[e];
    n || (n = this.subtypes[e] = {});
    const i = n[r];
    if (i !== void 0)
      return i;
    {
      const a = this.computeIsSubtype(e, r);
      return n[r] = a, a;
    }
  }
  getAllSubTypes(e) {
    const r = this.allSubtypes[e];
    if (r)
      return r;
    {
      const n = this.getAllTypes(), i = [];
      for (const a of n)
        this.isSubtype(a, e) && i.push(a);
      return this.allSubtypes[e] = i, i;
    }
  }
}
function gg(t) {
  return typeof t == "object" && t !== null && Array.isArray(t.content);
}
function vU(t) {
  return typeof t == "object" && t !== null && typeof t.tokenType == "object";
}
function yU(t) {
  return gg(t) && typeof t.fullText == "string";
}
class si {
  constructor(e, r) {
    this.startFn = e, this.nextFn = r;
  }
  iterator() {
    const e = {
      state: this.startFn(),
      next: () => this.nextFn(e.state),
      [Symbol.iterator]: () => e
    };
    return e;
  }
  [Symbol.iterator]() {
    return this.iterator();
  }
  isEmpty() {
    return !!this.iterator().next().done;
  }
  count() {
    const e = this.iterator();
    let r = 0, n = e.next();
    for (; !n.done; )
      r++, n = e.next();
    return r;
  }
  toArray() {
    const e = [], r = this.iterator();
    let n;
    do
      n = r.next(), n.value !== void 0 && e.push(n.value);
    while (!n.done);
    return e;
  }
  toSet() {
    return new Set(this);
  }
  toMap(e, r) {
    const n = this.map((i) => [
      e ? e(i) : i,
      r ? r(i) : i
    ]);
    return new Map(n);
  }
  toString() {
    return this.join();
  }
  concat(e) {
    return new si(() => ({ first: this.startFn(), firstDone: !1, iterator: e[Symbol.iterator]() }), (r) => {
      let n;
      if (!r.firstDone) {
        do
          if (n = this.nextFn(r.first), !n.done)
            return n;
        while (!n.done);
        r.firstDone = !0;
      }
      do
        if (n = r.iterator.next(), !n.done)
          return n;
      while (!n.done);
      return Ta;
    });
  }
  join(e = ",") {
    const r = this.iterator();
    let n = "", i, a = !1;
    do
      i = r.next(), i.done || (a && (n += e), n += v5e(i.value)), a = !0;
    while (!i.done);
    return n;
  }
  indexOf(e, r = 0) {
    const n = this.iterator();
    let i = 0, a = n.next();
    for (; !a.done; ) {
      if (i >= r && a.value === e)
        return i;
      a = n.next(), i++;
    }
    return -1;
  }
  every(e) {
    const r = this.iterator();
    let n = r.next();
    for (; !n.done; ) {
      if (!e(n.value))
        return !1;
      n = r.next();
    }
    return !0;
  }
  some(e) {
    const r = this.iterator();
    let n = r.next();
    for (; !n.done; ) {
      if (e(n.value))
        return !0;
      n = r.next();
    }
    return !1;
  }
  forEach(e) {
    const r = this.iterator();
    let n = 0, i = r.next();
    for (; !i.done; )
      e(i.value, n), i = r.next(), n++;
  }
  map(e) {
    return new si(this.startFn, (r) => {
      const { done: n, value: i } = this.nextFn(r);
      return n ? Ta : { done: !1, value: e(i) };
    });
  }
  filter(e) {
    return new si(this.startFn, (r) => {
      let n;
      do
        if (n = this.nextFn(r), !n.done && e(n.value))
          return n;
      while (!n.done);
      return Ta;
    });
  }
  nonNullable() {
    return this.filter((e) => e != null);
  }
  reduce(e, r) {
    const n = this.iterator();
    let i = r, a = n.next();
    for (; !a.done; )
      i === void 0 ? i = a.value : i = e(i, a.value), a = n.next();
    return i;
  }
  reduceRight(e, r) {
    return this.recursiveReduce(this.iterator(), e, r);
  }
  recursiveReduce(e, r, n) {
    const i = e.next();
    if (i.done)
      return n;
    const a = this.recursiveReduce(e, r, n);
    return a === void 0 ? i.value : r(a, i.value);
  }
  find(e) {
    const r = this.iterator();
    let n = r.next();
    for (; !n.done; ) {
      if (e(n.value))
        return n.value;
      n = r.next();
    }
  }
  findIndex(e) {
    const r = this.iterator();
    let n = 0, i = r.next();
    for (; !i.done; ) {
      if (e(i.value))
        return n;
      i = r.next(), n++;
    }
    return -1;
  }
  includes(e) {
    const r = this.iterator();
    let n = r.next();
    for (; !n.done; ) {
      if (n.value === e)
        return !0;
      n = r.next();
    }
    return !1;
  }
  flatMap(e) {
    return new si(() => ({ this: this.startFn() }), (r) => {
      do {
        if (r.iterator) {
          const a = r.iterator.next();
          if (a.done)
            r.iterator = void 0;
          else
            return a;
        }
        const { done: n, value: i } = this.nextFn(r.this);
        if (!n) {
          const a = e(i);
          if (Qy(a))
            r.iterator = a[Symbol.iterator]();
          else
            return { done: !1, value: a };
        }
      } while (r.iterator);
      return Ta;
    });
  }
  flat(e) {
    if (e === void 0 && (e = 1), e <= 0)
      return this;
    const r = e > 1 ? this.flat(e - 1) : this;
    return new si(() => ({ this: r.startFn() }), (n) => {
      do {
        if (n.iterator) {
          const s = n.iterator.next();
          if (s.done)
            n.iterator = void 0;
          else
            return s;
        }
        const { done: i, value: a } = r.nextFn(n.this);
        if (!i)
          if (Qy(a))
            n.iterator = a[Symbol.iterator]();
          else
            return { done: !1, value: a };
      } while (n.iterator);
      return Ta;
    });
  }
  head() {
    const r = this.iterator().next();
    if (!r.done)
      return r.value;
  }
  tail(e = 1) {
    return new si(() => {
      const r = this.startFn();
      for (let n = 0; n < e; n++)
        if (this.nextFn(r).done)
          return r;
      return r;
    }, this.nextFn);
  }
  limit(e) {
    return new si(() => ({ size: 0, state: this.startFn() }), (r) => (r.size++, r.size > e ? Ta : this.nextFn(r.state)));
  }
  distinct(e) {
    return new si(() => ({ set: /* @__PURE__ */ new Set(), internalState: this.startFn() }), (r) => {
      let n;
      do
        if (n = this.nextFn(r.internalState), !n.done) {
          const i = e ? e(n.value) : n.value;
          if (!r.set.has(i))
            return r.set.add(i), n;
        }
      while (!n.done);
      return Ta;
    });
  }
  exclude(e, r) {
    const n = /* @__PURE__ */ new Set();
    for (const i of e) {
      const a = r ? r(i) : i;
      n.add(a);
    }
    return this.filter((i) => {
      const a = r ? r(i) : i;
      return !n.has(a);
    });
  }
}
function v5e(t) {
  return typeof t == "string" ? t : typeof t > "u" ? "undefined" : typeof t.toString == "function" ? t.toString() : Object.prototype.toString.call(t);
}
function Qy(t) {
  return !!t && typeof t[Symbol.iterator] == "function";
}
const y5e = new si(() => {
}, () => Ta), Ta = Object.freeze({ done: !0, value: void 0 });
function oi(...t) {
  if (t.length === 1) {
    const e = t[0];
    if (e instanceof si)
      return e;
    if (Qy(e))
      return new si(() => e[Symbol.iterator](), (r) => r.next());
    if (typeof e.length == "number")
      return new si(() => ({ index: 0 }), (r) => r.index < e.length ? { done: !1, value: e[r.index++] } : Ta);
  }
  return t.length > 1 ? new si(() => ({ collIndex: 0, arrIndex: 0 }), (e) => {
    do {
      if (e.iterator) {
        const r = e.iterator.next();
        if (!r.done)
          return r;
        e.iterator = void 0;
      }
      if (e.array) {
        if (e.arrIndex < e.array.length)
          return { done: !1, value: e.array[e.arrIndex++] };
        e.array = void 0, e.arrIndex = 0;
      }
      if (e.collIndex < t.length) {
        const r = t[e.collIndex++];
        Qy(r) ? e.iterator = r[Symbol.iterator]() : r && typeof r.length == "number" && (e.array = r);
      }
    } while (e.iterator || e.array || e.collIndex < t.length);
    return Ta;
  }) : y5e;
}
class wS extends si {
  constructor(e, r, n) {
    super(() => ({
      iterators: n != null && n.includeRoot ? [[e][Symbol.iterator]()] : [r(e)[Symbol.iterator]()],
      pruned: !1
    }), (i) => {
      for (i.pruned && (i.iterators.pop(), i.pruned = !1); i.iterators.length > 0; ) {
        const s = i.iterators[i.iterators.length - 1].next();
        if (s.done)
          i.iterators.pop();
        else
          return i.iterators.push(r(s.value)[Symbol.iterator]()), s;
      }
      return Ta;
    });
  }
  iterator() {
    const e = {
      state: this.startFn(),
      next: () => this.nextFn(e.state),
      prune: () => {
        e.state.pruned = !0;
      },
      [Symbol.iterator]: () => e
    };
    return e;
  }
}
var NT;
(function(t) {
  function e(a) {
    return a.reduce((s, o) => s + o, 0);
  }
  t.sum = e;
  function r(a) {
    return a.reduce((s, o) => s * o, 0);
  }
  t.product = r;
  function n(a) {
    return a.reduce((s, o) => Math.min(s, o));
  }
  t.min = n;
  function i(a) {
    return a.reduce((s, o) => Math.max(s, o));
  }
  t.max = i;
})(NT || (NT = {}));
function MT(t) {
  return new wS(t, (e) => gg(e) ? e.content : [], { includeRoot: !0 });
}
function x5e(t, e) {
  for (; t.container; )
    if (t = t.container, t === e)
      return !0;
  return !1;
}
function DT(t) {
  return {
    start: {
      character: t.startColumn - 1,
      line: t.startLine - 1
    },
    end: {
      character: t.endColumn,
      // endColumn uses the correct index
      line: t.endLine - 1
    }
  };
}
function Jy(t) {
  if (!t)
    return;
  const { offset: e, end: r, range: n } = t;
  return {
    range: n,
    offset: e,
    end: r,
    length: r - e
  };
}
var _o;
(function(t) {
  t[t.Before = 0] = "Before", t[t.After = 1] = "After", t[t.OverlapFront = 2] = "OverlapFront", t[t.OverlapBack = 3] = "OverlapBack", t[t.Inside = 4] = "Inside", t[t.Outside = 5] = "Outside";
})(_o || (_o = {}));
function b5e(t, e) {
  if (t.end.line < e.start.line || t.end.line === e.start.line && t.end.character <= e.start.character)
    return _o.Before;
  if (t.start.line > e.end.line || t.start.line === e.end.line && t.start.character >= e.end.character)
    return _o.After;
  const r = t.start.line > e.start.line || t.start.line === e.start.line && t.start.character >= e.start.character, n = t.end.line < e.end.line || t.end.line === e.end.line && t.end.character <= e.end.character;
  return r && n ? _o.Inside : r ? _o.OverlapBack : n ? _o.OverlapFront : _o.Outside;
}
function w5e(t, e) {
  return b5e(t, e) > _o.After;
}
const T5e = /^[\w\p{L}]$/u;
function E5e(t, e) {
  if (t) {
    const r = k5e(t, !0);
    if (r && dL(r, e))
      return r;
    if (yU(t)) {
      const n = t.content.findIndex((i) => !i.hidden);
      for (let i = n - 1; i >= 0; i--) {
        const a = t.content[i];
        if (dL(a, e))
          return a;
      }
    }
  }
}
function dL(t, e) {
  return vU(t) && e.includes(t.tokenType.name);
}
function k5e(t, e = !0) {
  for (; t.container; ) {
    const r = t.container;
    let n = r.content.indexOf(t);
    for (; n > 0; ) {
      n--;
      const i = r.content[n];
      if (e || !i.hidden)
        return i;
    }
    t = r;
  }
}
class xU extends Error {
  constructor(e, r) {
    super(e ? `${r} at ${e.range.start.line}:${e.range.start.character}` : r);
  }
}
function c1(t) {
  throw new Error("Error! The input value was not handled.");
}
const lm = "AbstractRule", cm = "AbstractType", i5 = "Condition", fL = "TypeDefinition", a5 = "ValueLiteral", N0 = "AbstractElement";
function S5e(t) {
  return Mr.isInstance(t, N0);
}
const um = "ArrayLiteral", hm = "ArrayType", M0 = "BooleanLiteral";
function C5e(t) {
  return Mr.isInstance(t, M0);
}
const D0 = "Conjunction";
function A5e(t) {
  return Mr.isInstance(t, D0);
}
const I0 = "Disjunction";
function _5e(t) {
  return Mr.isInstance(t, I0);
}
const dm = "Grammar", s5 = "GrammarImport", O0 = "InferredType";
function bU(t) {
  return Mr.isInstance(t, O0);
}
const P0 = "Interface";
function wU(t) {
  return Mr.isInstance(t, P0);
}
const o5 = "NamedArgument", B0 = "Negation";
function L5e(t) {
  return Mr.isInstance(t, B0);
}
const fm = "NumberLiteral", pm = "Parameter", F0 = "ParameterReference";
function R5e(t) {
  return Mr.isInstance(t, F0);
}
const $0 = "ParserRule";
function is(t) {
  return Mr.isInstance(t, $0);
}
const gm = "ReferenceType", pv = "ReturnType";
function N5e(t) {
  return Mr.isInstance(t, pv);
}
const z0 = "SimpleType";
function M5e(t) {
  return Mr.isInstance(t, z0);
}
const mm = "StringLiteral", ph = "TerminalRule";
function Gu(t) {
  return Mr.isInstance(t, ph);
}
const V0 = "Type";
function TU(t) {
  return Mr.isInstance(t, V0);
}
const l5 = "TypeAttribute", vm = "UnionType", G0 = "Action";
function Xx(t) {
  return Mr.isInstance(t, G0);
}
const U0 = "Alternatives";
function EU(t) {
  return Mr.isInstance(t, U0);
}
const W0 = "Assignment";
function bu(t) {
  return Mr.isInstance(t, W0);
}
const H0 = "CharacterRange";
function D5e(t) {
  return Mr.isInstance(t, H0);
}
const q0 = "CrossReference";
function TS(t) {
  return Mr.isInstance(t, q0);
}
const Y0 = "EndOfFile";
function I5e(t) {
  return Mr.isInstance(t, Y0);
}
const X0 = "Group";
function ES(t) {
  return Mr.isInstance(t, X0);
}
const j0 = "Keyword";
function wu(t) {
  return Mr.isInstance(t, j0);
}
const K0 = "NegatedToken";
function O5e(t) {
  return Mr.isInstance(t, K0);
}
const Z0 = "RegexToken";
function P5e(t) {
  return Mr.isInstance(t, Z0);
}
const Q0 = "RuleCall";
function Tu(t) {
  return Mr.isInstance(t, Q0);
}
const J0 = "TerminalAlternatives";
function B5e(t) {
  return Mr.isInstance(t, J0);
}
const ep = "TerminalGroup";
function F5e(t) {
  return Mr.isInstance(t, ep);
}
const tp = "TerminalRuleCall";
function $5e(t) {
  return Mr.isInstance(t, tp);
}
const rp = "UnorderedGroup";
function kU(t) {
  return Mr.isInstance(t, rp);
}
const np = "UntilToken";
function z5e(t) {
  return Mr.isInstance(t, np);
}
const ip = "Wildcard";
function V5e(t) {
  return Mr.isInstance(t, ip);
}
class SU extends mU {
  getAllTypes() {
    return [N0, lm, cm, G0, U0, um, hm, W0, M0, H0, i5, D0, q0, I0, Y0, dm, s5, X0, O0, P0, j0, o5, K0, B0, fm, pm, F0, $0, gm, Z0, pv, Q0, z0, mm, J0, ep, ph, tp, V0, l5, fL, vm, rp, np, a5, ip];
  }
  computeIsSubtype(e, r) {
    switch (e) {
      case G0:
      case U0:
      case W0:
      case H0:
      case q0:
      case Y0:
      case X0:
      case j0:
      case K0:
      case Z0:
      case Q0:
      case J0:
      case ep:
      case tp:
      case rp:
      case np:
      case ip:
        return this.isSubtype(N0, r);
      case um:
      case fm:
      case mm:
        return this.isSubtype(a5, r);
      case hm:
      case gm:
      case z0:
      case vm:
        return this.isSubtype(fL, r);
      case M0:
        return this.isSubtype(i5, r) || this.isSubtype(a5, r);
      case D0:
      case I0:
      case B0:
      case F0:
        return this.isSubtype(i5, r);
      case O0:
      case P0:
      case V0:
        return this.isSubtype(cm, r);
      case $0:
        return this.isSubtype(lm, r) || this.isSubtype(cm, r);
      case ph:
        return this.isSubtype(lm, r);
      default:
        return !1;
    }
  }
  getReferenceType(e) {
    const r = `${e.container.$type}:${e.property}`;
    switch (r) {
      case "Action:type":
      case "CrossReference:type":
      case "Interface:superTypes":
      case "ParserRule:returnType":
      case "SimpleType:typeRef":
        return cm;
      case "Grammar:hiddenTokens":
      case "ParserRule:hiddenTokens":
      case "RuleCall:rule":
        return lm;
      case "Grammar:usedGrammars":
        return dm;
      case "NamedArgument:parameter":
      case "ParameterReference:parameter":
        return pm;
      case "TerminalRuleCall:rule":
        return ph;
      default:
        throw new Error(`${r} is not a valid reference id.`);
    }
  }
  getTypeMetaData(e) {
    switch (e) {
      case N0:
        return {
          name: N0,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" }
          ]
        };
      case um:
        return {
          name: um,
          properties: [
            { name: "elements", defaultValue: [] }
          ]
        };
      case hm:
        return {
          name: hm,
          properties: [
            { name: "elementType" }
          ]
        };
      case M0:
        return {
          name: M0,
          properties: [
            { name: "true", defaultValue: !1 }
          ]
        };
      case D0:
        return {
          name: D0,
          properties: [
            { name: "left" },
            { name: "right" }
          ]
        };
      case I0:
        return {
          name: I0,
          properties: [
            { name: "left" },
            { name: "right" }
          ]
        };
      case dm:
        return {
          name: dm,
          properties: [
            { name: "definesHiddenTokens", defaultValue: !1 },
            { name: "hiddenTokens", defaultValue: [] },
            { name: "imports", defaultValue: [] },
            { name: "interfaces", defaultValue: [] },
            { name: "isDeclared", defaultValue: !1 },
            { name: "name" },
            { name: "rules", defaultValue: [] },
            { name: "types", defaultValue: [] },
            { name: "usedGrammars", defaultValue: [] }
          ]
        };
      case s5:
        return {
          name: s5,
          properties: [
            { name: "path" }
          ]
        };
      case O0:
        return {
          name: O0,
          properties: [
            { name: "name" }
          ]
        };
      case P0:
        return {
          name: P0,
          properties: [
            { name: "attributes", defaultValue: [] },
            { name: "name" },
            { name: "superTypes", defaultValue: [] }
          ]
        };
      case o5:
        return {
          name: o5,
          properties: [
            { name: "calledByName", defaultValue: !1 },
            { name: "parameter" },
            { name: "value" }
          ]
        };
      case B0:
        return {
          name: B0,
          properties: [
            { name: "value" }
          ]
        };
      case fm:
        return {
          name: fm,
          properties: [
            { name: "value" }
          ]
        };
      case pm:
        return {
          name: pm,
          properties: [
            { name: "name" }
          ]
        };
      case F0:
        return {
          name: F0,
          properties: [
            { name: "parameter" }
          ]
        };
      case $0:
        return {
          name: $0,
          properties: [
            { name: "dataType" },
            { name: "definesHiddenTokens", defaultValue: !1 },
            { name: "definition" },
            { name: "entry", defaultValue: !1 },
            { name: "fragment", defaultValue: !1 },
            { name: "hiddenTokens", defaultValue: [] },
            { name: "inferredType" },
            { name: "name" },
            { name: "parameters", defaultValue: [] },
            { name: "returnType" },
            { name: "wildcard", defaultValue: !1 }
          ]
        };
      case gm:
        return {
          name: gm,
          properties: [
            { name: "referenceType" }
          ]
        };
      case pv:
        return {
          name: pv,
          properties: [
            { name: "name" }
          ]
        };
      case z0:
        return {
          name: z0,
          properties: [
            { name: "primitiveType" },
            { name: "stringType" },
            { name: "typeRef" }
          ]
        };
      case mm:
        return {
          name: mm,
          properties: [
            { name: "value" }
          ]
        };
      case ph:
        return {
          name: ph,
          properties: [
            { name: "definition" },
            { name: "fragment", defaultValue: !1 },
            { name: "hidden", defaultValue: !1 },
            { name: "name" },
            { name: "type" }
          ]
        };
      case V0:
        return {
          name: V0,
          properties: [
            { name: "name" },
            { name: "type" }
          ]
        };
      case l5:
        return {
          name: l5,
          properties: [
            { name: "defaultValue" },
            { name: "isOptional", defaultValue: !1 },
            { name: "name" },
            { name: "type" }
          ]
        };
      case vm:
        return {
          name: vm,
          properties: [
            { name: "types", defaultValue: [] }
          ]
        };
      case G0:
        return {
          name: G0,
          properties: [
            { name: "cardinality" },
            { name: "feature" },
            { name: "inferredType" },
            { name: "lookahead" },
            { name: "operator" },
            { name: "type" }
          ]
        };
      case U0:
        return {
          name: U0,
          properties: [
            { name: "cardinality" },
            { name: "elements", defaultValue: [] },
            { name: "lookahead" }
          ]
        };
      case W0:
        return {
          name: W0,
          properties: [
            { name: "cardinality" },
            { name: "feature" },
            { name: "lookahead" },
            { name: "operator" },
            { name: "terminal" }
          ]
        };
      case H0:
        return {
          name: H0,
          properties: [
            { name: "cardinality" },
            { name: "left" },
            { name: "lookahead" },
            { name: "right" }
          ]
        };
      case q0:
        return {
          name: q0,
          properties: [
            { name: "cardinality" },
            { name: "deprecatedSyntax", defaultValue: !1 },
            { name: "lookahead" },
            { name: "terminal" },
            { name: "type" }
          ]
        };
      case Y0:
        return {
          name: Y0,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" }
          ]
        };
      case X0:
        return {
          name: X0,
          properties: [
            { name: "cardinality" },
            { name: "elements", defaultValue: [] },
            { name: "guardCondition" },
            { name: "lookahead" }
          ]
        };
      case j0:
        return {
          name: j0,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" },
            { name: "value" }
          ]
        };
      case K0:
        return {
          name: K0,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" },
            { name: "terminal" }
          ]
        };
      case Z0:
        return {
          name: Z0,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" },
            { name: "regex" }
          ]
        };
      case Q0:
        return {
          name: Q0,
          properties: [
            { name: "arguments", defaultValue: [] },
            { name: "cardinality" },
            { name: "lookahead" },
            { name: "rule" }
          ]
        };
      case J0:
        return {
          name: J0,
          properties: [
            { name: "cardinality" },
            { name: "elements", defaultValue: [] },
            { name: "lookahead" }
          ]
        };
      case ep:
        return {
          name: ep,
          properties: [
            { name: "cardinality" },
            { name: "elements", defaultValue: [] },
            { name: "lookahead" }
          ]
        };
      case tp:
        return {
          name: tp,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" },
            { name: "rule" }
          ]
        };
      case rp:
        return {
          name: rp,
          properties: [
            { name: "cardinality" },
            { name: "elements", defaultValue: [] },
            { name: "lookahead" }
          ]
        };
      case np:
        return {
          name: np,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" },
            { name: "terminal" }
          ]
        };
      case ip:
        return {
          name: ip,
          properties: [
            { name: "cardinality" },
            { name: "lookahead" }
          ]
        };
      default:
        return {
          name: e,
          properties: []
        };
    }
  }
}
const Mr = new SU();
function G5e(t) {
  for (const [e, r] of Object.entries(t))
    e.startsWith("$") || (Array.isArray(r) ? r.forEach((n, i) => {
      ki(n) && (n.$container = t, n.$containerProperty = e, n.$containerIndex = i);
    }) : ki(r) && (r.$container = t, r.$containerProperty = e));
}
function jx(t, e) {
  let r = t;
  for (; r; ) {
    if (e(r))
      return r;
    r = r.$container;
  }
}
function Xl(t) {
  const r = IT(t).$document;
  if (!r)
    throw new Error("AST node has no document.");
  return r;
}
function IT(t) {
  for (; t.$container; )
    t = t.$container;
  return t;
}
function kS(t, e) {
  if (!t)
    throw new Error("Node must be an AstNode.");
  const r = e == null ? void 0 : e.range;
  return new si(() => ({
    keys: Object.keys(t),
    keyIndex: 0,
    arrayIndex: 0
  }), (n) => {
    for (; n.keyIndex < n.keys.length; ) {
      const i = n.keys[n.keyIndex];
      if (!i.startsWith("$")) {
        const a = t[i];
        if (ki(a)) {
          if (n.keyIndex++, pL(a, r))
            return { done: !1, value: a };
        } else if (Array.isArray(a)) {
          for (; n.arrayIndex < a.length; ) {
            const s = n.arrayIndex++, o = a[s];
            if (ki(o) && pL(o, r))
              return { done: !1, value: o };
          }
          n.arrayIndex = 0;
        }
      }
      n.keyIndex++;
    }
    return Ta;
  });
}
function u1(t, e) {
  if (!t)
    throw new Error("Root node must be an AstNode.");
  return new wS(t, (r) => kS(r, e));
}
function $h(t, e) {
  if (!t)
    throw new Error("Root node must be an AstNode.");
  return new wS(t, (r) => kS(r, e), { includeRoot: !0 });
}
function pL(t, e) {
  var r;
  if (!e)
    return !0;
  const n = (r = t.$cstNode) === null || r === void 0 ? void 0 : r.range;
  return n ? w5e(n, e) : !1;
}
function CU(t) {
  return new si(() => ({
    keys: Object.keys(t),
    keyIndex: 0,
    arrayIndex: 0
  }), (e) => {
    for (; e.keyIndex < e.keys.length; ) {
      const r = e.keys[e.keyIndex];
      if (!r.startsWith("$")) {
        const n = t[r];
        if (qs(n))
          return e.keyIndex++, { done: !1, value: { reference: n, container: t, property: r } };
        if (Array.isArray(n)) {
          for (; e.arrayIndex < n.length; ) {
            const i = e.arrayIndex++, a = n[i];
            if (qs(a))
              return { done: !1, value: { reference: a, container: t, property: r, index: i } };
          }
          e.arrayIndex = 0;
        }
      }
      e.keyIndex++;
    }
    return Ta;
  });
}
function U5e(t, e) {
  const r = t.getTypeMetaData(e.$type), n = e;
  for (const i of r.properties)
    i.defaultValue !== void 0 && n[i.name] === void 0 && (n[i.name] = AU(i.defaultValue));
}
function AU(t) {
  return Array.isArray(t) ? [...t.map(AU)] : t;
}
function Yt(t) {
  return t.charCodeAt(0);
}
function c5(t, e) {
  Array.isArray(t) ? t.forEach(function(r) {
    e.push(r);
  }) : e.push(t);
}
function f0(t, e) {
  if (t[e] === !0)
    throw "duplicate flag " + e;
  t[e], t[e] = !0;
}
function oh(t) {
  if (t === void 0)
    throw Error("Internal Error - Should never get here!");
  return !0;
}
function W5e() {
  throw Error("Internal Error - Should never get here!");
}
function gL(t) {
  return t.type === "Character";
}
const e2 = [];
for (let t = Yt("0"); t <= Yt("9"); t++)
  e2.push(t);
const t2 = [Yt("_")].concat(e2);
for (let t = Yt("a"); t <= Yt("z"); t++)
  t2.push(t);
for (let t = Yt("A"); t <= Yt("Z"); t++)
  t2.push(t);
const mL = [
  Yt(" "),
  Yt("\f"),
  Yt(`
`),
  Yt("\r"),
  Yt("	"),
  Yt("\v"),
  Yt("	"),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt(" "),
  Yt("\u2028"),
  Yt("\u2029"),
  Yt(" "),
  Yt(" "),
  Yt("　"),
  Yt("\uFEFF")
], H5e = /[0-9a-fA-F]/, ym = /[0-9]/, q5e = /[1-9]/;
class _U {
  constructor() {
    this.idx = 0, this.input = "", this.groupIdx = 0;
  }
  saveState() {
    return {
      idx: this.idx,
      input: this.input,
      groupIdx: this.groupIdx
    };
  }
  restoreState(e) {
    this.idx = e.idx, this.input = e.input, this.groupIdx = e.groupIdx;
  }
  pattern(e) {
    this.idx = 0, this.input = e, this.groupIdx = 0, this.consumeChar("/");
    const r = this.disjunction();
    this.consumeChar("/");
    const n = {
      type: "Flags",
      loc: { begin: this.idx, end: e.length },
      global: !1,
      ignoreCase: !1,
      multiLine: !1,
      unicode: !1,
      sticky: !1
    };
    for (; this.isRegExpFlag(); )
      switch (this.popChar()) {
        case "g":
          f0(n, "global");
          break;
        case "i":
          f0(n, "ignoreCase");
          break;
        case "m":
          f0(n, "multiLine");
          break;
        case "u":
          f0(n, "unicode");
          break;
        case "y":
          f0(n, "sticky");
          break;
      }
    if (this.idx !== this.input.length)
      throw Error("Redundant input: " + this.input.substring(this.idx));
    return {
      type: "Pattern",
      flags: n,
      value: r,
      loc: this.loc(0)
    };
  }
  disjunction() {
    const e = [], r = this.idx;
    for (e.push(this.alternative()); this.peekChar() === "|"; )
      this.consumeChar("|"), e.push(this.alternative());
    return { type: "Disjunction", value: e, loc: this.loc(r) };
  }
  alternative() {
    const e = [], r = this.idx;
    for (; this.isTerm(); )
      e.push(this.term());
    return { type: "Alternative", value: e, loc: this.loc(r) };
  }
  term() {
    return this.isAssertion() ? this.assertion() : this.atom();
  }
  assertion() {
    const e = this.idx;
    switch (this.popChar()) {
      case "^":
        return {
          type: "StartAnchor",
          loc: this.loc(e)
        };
      case "$":
        return { type: "EndAnchor", loc: this.loc(e) };
      case "\\":
        switch (this.popChar()) {
          case "b":
            return {
              type: "WordBoundary",
              loc: this.loc(e)
            };
          case "B":
            return {
              type: "NonWordBoundary",
              loc: this.loc(e)
            };
        }
        throw Error("Invalid Assertion Escape");
      case "(":
        this.consumeChar("?");
        let r;
        switch (this.popChar()) {
          case "=":
            r = "Lookahead";
            break;
          case "!":
            r = "NegativeLookahead";
            break;
        }
        oh(r);
        const n = this.disjunction();
        return this.consumeChar(")"), {
          type: r,
          value: n,
          loc: this.loc(e)
        };
    }
    return W5e();
  }
  quantifier(e = !1) {
    let r;
    const n = this.idx;
    switch (this.popChar()) {
      case "*":
        r = {
          atLeast: 0,
          atMost: 1 / 0
        };
        break;
      case "+":
        r = {
          atLeast: 1,
          atMost: 1 / 0
        };
        break;
      case "?":
        r = {
          atLeast: 0,
          atMost: 1
        };
        break;
      case "{":
        const i = this.integerIncludingZero();
        switch (this.popChar()) {
          case "}":
            r = {
              atLeast: i,
              atMost: i
            };
            break;
          case ",":
            let a;
            this.isDigit() ? (a = this.integerIncludingZero(), r = {
              atLeast: i,
              atMost: a
            }) : r = {
              atLeast: i,
              atMost: 1 / 0
            }, this.consumeChar("}");
            break;
        }
        if (e === !0 && r === void 0)
          return;
        oh(r);
        break;
    }
    if (!(e === !0 && r === void 0) && oh(r))
      return this.peekChar(0) === "?" ? (this.consumeChar("?"), r.greedy = !1) : r.greedy = !0, r.type = "Quantifier", r.loc = this.loc(n), r;
  }
  atom() {
    let e;
    const r = this.idx;
    switch (this.peekChar()) {
      case ".":
        e = this.dotAll();
        break;
      case "\\":
        e = this.atomEscape();
        break;
      case "[":
        e = this.characterClass();
        break;
      case "(":
        e = this.group();
        break;
    }
    if (e === void 0 && this.isPatternCharacter() && (e = this.patternCharacter()), oh(e))
      return e.loc = this.loc(r), this.isQuantifier() && (e.quantifier = this.quantifier()), e;
  }
  dotAll() {
    return this.consumeChar("."), {
      type: "Set",
      complement: !0,
      value: [Yt(`
`), Yt("\r"), Yt("\u2028"), Yt("\u2029")]
    };
  }
  atomEscape() {
    switch (this.consumeChar("\\"), this.peekChar()) {
      case "1":
      case "2":
      case "3":
      case "4":
      case "5":
      case "6":
      case "7":
      case "8":
      case "9":
        return this.decimalEscapeAtom();
      case "d":
      case "D":
      case "s":
      case "S":
      case "w":
      case "W":
        return this.characterClassEscape();
      case "f":
      case "n":
      case "r":
      case "t":
      case "v":
        return this.controlEscapeAtom();
      case "c":
        return this.controlLetterEscapeAtom();
      case "0":
        return this.nulCharacterAtom();
      case "x":
        return this.hexEscapeSequenceAtom();
      case "u":
        return this.regExpUnicodeEscapeSequenceAtom();
      default:
        return this.identityEscapeAtom();
    }
  }
  decimalEscapeAtom() {
    return { type: "GroupBackReference", value: this.positiveInteger() };
  }
  characterClassEscape() {
    let e, r = !1;
    switch (this.popChar()) {
      case "d":
        e = e2;
        break;
      case "D":
        e = e2, r = !0;
        break;
      case "s":
        e = mL;
        break;
      case "S":
        e = mL, r = !0;
        break;
      case "w":
        e = t2;
        break;
      case "W":
        e = t2, r = !0;
        break;
    }
    if (oh(e))
      return { type: "Set", value: e, complement: r };
  }
  controlEscapeAtom() {
    let e;
    switch (this.popChar()) {
      case "f":
        e = Yt("\f");
        break;
      case "n":
        e = Yt(`
`);
        break;
      case "r":
        e = Yt("\r");
        break;
      case "t":
        e = Yt("	");
        break;
      case "v":
        e = Yt("\v");
        break;
    }
    if (oh(e))
      return { type: "Character", value: e };
  }
  controlLetterEscapeAtom() {
    this.consumeChar("c");
    const e = this.popChar();
    if (/[a-zA-Z]/.test(e) === !1)
      throw Error("Invalid ");
    return { type: "Character", value: e.toUpperCase().charCodeAt(0) - 64 };
  }
  nulCharacterAtom() {
    return this.consumeChar("0"), { type: "Character", value: Yt("\0") };
  }
  hexEscapeSequenceAtom() {
    return this.consumeChar("x"), this.parseHexDigits(2);
  }
  regExpUnicodeEscapeSequenceAtom() {
    return this.consumeChar("u"), this.parseHexDigits(4);
  }
  identityEscapeAtom() {
    const e = this.popChar();
    return { type: "Character", value: Yt(e) };
  }
  classPatternCharacterAtom() {
    switch (this.peekChar()) {
      case `
`:
      case "\r":
      case "\u2028":
      case "\u2029":
      case "\\":
      case "]":
        throw Error("TBD");
      default:
        const e = this.popChar();
        return { type: "Character", value: Yt(e) };
    }
  }
  characterClass() {
    const e = [];
    let r = !1;
    for (this.consumeChar("["), this.peekChar(0) === "^" && (this.consumeChar("^"), r = !0); this.isClassAtom(); ) {
      const n = this.classAtom();
      if (n.type, gL(n) && this.isRangeDash()) {
        this.consumeChar("-");
        const i = this.classAtom();
        if (i.type, gL(i)) {
          if (i.value < n.value)
            throw Error("Range out of order in character class");
          e.push({ from: n.value, to: i.value });
        } else
          c5(n.value, e), e.push(Yt("-")), c5(i.value, e);
      } else
        c5(n.value, e);
    }
    return this.consumeChar("]"), { type: "Set", complement: r, value: e };
  }
  classAtom() {
    switch (this.peekChar()) {
      case "]":
      case `
`:
      case "\r":
      case "\u2028":
      case "\u2029":
        throw Error("TBD");
      case "\\":
        return this.classEscape();
      default:
        return this.classPatternCharacterAtom();
    }
  }
  classEscape() {
    switch (this.consumeChar("\\"), this.peekChar()) {
      case "b":
        return this.consumeChar("b"), { type: "Character", value: Yt("\b") };
      case "d":
      case "D":
      case "s":
      case "S":
      case "w":
      case "W":
        return this.characterClassEscape();
      case "f":
      case "n":
      case "r":
      case "t":
      case "v":
        return this.controlEscapeAtom();
      case "c":
        return this.controlLetterEscapeAtom();
      case "0":
        return this.nulCharacterAtom();
      case "x":
        return this.hexEscapeSequenceAtom();
      case "u":
        return this.regExpUnicodeEscapeSequenceAtom();
      default:
        return this.identityEscapeAtom();
    }
  }
  group() {
    let e = !0;
    switch (this.consumeChar("("), this.peekChar(0)) {
      case "?":
        this.consumeChar("?"), this.consumeChar(":"), e = !1;
        break;
      default:
        this.groupIdx++;
        break;
    }
    const r = this.disjunction();
    this.consumeChar(")");
    const n = {
      type: "Group",
      capturing: e,
      value: r
    };
    return e && (n.idx = this.groupIdx), n;
  }
  positiveInteger() {
    let e = this.popChar();
    if (q5e.test(e) === !1)
      throw Error("Expecting a positive integer");
    for (; ym.test(this.peekChar(0)); )
      e += this.popChar();
    return parseInt(e, 10);
  }
  integerIncludingZero() {
    let e = this.popChar();
    if (ym.test(e) === !1)
      throw Error("Expecting an integer");
    for (; ym.test(this.peekChar(0)); )
      e += this.popChar();
    return parseInt(e, 10);
  }
  patternCharacter() {
    const e = this.popChar();
    switch (e) {
      case `
`:
      case "\r":
      case "\u2028":
      case "\u2029":
      case "^":
      case "$":
      case "\\":
      case ".":
      case "*":
      case "+":
      case "?":
      case "(":
      case ")":
      case "[":
      case "|":
        throw Error("TBD");
      default:
        return { type: "Character", value: Yt(e) };
    }
  }
  isRegExpFlag() {
    switch (this.peekChar(0)) {
      case "g":
      case "i":
      case "m":
      case "u":
      case "y":
        return !0;
      default:
        return !1;
    }
  }
  isRangeDash() {
    return this.peekChar() === "-" && this.isClassAtom(1);
  }
  isDigit() {
    return ym.test(this.peekChar(0));
  }
  isClassAtom(e = 0) {
    switch (this.peekChar(e)) {
      case "]":
      case `
`:
      case "\r":
      case "\u2028":
      case "\u2029":
        return !1;
      default:
        return !0;
    }
  }
  isTerm() {
    return this.isAtom() || this.isAssertion();
  }
  isAtom() {
    if (this.isPatternCharacter())
      return !0;
    switch (this.peekChar(0)) {
      case ".":
      case "\\":
      case "[":
      case "(":
        return !0;
      default:
        return !1;
    }
  }
  isAssertion() {
    switch (this.peekChar(0)) {
      case "^":
      case "$":
        return !0;
      case "\\":
        switch (this.peekChar(1)) {
          case "b":
          case "B":
            return !0;
          default:
            return !1;
        }
      case "(":
        return this.peekChar(1) === "?" && (this.peekChar(2) === "=" || this.peekChar(2) === "!");
      default:
        return !1;
    }
  }
  isQuantifier() {
    const e = this.saveState();
    try {
      return this.quantifier(!0) !== void 0;
    } catch {
      return !1;
    } finally {
      this.restoreState(e);
    }
  }
  isPatternCharacter() {
    switch (this.peekChar()) {
      case "^":
      case "$":
      case "\\":
      case ".":
      case "*":
      case "+":
      case "?":
      case "(":
      case ")":
      case "[":
      case "|":
      case "/":
      case `
`:
      case "\r":
      case "\u2028":
      case "\u2029":
        return !1;
      default:
        return !0;
    }
  }
  parseHexDigits(e) {
    let r = "";
    for (let i = 0; i < e; i++) {
      const a = this.popChar();
      if (H5e.test(a) === !1)
        throw Error("Expecting a HexDecimal digits");
      r += a;
    }
    return { type: "Character", value: parseInt(r, 16) };
  }
  peekChar(e = 0) {
    return this.input[this.idx + e];
  }
  popChar() {
    const e = this.peekChar(0);
    return this.consumeChar(void 0), e;
  }
  consumeChar(e) {
    if (e !== void 0 && this.input[this.idx] !== e)
      throw Error("Expected: '" + e + "' but found: '" + this.input[this.idx] + "' at offset: " + this.idx);
    if (this.idx >= this.input.length)
      throw Error("Unexpected end of input");
    this.idx++;
  }
  loc(e) {
    return { begin: e, end: this.idx };
  }
}
class Kx {
  visitChildren(e) {
    for (const r in e) {
      const n = e[r];
      e.hasOwnProperty(r) && (n.type !== void 0 ? this.visit(n) : Array.isArray(n) && n.forEach((i) => {
        this.visit(i);
      }, this));
    }
  }
  visit(e) {
    switch (e.type) {
      case "Pattern":
        this.visitPattern(e);
        break;
      case "Flags":
        this.visitFlags(e);
        break;
      case "Disjunction":
        this.visitDisjunction(e);
        break;
      case "Alternative":
        this.visitAlternative(e);
        break;
      case "StartAnchor":
        this.visitStartAnchor(e);
        break;
      case "EndAnchor":
        this.visitEndAnchor(e);
        break;
      case "WordBoundary":
        this.visitWordBoundary(e);
        break;
      case "NonWordBoundary":
        this.visitNonWordBoundary(e);
        break;
      case "Lookahead":
        this.visitLookahead(e);
        break;
      case "NegativeLookahead":
        this.visitNegativeLookahead(e);
        break;
      case "Character":
        this.visitCharacter(e);
        break;
      case "Set":
        this.visitSet(e);
        break;
      case "Group":
        this.visitGroup(e);
        break;
      case "GroupBackReference":
        this.visitGroupBackReference(e);
        break;
      case "Quantifier":
        this.visitQuantifier(e);
        break;
    }
    this.visitChildren(e);
  }
  visitPattern(e) {
  }
  visitFlags(e) {
  }
  visitDisjunction(e) {
  }
  visitAlternative(e) {
  }
  // Assertion
  visitStartAnchor(e) {
  }
  visitEndAnchor(e) {
  }
  visitWordBoundary(e) {
  }
  visitNonWordBoundary(e) {
  }
  visitLookahead(e) {
  }
  visitNegativeLookahead(e) {
  }
  // atoms
  visitCharacter(e) {
  }
  visitSet(e) {
  }
  visitGroup(e) {
  }
  visitGroupBackReference(e) {
  }
  visitQuantifier(e) {
  }
}
const Y5e = /\r?\n/gm, X5e = new _U();
class j5e extends Kx {
  constructor() {
    super(...arguments), this.isStarting = !0, this.endRegexpStack = [], this.multiline = !1;
  }
  get endRegex() {
    return this.endRegexpStack.join("");
  }
  reset(e) {
    this.multiline = !1, this.regex = e, this.startRegexp = "", this.isStarting = !0, this.endRegexpStack = [];
  }
  visitGroup(e) {
    e.quantifier && (this.isStarting = !1, this.endRegexpStack = []);
  }
  visitCharacter(e) {
    const r = String.fromCharCode(e.value);
    if (!this.multiline && r === `
` && (this.multiline = !0), e.quantifier)
      this.isStarting = !1, this.endRegexpStack = [];
    else {
      const n = Zx(r);
      this.endRegexpStack.push(n), this.isStarting && (this.startRegexp += n);
    }
  }
  visitSet(e) {
    if (!this.multiline) {
      const r = this.regex.substring(e.loc.begin, e.loc.end), n = new RegExp(r);
      this.multiline = !!`
`.match(n);
    }
    if (e.quantifier)
      this.isStarting = !1, this.endRegexpStack = [];
    else {
      const r = this.regex.substring(e.loc.begin, e.loc.end);
      this.endRegexpStack.push(r), this.isStarting && (this.startRegexp += r);
    }
  }
  visitChildren(e) {
    e.type === "Group" && e.quantifier || super.visitChildren(e);
  }
}
const u5 = new j5e();
function K5e(t) {
  try {
    return typeof t == "string" && (t = new RegExp(t)), t = t.toString(), u5.reset(t), u5.visit(X5e.pattern(t)), u5.multiline;
  } catch {
    return !1;
  }
}
const Z5e = `\f
\r	\v              \u2028\u2029  　\uFEFF`.split("");
function OT(t) {
  const e = typeof t == "string" ? new RegExp(t) : t;
  return Z5e.some((r) => e.test(r));
}
function Zx(t) {
  return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function Q5e(t) {
  return Array.prototype.map.call(t, (e) => /\w/.test(e) ? `[${e.toLowerCase()}${e.toUpperCase()}]` : Zx(e)).join("");
}
function J5e(t, e) {
  const r = ewe(t), n = e.match(r);
  return !!n && n[0].length > 0;
}
function ewe(t) {
  typeof t == "string" && (t = new RegExp(t));
  const e = t, r = t.source;
  let n = 0;
  function i() {
    let a = "", s;
    function o(u) {
      a += r.substr(n, u), n += u;
    }
    function l(u) {
      a += "(?:" + r.substr(n, u) + "|$)", n += u;
    }
    for (; n < r.length; )
      switch (r[n]) {
        case "\\":
          switch (r[n + 1]) {
            case "c":
              l(3);
              break;
            case "x":
              l(4);
              break;
            case "u":
              e.unicode ? r[n + 2] === "{" ? l(r.indexOf("}", n) - n + 1) : l(6) : l(2);
              break;
            case "p":
            case "P":
              e.unicode ? l(r.indexOf("}", n) - n + 1) : l(2);
              break;
            case "k":
              l(r.indexOf(">", n) - n + 1);
              break;
            default:
              l(2);
              break;
          }
          break;
        case "[":
          s = /\[(?:\\.|.)*?\]/g, s.lastIndex = n, s = s.exec(r) || [], l(s[0].length);
          break;
        case "|":
        case "^":
        case "$":
        case "*":
        case "+":
        case "?":
          o(1);
          break;
        case "{":
          s = /\{\d+,?\d*\}/g, s.lastIndex = n, s = s.exec(r), s ? o(s[0].length) : l(1);
          break;
        case "(":
          if (r[n + 1] === "?")
            switch (r[n + 2]) {
              case ":":
                a += "(?:", n += 3, a += i() + "|$)";
                break;
              case "=":
                a += "(?=", n += 3, a += i() + ")";
                break;
              case "!":
                s = n, n += 3, i(), a += r.substr(s, n - s);
                break;
              case "<":
                switch (r[n + 3]) {
                  case "=":
                  case "!":
                    s = n, n += 4, i(), a += r.substr(s, n - s);
                    break;
                  default:
                    o(r.indexOf(">", n) - n + 1), a += i() + "|$)";
                    break;
                }
                break;
            }
          else
            o(1), a += i() + "|$)";
          break;
        case ")":
          return ++n, a;
        default:
          l(1);
          break;
      }
    return a;
  }
  return new RegExp(i(), t.flags);
}
function twe(t) {
  return t.rules.find((e) => is(e) && e.entry);
}
function rwe(t) {
  return t.rules.filter((e) => Gu(e) && e.hidden);
}
function LU(t, e) {
  const r = /* @__PURE__ */ new Set(), n = twe(t);
  if (!n)
    return new Set(t.rules);
  const i = [n].concat(rwe(t));
  for (const s of i)
    RU(s, r, e);
  const a = /* @__PURE__ */ new Set();
  for (const s of t.rules)
    (r.has(s.name) || Gu(s) && s.hidden) && a.add(s);
  return a;
}
function RU(t, e, r) {
  e.add(t.name), u1(t).forEach((n) => {
    if (Tu(n) || r) {
      const i = n.rule.ref;
      i && !e.has(i.name) && RU(i, e, r);
    }
  });
}
function nwe(t) {
  if (t.terminal)
    return t.terminal;
  if (t.type.ref) {
    const e = MU(t.type.ref);
    return e == null ? void 0 : e.terminal;
  }
}
function iwe(t) {
  return t.hidden && !OT(_S(t));
}
function awe(t, e) {
  return !t || !e ? [] : SS(t, e, t.astNode, !0);
}
function NU(t, e, r) {
  if (!t || !e)
    return;
  const n = SS(t, e, t.astNode, !0);
  if (n.length !== 0)
    return r !== void 0 ? r = Math.max(0, Math.min(r, n.length - 1)) : r = 0, n[r];
}
function SS(t, e, r, n) {
  if (!n) {
    const i = jx(t.grammarSource, bu);
    if (i && i.feature === e)
      return [t];
  }
  return gg(t) && t.astNode === r ? t.content.flatMap((i) => SS(i, e, r, !1)) : [];
}
function swe(t, e, r) {
  if (!t)
    return;
  const n = owe(t, e, t == null ? void 0 : t.astNode);
  if (n.length !== 0)
    return r !== void 0 ? r = Math.max(0, Math.min(r, n.length - 1)) : r = 0, n[r];
}
function owe(t, e, r) {
  if (t.astNode !== r)
    return [];
  if (wu(t.grammarSource) && t.grammarSource.value === e)
    return [t];
  const n = MT(t).iterator();
  let i;
  const a = [];
  do
    if (i = n.next(), !i.done) {
      const s = i.value;
      s.astNode === r ? wu(s.grammarSource) && s.grammarSource.value === e && a.push(s) : n.prune();
    }
  while (!i.done);
  return a;
}
function lwe(t) {
  var e;
  const r = t.astNode;
  for (; r === ((e = t.container) === null || e === void 0 ? void 0 : e.astNode); ) {
    const n = jx(t.grammarSource, bu);
    if (n)
      return n;
    t = t.container;
  }
}
function MU(t) {
  let e = t;
  return bU(e) && (Xx(e.$container) ? e = e.$container.$container : is(e.$container) ? e = e.$container : c1(e.$container)), DU(t, e, /* @__PURE__ */ new Map());
}
function DU(t, e, r) {
  var n;
  function i(a, s) {
    let o;
    return jx(a, bu) || (o = DU(s, s, r)), r.set(t, o), o;
  }
  if (r.has(t))
    return r.get(t);
  r.set(t, void 0);
  for (const a of u1(e)) {
    if (bu(a) && a.feature.toLowerCase() === "name")
      return r.set(t, a), a;
    if (Tu(a) && is(a.rule.ref))
      return i(a, a.rule.ref);
    if (M5e(a) && (!((n = a.typeRef) === null || n === void 0) && n.ref))
      return i(a, a.typeRef.ref);
  }
}
function IU(t) {
  return OU(t, /* @__PURE__ */ new Set());
}
function OU(t, e) {
  if (e.has(t))
    return !0;
  e.add(t);
  for (const r of u1(t))
    if (Tu(r)) {
      if (!r.rule.ref || is(r.rule.ref) && !OU(r.rule.ref, e))
        return !1;
    } else {
      if (bu(r))
        return !1;
      if (Xx(r))
        return !1;
    }
  return !!t.definition;
}
function CS(t) {
  if (t.inferredType)
    return t.inferredType.name;
  if (t.dataType)
    return t.dataType;
  if (t.returnType) {
    const e = t.returnType.ref;
    if (e) {
      if (is(e))
        return e.name;
      if (wU(e) || TU(e))
        return e.name;
    }
  }
}
function AS(t) {
  var e;
  if (is(t))
    return IU(t) ? t.name : (e = CS(t)) !== null && e !== void 0 ? e : t.name;
  if (wU(t) || TU(t) || N5e(t))
    return t.name;
  if (Xx(t)) {
    const r = cwe(t);
    if (r)
      return r;
  } else if (bU(t))
    return t.name;
  throw new Error("Cannot get name of Unknown Type");
}
function cwe(t) {
  var e;
  if (t.inferredType)
    return t.inferredType.name;
  if (!((e = t.type) === null || e === void 0) && e.ref)
    return AS(t.type.ref);
}
function uwe(t) {
  var e, r, n;
  return Gu(t) ? (r = (e = t.type) === null || e === void 0 ? void 0 : e.name) !== null && r !== void 0 ? r : "string" : (n = CS(t)) !== null && n !== void 0 ? n : t.name;
}
function _S(t) {
  const e = {
    s: !1,
    i: !1,
    u: !1
  }, r = $f(t.definition, e), n = Object.entries(e).filter(([, i]) => i).map(([i]) => i).join("");
  return new RegExp(r, n);
}
const LS = /[\s\S]/.source;
function $f(t, e) {
  if (B5e(t))
    return hwe(t);
  if (F5e(t))
    return dwe(t);
  if (D5e(t))
    return gwe(t);
  if ($5e(t)) {
    const r = t.rule.ref;
    if (!r)
      throw new Error("Missing rule reference.");
    return Go($f(r.definition), {
      cardinality: t.cardinality,
      lookahead: t.lookahead
    });
  } else {
    if (O5e(t))
      return pwe(t);
    if (z5e(t))
      return fwe(t);
    if (P5e(t)) {
      const r = t.regex.lastIndexOf("/"), n = t.regex.substring(1, r), i = t.regex.substring(r + 1);
      return e && (e.i = i.includes("i"), e.s = i.includes("s"), e.u = i.includes("u")), Go(n, {
        cardinality: t.cardinality,
        lookahead: t.lookahead,
        wrap: !1
      });
    } else {
      if (V5e(t))
        return Go(LS, {
          cardinality: t.cardinality,
          lookahead: t.lookahead
        });
      throw new Error(`Invalid terminal element: ${t == null ? void 0 : t.$type}`);
    }
  }
}
function hwe(t) {
  return Go(t.elements.map((e) => $f(e)).join("|"), {
    cardinality: t.cardinality,
    lookahead: t.lookahead
  });
}
function dwe(t) {
  return Go(t.elements.map((e) => $f(e)).join(""), {
    cardinality: t.cardinality,
    lookahead: t.lookahead
  });
}
function fwe(t) {
  return Go(`${LS}*?${$f(t.terminal)}`, {
    cardinality: t.cardinality,
    lookahead: t.lookahead
  });
}
function pwe(t) {
  return Go(`(?!${$f(t.terminal)})${LS}*?`, {
    cardinality: t.cardinality,
    lookahead: t.lookahead
  });
}
function gwe(t) {
  return t.right ? Go(`[${h5(t.left)}-${h5(t.right)}]`, {
    cardinality: t.cardinality,
    lookahead: t.lookahead,
    wrap: !1
  }) : Go(h5(t.left), {
    cardinality: t.cardinality,
    lookahead: t.lookahead,
    wrap: !1
  });
}
function h5(t) {
  return Zx(t.value);
}
function Go(t, e) {
  var r;
  return (e.wrap !== !1 || e.lookahead) && (t = `(${(r = e.lookahead) !== null && r !== void 0 ? r : ""}${t})`), e.cardinality ? `${t}${e.cardinality}` : t;
}
function mwe(t) {
  const e = [], r = t.Grammar;
  for (const n of r.rules)
    Gu(n) && iwe(n) && K5e(_S(n)) && e.push(n.name);
  return {
    multilineCommentRules: e,
    nameRegexp: T5e
  };
}
function PT(t) {
  console && console.error && console.error(`Error: ${t}`);
}
function PU(t) {
  console && console.warn && console.warn(`Warning: ${t}`);
}
function BU(t) {
  const e = (/* @__PURE__ */ new Date()).getTime(), r = t();
  return { time: (/* @__PURE__ */ new Date()).getTime() - e, value: r };
}
function FU(t) {
  function e() {
  }
  e.prototype = t;
  const r = new e();
  function n() {
    return typeof r.bar;
  }
  return n(), n(), t;
}
function vwe(t) {
  return ywe(t) ? t.LABEL : t.name;
}
function ywe(t) {
  return fa(t.LABEL) && t.LABEL !== "";
}
class ho {
  get definition() {
    return this._definition;
  }
  set definition(e) {
    this._definition = e;
  }
  constructor(e) {
    this._definition = e;
  }
  accept(e) {
    e.visit(this), Ie(this.definition, (r) => {
      r.accept(e);
    });
  }
}
class Xi extends ho {
  constructor(e) {
    super([]), this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
  set definition(e) {
  }
  get definition() {
    return this.referencedRule !== void 0 ? this.referencedRule.definition : [];
  }
  accept(e) {
    e.visit(this);
  }
}
class zf extends ho {
  constructor(e) {
    super(e.definition), this.orgText = "", Na(this, As(e, (r) => r !== void 0));
  }
}
class pa extends ho {
  constructor(e) {
    super(e.definition), this.ignoreAmbiguities = !1, Na(this, As(e, (r) => r !== void 0));
  }
}
let hi = class extends ho {
  constructor(e) {
    super(e.definition), this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
};
class Oa extends ho {
  constructor(e) {
    super(e.definition), this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
}
class Pa extends ho {
  constructor(e) {
    super(e.definition), this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
}
class on extends ho {
  constructor(e) {
    super(e.definition), this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
}
class ya extends ho {
  constructor(e) {
    super(e.definition), this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
}
class xa extends ho {
  get definition() {
    return this._definition;
  }
  set definition(e) {
    this._definition = e;
  }
  constructor(e) {
    super(e.definition), this.idx = 1, this.ignoreAmbiguities = !1, this.hasPredicates = !1, Na(this, As(e, (r) => r !== void 0));
  }
}
class qr {
  constructor(e) {
    this.idx = 1, Na(this, As(e, (r) => r !== void 0));
  }
  accept(e) {
    e.visit(this);
  }
}
function xwe(t) {
  return ft(t, gv);
}
function gv(t) {
  function e(r) {
    return ft(r, gv);
  }
  if (t instanceof Xi) {
    const r = {
      type: "NonTerminal",
      name: t.nonTerminalName,
      idx: t.idx
    };
    return fa(t.label) && (r.label = t.label), r;
  } else {
    if (t instanceof pa)
      return {
        type: "Alternative",
        definition: e(t.definition)
      };
    if (t instanceof hi)
      return {
        type: "Option",
        idx: t.idx,
        definition: e(t.definition)
      };
    if (t instanceof Oa)
      return {
        type: "RepetitionMandatory",
        idx: t.idx,
        definition: e(t.definition)
      };
    if (t instanceof Pa)
      return {
        type: "RepetitionMandatoryWithSeparator",
        idx: t.idx,
        separator: gv(new qr({ terminalType: t.separator })),
        definition: e(t.definition)
      };
    if (t instanceof ya)
      return {
        type: "RepetitionWithSeparator",
        idx: t.idx,
        separator: gv(new qr({ terminalType: t.separator })),
        definition: e(t.definition)
      };
    if (t instanceof on)
      return {
        type: "Repetition",
        idx: t.idx,
        definition: e(t.definition)
      };
    if (t instanceof xa)
      return {
        type: "Alternation",
        idx: t.idx,
        definition: e(t.definition)
      };
    if (t instanceof qr) {
      const r = {
        type: "Terminal",
        name: t.terminalType.name,
        label: vwe(t.terminalType),
        idx: t.idx
      };
      fa(t.label) && (r.terminalLabel = t.label);
      const n = t.terminalType.PATTERN;
      return t.terminalType.PATTERN && (r.pattern = Zo(n) ? n.source : n), r;
    } else {
      if (t instanceof zf)
        return {
          type: "Rule",
          name: t.name,
          orgText: t.orgText,
          definition: e(t.definition)
        };
      throw Error("non exhaustive match");
    }
  }
}
class Vf {
  visit(e) {
    const r = e;
    switch (r.constructor) {
      case Xi:
        return this.visitNonTerminal(r);
      case pa:
        return this.visitAlternative(r);
      case hi:
        return this.visitOption(r);
      case Oa:
        return this.visitRepetitionMandatory(r);
      case Pa:
        return this.visitRepetitionMandatoryWithSeparator(r);
      case ya:
        return this.visitRepetitionWithSeparator(r);
      case on:
        return this.visitRepetition(r);
      case xa:
        return this.visitAlternation(r);
      case qr:
        return this.visitTerminal(r);
      case zf:
        return this.visitRule(r);
      default:
        throw Error("non exhaustive match");
    }
  }
  /* c8 ignore next */
  visitNonTerminal(e) {
  }
  /* c8 ignore next */
  visitAlternative(e) {
  }
  /* c8 ignore next */
  visitOption(e) {
  }
  /* c8 ignore next */
  visitRepetition(e) {
  }
  /* c8 ignore next */
  visitRepetitionMandatory(e) {
  }
  /* c8 ignore next 3 */
  visitRepetitionMandatoryWithSeparator(e) {
  }
  /* c8 ignore next */
  visitRepetitionWithSeparator(e) {
  }
  /* c8 ignore next */
  visitAlternation(e) {
  }
  /* c8 ignore next */
  visitTerminal(e) {
  }
  /* c8 ignore next */
  visitRule(e) {
  }
}
function bwe(t) {
  return t instanceof pa || t instanceof hi || t instanceof on || t instanceof Oa || t instanceof Pa || t instanceof ya || t instanceof qr || t instanceof zf;
}
function r2(t, e = []) {
  return t instanceof hi || t instanceof on || t instanceof ya ? !0 : t instanceof xa ? Pz(t.definition, (n) => r2(n, e)) : t instanceof Xi && Qi(e, t) ? !1 : t instanceof ho ? (t instanceof Xi && e.push(t), ys(t.definition, (n) => r2(n, e))) : !1;
}
function wwe(t) {
  return t instanceof xa;
}
function Vs(t) {
  if (t instanceof Xi)
    return "SUBRULE";
  if (t instanceof hi)
    return "OPTION";
  if (t instanceof xa)
    return "OR";
  if (t instanceof Oa)
    return "AT_LEAST_ONE";
  if (t instanceof Pa)
    return "AT_LEAST_ONE_SEP";
  if (t instanceof ya)
    return "MANY_SEP";
  if (t instanceof on)
    return "MANY";
  if (t instanceof qr)
    return "CONSUME";
  throw Error("non exhaustive match");
}
class Qx {
  walk(e, r = []) {
    Ie(e.definition, (n, i) => {
      const a = ii(e.definition, i + 1);
      if (n instanceof Xi)
        this.walkProdRef(n, a, r);
      else if (n instanceof qr)
        this.walkTerminal(n, a, r);
      else if (n instanceof pa)
        this.walkFlat(n, a, r);
      else if (n instanceof hi)
        this.walkOption(n, a, r);
      else if (n instanceof Oa)
        this.walkAtLeastOne(n, a, r);
      else if (n instanceof Pa)
        this.walkAtLeastOneSep(n, a, r);
      else if (n instanceof ya)
        this.walkManySep(n, a, r);
      else if (n instanceof on)
        this.walkMany(n, a, r);
      else if (n instanceof xa)
        this.walkOr(n, a, r);
      else
        throw Error("non exhaustive match");
    });
  }
  walkTerminal(e, r, n) {
  }
  walkProdRef(e, r, n) {
  }
  walkFlat(e, r, n) {
    const i = r.concat(n);
    this.walk(e, i);
  }
  walkOption(e, r, n) {
    const i = r.concat(n);
    this.walk(e, i);
  }
  walkAtLeastOne(e, r, n) {
    const i = [
      new hi({ definition: e.definition })
    ].concat(r, n);
    this.walk(e, i);
  }
  walkAtLeastOneSep(e, r, n) {
    const i = vL(e, r, n);
    this.walk(e, i);
  }
  walkMany(e, r, n) {
    const i = [
      new hi({ definition: e.definition })
    ].concat(r, n);
    this.walk(e, i);
  }
  walkManySep(e, r, n) {
    const i = vL(e, r, n);
    this.walk(e, i);
  }
  walkOr(e, r, n) {
    const i = r.concat(n);
    Ie(e.definition, (a) => {
      const s = new pa({ definition: [a] });
      this.walk(s, i);
    });
  }
}
function vL(t, e, r) {
  return [
    new hi({
      definition: [
        new qr({ terminalType: t.separator })
      ].concat(t.definition)
    })
  ].concat(e, r);
}
function h1(t) {
  if (t instanceof Xi)
    return h1(t.referencedRule);
  if (t instanceof qr)
    return kwe(t);
  if (bwe(t))
    return Twe(t);
  if (wwe(t))
    return Ewe(t);
  throw Error("non exhaustive match");
}
function Twe(t) {
  let e = [];
  const r = t.definition;
  let n = 0, i = r.length > n, a, s = !0;
  for (; i && s; )
    a = r[n], s = r2(a), e = e.concat(h1(a)), n = n + 1, i = r.length > n;
  return Bk(e);
}
function Ewe(t) {
  const e = ft(t.definition, (r) => h1(r));
  return Bk(jn(e));
}
function kwe(t) {
  return [t.terminalType];
}
const $U = "_~IN~_";
class Swe extends Qx {
  constructor(e) {
    super(), this.topProd = e, this.follows = {};
  }
  startWalking() {
    return this.walk(this.topProd), this.follows;
  }
  walkTerminal(e, r, n) {
  }
  walkProdRef(e, r, n) {
    const i = Awe(e.referencedRule, e.idx) + this.topProd.name, a = r.concat(n), s = new pa({ definition: a }), o = h1(s);
    this.follows[i] = o;
  }
}
function Cwe(t) {
  const e = {};
  return Ie(t, (r) => {
    const n = new Swe(r).startWalking();
    Na(e, n);
  }), e;
}
function Awe(t, e) {
  return t.name + e + $U;
}
let mv = {};
const _we = new _U();
function Jx(t) {
  const e = t.toString();
  if (mv.hasOwnProperty(e))
    return mv[e];
  {
    const r = _we.pattern(e);
    return mv[e] = r, r;
  }
}
function Lwe() {
  mv = {};
}
const zU = "Complement Sets are not supported for first char optimization", n2 = `Unable to use "first char" lexer optimizations:
`;
function Rwe(t, e = !1) {
  try {
    const r = Jx(t);
    return BT(r.value, {}, r.flags.ignoreCase);
  } catch (r) {
    if (r.message === zU)
      e && PU(`${n2}	Unable to optimize: < ${t.toString()} >
	Complement Sets cannot be automatically optimized.
	This will disable the lexer's first char optimizations.
	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);
    else {
      let n = "";
      e && (n = `
	This will disable the lexer's first char optimizations.
	See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`), PT(`${n2}
	Failed parsing: < ${t.toString()} >
	Using the @chevrotain/regexp-to-ast library
	Please open an issue at: https://github.com/chevrotain/chevrotain/issues` + n);
    }
  }
  return [];
}
function BT(t, e, r) {
  switch (t.type) {
    case "Disjunction":
      for (let i = 0; i < t.value.length; i++)
        BT(t.value[i], e, r);
      break;
    case "Alternative":
      const n = t.value;
      for (let i = 0; i < n.length; i++) {
        const a = n[i];
        switch (a.type) {
          case "EndAnchor":
          case "GroupBackReference":
          case "Lookahead":
          case "NegativeLookahead":
          case "StartAnchor":
          case "WordBoundary":
          case "NonWordBoundary":
            continue;
        }
        const s = a;
        switch (s.type) {
          case "Character":
            xm(s.value, e, r);
            break;
          case "Set":
            if (s.complement === !0)
              throw Error(zU);
            Ie(s.value, (l) => {
              if (typeof l == "number")
                xm(l, e, r);
              else {
                const u = l;
                if (r === !0)
                  for (let h = u.from; h <= u.to; h++)
                    xm(h, e, r);
                else {
                  for (let h = u.from; h <= u.to && h < sp; h++)
                    xm(h, e, r);
                  if (u.to >= sp) {
                    const h = u.from >= sp ? u.from : sp, d = u.to, f = jl(h), p = jl(d);
                    for (let g = f; g <= p; g++)
                      e[g] = g;
                  }
                }
              }
            });
            break;
          case "Group":
            BT(s.value, e, r);
            break;
          default:
            throw Error("Non Exhaustive Match");
        }
        const o = s.quantifier !== void 0 && s.quantifier.atLeast === 0;
        if (
          // A group may be optional due to empty contents /(?:)/
          // or if everything inside it is optional /((a)?)/
          s.type === "Group" && FT(s) === !1 || // If this term is not a group it may only be optional if it has an optional quantifier
          s.type !== "Group" && o === !1
        )
          break;
      }
      break;
    default:
      throw Error("non exhaustive match!");
  }
  return Pr(e);
}
function xm(t, e, r) {
  const n = jl(t);
  e[n] = n, r === !0 && Nwe(t, e);
}
function Nwe(t, e) {
  const r = String.fromCharCode(t), n = r.toUpperCase();
  if (n !== r) {
    const i = jl(n.charCodeAt(0));
    e[i] = i;
  } else {
    const i = r.toLowerCase();
    if (i !== r) {
      const a = jl(i.charCodeAt(0));
      e[a] = a;
    }
  }
}
function yL(t, e) {
  return Ko(t.value, (r) => {
    if (typeof r == "number")
      return Qi(e, r);
    {
      const n = r;
      return Ko(e, (i) => n.from <= i && i <= n.to) !== void 0;
    }
  });
}
function FT(t) {
  const e = t.quantifier;
  return e && e.atLeast === 0 ? !0 : t.value ? ir(t.value) ? ys(t.value, FT) : FT(t.value) : !1;
}
class Mwe extends Kx {
  constructor(e) {
    super(), this.targetCharCodes = e, this.found = !1;
  }
  visitChildren(e) {
    if (this.found !== !0) {
      switch (e.type) {
        case "Lookahead":
          this.visitLookahead(e);
          return;
        case "NegativeLookahead":
          this.visitNegativeLookahead(e);
          return;
      }
      super.visitChildren(e);
    }
  }
  visitCharacter(e) {
    Qi(this.targetCharCodes, e.value) && (this.found = !0);
  }
  visitSet(e) {
    e.complement ? yL(e, this.targetCharCodes) === void 0 && (this.found = !0) : yL(e, this.targetCharCodes) !== void 0 && (this.found = !0);
  }
}
function RS(t, e) {
  if (e instanceof RegExp) {
    const r = Jx(e), n = new Mwe(t);
    return n.visit(r), n.found;
  } else
    return Ko(e, (r) => Qi(t, r.charCodeAt(0))) !== void 0;
}
const Eu = "PATTERN", ap = "defaultMode", bm = "modes";
let VU = typeof new RegExp("(?:)").sticky == "boolean";
function Dwe(t, e) {
  e = kx(e, {
    useSticky: VU,
    debug: !1,
    safeMode: !1,
    positionTracking: "full",
    lineTerminatorCharacters: ["\r", `
`],
    tracer: (b, w) => w()
  });
  const r = e.tracer;
  r("initCharCodeToOptimizedIndexMap", () => {
    rTe();
  });
  let n;
  r("Reject Lexer.NA", () => {
    n = Ax(t, (b) => b[Eu] === ua.NA);
  });
  let i = !1, a;
  r("Transform Patterns", () => {
    i = !1, a = ft(n, (b) => {
      const w = b[Eu];
      if (Zo(w)) {
        const T = w.source;
        return T.length === 1 && // only these regExp meta characters which can appear in a length one regExp
        T !== "^" && T !== "$" && T !== "." && !w.ignoreCase ? T : T.length === 2 && T[0] === "\\" && // not a meta character
        !Qi([
          "d",
          "D",
          "s",
          "S",
          "t",
          "r",
          "n",
          "t",
          "0",
          "c",
          "b",
          "B",
          "f",
          "v",
          "w",
          "W"
        ], T[1]) ? T[1] : e.useSticky ? bL(w) : xL(w);
      } else {
        if (Ja(w))
          return i = !0, { exec: w };
        if (typeof w == "object")
          return i = !0, w;
        if (typeof w == "string") {
          if (w.length === 1)
            return w;
          {
            const T = w.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&"), E = new RegExp(T);
            return e.useSticky ? bL(E) : xL(E);
          }
        } else
          throw Error("non exhaustive match");
      }
    });
  });
  let s, o, l, u, h;
  r("misc mapping", () => {
    s = ft(n, (b) => b.tokenTypeIdx), o = ft(n, (b) => {
      const w = b.GROUP;
      if (w !== ua.SKIPPED) {
        if (fa(w))
          return w;
        if (Rr(w))
          return !1;
        throw Error("non exhaustive match");
      }
    }), l = ft(n, (b) => {
      const w = b.LONGER_ALT;
      if (w)
        return ir(w) ? ft(w, (E) => yA(n, E)) : [yA(n, w)];
    }), u = ft(n, (b) => b.PUSH_MODE), h = ft(n, (b) => Ft(b, "POP_MODE"));
  });
  let d;
  r("Line Terminator Handling", () => {
    const b = WU(e.lineTerminatorCharacters);
    d = ft(n, (w) => !1), e.positionTracking !== "onlyOffset" && (d = ft(n, (w) => Ft(w, "LINE_BREAKS") ? !!w.LINE_BREAKS : UU(w, b) === !1 && RS(b, w.PATTERN)));
  });
  let f, p, g, m;
  r("Misc Mapping #2", () => {
    f = ft(n, GU), p = ft(a, Jwe), g = An(n, (b, w) => {
      const T = w.GROUP;
      return fa(T) && T !== ua.SKIPPED && (b[T] = []), b;
    }, {}), m = ft(a, (b, w) => ({
      pattern: a[w],
      longerAlt: l[w],
      canLineTerminator: d[w],
      isCustom: f[w],
      short: p[w],
      group: o[w],
      push: u[w],
      pop: h[w],
      tokenTypeIdx: s[w],
      tokenType: n[w]
    }));
  });
  let v = !0, y = [];
  return e.safeMode || r("First Char Optimization", () => {
    y = An(n, (b, w, T) => {
      if (typeof w.PATTERN == "string") {
        const E = w.PATTERN.charCodeAt(0), C = jl(E);
        d5(b, C, m[T]);
      } else if (ir(w.START_CHARS_HINT)) {
        let E;
        Ie(w.START_CHARS_HINT, (C) => {
          const k = typeof C == "string" ? C.charCodeAt(0) : C, _ = jl(k);
          E !== _ && (E = _, d5(b, _, m[T]));
        });
      } else if (Zo(w.PATTERN))
        if (w.PATTERN.unicode)
          v = !1, e.ensureOptimizations && PT(`${n2}	Unable to analyze < ${w.PATTERN.toString()} > pattern.
	The regexp unicode flag is not currently supported by the regexp-to-ast library.
	This will disable the lexer's first char optimizations.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);
        else {
          const E = Rwe(w.PATTERN, e.ensureOptimizations);
          Sr(E) && (v = !1), Ie(E, (C) => {
            d5(b, C, m[T]);
          });
        }
      else
        e.ensureOptimizations && PT(`${n2}	TokenType: <${w.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
	This will disable the lexer's first char optimizations.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`), v = !1;
      return b;
    }, []);
  }), {
    emptyGroups: g,
    patternIdxToConfig: m,
    charCodeToPatternIdxToConfig: y,
    hasCustom: i,
    canBeOptimized: v
  };
}
function Iwe(t, e) {
  let r = [];
  const n = Pwe(t);
  r = r.concat(n.errors);
  const i = Bwe(n.valid), a = i.valid;
  return r = r.concat(i.errors), r = r.concat(Owe(a)), r = r.concat(Hwe(a)), r = r.concat(qwe(a, e)), r = r.concat(Ywe(a)), r;
}
function Owe(t) {
  let e = [];
  const r = cn(t, (n) => Zo(n[Eu]));
  return e = e.concat($we(r)), e = e.concat(Gwe(r)), e = e.concat(Uwe(r)), e = e.concat(Wwe(r)), e = e.concat(zwe(r)), e;
}
function Pwe(t) {
  const e = cn(t, (i) => !Ft(i, Eu)), r = ft(e, (i) => ({
    message: "Token Type: ->" + i.name + "<- missing static 'PATTERN' property",
    type: ln.MISSING_PATTERN,
    tokenTypes: [i]
  })), n = Sx(t, e);
  return { errors: r, valid: n };
}
function Bwe(t) {
  const e = cn(t, (i) => {
    const a = i[Eu];
    return !Zo(a) && !Ja(a) && !Ft(a, "exec") && !fa(a);
  }), r = ft(e, (i) => ({
    message: "Token Type: ->" + i.name + "<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",
    type: ln.INVALID_PATTERN,
    tokenTypes: [i]
  })), n = Sx(t, e);
  return { errors: r, valid: n };
}
const Fwe = /[^\\][$]/;
function $we(t) {
  class e extends Kx {
    constructor() {
      super(...arguments), this.found = !1;
    }
    visitEndAnchor(a) {
      this.found = !0;
    }
  }
  const r = cn(t, (i) => {
    const a = i.PATTERN;
    try {
      const s = Jx(a), o = new e();
      return o.visit(s), o.found;
    } catch {
      return Fwe.test(a.source);
    }
  });
  return ft(r, (i) => ({
    message: `Unexpected RegExp Anchor Error:
	Token Type: ->` + i.name + `<- static 'PATTERN' cannot contain end of input anchor '$'
	See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.`,
    type: ln.EOI_ANCHOR_FOUND,
    tokenTypes: [i]
  }));
}
function zwe(t) {
  const e = cn(t, (n) => n.PATTERN.test(""));
  return ft(e, (n) => ({
    message: "Token Type: ->" + n.name + "<- static 'PATTERN' must not match an empty string",
    type: ln.EMPTY_MATCH_PATTERN,
    tokenTypes: [n]
  }));
}
const Vwe = /[^\\[][\^]|^\^/;
function Gwe(t) {
  class e extends Kx {
    constructor() {
      super(...arguments), this.found = !1;
    }
    visitStartAnchor(a) {
      this.found = !0;
    }
  }
  const r = cn(t, (i) => {
    const a = i.PATTERN;
    try {
      const s = Jx(a), o = new e();
      return o.visit(s), o.found;
    } catch {
      return Vwe.test(a.source);
    }
  });
  return ft(r, (i) => ({
    message: `Unexpected RegExp Anchor Error:
	Token Type: ->` + i.name + `<- static 'PATTERN' cannot contain start of input anchor '^'
	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS	for details.`,
    type: ln.SOI_ANCHOR_FOUND,
    tokenTypes: [i]
  }));
}
function Uwe(t) {
  const e = cn(t, (n) => {
    const i = n[Eu];
    return i instanceof RegExp && (i.multiline || i.global);
  });
  return ft(e, (n) => ({
    message: "Token Type: ->" + n.name + "<- static 'PATTERN' may NOT contain global('g') or multiline('m')",
    type: ln.UNSUPPORTED_FLAGS_FOUND,
    tokenTypes: [n]
  }));
}
function Wwe(t) {
  const e = [];
  let r = ft(t, (a) => An(t, (s, o) => (a.PATTERN.source === o.PATTERN.source && !Qi(e, o) && o.PATTERN !== ua.NA && (e.push(o), s.push(o)), s), []));
  r = Xg(r);
  const n = cn(r, (a) => a.length > 1);
  return ft(n, (a) => {
    const s = ft(a, (l) => l.name);
    return {
      message: `The same RegExp pattern ->${Es(a).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,
      type: ln.DUPLICATE_PATTERNS_FOUND,
      tokenTypes: a
    };
  });
}
function Hwe(t) {
  const e = cn(t, (n) => {
    if (!Ft(n, "GROUP"))
      return !1;
    const i = n.GROUP;
    return i !== ua.SKIPPED && i !== ua.NA && !fa(i);
  });
  return ft(e, (n) => ({
    message: "Token Type: ->" + n.name + "<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",
    type: ln.INVALID_GROUP_TYPE_FOUND,
    tokenTypes: [n]
  }));
}
function qwe(t, e) {
  const r = cn(t, (i) => i.PUSH_MODE !== void 0 && !Qi(e, i.PUSH_MODE));
  return ft(r, (i) => ({
    message: `Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,
    type: ln.PUSH_MODE_DOES_NOT_EXIST,
    tokenTypes: [i]
  }));
}
function Ywe(t) {
  const e = [], r = An(t, (n, i, a) => {
    const s = i.PATTERN;
    return s === ua.NA || (fa(s) ? n.push({ str: s, idx: a, tokenType: i }) : Zo(s) && jwe(s) && n.push({ str: s.source, idx: a, tokenType: i })), n;
  }, []);
  return Ie(t, (n, i) => {
    Ie(r, ({ str: a, idx: s, tokenType: o }) => {
      if (i < s && Xwe(a, n.PATTERN)) {
        const l = `Token: ->${o.name}<- can never be matched.
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;
        e.push({
          message: l,
          type: ln.UNREACHABLE_PATTERN,
          tokenTypes: [n, o]
        });
      }
    });
  }), e;
}
function Xwe(t, e) {
  if (Zo(e)) {
    const r = e.exec(t);
    return r !== null && r.index === 0;
  } else {
    if (Ja(e))
      return e(t, 0, [], {});
    if (Ft(e, "exec"))
      return e.exec(t, 0, [], {});
    if (typeof e == "string")
      return e === t;
    throw Error("non exhaustive match");
  }
}
function jwe(t) {
  return Ko([
    ".",
    "\\",
    "[",
    "]",
    "|",
    "^",
    "$",
    "(",
    ")",
    "?",
    "*",
    "+",
    "{"
  ], (r) => t.source.indexOf(r) !== -1) === void 0;
}
function xL(t) {
  const e = t.ignoreCase ? "i" : "";
  return new RegExp(`^(?:${t.source})`, e);
}
function bL(t) {
  const e = t.ignoreCase ? "iy" : "y";
  return new RegExp(`${t.source}`, e);
}
function Kwe(t, e, r) {
  const n = [];
  return Ft(t, ap) || n.push({
    message: "A MultiMode Lexer cannot be initialized without a <" + ap + `> property in its definition
`,
    type: ln.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE
  }), Ft(t, bm) || n.push({
    message: "A MultiMode Lexer cannot be initialized without a <" + bm + `> property in its definition
`,
    type: ln.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY
  }), Ft(t, bm) && Ft(t, ap) && !Ft(t.modes, t.defaultMode) && n.push({
    message: `A MultiMode Lexer cannot be initialized with a ${ap}: <${t.defaultMode}>which does not exist
`,
    type: ln.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST
  }), Ft(t, bm) && Ie(t.modes, (i, a) => {
    Ie(i, (s, o) => {
      if (Rr(s))
        n.push({
          message: `A Lexer cannot be initialized using an undefined Token Type. Mode:<${a}> at index: <${o}>
`,
          type: ln.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED
        });
      else if (Ft(s, "LONGER_ALT")) {
        const l = ir(s.LONGER_ALT) ? s.LONGER_ALT : [s.LONGER_ALT];
        Ie(l, (u) => {
          !Rr(u) && !Qi(i, u) && n.push({
            message: `A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${s.name}> outside of mode <${a}>
`,
            type: ln.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE
          });
        });
      }
    });
  }), n;
}
function Zwe(t, e, r) {
  const n = [];
  let i = !1;
  const a = Xg(jn(Pr(t.modes))), s = Ax(a, (l) => l[Eu] === ua.NA), o = WU(r);
  return e && Ie(s, (l) => {
    const u = UU(l, o);
    if (u !== !1) {
      const d = {
        message: tTe(l, u),
        type: u.issue,
        tokenType: l
      };
      n.push(d);
    } else
      Ft(l, "LINE_BREAKS") ? l.LINE_BREAKS === !0 && (i = !0) : RS(o, l.PATTERN) && (i = !0);
  }), e && !i && n.push({
    message: `Warning: No LINE_BREAKS Found.
	This Lexer has been defined to track line and column information,
	But none of the Token Types can be identified as matching a line terminator.
	See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS 
	for details.`,
    type: ln.NO_LINE_BREAKS_FLAGS
  }), n;
}
function Qwe(t) {
  const e = {}, r = On(t);
  return Ie(r, (n) => {
    const i = t[n];
    if (ir(i))
      e[n] = [];
    else
      throw Error("non exhaustive match");
  }), e;
}
function GU(t) {
  const e = t.PATTERN;
  if (Zo(e))
    return !1;
  if (Ja(e))
    return !0;
  if (Ft(e, "exec"))
    return !0;
  if (fa(e))
    return !1;
  throw Error("non exhaustive match");
}
function Jwe(t) {
  return fa(t) && t.length === 1 ? t.charCodeAt(0) : !1;
}
const eTe = {
  // implements /\n|\r\n?/g.test
  test: function(t) {
    const e = t.length;
    for (let r = this.lastIndex; r < e; r++) {
      const n = t.charCodeAt(r);
      if (n === 10)
        return this.lastIndex = r + 1, !0;
      if (n === 13)
        return t.charCodeAt(r + 1) === 10 ? this.lastIndex = r + 2 : this.lastIndex = r + 1, !0;
    }
    return !1;
  },
  lastIndex: 0
};
function UU(t, e) {
  if (Ft(t, "LINE_BREAKS"))
    return !1;
  if (Zo(t.PATTERN)) {
    try {
      RS(e, t.PATTERN);
    } catch (r) {
      return {
        issue: ln.IDENTIFY_TERMINATOR,
        errMsg: r.message
      };
    }
    return !1;
  } else {
    if (fa(t.PATTERN))
      return !1;
    if (GU(t))
      return { issue: ln.CUSTOM_LINE_BREAK };
    throw Error("non exhaustive match");
  }
}
function tTe(t, e) {
  if (e.issue === ln.IDENTIFY_TERMINATOR)
    return `Warning: unable to identify line terminator usage in pattern.
	The problem is in the <${t.name}> Token Type
	 Root cause: ${e.errMsg}.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;
  if (e.issue === ln.CUSTOM_LINE_BREAK)
    return `Warning: A Custom Token Pattern should specify the <line_breaks> option.
	The problem is in the <${t.name}> Token Type
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;
  throw Error("non exhaustive match");
}
function WU(t) {
  return ft(t, (r) => fa(r) ? r.charCodeAt(0) : r);
}
function d5(t, e, r) {
  t[e] === void 0 ? t[e] = [r] : t[e].push(r);
}
const sp = 256;
let vv = [];
function jl(t) {
  return t < sp ? t : vv[t];
}
function rTe() {
  if (Sr(vv)) {
    vv = new Array(65536);
    for (let t = 0; t < 65536; t++)
      vv[t] = t > 255 ? 255 + ~~(t / 255) : t;
  }
}
function d1(t, e) {
  const r = t.tokenTypeIdx;
  return r === e.tokenTypeIdx ? !0 : e.isParent === !0 && e.categoryMatchesMap[r] === !0;
}
function i2(t, e) {
  return t.tokenTypeIdx === e.tokenTypeIdx;
}
let wL = 1;
const HU = {};
function f1(t) {
  const e = nTe(t);
  iTe(e), sTe(e), aTe(e), Ie(e, (r) => {
    r.isParent = r.categoryMatches.length > 0;
  });
}
function nTe(t) {
  let e = $n(t), r = t, n = !0;
  for (; n; ) {
    r = Xg(jn(ft(r, (a) => a.CATEGORIES)));
    const i = Sx(r, e);
    e = e.concat(i), Sr(i) ? n = !1 : r = i;
  }
  return e;
}
function iTe(t) {
  Ie(t, (e) => {
    YU(e) || (HU[wL] = e, e.tokenTypeIdx = wL++), TL(e) && !ir(e.CATEGORIES) && (e.CATEGORIES = [e.CATEGORIES]), TL(e) || (e.CATEGORIES = []), oTe(e) || (e.categoryMatches = []), lTe(e) || (e.categoryMatchesMap = {});
  });
}
function aTe(t) {
  Ie(t, (e) => {
    e.categoryMatches = [], Ie(e.categoryMatchesMap, (r, n) => {
      e.categoryMatches.push(HU[n].tokenTypeIdx);
    });
  });
}
function sTe(t) {
  Ie(t, (e) => {
    qU([], e);
  });
}
function qU(t, e) {
  Ie(t, (r) => {
    e.categoryMatchesMap[r.tokenTypeIdx] = !0;
  }), Ie(e.CATEGORIES, (r) => {
    const n = t.concat(e);
    Qi(n, r) || qU(n, r);
  });
}
function YU(t) {
  return Ft(t, "tokenTypeIdx");
}
function TL(t) {
  return Ft(t, "CATEGORIES");
}
function oTe(t) {
  return Ft(t, "categoryMatches");
}
function lTe(t) {
  return Ft(t, "categoryMatchesMap");
}
function cTe(t) {
  return Ft(t, "tokenTypeIdx");
}
const $T = {
  buildUnableToPopLexerModeMessage(t) {
    return `Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`;
  },
  buildUnexpectedCharactersMessage(t, e, r, n, i) {
    return `unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`;
  }
};
var ln;
(function(t) {
  t[t.MISSING_PATTERN = 0] = "MISSING_PATTERN", t[t.INVALID_PATTERN = 1] = "INVALID_PATTERN", t[t.EOI_ANCHOR_FOUND = 2] = "EOI_ANCHOR_FOUND", t[t.UNSUPPORTED_FLAGS_FOUND = 3] = "UNSUPPORTED_FLAGS_FOUND", t[t.DUPLICATE_PATTERNS_FOUND = 4] = "DUPLICATE_PATTERNS_FOUND", t[t.INVALID_GROUP_TYPE_FOUND = 5] = "INVALID_GROUP_TYPE_FOUND", t[t.PUSH_MODE_DOES_NOT_EXIST = 6] = "PUSH_MODE_DOES_NOT_EXIST", t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE = 7] = "MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE", t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY = 8] = "MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY", t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST = 9] = "MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST", t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED = 10] = "LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED", t[t.SOI_ANCHOR_FOUND = 11] = "SOI_ANCHOR_FOUND", t[t.EMPTY_MATCH_PATTERN = 12] = "EMPTY_MATCH_PATTERN", t[t.NO_LINE_BREAKS_FLAGS = 13] = "NO_LINE_BREAKS_FLAGS", t[t.UNREACHABLE_PATTERN = 14] = "UNREACHABLE_PATTERN", t[t.IDENTIFY_TERMINATOR = 15] = "IDENTIFY_TERMINATOR", t[t.CUSTOM_LINE_BREAK = 16] = "CUSTOM_LINE_BREAK", t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE = 17] = "MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";
})(ln || (ln = {}));
const op = {
  deferDefinitionErrorsHandling: !1,
  positionTracking: "full",
  lineTerminatorsPattern: /\n|\r\n?/g,
  lineTerminatorCharacters: [`
`, "\r"],
  ensureOptimizations: !1,
  safeMode: !1,
  errorMessageProvider: $T,
  traceInitPerf: !1,
  skipValidations: !1,
  recoveryEnabled: !0
};
Object.freeze(op);
class ua {
  constructor(e, r = op) {
    if (this.lexerDefinition = e, this.lexerDefinitionErrors = [], this.lexerDefinitionWarning = [], this.patternIdxToConfig = {}, this.charCodeToPatternIdxToConfig = {}, this.modes = [], this.emptyGroups = {}, this.trackStartLines = !0, this.trackEndLines = !0, this.hasCustom = !1, this.canModeBeOptimized = {}, this.TRACE_INIT = (i, a) => {
      if (this.traceInitPerf === !0) {
        this.traceInitIndent++;
        const s = new Array(this.traceInitIndent + 1).join("	");
        this.traceInitIndent < this.traceInitMaxIdent && console.log(`${s}--> <${i}>`);
        const { time: o, value: l } = BU(a), u = o > 10 ? console.warn : console.log;
        return this.traceInitIndent < this.traceInitMaxIdent && u(`${s}<-- <${i}> time: ${o}ms`), this.traceInitIndent--, l;
      } else
        return a();
    }, typeof r == "boolean")
      throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);
    this.config = Na({}, op, r);
    const n = this.config.traceInitPerf;
    n === !0 ? (this.traceInitMaxIdent = 1 / 0, this.traceInitPerf = !0) : typeof n == "number" && (this.traceInitMaxIdent = n, this.traceInitPerf = !0), this.traceInitIndent = -1, this.TRACE_INIT("Lexer Constructor", () => {
      let i, a = !0;
      this.TRACE_INIT("Lexer Config handling", () => {
        if (this.config.lineTerminatorsPattern === op.lineTerminatorsPattern)
          this.config.lineTerminatorsPattern = eTe;
        else if (this.config.lineTerminatorCharacters === op.lineTerminatorCharacters)
          throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
	For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);
        if (r.safeMode && r.ensureOptimizations)
          throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');
        this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking), this.trackEndLines = /full/i.test(this.config.positionTracking), ir(e) ? i = {
          modes: { defaultMode: $n(e) },
          defaultMode: ap
        } : (a = !1, i = $n(e));
      }), this.config.skipValidations === !1 && (this.TRACE_INIT("performRuntimeChecks", () => {
        this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(Kwe(i, this.trackStartLines, this.config.lineTerminatorCharacters));
      }), this.TRACE_INIT("performWarningRuntimeChecks", () => {
        this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(Zwe(i, this.trackStartLines, this.config.lineTerminatorCharacters));
      })), i.modes = i.modes ? i.modes : {}, Ie(i.modes, (o, l) => {
        i.modes[l] = Ax(o, (u) => Rr(u));
      });
      const s = On(i.modes);
      if (Ie(i.modes, (o, l) => {
        this.TRACE_INIT(`Mode: <${l}> processing`, () => {
          if (this.modes.push(l), this.config.skipValidations === !1 && this.TRACE_INIT("validatePatterns", () => {
            this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(Iwe(o, s));
          }), Sr(this.lexerDefinitionErrors)) {
            f1(o);
            let u;
            this.TRACE_INIT("analyzeTokenTypes", () => {
              u = Dwe(o, {
                lineTerminatorCharacters: this.config.lineTerminatorCharacters,
                positionTracking: r.positionTracking,
                ensureOptimizations: r.ensureOptimizations,
                safeMode: r.safeMode,
                tracer: this.TRACE_INIT
              });
            }), this.patternIdxToConfig[l] = u.patternIdxToConfig, this.charCodeToPatternIdxToConfig[l] = u.charCodeToPatternIdxToConfig, this.emptyGroups = Na({}, this.emptyGroups, u.emptyGroups), this.hasCustom = u.hasCustom || this.hasCustom, this.canModeBeOptimized[l] = u.canBeOptimized;
          }
        });
      }), this.defaultMode = i.defaultMode, !Sr(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) {
        const l = ft(this.lexerDefinitionErrors, (u) => u.message).join(`-----------------------
`);
        throw new Error(`Errors detected in definition of Lexer:
` + l);
      }
      Ie(this.lexerDefinitionWarning, (o) => {
        PU(o.message);
      }), this.TRACE_INIT("Choosing sub-methods implementations", () => {
        if (VU ? (this.chopInput = qo, this.match = this.matchWithTest) : (this.updateLastIndex = Nn, this.match = this.matchWithExec), a && (this.handleModes = Nn), this.trackStartLines === !1 && (this.computeNewColumn = qo), this.trackEndLines === !1 && (this.updateTokenEndLineColumnLocation = Nn), /full/i.test(this.config.positionTracking))
          this.createTokenInstance = this.createFullToken;
        else if (/onlyStart/i.test(this.config.positionTracking))
          this.createTokenInstance = this.createStartOnlyToken;
        else if (/onlyOffset/i.test(this.config.positionTracking))
          this.createTokenInstance = this.createOffsetOnlyToken;
        else
          throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);
        this.hasCustom ? (this.addToken = this.addTokenUsingPush, this.handlePayload = this.handlePayloadWithCustom) : (this.addToken = this.addTokenUsingMemberAccess, this.handlePayload = this.handlePayloadNoCustom);
      }), this.TRACE_INIT("Failed Optimization Warnings", () => {
        const o = An(this.canModeBeOptimized, (l, u, h) => (u === !1 && l.push(h), l), []);
        if (r.ensureOptimizations && !Sr(o))
          throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
	 Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
	 Or inspect the console log for details on how to resolve these issues.`);
      }), this.TRACE_INIT("clearRegExpParserCache", () => {
        Lwe();
      }), this.TRACE_INIT("toFastProperties", () => {
        FU(this);
      });
    });
  }
  tokenize(e, r = this.defaultMode) {
    if (!Sr(this.lexerDefinitionErrors)) {
      const i = ft(this.lexerDefinitionErrors, (a) => a.message).join(`-----------------------
`);
      throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
` + i);
    }
    return this.tokenizeInternal(e, r);
  }
  // There is quite a bit of duplication between this and "tokenizeInternalLazy"
  // This is intentional due to performance considerations.
  // this method also used quite a bit of `!` none null assertions because it is too optimized
  // for `tsc` to always understand it is "safe"
  tokenizeInternal(e, r) {
    let n, i, a, s, o, l, u, h, d, f, p, g, m, v, y;
    const b = e, w = b.length;
    let T = 0, E = 0;
    const C = this.hasCustom ? 0 : Math.floor(e.length / 10), k = new Array(C), _ = [];
    let L = this.trackStartLines ? 1 : void 0, N = this.trackStartLines ? 1 : void 0;
    const A = Qwe(this.emptyGroups), O = this.trackStartLines, P = this.config.lineTerminatorsPattern;
    let S = 0, R = [], I = [];
    const D = [], M = [];
    Object.freeze(M);
    let B;
    function $() {
      return R;
    }
    function F(re) {
      const ne = jl(re), he = I[ne];
      return he === void 0 ? M : he;
    }
    const G = (re) => {
      if (D.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition"
      // So no error should occur.
      re.tokenType.PUSH_MODE === void 0) {
        const ne = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(re);
        _.push({
          offset: re.startOffset,
          line: re.startLine,
          column: re.startColumn,
          length: re.image.length,
          message: ne
        });
      } else {
        D.pop();
        const ne = Qs(D);
        R = this.patternIdxToConfig[ne], I = this.charCodeToPatternIdxToConfig[ne], S = R.length;
        const he = this.canModeBeOptimized[ne] && this.config.safeMode === !1;
        I && he ? B = F : B = $;
      }
    };
    function H(re) {
      D.push(re), I = this.charCodeToPatternIdxToConfig[re], R = this.patternIdxToConfig[re], S = R.length, S = R.length;
      const ne = this.canModeBeOptimized[re] && this.config.safeMode === !1;
      I && ne ? B = F : B = $;
    }
    H.call(this, r);
    let ee;
    const Y = this.config.recoveryEnabled;
    for (; T < w; ) {
      l = null;
      const re = b.charCodeAt(T), ne = B(re), he = ne.length;
      for (n = 0; n < he; n++) {
        ee = ne[n];
        const K = ee.pattern;
        u = null;
        const Z = ee.short;
        if (Z !== !1 ? re === Z && (l = K) : ee.isCustom === !0 ? (y = K.exec(b, T, k, A), y !== null ? (l = y[0], y.payload !== void 0 && (u = y.payload)) : l = null) : (this.updateLastIndex(K, T), l = this.match(K, e, T)), l !== null) {
          if (o = ee.longerAlt, o !== void 0) {
            const X = o.length;
            for (a = 0; a < X; a++) {
              const q = R[o[a]], J = q.pattern;
              if (h = null, q.isCustom === !0 ? (y = J.exec(b, T, k, A), y !== null ? (s = y[0], y.payload !== void 0 && (h = y.payload)) : s = null) : (this.updateLastIndex(J, T), s = this.match(J, e, T)), s && s.length > l.length) {
                l = s, u = h, ee = q;
                break;
              }
            }
          }
          break;
        }
      }
      if (l !== null) {
        if (d = l.length, f = ee.group, f !== void 0 && (p = ee.tokenTypeIdx, g = this.createTokenInstance(l, T, p, ee.tokenType, L, N, d), this.handlePayload(g, u), f === !1 ? E = this.addToken(k, E, g) : A[f].push(g)), e = this.chopInput(e, d), T = T + d, N = this.computeNewColumn(N, d), O === !0 && ee.canLineTerminator === !0) {
          let K = 0, Z, X;
          P.lastIndex = 0;
          do
            Z = P.test(l), Z === !0 && (X = P.lastIndex - 1, K++);
          while (Z === !0);
          K !== 0 && (L = L + K, N = d - X, this.updateTokenEndLineColumnLocation(g, f, X, K, L, N, d));
        }
        this.handleModes(ee, G, H, g);
      } else {
        const K = T, Z = L, X = N;
        let q = Y === !1;
        for (; q === !1 && T < w; )
          for (e = this.chopInput(e, 1), T++, i = 0; i < S; i++) {
            const J = R[i], j = J.pattern, pe = J.short;
            if (pe !== !1 ? b.charCodeAt(T) === pe && (q = !0) : J.isCustom === !0 ? q = j.exec(b, T, k, A) !== null : (this.updateLastIndex(j, T), q = j.exec(e) !== null), q === !0)
              break;
          }
        if (m = T - K, N = this.computeNewColumn(N, m), v = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(b, K, m, Z, X), _.push({
          offset: K,
          line: Z,
          column: X,
          length: m,
          message: v
        }), Y === !1)
          break;
      }
    }
    return this.hasCustom || (k.length = E), {
      tokens: k,
      groups: A,
      errors: _
    };
  }
  handleModes(e, r, n, i) {
    if (e.pop === !0) {
      const a = e.push;
      r(i), a !== void 0 && n.call(this, a);
    } else e.push !== void 0 && n.call(this, e.push);
  }
  chopInput(e, r) {
    return e.substring(r);
  }
  updateLastIndex(e, r) {
    e.lastIndex = r;
  }
  // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler
  updateTokenEndLineColumnLocation(e, r, n, i, a, s, o) {
    let l, u;
    r !== void 0 && (l = n === o - 1, u = l ? -1 : 0, i === 1 && l === !0 || (e.endLine = a + u, e.endColumn = s - 1 + -u));
  }
  computeNewColumn(e, r) {
    return e + r;
  }
  createOffsetOnlyToken(e, r, n, i) {
    return {
      image: e,
      startOffset: r,
      tokenTypeIdx: n,
      tokenType: i
    };
  }
  createStartOnlyToken(e, r, n, i, a, s) {
    return {
      image: e,
      startOffset: r,
      startLine: a,
      startColumn: s,
      tokenTypeIdx: n,
      tokenType: i
    };
  }
  createFullToken(e, r, n, i, a, s, o) {
    return {
      image: e,
      startOffset: r,
      endOffset: r + o - 1,
      startLine: a,
      endLine: a,
      startColumn: s,
      endColumn: s + o - 1,
      tokenTypeIdx: n,
      tokenType: i
    };
  }
  addTokenUsingPush(e, r, n) {
    return e.push(n), r;
  }
  addTokenUsingMemberAccess(e, r, n) {
    return e[r] = n, r++, r;
  }
  handlePayloadNoCustom(e, r) {
  }
  handlePayloadWithCustom(e, r) {
    r !== null && (e.payload = r);
  }
  matchWithTest(e, r, n) {
    return e.test(r) === !0 ? r.substring(n, e.lastIndex) : null;
  }
  matchWithExec(e, r) {
    const n = e.exec(r);
    return n !== null ? n[0] : null;
  }
}
ua.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";
ua.NA = /NOT_APPLICABLE/;
function zh(t) {
  return XU(t) ? t.LABEL : t.name;
}
function XU(t) {
  return fa(t.LABEL) && t.LABEL !== "";
}
const uTe = "parent", EL = "categories", kL = "label", SL = "group", CL = "push_mode", AL = "pop_mode", _L = "longer_alt", LL = "line_breaks", RL = "start_chars_hint";
function jU(t) {
  return hTe(t);
}
function hTe(t) {
  const e = t.pattern, r = {};
  if (r.name = t.name, Rr(e) || (r.PATTERN = e), Ft(t, uTe))
    throw `The parent property is no longer supported.
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;
  return Ft(t, EL) && (r.CATEGORIES = t[EL]), f1([r]), Ft(t, kL) && (r.LABEL = t[kL]), Ft(t, SL) && (r.GROUP = t[SL]), Ft(t, AL) && (r.POP_MODE = t[AL]), Ft(t, CL) && (r.PUSH_MODE = t[CL]), Ft(t, _L) && (r.LONGER_ALT = t[_L]), Ft(t, LL) && (r.LINE_BREAKS = t[LL]), Ft(t, RL) && (r.START_CHARS_HINT = t[RL]), r;
}
const Kl = jU({ name: "EOF", pattern: ua.NA });
f1([Kl]);
function NS(t, e, r, n, i, a, s, o) {
  return {
    image: e,
    startOffset: r,
    endOffset: n,
    startLine: i,
    endLine: a,
    startColumn: s,
    endColumn: o,
    tokenTypeIdx: t.tokenTypeIdx,
    tokenType: t
  };
}
function KU(t, e) {
  return d1(t, e);
}
const Sh = {
  buildMismatchTokenMessage({ expected: t, actual: e, previous: r, ruleName: n }) {
    return `Expecting ${XU(t) ? `--> ${zh(t)} <--` : `token of type --> ${t.name} <--`} but found --> '${e.image}' <--`;
  },
  buildNotAllInputParsedMessage({ firstRedundant: t, ruleName: e }) {
    return "Redundant input, expecting EOF but found: " + t.image;
  },
  buildNoViableAltMessage({ expectedPathsPerAlt: t, actual: e, previous: r, customUserDescription: n, ruleName: i }) {
    const a = "Expecting: ", o = `
but found: '` + Es(e).image + "'";
    if (n)
      return a + n + o;
    {
      const l = An(t, (f, p) => f.concat(p), []), u = ft(l, (f) => `[${ft(f, (p) => zh(p)).join(", ")}]`), d = `one of these possible Token sequences:
${ft(u, (f, p) => `  ${p + 1}. ${f}`).join(`
`)}`;
      return a + d + o;
    }
  },
  buildEarlyExitMessage({ expectedIterationPaths: t, actual: e, customUserDescription: r, ruleName: n }) {
    const i = "Expecting: ", s = `
but found: '` + Es(e).image + "'";
    if (r)
      return i + r + s;
    {
      const l = `expecting at least one iteration which starts with one of these possible Token sequences::
  <${ft(t, (u) => `[${ft(u, (h) => zh(h)).join(",")}]`).join(" ,")}>`;
      return i + l + s;
    }
  }
};
Object.freeze(Sh);
const dTe = {
  buildRuleNotFoundError(t, e) {
    return "Invalid grammar, reference to a rule which is not defined: ->" + e.nonTerminalName + `<-
inside top level rule: ->` + t.name + "<-";
  }
}, jc = {
  buildDuplicateFoundError(t, e) {
    function r(h) {
      return h instanceof qr ? h.terminalType.name : h instanceof Xi ? h.nonTerminalName : "";
    }
    const n = t.name, i = Es(e), a = i.idx, s = Vs(i), o = r(i), l = a > 0;
    let u = `->${s}${l ? a : ""}<- ${o ? `with argument: ->${o}<-` : ""}
                  appears more than once (${e.length} times) in the top level rule: ->${n}<-.                  
                  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES 
                  `;
    return u = u.replace(/[ \t]+/g, " "), u = u.replace(/\s\s+/g, `
`), u;
  },
  buildNamespaceConflictError(t) {
    return `Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`;
  },
  buildAlternationPrefixAmbiguityError(t) {
    const e = ft(t.prefixPath, (i) => zh(i)).join(", "), r = t.alternation.idx === 0 ? "" : t.alternation.idx;
    return `Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${r}> inside <${t.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`;
  },
  buildAlternationAmbiguityError(t) {
    const e = ft(t.prefixPath, (i) => zh(i)).join(", "), r = t.alternation.idx === 0 ? "" : t.alternation.idx;
    let n = `Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${r}> inside <${t.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;
    return n = n + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`, n;
  },
  buildEmptyRepetitionError(t) {
    let e = Vs(t.repetition);
    return t.repetition.idx !== 0 && (e += t.repetition.idx), `The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`;
  },
  // TODO: remove - `errors_public` from nyc.config.js exclude
  //       once this method is fully removed from this file
  buildTokenNameError(t) {
    return "deprecated";
  },
  buildEmptyAlternationError(t) {
    return `Ambiguous empty alternative: <${t.emptyChoiceIdx + 1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`;
  },
  buildTooManyAlternativesError(t) {
    return `An Alternation cannot have more than 256 alternatives:
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
 has ${t.alternation.definition.length + 1} alternatives.`;
  },
  buildLeftRecursionError(t) {
    const e = t.topLevelRule.name, r = ft(t.leftRecursionPath, (a) => a.name), n = `${e} --> ${r.concat([e]).join(" --> ")}`;
    return `Left Recursion found in grammar.
rule: <${e}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is: 
 ${n}
 To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`;
  },
  // TODO: remove - `errors_public` from nyc.config.js exclude
  //       once this method is fully removed from this file
  buildInvalidRuleNameError(t) {
    return "deprecated";
  },
  buildDuplicateRuleNameError(t) {
    let e;
    return t.topLevelRule instanceof zf ? e = t.topLevelRule.name : e = t.topLevelRule, `Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`;
  }
};
function fTe(t, e) {
  const r = new pTe(t, e);
  return r.resolveRefs(), r.errors;
}
class pTe extends Vf {
  constructor(e, r) {
    super(), this.nameToTopRule = e, this.errMsgProvider = r, this.errors = [];
  }
  resolveRefs() {
    Ie(Pr(this.nameToTopRule), (e) => {
      this.currTopLevel = e, e.accept(this);
    });
  }
  visitNonTerminal(e) {
    const r = this.nameToTopRule[e.nonTerminalName];
    if (r)
      e.referencedRule = r;
    else {
      const n = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, e);
      this.errors.push({
        message: n,
        type: ji.UNRESOLVED_SUBRULE_REF,
        ruleName: this.currTopLevel.name,
        unresolvedRefName: e.nonTerminalName
      });
    }
  }
}
class gTe extends Qx {
  constructor(e, r) {
    super(), this.topProd = e, this.path = r, this.possibleTokTypes = [], this.nextProductionName = "", this.nextProductionOccurrence = 0, this.found = !1, this.isAtEndOfPath = !1;
  }
  startWalking() {
    if (this.found = !1, this.path.ruleStack[0] !== this.topProd.name)
      throw Error("The path does not start with the walker's top Rule!");
    return this.ruleStack = $n(this.path.ruleStack).reverse(), this.occurrenceStack = $n(this.path.occurrenceStack).reverse(), this.ruleStack.pop(), this.occurrenceStack.pop(), this.updateExpectedNext(), this.walk(this.topProd), this.possibleTokTypes;
  }
  walk(e, r = []) {
    this.found || super.walk(e, r);
  }
  walkProdRef(e, r, n) {
    if (e.referencedRule.name === this.nextProductionName && e.idx === this.nextProductionOccurrence) {
      const i = r.concat(n);
      this.updateExpectedNext(), this.walk(e.referencedRule, i);
    }
  }
  updateExpectedNext() {
    Sr(this.ruleStack) ? (this.nextProductionName = "", this.nextProductionOccurrence = 0, this.isAtEndOfPath = !0) : (this.nextProductionName = this.ruleStack.pop(), this.nextProductionOccurrence = this.occurrenceStack.pop());
  }
}
class mTe extends gTe {
  constructor(e, r) {
    super(e, r), this.path = r, this.nextTerminalName = "", this.nextTerminalOccurrence = 0, this.nextTerminalName = this.path.lastTok.name, this.nextTerminalOccurrence = this.path.lastTokOccurrence;
  }
  walkTerminal(e, r, n) {
    if (this.isAtEndOfPath && e.terminalType.name === this.nextTerminalName && e.idx === this.nextTerminalOccurrence && !this.found) {
      const i = r.concat(n), a = new pa({ definition: i });
      this.possibleTokTypes = h1(a), this.found = !0;
    }
  }
}
class eb extends Qx {
  constructor(e, r) {
    super(), this.topRule = e, this.occurrence = r, this.result = {
      token: void 0,
      occurrence: void 0,
      isEndOfRule: void 0
    };
  }
  startWalking() {
    return this.walk(this.topRule), this.result;
  }
}
class vTe extends eb {
  walkMany(e, r, n) {
    if (e.idx === this.occurrence) {
      const i = Es(r.concat(n));
      this.result.isEndOfRule = i === void 0, i instanceof qr && (this.result.token = i.terminalType, this.result.occurrence = i.idx);
    } else
      super.walkMany(e, r, n);
  }
}
class NL extends eb {
  walkManySep(e, r, n) {
    if (e.idx === this.occurrence) {
      const i = Es(r.concat(n));
      this.result.isEndOfRule = i === void 0, i instanceof qr && (this.result.token = i.terminalType, this.result.occurrence = i.idx);
    } else
      super.walkManySep(e, r, n);
  }
}
class yTe extends eb {
  walkAtLeastOne(e, r, n) {
    if (e.idx === this.occurrence) {
      const i = Es(r.concat(n));
      this.result.isEndOfRule = i === void 0, i instanceof qr && (this.result.token = i.terminalType, this.result.occurrence = i.idx);
    } else
      super.walkAtLeastOne(e, r, n);
  }
}
class ML extends eb {
  walkAtLeastOneSep(e, r, n) {
    if (e.idx === this.occurrence) {
      const i = Es(r.concat(n));
      this.result.isEndOfRule = i === void 0, i instanceof qr && (this.result.token = i.terminalType, this.result.occurrence = i.idx);
    } else
      super.walkAtLeastOneSep(e, r, n);
  }
}
function zT(t, e, r = []) {
  r = $n(r);
  let n = [], i = 0;
  function a(o) {
    return o.concat(ii(t, i + 1));
  }
  function s(o) {
    const l = zT(a(o), e, r);
    return n.concat(l);
  }
  for (; r.length < e && i < t.length; ) {
    const o = t[i];
    if (o instanceof pa)
      return s(o.definition);
    if (o instanceof Xi)
      return s(o.definition);
    if (o instanceof hi)
      n = s(o.definition);
    else if (o instanceof Oa) {
      const l = o.definition.concat([
        new on({
          definition: o.definition
        })
      ]);
      return s(l);
    } else if (o instanceof Pa) {
      const l = [
        new pa({ definition: o.definition }),
        new on({
          definition: [new qr({ terminalType: o.separator })].concat(o.definition)
        })
      ];
      return s(l);
    } else if (o instanceof ya) {
      const l = o.definition.concat([
        new on({
          definition: [new qr({ terminalType: o.separator })].concat(o.definition)
        })
      ]);
      n = s(l);
    } else if (o instanceof on) {
      const l = o.definition.concat([
        new on({
          definition: o.definition
        })
      ]);
      n = s(l);
    } else {
      if (o instanceof xa)
        return Ie(o.definition, (l) => {
          Sr(l.definition) === !1 && (n = s(l.definition));
        }), n;
      if (o instanceof qr)
        r.push(o.terminalType);
      else
        throw Error("non exhaustive match");
    }
    i++;
  }
  return n.push({
    partialPath: r,
    suffixDef: ii(t, i)
  }), n;
}
function ZU(t, e, r, n) {
  const i = "EXIT_NONE_TERMINAL", a = [i], s = "EXIT_ALTERNATIVE";
  let o = !1;
  const l = e.length, u = l - n - 1, h = [], d = [];
  for (d.push({
    idx: -1,
    def: t,
    ruleStack: [],
    occurrenceStack: []
  }); !Sr(d); ) {
    const f = d.pop();
    if (f === s) {
      o && Qs(d).idx <= u && d.pop();
      continue;
    }
    const p = f.def, g = f.idx, m = f.ruleStack, v = f.occurrenceStack;
    if (Sr(p))
      continue;
    const y = p[0];
    if (y === i) {
      const b = {
        idx: g,
        def: ii(p),
        ruleStack: tg(m),
        occurrenceStack: tg(v)
      };
      d.push(b);
    } else if (y instanceof qr)
      if (g < l - 1) {
        const b = g + 1, w = e[b];
        if (r(w, y.terminalType)) {
          const T = {
            idx: b,
            def: ii(p),
            ruleStack: m,
            occurrenceStack: v
          };
          d.push(T);
        }
      } else if (g === l - 1)
        h.push({
          nextTokenType: y.terminalType,
          nextTokenOccurrence: y.idx,
          ruleStack: m,
          occurrenceStack: v
        }), o = !0;
      else
        throw Error("non exhaustive match");
    else if (y instanceof Xi) {
      const b = $n(m);
      b.push(y.nonTerminalName);
      const w = $n(v);
      w.push(y.idx);
      const T = {
        idx: g,
        def: y.definition.concat(a, ii(p)),
        ruleStack: b,
        occurrenceStack: w
      };
      d.push(T);
    } else if (y instanceof hi) {
      const b = {
        idx: g,
        def: ii(p),
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(b), d.push(s);
      const w = {
        idx: g,
        def: y.definition.concat(ii(p)),
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(w);
    } else if (y instanceof Oa) {
      const b = new on({
        definition: y.definition,
        idx: y.idx
      }), w = y.definition.concat([b], ii(p)), T = {
        idx: g,
        def: w,
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(T);
    } else if (y instanceof Pa) {
      const b = new qr({
        terminalType: y.separator
      }), w = new on({
        definition: [b].concat(y.definition),
        idx: y.idx
      }), T = y.definition.concat([w], ii(p)), E = {
        idx: g,
        def: T,
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(E);
    } else if (y instanceof ya) {
      const b = {
        idx: g,
        def: ii(p),
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(b), d.push(s);
      const w = new qr({
        terminalType: y.separator
      }), T = new on({
        definition: [w].concat(y.definition),
        idx: y.idx
      }), E = y.definition.concat([T], ii(p)), C = {
        idx: g,
        def: E,
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(C);
    } else if (y instanceof on) {
      const b = {
        idx: g,
        def: ii(p),
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(b), d.push(s);
      const w = new on({
        definition: y.definition,
        idx: y.idx
      }), T = y.definition.concat([w], ii(p)), E = {
        idx: g,
        def: T,
        ruleStack: m,
        occurrenceStack: v
      };
      d.push(E);
    } else if (y instanceof xa)
      for (let b = y.definition.length - 1; b >= 0; b--) {
        const w = y.definition[b], T = {
          idx: g,
          def: w.definition.concat(ii(p)),
          ruleStack: m,
          occurrenceStack: v
        };
        d.push(T), d.push(s);
      }
    else if (y instanceof pa)
      d.push({
        idx: g,
        def: y.definition.concat(ii(p)),
        ruleStack: m,
        occurrenceStack: v
      });
    else if (y instanceof zf)
      d.push(xTe(y, g, m, v));
    else
      throw Error("non exhaustive match");
  }
  return h;
}
function xTe(t, e, r, n) {
  const i = $n(r);
  i.push(t.name);
  const a = $n(n);
  return a.push(1), {
    idx: e,
    def: t.definition,
    ruleStack: i,
    occurrenceStack: a
  };
}
var tn;
(function(t) {
  t[t.OPTION = 0] = "OPTION", t[t.REPETITION = 1] = "REPETITION", t[t.REPETITION_MANDATORY = 2] = "REPETITION_MANDATORY", t[t.REPETITION_MANDATORY_WITH_SEPARATOR = 3] = "REPETITION_MANDATORY_WITH_SEPARATOR", t[t.REPETITION_WITH_SEPARATOR = 4] = "REPETITION_WITH_SEPARATOR", t[t.ALTERNATION = 5] = "ALTERNATION";
})(tn || (tn = {}));
function MS(t) {
  if (t instanceof hi || t === "Option")
    return tn.OPTION;
  if (t instanceof on || t === "Repetition")
    return tn.REPETITION;
  if (t instanceof Oa || t === "RepetitionMandatory")
    return tn.REPETITION_MANDATORY;
  if (t instanceof Pa || t === "RepetitionMandatoryWithSeparator")
    return tn.REPETITION_MANDATORY_WITH_SEPARATOR;
  if (t instanceof ya || t === "RepetitionWithSeparator")
    return tn.REPETITION_WITH_SEPARATOR;
  if (t instanceof xa || t === "Alternation")
    return tn.ALTERNATION;
  throw Error("non exhaustive match");
}
function DL(t) {
  const { occurrence: e, rule: r, prodType: n, maxLookahead: i } = t, a = MS(n);
  return a === tn.ALTERNATION ? tb(e, r, i) : rb(e, r, a, i);
}
function bTe(t, e, r, n, i, a) {
  const s = tb(t, e, r), o = eW(s) ? i2 : d1;
  return a(s, n, o, i);
}
function wTe(t, e, r, n, i, a) {
  const s = rb(t, e, i, r), o = eW(s) ? i2 : d1;
  return a(s[0], o, n);
}
function TTe(t, e, r, n) {
  const i = t.length, a = ys(t, (s) => ys(s, (o) => o.length === 1));
  if (e)
    return function(s) {
      const o = ft(s, (l) => l.GATE);
      for (let l = 0; l < i; l++) {
        const u = t[l], h = u.length, d = o[l];
        if (!(d !== void 0 && d.call(this) === !1))
          e: for (let f = 0; f < h; f++) {
            const p = u[f], g = p.length;
            for (let m = 0; m < g; m++) {
              const v = this.LA(m + 1);
              if (r(v, p[m]) === !1)
                continue e;
            }
            return l;
          }
      }
    };
  if (a && !n) {
    const s = ft(t, (l) => jn(l)), o = An(s, (l, u, h) => (Ie(u, (d) => {
      Ft(l, d.tokenTypeIdx) || (l[d.tokenTypeIdx] = h), Ie(d.categoryMatches, (f) => {
        Ft(l, f) || (l[f] = h);
      });
    }), l), {});
    return function() {
      const l = this.LA(1);
      return o[l.tokenTypeIdx];
    };
  } else
    return function() {
      for (let s = 0; s < i; s++) {
        const o = t[s], l = o.length;
        e: for (let u = 0; u < l; u++) {
          const h = o[u], d = h.length;
          for (let f = 0; f < d; f++) {
            const p = this.LA(f + 1);
            if (r(p, h[f]) === !1)
              continue e;
          }
          return s;
        }
      }
    };
}
function ETe(t, e, r) {
  const n = ys(t, (a) => a.length === 1), i = t.length;
  if (n && !r) {
    const a = jn(t);
    if (a.length === 1 && Sr(a[0].categoryMatches)) {
      const o = a[0].tokenTypeIdx;
      return function() {
        return this.LA(1).tokenTypeIdx === o;
      };
    } else {
      const s = An(a, (o, l, u) => (o[l.tokenTypeIdx] = !0, Ie(l.categoryMatches, (h) => {
        o[h] = !0;
      }), o), []);
      return function() {
        const o = this.LA(1);
        return s[o.tokenTypeIdx] === !0;
      };
    }
  } else
    return function() {
      e: for (let a = 0; a < i; a++) {
        const s = t[a], o = s.length;
        for (let l = 0; l < o; l++) {
          const u = this.LA(l + 1);
          if (e(u, s[l]) === !1)
            continue e;
        }
        return !0;
      }
      return !1;
    };
}
class kTe extends Qx {
  constructor(e, r, n) {
    super(), this.topProd = e, this.targetOccurrence = r, this.targetProdType = n;
  }
  startWalking() {
    return this.walk(this.topProd), this.restDef;
  }
  checkIsTarget(e, r, n, i) {
    return e.idx === this.targetOccurrence && this.targetProdType === r ? (this.restDef = n.concat(i), !0) : !1;
  }
  walkOption(e, r, n) {
    this.checkIsTarget(e, tn.OPTION, r, n) || super.walkOption(e, r, n);
  }
  walkAtLeastOne(e, r, n) {
    this.checkIsTarget(e, tn.REPETITION_MANDATORY, r, n) || super.walkOption(e, r, n);
  }
  walkAtLeastOneSep(e, r, n) {
    this.checkIsTarget(e, tn.REPETITION_MANDATORY_WITH_SEPARATOR, r, n) || super.walkOption(e, r, n);
  }
  walkMany(e, r, n) {
    this.checkIsTarget(e, tn.REPETITION, r, n) || super.walkOption(e, r, n);
  }
  walkManySep(e, r, n) {
    this.checkIsTarget(e, tn.REPETITION_WITH_SEPARATOR, r, n) || super.walkOption(e, r, n);
  }
}
class QU extends Vf {
  constructor(e, r, n) {
    super(), this.targetOccurrence = e, this.targetProdType = r, this.targetRef = n, this.result = [];
  }
  checkIsTarget(e, r) {
    e.idx === this.targetOccurrence && this.targetProdType === r && (this.targetRef === void 0 || e === this.targetRef) && (this.result = e.definition);
  }
  visitOption(e) {
    this.checkIsTarget(e, tn.OPTION);
  }
  visitRepetition(e) {
    this.checkIsTarget(e, tn.REPETITION);
  }
  visitRepetitionMandatory(e) {
    this.checkIsTarget(e, tn.REPETITION_MANDATORY);
  }
  visitRepetitionMandatoryWithSeparator(e) {
    this.checkIsTarget(e, tn.REPETITION_MANDATORY_WITH_SEPARATOR);
  }
  visitRepetitionWithSeparator(e) {
    this.checkIsTarget(e, tn.REPETITION_WITH_SEPARATOR);
  }
  visitAlternation(e) {
    this.checkIsTarget(e, tn.ALTERNATION);
  }
}
function IL(t) {
  const e = new Array(t);
  for (let r = 0; r < t; r++)
    e[r] = [];
  return e;
}
function f5(t) {
  let e = [""];
  for (let r = 0; r < t.length; r++) {
    const n = t[r], i = [];
    for (let a = 0; a < e.length; a++) {
      const s = e[a];
      i.push(s + "_" + n.tokenTypeIdx);
      for (let o = 0; o < n.categoryMatches.length; o++) {
        const l = "_" + n.categoryMatches[o];
        i.push(s + l);
      }
    }
    e = i;
  }
  return e;
}
function STe(t, e, r) {
  for (let n = 0; n < t.length; n++) {
    if (n === r)
      continue;
    const i = t[n];
    for (let a = 0; a < e.length; a++) {
      const s = e[a];
      if (i[s] === !0)
        return !1;
    }
  }
  return !0;
}
function JU(t, e) {
  const r = ft(t, (s) => zT([s], 1)), n = IL(r.length), i = ft(r, (s) => {
    const o = {};
    return Ie(s, (l) => {
      const u = f5(l.partialPath);
      Ie(u, (h) => {
        o[h] = !0;
      });
    }), o;
  });
  let a = r;
  for (let s = 1; s <= e; s++) {
    const o = a;
    a = IL(o.length);
    for (let l = 0; l < o.length; l++) {
      const u = o[l];
      for (let h = 0; h < u.length; h++) {
        const d = u[h].partialPath, f = u[h].suffixDef, p = f5(d);
        if (STe(i, p, l) || Sr(f) || d.length === e) {
          const m = n[l];
          if (VT(m, d) === !1) {
            m.push(d);
            for (let v = 0; v < p.length; v++) {
              const y = p[v];
              i[l][y] = !0;
            }
          }
        } else {
          const m = zT(f, s + 1, d);
          a[l] = a[l].concat(m), Ie(m, (v) => {
            const y = f5(v.partialPath);
            Ie(y, (b) => {
              i[l][b] = !0;
            });
          });
        }
      }
    }
  }
  return n;
}
function tb(t, e, r, n) {
  const i = new QU(t, tn.ALTERNATION, n);
  return e.accept(i), JU(i.result, r);
}
function rb(t, e, r, n) {
  const i = new QU(t, r);
  e.accept(i);
  const a = i.result, o = new kTe(e, t, r).startWalking(), l = new pa({ definition: a }), u = new pa({ definition: o });
  return JU([l, u], n);
}
function VT(t, e) {
  e: for (let r = 0; r < t.length; r++) {
    const n = t[r];
    if (n.length === e.length) {
      for (let i = 0; i < n.length; i++) {
        const a = e[i], s = n[i];
        if ((a === s || s.categoryMatchesMap[a.tokenTypeIdx] !== void 0) === !1)
          continue e;
      }
      return !0;
    }
  }
  return !1;
}
function CTe(t, e) {
  return t.length < e.length && ys(t, (r, n) => {
    const i = e[n];
    return r === i || i.categoryMatchesMap[r.tokenTypeIdx];
  });
}
function eW(t) {
  return ys(t, (e) => ys(e, (r) => ys(r, (n) => Sr(n.categoryMatches))));
}
function ATe(t) {
  const e = t.lookaheadStrategy.validate({
    rules: t.rules,
    tokenTypes: t.tokenTypes,
    grammarName: t.grammarName
  });
  return ft(e, (r) => Object.assign({ type: ji.CUSTOM_LOOKAHEAD_VALIDATION }, r));
}
function _Te(t, e, r, n) {
  const i = _a(t, (l) => LTe(l, r)), a = VTe(t, e, r), s = _a(t, (l) => BTe(l, r)), o = _a(t, (l) => MTe(l, t, n, r));
  return i.concat(a, s, o);
}
function LTe(t, e) {
  const r = new NTe();
  t.accept(r);
  const n = r.allProductions, i = Vpe(n, RTe), a = As(i, (o) => o.length > 1);
  return ft(Pr(a), (o) => {
    const l = Es(o), u = e.buildDuplicateFoundError(t, o), h = Vs(l), d = {
      message: u,
      type: ji.DUPLICATE_PRODUCTIONS,
      ruleName: t.name,
      dslName: h,
      occurrence: l.idx
    }, f = tW(l);
    return f && (d.parameter = f), d;
  });
}
function RTe(t) {
  return `${Vs(t)}_#_${t.idx}_#_${tW(t)}`;
}
function tW(t) {
  return t instanceof qr ? t.terminalType.name : t instanceof Xi ? t.nonTerminalName : "";
}
class NTe extends Vf {
  constructor() {
    super(...arguments), this.allProductions = [];
  }
  visitNonTerminal(e) {
    this.allProductions.push(e);
  }
  visitOption(e) {
    this.allProductions.push(e);
  }
  visitRepetitionWithSeparator(e) {
    this.allProductions.push(e);
  }
  visitRepetitionMandatory(e) {
    this.allProductions.push(e);
  }
  visitRepetitionMandatoryWithSeparator(e) {
    this.allProductions.push(e);
  }
  visitRepetition(e) {
    this.allProductions.push(e);
  }
  visitAlternation(e) {
    this.allProductions.push(e);
  }
  visitTerminal(e) {
    this.allProductions.push(e);
  }
}
function MTe(t, e, r, n) {
  const i = [];
  if (An(e, (s, o) => o.name === t.name ? s + 1 : s, 0) > 1) {
    const s = n.buildDuplicateRuleNameError({
      topLevelRule: t,
      grammarName: r
    });
    i.push({
      message: s,
      type: ji.DUPLICATE_RULE_NAME,
      ruleName: t.name
    });
  }
  return i;
}
function DTe(t, e, r) {
  const n = [];
  let i;
  return Qi(e, t) || (i = `Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `, n.push({
    message: i,
    type: ji.INVALID_RULE_OVERRIDE,
    ruleName: t
  })), n;
}
function rW(t, e, r, n = []) {
  const i = [], a = yv(e.definition);
  if (Sr(a))
    return [];
  {
    const s = t.name;
    Qi(a, t) && i.push({
      message: r.buildLeftRecursionError({
        topLevelRule: t,
        leftRecursionPath: n
      }),
      type: ji.LEFT_RECURSION,
      ruleName: s
    });
    const l = Sx(a, n.concat([t])), u = _a(l, (h) => {
      const d = $n(n);
      return d.push(h), rW(t, h, r, d);
    });
    return i.concat(u);
  }
}
function yv(t) {
  let e = [];
  if (Sr(t))
    return e;
  const r = Es(t);
  if (r instanceof Xi)
    e.push(r.referencedRule);
  else if (r instanceof pa || r instanceof hi || r instanceof Oa || r instanceof Pa || r instanceof ya || r instanceof on)
    e = e.concat(yv(r.definition));
  else if (r instanceof xa)
    e = jn(ft(r.definition, (a) => yv(a.definition)));
  else if (!(r instanceof qr)) throw Error("non exhaustive match");
  const n = r2(r), i = t.length > 1;
  if (n && i) {
    const a = ii(t);
    return e.concat(yv(a));
  } else
    return e;
}
class DS extends Vf {
  constructor() {
    super(...arguments), this.alternations = [];
  }
  visitAlternation(e) {
    this.alternations.push(e);
  }
}
function ITe(t, e) {
  const r = new DS();
  t.accept(r);
  const n = r.alternations;
  return _a(n, (a) => {
    const s = tg(a.definition);
    return _a(s, (o, l) => {
      const u = ZU([o], [], d1, 1);
      return Sr(u) ? [
        {
          message: e.buildEmptyAlternationError({
            topLevelRule: t,
            alternation: a,
            emptyChoiceIdx: l
          }),
          type: ji.NONE_LAST_EMPTY_ALT,
          ruleName: t.name,
          occurrence: a.idx,
          alternative: l + 1
        }
      ] : [];
    });
  });
}
function OTe(t, e, r) {
  const n = new DS();
  t.accept(n);
  let i = n.alternations;
  return i = Ax(i, (s) => s.ignoreAmbiguities === !0), _a(i, (s) => {
    const o = s.idx, l = s.maxLookahead || e, u = tb(o, t, l, s), h = $Te(u, s, t, r), d = zTe(u, s, t, r);
    return h.concat(d);
  });
}
class PTe extends Vf {
  constructor() {
    super(...arguments), this.allProductions = [];
  }
  visitRepetitionWithSeparator(e) {
    this.allProductions.push(e);
  }
  visitRepetitionMandatory(e) {
    this.allProductions.push(e);
  }
  visitRepetitionMandatoryWithSeparator(e) {
    this.allProductions.push(e);
  }
  visitRepetition(e) {
    this.allProductions.push(e);
  }
}
function BTe(t, e) {
  const r = new DS();
  t.accept(r);
  const n = r.alternations;
  return _a(n, (a) => a.definition.length > 255 ? [
    {
      message: e.buildTooManyAlternativesError({
        topLevelRule: t,
        alternation: a
      }),
      type: ji.TOO_MANY_ALTS,
      ruleName: t.name,
      occurrence: a.idx
    }
  ] : []);
}
function FTe(t, e, r) {
  const n = [];
  return Ie(t, (i) => {
    const a = new PTe();
    i.accept(a);
    const s = a.allProductions;
    Ie(s, (o) => {
      const l = MS(o), u = o.maxLookahead || e, h = o.idx, f = rb(h, i, l, u)[0];
      if (Sr(jn(f))) {
        const p = r.buildEmptyRepetitionError({
          topLevelRule: i,
          repetition: o
        });
        n.push({
          message: p,
          type: ji.NO_NON_EMPTY_LOOKAHEAD,
          ruleName: i.name
        });
      }
    });
  }), n;
}
function $Te(t, e, r, n) {
  const i = [], a = An(t, (o, l, u) => (e.definition[u].ignoreAmbiguities === !0 || Ie(l, (h) => {
    const d = [u];
    Ie(t, (f, p) => {
      u !== p && VT(f, h) && // ignore (skip) ambiguities with this "other" alternative
      e.definition[p].ignoreAmbiguities !== !0 && d.push(p);
    }), d.length > 1 && !VT(i, h) && (i.push(h), o.push({
      alts: d,
      path: h
    }));
  }), o), []);
  return ft(a, (o) => {
    const l = ft(o.alts, (h) => h + 1);
    return {
      message: n.buildAlternationAmbiguityError({
        topLevelRule: r,
        alternation: e,
        ambiguityIndices: l,
        prefixPath: o.path
      }),
      type: ji.AMBIGUOUS_ALTS,
      ruleName: r.name,
      occurrence: e.idx,
      alternatives: o.alts
    };
  });
}
function zTe(t, e, r, n) {
  const i = An(t, (s, o, l) => {
    const u = ft(o, (h) => ({ idx: l, path: h }));
    return s.concat(u);
  }, []);
  return Xg(_a(i, (s) => {
    if (e.definition[s.idx].ignoreAmbiguities === !0)
      return [];
    const l = s.idx, u = s.path, h = cn(i, (f) => (
      // ignore (skip) ambiguities with this "other" alternative
      e.definition[f.idx].ignoreAmbiguities !== !0 && f.idx < l && // checking for strict prefix because identical lookaheads
      // will be be detected using a different validation.
      CTe(f.path, u)
    ));
    return ft(h, (f) => {
      const p = [f.idx + 1, l + 1], g = e.idx === 0 ? "" : e.idx;
      return {
        message: n.buildAlternationPrefixAmbiguityError({
          topLevelRule: r,
          alternation: e,
          ambiguityIndices: p,
          prefixPath: f.path
        }),
        type: ji.AMBIGUOUS_PREFIX_ALTS,
        ruleName: r.name,
        occurrence: g,
        alternatives: p
      };
    });
  }));
}
function VTe(t, e, r) {
  const n = [], i = ft(e, (a) => a.name);
  return Ie(t, (a) => {
    const s = a.name;
    if (Qi(i, s)) {
      const o = r.buildNamespaceConflictError(a);
      n.push({
        message: o,
        type: ji.CONFLICT_TOKENS_RULES_NAMESPACE,
        ruleName: s
      });
    }
  }), n;
}
function GTe(t) {
  const e = kx(t, {
    errMsgProvider: dTe
  }), r = {};
  return Ie(t.rules, (n) => {
    r[n.name] = n;
  }), fTe(r, e.errMsgProvider);
}
function UTe(t) {
  return t = kx(t, {
    errMsgProvider: jc
  }), _Te(t.rules, t.tokenTypes, t.errMsgProvider, t.grammarName);
}
const nW = "MismatchedTokenException", iW = "NoViableAltException", aW = "EarlyExitException", sW = "NotAllInputParsedException", oW = [
  nW,
  iW,
  aW,
  sW
];
Object.freeze(oW);
function a2(t) {
  return Qi(oW, t.name);
}
class nb extends Error {
  constructor(e, r) {
    super(e), this.token = r, this.resyncedTokens = [], Object.setPrototypeOf(this, new.target.prototype), Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
  }
}
class lW extends nb {
  constructor(e, r, n) {
    super(e, r), this.previousToken = n, this.name = nW;
  }
}
class WTe extends nb {
  constructor(e, r, n) {
    super(e, r), this.previousToken = n, this.name = iW;
  }
}
class HTe extends nb {
  constructor(e, r) {
    super(e, r), this.name = sW;
  }
}
class qTe extends nb {
  constructor(e, r, n) {
    super(e, r), this.previousToken = n, this.name = aW;
  }
}
const p5 = {}, cW = "InRuleRecoveryException";
class YTe extends Error {
  constructor(e) {
    super(e), this.name = cW;
  }
}
class XTe {
  initRecoverable(e) {
    this.firstAfterRepMap = {}, this.resyncFollows = {}, this.recoveryEnabled = Ft(e, "recoveryEnabled") ? e.recoveryEnabled : el.recoveryEnabled, this.recoveryEnabled && (this.attemptInRepetitionRecovery = jTe);
  }
  getTokenToInsert(e) {
    const r = NS(e, "", NaN, NaN, NaN, NaN, NaN, NaN);
    return r.isInsertedInRecovery = !0, r;
  }
  canTokenTypeBeInsertedInRecovery(e) {
    return !0;
  }
  canTokenTypeBeDeletedInRecovery(e) {
    return !0;
  }
  tryInRepetitionRecovery(e, r, n, i) {
    const a = this.findReSyncTokenType(), s = this.exportLexerState(), o = [];
    let l = !1;
    const u = this.LA(1);
    let h = this.LA(1);
    const d = () => {
      const f = this.LA(0), p = this.errorMessageProvider.buildMismatchTokenMessage({
        expected: i,
        actual: u,
        previous: f,
        ruleName: this.getCurrRuleFullName()
      }), g = new lW(p, u, this.LA(0));
      g.resyncedTokens = tg(o), this.SAVE_ERROR(g);
    };
    for (; !l; )
      if (this.tokenMatcher(h, i)) {
        d();
        return;
      } else if (n.call(this)) {
        d(), e.apply(this, r);
        return;
      } else this.tokenMatcher(h, a) ? l = !0 : (h = this.SKIP_TOKEN(), this.addToResyncTokens(h, o));
    this.importLexerState(s);
  }
  shouldInRepetitionRecoveryBeTried(e, r, n) {
    return !(n === !1 || this.tokenMatcher(this.LA(1), e) || this.isBackTracking() || this.canPerformInRuleRecovery(e, this.getFollowsForInRuleRecovery(e, r)));
  }
  // Error Recovery functionality
  getFollowsForInRuleRecovery(e, r) {
    const n = this.getCurrentGrammarPath(e, r);
    return this.getNextPossibleTokenTypes(n);
  }
  tryInRuleRecovery(e, r) {
    if (this.canRecoverWithSingleTokenInsertion(e, r))
      return this.getTokenToInsert(e);
    if (this.canRecoverWithSingleTokenDeletion(e)) {
      const n = this.SKIP_TOKEN();
      return this.consumeToken(), n;
    }
    throw new YTe("sad sad panda");
  }
  canPerformInRuleRecovery(e, r) {
    return this.canRecoverWithSingleTokenInsertion(e, r) || this.canRecoverWithSingleTokenDeletion(e);
  }
  canRecoverWithSingleTokenInsertion(e, r) {
    if (!this.canTokenTypeBeInsertedInRecovery(e) || Sr(r))
      return !1;
    const n = this.LA(1);
    return Ko(r, (a) => this.tokenMatcher(n, a)) !== void 0;
  }
  canRecoverWithSingleTokenDeletion(e) {
    return this.canTokenTypeBeDeletedInRecovery(e) ? this.tokenMatcher(this.LA(2), e) : !1;
  }
  isInCurrentRuleReSyncSet(e) {
    const r = this.getCurrFollowKey(), n = this.getFollowSetFromFollowKey(r);
    return Qi(n, e);
  }
  findReSyncTokenType() {
    const e = this.flattenFollowSet();
    let r = this.LA(1), n = 2;
    for (; ; ) {
      const i = Ko(e, (a) => KU(r, a));
      if (i !== void 0)
        return i;
      r = this.LA(n), n++;
    }
  }
  getCurrFollowKey() {
    if (this.RULE_STACK.length === 1)
      return p5;
    const e = this.getLastExplicitRuleShortName(), r = this.getLastExplicitRuleOccurrenceIndex(), n = this.getPreviousExplicitRuleShortName();
    return {
      ruleName: this.shortRuleNameToFullName(e),
      idxInCallingRule: r,
      inRule: this.shortRuleNameToFullName(n)
    };
  }
  buildFullFollowKeyStack() {
    const e = this.RULE_STACK, r = this.RULE_OCCURRENCE_STACK;
    return ft(e, (n, i) => i === 0 ? p5 : {
      ruleName: this.shortRuleNameToFullName(n),
      idxInCallingRule: r[i],
      inRule: this.shortRuleNameToFullName(e[i - 1])
    });
  }
  flattenFollowSet() {
    const e = ft(this.buildFullFollowKeyStack(), (r) => this.getFollowSetFromFollowKey(r));
    return jn(e);
  }
  getFollowSetFromFollowKey(e) {
    if (e === p5)
      return [Kl];
    const r = e.ruleName + e.idxInCallingRule + $U + e.inRule;
    return this.resyncFollows[r];
  }
  // It does not make any sense to include a virtual EOF token in the list of resynced tokens
  // as EOF does not really exist and thus does not contain any useful information (line/column numbers)
  addToResyncTokens(e, r) {
    return this.tokenMatcher(e, Kl) || r.push(e), r;
  }
  reSyncTo(e) {
    const r = [];
    let n = this.LA(1);
    for (; this.tokenMatcher(n, e) === !1; )
      n = this.SKIP_TOKEN(), this.addToResyncTokens(n, r);
    return tg(r);
  }
  attemptInRepetitionRecovery(e, r, n, i, a, s, o) {
  }
  getCurrentGrammarPath(e, r) {
    const n = this.getHumanReadableRuleStack(), i = $n(this.RULE_OCCURRENCE_STACK);
    return {
      ruleStack: n,
      occurrenceStack: i,
      lastTok: e,
      lastTokOccurrence: r
    };
  }
  getHumanReadableRuleStack() {
    return ft(this.RULE_STACK, (e) => this.shortRuleNameToFullName(e));
  }
}
function jTe(t, e, r, n, i, a, s) {
  const o = this.getKeyForAutomaticLookahead(n, i);
  let l = this.firstAfterRepMap[o];
  if (l === void 0) {
    const f = this.getCurrRuleFullName(), p = this.getGAstProductions()[f];
    l = new a(p, i).startWalking(), this.firstAfterRepMap[o] = l;
  }
  let u = l.token, h = l.occurrence;
  const d = l.isEndOfRule;
  this.RULE_STACK.length === 1 && d && u === void 0 && (u = Kl, h = 1), !(u === void 0 || h === void 0) && this.shouldInRepetitionRecoveryBeTried(u, h, s) && this.tryInRepetitionRecovery(t, e, r, u);
}
const KTe = 4, dc = 8, uW = 1 << dc, hW = 2 << dc, GT = 3 << dc, UT = 4 << dc, WT = 5 << dc, xv = 6 << dc;
function g5(t, e, r) {
  return r | e | t;
}
class IS {
  constructor(e) {
    var r;
    this.maxLookahead = (r = e == null ? void 0 : e.maxLookahead) !== null && r !== void 0 ? r : el.maxLookahead;
  }
  validate(e) {
    const r = this.validateNoLeftRecursion(e.rules);
    if (Sr(r)) {
      const n = this.validateEmptyOrAlternatives(e.rules), i = this.validateAmbiguousAlternationAlternatives(e.rules, this.maxLookahead), a = this.validateSomeNonEmptyLookaheadPath(e.rules, this.maxLookahead);
      return [
        ...r,
        ...n,
        ...i,
        ...a
      ];
    }
    return r;
  }
  validateNoLeftRecursion(e) {
    return _a(e, (r) => rW(r, r, jc));
  }
  validateEmptyOrAlternatives(e) {
    return _a(e, (r) => ITe(r, jc));
  }
  validateAmbiguousAlternationAlternatives(e, r) {
    return _a(e, (n) => OTe(n, r, jc));
  }
  validateSomeNonEmptyLookaheadPath(e, r) {
    return FTe(e, r, jc);
  }
  buildLookaheadForAlternation(e) {
    return bTe(e.prodOccurrence, e.rule, e.maxLookahead, e.hasPredicates, e.dynamicTokensEnabled, TTe);
  }
  buildLookaheadForOptional(e) {
    return wTe(e.prodOccurrence, e.rule, e.maxLookahead, e.dynamicTokensEnabled, MS(e.prodType), ETe);
  }
}
class ZTe {
  initLooksAhead(e) {
    this.dynamicTokensEnabled = Ft(e, "dynamicTokensEnabled") ? e.dynamicTokensEnabled : el.dynamicTokensEnabled, this.maxLookahead = Ft(e, "maxLookahead") ? e.maxLookahead : el.maxLookahead, this.lookaheadStrategy = Ft(e, "lookaheadStrategy") ? e.lookaheadStrategy : new IS({ maxLookahead: this.maxLookahead }), this.lookAheadFuncsCache = /* @__PURE__ */ new Map();
  }
  preComputeLookaheadFunctions(e) {
    Ie(e, (r) => {
      this.TRACE_INIT(`${r.name} Rule Lookahead`, () => {
        const { alternation: n, repetition: i, option: a, repetitionMandatory: s, repetitionMandatoryWithSeparator: o, repetitionWithSeparator: l } = JTe(r);
        Ie(n, (u) => {
          const h = u.idx === 0 ? "" : u.idx;
          this.TRACE_INIT(`${Vs(u)}${h}`, () => {
            const d = this.lookaheadStrategy.buildLookaheadForAlternation({
              prodOccurrence: u.idx,
              rule: r,
              maxLookahead: u.maxLookahead || this.maxLookahead,
              hasPredicates: u.hasPredicates,
              dynamicTokensEnabled: this.dynamicTokensEnabled
            }), f = g5(this.fullRuleNameToShort[r.name], uW, u.idx);
            this.setLaFuncCache(f, d);
          });
        }), Ie(i, (u) => {
          this.computeLookaheadFunc(r, u.idx, GT, "Repetition", u.maxLookahead, Vs(u));
        }), Ie(a, (u) => {
          this.computeLookaheadFunc(r, u.idx, hW, "Option", u.maxLookahead, Vs(u));
        }), Ie(s, (u) => {
          this.computeLookaheadFunc(r, u.idx, UT, "RepetitionMandatory", u.maxLookahead, Vs(u));
        }), Ie(o, (u) => {
          this.computeLookaheadFunc(r, u.idx, xv, "RepetitionMandatoryWithSeparator", u.maxLookahead, Vs(u));
        }), Ie(l, (u) => {
          this.computeLookaheadFunc(r, u.idx, WT, "RepetitionWithSeparator", u.maxLookahead, Vs(u));
        });
      });
    });
  }
  computeLookaheadFunc(e, r, n, i, a, s) {
    this.TRACE_INIT(`${s}${r === 0 ? "" : r}`, () => {
      const o = this.lookaheadStrategy.buildLookaheadForOptional({
        prodOccurrence: r,
        rule: e,
        maxLookahead: a || this.maxLookahead,
        dynamicTokensEnabled: this.dynamicTokensEnabled,
        prodType: i
      }), l = g5(this.fullRuleNameToShort[e.name], n, r);
      this.setLaFuncCache(l, o);
    });
  }
  // this actually returns a number, but it is always used as a string (object prop key)
  getKeyForAutomaticLookahead(e, r) {
    const n = this.getLastExplicitRuleShortName();
    return g5(n, e, r);
  }
  getLaFuncFromCache(e) {
    return this.lookAheadFuncsCache.get(e);
  }
  /* istanbul ignore next */
  setLaFuncCache(e, r) {
    this.lookAheadFuncsCache.set(e, r);
  }
}
class QTe extends Vf {
  constructor() {
    super(...arguments), this.dslMethods = {
      option: [],
      alternation: [],
      repetition: [],
      repetitionWithSeparator: [],
      repetitionMandatory: [],
      repetitionMandatoryWithSeparator: []
    };
  }
  reset() {
    this.dslMethods = {
      option: [],
      alternation: [],
      repetition: [],
      repetitionWithSeparator: [],
      repetitionMandatory: [],
      repetitionMandatoryWithSeparator: []
    };
  }
  visitOption(e) {
    this.dslMethods.option.push(e);
  }
  visitRepetitionWithSeparator(e) {
    this.dslMethods.repetitionWithSeparator.push(e);
  }
  visitRepetitionMandatory(e) {
    this.dslMethods.repetitionMandatory.push(e);
  }
  visitRepetitionMandatoryWithSeparator(e) {
    this.dslMethods.repetitionMandatoryWithSeparator.push(e);
  }
  visitRepetition(e) {
    this.dslMethods.repetition.push(e);
  }
  visitAlternation(e) {
    this.dslMethods.alternation.push(e);
  }
}
const wm = new QTe();
function JTe(t) {
  wm.reset(), t.accept(wm);
  const e = wm.dslMethods;
  return wm.reset(), e;
}
function OL(t, e) {
  isNaN(t.startOffset) === !0 ? (t.startOffset = e.startOffset, t.endOffset = e.endOffset) : t.endOffset < e.endOffset && (t.endOffset = e.endOffset);
}
function PL(t, e) {
  isNaN(t.startOffset) === !0 ? (t.startOffset = e.startOffset, t.startColumn = e.startColumn, t.startLine = e.startLine, t.endOffset = e.endOffset, t.endColumn = e.endColumn, t.endLine = e.endLine) : t.endOffset < e.endOffset && (t.endOffset = e.endOffset, t.endColumn = e.endColumn, t.endLine = e.endLine);
}
function e6e(t, e, r) {
  t.children[r] === void 0 ? t.children[r] = [e] : t.children[r].push(e);
}
function t6e(t, e, r) {
  t.children[e] === void 0 ? t.children[e] = [r] : t.children[e].push(r);
}
const r6e = "name";
function dW(t, e) {
  Object.defineProperty(t, r6e, {
    enumerable: !1,
    configurable: !0,
    writable: !1,
    value: e
  });
}
function n6e(t, e) {
  const r = On(t), n = r.length;
  for (let i = 0; i < n; i++) {
    const a = r[i], s = t[a], o = s.length;
    for (let l = 0; l < o; l++) {
      const u = s[l];
      u.tokenTypeIdx === void 0 && this[u.name](u.children, e);
    }
  }
}
function i6e(t, e) {
  const r = function() {
  };
  dW(r, t + "BaseSemantics");
  const n = {
    visit: function(i, a) {
      if (ir(i) && (i = i[0]), !Rr(i))
        return this[i.name](i.children, a);
    },
    validateVisitor: function() {
      const i = s6e(this, e);
      if (!Sr(i)) {
        const a = ft(i, (s) => s.msg);
        throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
	${a.join(`

`).replace(/\n/g, `
	`)}`);
      }
    }
  };
  return r.prototype = n, r.prototype.constructor = r, r._RULE_NAMES = e, r;
}
function a6e(t, e, r) {
  const n = function() {
  };
  dW(n, t + "BaseSemanticsWithDefaults");
  const i = Object.create(r.prototype);
  return Ie(e, (a) => {
    i[a] = n6e;
  }), n.prototype = i, n.prototype.constructor = n, n;
}
var HT;
(function(t) {
  t[t.REDUNDANT_METHOD = 0] = "REDUNDANT_METHOD", t[t.MISSING_METHOD = 1] = "MISSING_METHOD";
})(HT || (HT = {}));
function s6e(t, e) {
  return o6e(t, e);
}
function o6e(t, e) {
  const r = cn(e, (i) => Ja(t[i]) === !1), n = ft(r, (i) => ({
    msg: `Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,
    type: HT.MISSING_METHOD,
    methodName: i
  }));
  return Xg(n);
}
class l6e {
  initTreeBuilder(e) {
    if (this.CST_STACK = [], this.outputCst = e.outputCst, this.nodeLocationTracking = Ft(e, "nodeLocationTracking") ? e.nodeLocationTracking : el.nodeLocationTracking, !this.outputCst)
      this.cstInvocationStateUpdate = Nn, this.cstFinallyStateUpdate = Nn, this.cstPostTerminal = Nn, this.cstPostNonTerminal = Nn, this.cstPostRule = Nn;
    else if (/full/i.test(this.nodeLocationTracking))
      this.recoveryEnabled ? (this.setNodeLocationFromToken = PL, this.setNodeLocationFromNode = PL, this.cstPostRule = Nn, this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery) : (this.setNodeLocationFromToken = Nn, this.setNodeLocationFromNode = Nn, this.cstPostRule = this.cstPostRuleFull, this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular);
    else if (/onlyOffset/i.test(this.nodeLocationTracking))
      this.recoveryEnabled ? (this.setNodeLocationFromToken = OL, this.setNodeLocationFromNode = OL, this.cstPostRule = Nn, this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery) : (this.setNodeLocationFromToken = Nn, this.setNodeLocationFromNode = Nn, this.cstPostRule = this.cstPostRuleOnlyOffset, this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular);
    else if (/none/i.test(this.nodeLocationTracking))
      this.setNodeLocationFromToken = Nn, this.setNodeLocationFromNode = Nn, this.cstPostRule = Nn, this.setInitialNodeLocation = Nn;
    else
      throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);
  }
  setInitialNodeLocationOnlyOffsetRecovery(e) {
    e.location = {
      startOffset: NaN,
      endOffset: NaN
    };
  }
  setInitialNodeLocationOnlyOffsetRegular(e) {
    e.location = {
      // without error recovery the starting Location of a new CstNode is guaranteed
      // To be the next Token's startOffset (for valid inputs).
      // For invalid inputs there won't be any CSTOutput so this potential
      // inaccuracy does not matter
      startOffset: this.LA(1).startOffset,
      endOffset: NaN
    };
  }
  setInitialNodeLocationFullRecovery(e) {
    e.location = {
      startOffset: NaN,
      startLine: NaN,
      startColumn: NaN,
      endOffset: NaN,
      endLine: NaN,
      endColumn: NaN
    };
  }
  /**
       *  @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work
  
       * @param cstNode
       */
  setInitialNodeLocationFullRegular(e) {
    const r = this.LA(1);
    e.location = {
      startOffset: r.startOffset,
      startLine: r.startLine,
      startColumn: r.startColumn,
      endOffset: NaN,
      endLine: NaN,
      endColumn: NaN
    };
  }
  cstInvocationStateUpdate(e) {
    const r = {
      name: e,
      children: /* @__PURE__ */ Object.create(null)
    };
    this.setInitialNodeLocation(r), this.CST_STACK.push(r);
  }
  cstFinallyStateUpdate() {
    this.CST_STACK.pop();
  }
  cstPostRuleFull(e) {
    const r = this.LA(0), n = e.location;
    n.startOffset <= r.startOffset ? (n.endOffset = r.endOffset, n.endLine = r.endLine, n.endColumn = r.endColumn) : (n.startOffset = NaN, n.startLine = NaN, n.startColumn = NaN);
  }
  cstPostRuleOnlyOffset(e) {
    const r = this.LA(0), n = e.location;
    n.startOffset <= r.startOffset ? n.endOffset = r.endOffset : n.startOffset = NaN;
  }
  cstPostTerminal(e, r) {
    const n = this.CST_STACK[this.CST_STACK.length - 1];
    e6e(n, r, e), this.setNodeLocationFromToken(n.location, r);
  }
  cstPostNonTerminal(e, r) {
    const n = this.CST_STACK[this.CST_STACK.length - 1];
    t6e(n, r, e), this.setNodeLocationFromNode(n.location, e.location);
  }
  getBaseCstVisitorConstructor() {
    if (Rr(this.baseCstVisitorConstructor)) {
      const e = i6e(this.className, On(this.gastProductionsCache));
      return this.baseCstVisitorConstructor = e, e;
    }
    return this.baseCstVisitorConstructor;
  }
  getBaseCstVisitorConstructorWithDefaults() {
    if (Rr(this.baseCstVisitorWithDefaultsConstructor)) {
      const e = a6e(this.className, On(this.gastProductionsCache), this.getBaseCstVisitorConstructor());
      return this.baseCstVisitorWithDefaultsConstructor = e, e;
    }
    return this.baseCstVisitorWithDefaultsConstructor;
  }
  getLastExplicitRuleShortName() {
    const e = this.RULE_STACK;
    return e[e.length - 1];
  }
  getPreviousExplicitRuleShortName() {
    const e = this.RULE_STACK;
    return e[e.length - 2];
  }
  getLastExplicitRuleOccurrenceIndex() {
    const e = this.RULE_OCCURRENCE_STACK;
    return e[e.length - 1];
  }
}
class c6e {
  initLexerAdapter() {
    this.tokVector = [], this.tokVectorLength = 0, this.currIdx = -1;
  }
  set input(e) {
    if (this.selfAnalysisDone !== !0)
      throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");
    this.reset(), this.tokVector = e, this.tokVectorLength = e.length;
  }
  get input() {
    return this.tokVector;
  }
  // skips a token and returns the next token
  SKIP_TOKEN() {
    return this.currIdx <= this.tokVector.length - 2 ? (this.consumeToken(), this.LA(1)) : o2;
  }
  // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers
  // or lexers dependent on parser context.
  LA(e) {
    const r = this.currIdx + e;
    return r < 0 || this.tokVectorLength <= r ? o2 : this.tokVector[r];
  }
  consumeToken() {
    this.currIdx++;
  }
  exportLexerState() {
    return this.currIdx;
  }
  importLexerState(e) {
    this.currIdx = e;
  }
  resetLexerState() {
    this.currIdx = -1;
  }
  moveToTerminatedState() {
    this.currIdx = this.tokVector.length - 1;
  }
  getLexerPosition() {
    return this.exportLexerState();
  }
}
class u6e {
  ACTION(e) {
    return e.call(this);
  }
  consume(e, r, n) {
    return this.consumeInternal(r, e, n);
  }
  subrule(e, r, n) {
    return this.subruleInternal(r, e, n);
  }
  option(e, r) {
    return this.optionInternal(r, e);
  }
  or(e, r) {
    return this.orInternal(r, e);
  }
  many(e, r) {
    return this.manyInternal(e, r);
  }
  atLeastOne(e, r) {
    return this.atLeastOneInternal(e, r);
  }
  CONSUME(e, r) {
    return this.consumeInternal(e, 0, r);
  }
  CONSUME1(e, r) {
    return this.consumeInternal(e, 1, r);
  }
  CONSUME2(e, r) {
    return this.consumeInternal(e, 2, r);
  }
  CONSUME3(e, r) {
    return this.consumeInternal(e, 3, r);
  }
  CONSUME4(e, r) {
    return this.consumeInternal(e, 4, r);
  }
  CONSUME5(e, r) {
    return this.consumeInternal(e, 5, r);
  }
  CONSUME6(e, r) {
    return this.consumeInternal(e, 6, r);
  }
  CONSUME7(e, r) {
    return this.consumeInternal(e, 7, r);
  }
  CONSUME8(e, r) {
    return this.consumeInternal(e, 8, r);
  }
  CONSUME9(e, r) {
    return this.consumeInternal(e, 9, r);
  }
  SUBRULE(e, r) {
    return this.subruleInternal(e, 0, r);
  }
  SUBRULE1(e, r) {
    return this.subruleInternal(e, 1, r);
  }
  SUBRULE2(e, r) {
    return this.subruleInternal(e, 2, r);
  }
  SUBRULE3(e, r) {
    return this.subruleInternal(e, 3, r);
  }
  SUBRULE4(e, r) {
    return this.subruleInternal(e, 4, r);
  }
  SUBRULE5(e, r) {
    return this.subruleInternal(e, 5, r);
  }
  SUBRULE6(e, r) {
    return this.subruleInternal(e, 6, r);
  }
  SUBRULE7(e, r) {
    return this.subruleInternal(e, 7, r);
  }
  SUBRULE8(e, r) {
    return this.subruleInternal(e, 8, r);
  }
  SUBRULE9(e, r) {
    return this.subruleInternal(e, 9, r);
  }
  OPTION(e) {
    return this.optionInternal(e, 0);
  }
  OPTION1(e) {
    return this.optionInternal(e, 1);
  }
  OPTION2(e) {
    return this.optionInternal(e, 2);
  }
  OPTION3(e) {
    return this.optionInternal(e, 3);
  }
  OPTION4(e) {
    return this.optionInternal(e, 4);
  }
  OPTION5(e) {
    return this.optionInternal(e, 5);
  }
  OPTION6(e) {
    return this.optionInternal(e, 6);
  }
  OPTION7(e) {
    return this.optionInternal(e, 7);
  }
  OPTION8(e) {
    return this.optionInternal(e, 8);
  }
  OPTION9(e) {
    return this.optionInternal(e, 9);
  }
  OR(e) {
    return this.orInternal(e, 0);
  }
  OR1(e) {
    return this.orInternal(e, 1);
  }
  OR2(e) {
    return this.orInternal(e, 2);
  }
  OR3(e) {
    return this.orInternal(e, 3);
  }
  OR4(e) {
    return this.orInternal(e, 4);
  }
  OR5(e) {
    return this.orInternal(e, 5);
  }
  OR6(e) {
    return this.orInternal(e, 6);
  }
  OR7(e) {
    return this.orInternal(e, 7);
  }
  OR8(e) {
    return this.orInternal(e, 8);
  }
  OR9(e) {
    return this.orInternal(e, 9);
  }
  MANY(e) {
    this.manyInternal(0, e);
  }
  MANY1(e) {
    this.manyInternal(1, e);
  }
  MANY2(e) {
    this.manyInternal(2, e);
  }
  MANY3(e) {
    this.manyInternal(3, e);
  }
  MANY4(e) {
    this.manyInternal(4, e);
  }
  MANY5(e) {
    this.manyInternal(5, e);
  }
  MANY6(e) {
    this.manyInternal(6, e);
  }
  MANY7(e) {
    this.manyInternal(7, e);
  }
  MANY8(e) {
    this.manyInternal(8, e);
  }
  MANY9(e) {
    this.manyInternal(9, e);
  }
  MANY_SEP(e) {
    this.manySepFirstInternal(0, e);
  }
  MANY_SEP1(e) {
    this.manySepFirstInternal(1, e);
  }
  MANY_SEP2(e) {
    this.manySepFirstInternal(2, e);
  }
  MANY_SEP3(e) {
    this.manySepFirstInternal(3, e);
  }
  MANY_SEP4(e) {
    this.manySepFirstInternal(4, e);
  }
  MANY_SEP5(e) {
    this.manySepFirstInternal(5, e);
  }
  MANY_SEP6(e) {
    this.manySepFirstInternal(6, e);
  }
  MANY_SEP7(e) {
    this.manySepFirstInternal(7, e);
  }
  MANY_SEP8(e) {
    this.manySepFirstInternal(8, e);
  }
  MANY_SEP9(e) {
    this.manySepFirstInternal(9, e);
  }
  AT_LEAST_ONE(e) {
    this.atLeastOneInternal(0, e);
  }
  AT_LEAST_ONE1(e) {
    return this.atLeastOneInternal(1, e);
  }
  AT_LEAST_ONE2(e) {
    this.atLeastOneInternal(2, e);
  }
  AT_LEAST_ONE3(e) {
    this.atLeastOneInternal(3, e);
  }
  AT_LEAST_ONE4(e) {
    this.atLeastOneInternal(4, e);
  }
  AT_LEAST_ONE5(e) {
    this.atLeastOneInternal(5, e);
  }
  AT_LEAST_ONE6(e) {
    this.atLeastOneInternal(6, e);
  }
  AT_LEAST_ONE7(e) {
    this.atLeastOneInternal(7, e);
  }
  AT_LEAST_ONE8(e) {
    this.atLeastOneInternal(8, e);
  }
  AT_LEAST_ONE9(e) {
    this.atLeastOneInternal(9, e);
  }
  AT_LEAST_ONE_SEP(e) {
    this.atLeastOneSepFirstInternal(0, e);
  }
  AT_LEAST_ONE_SEP1(e) {
    this.atLeastOneSepFirstInternal(1, e);
  }
  AT_LEAST_ONE_SEP2(e) {
    this.atLeastOneSepFirstInternal(2, e);
  }
  AT_LEAST_ONE_SEP3(e) {
    this.atLeastOneSepFirstInternal(3, e);
  }
  AT_LEAST_ONE_SEP4(e) {
    this.atLeastOneSepFirstInternal(4, e);
  }
  AT_LEAST_ONE_SEP5(e) {
    this.atLeastOneSepFirstInternal(5, e);
  }
  AT_LEAST_ONE_SEP6(e) {
    this.atLeastOneSepFirstInternal(6, e);
  }
  AT_LEAST_ONE_SEP7(e) {
    this.atLeastOneSepFirstInternal(7, e);
  }
  AT_LEAST_ONE_SEP8(e) {
    this.atLeastOneSepFirstInternal(8, e);
  }
  AT_LEAST_ONE_SEP9(e) {
    this.atLeastOneSepFirstInternal(9, e);
  }
  RULE(e, r, n = l2) {
    if (Qi(this.definedRulesNames, e)) {
      const s = {
        message: jc.buildDuplicateRuleNameError({
          topLevelRule: e,
          grammarName: this.className
        }),
        type: ji.DUPLICATE_RULE_NAME,
        ruleName: e
      };
      this.definitionErrors.push(s);
    }
    this.definedRulesNames.push(e);
    const i = this.defineRule(e, r, n);
    return this[e] = i, i;
  }
  OVERRIDE_RULE(e, r, n = l2) {
    const i = DTe(e, this.definedRulesNames, this.className);
    this.definitionErrors = this.definitionErrors.concat(i);
    const a = this.defineRule(e, r, n);
    return this[e] = a, a;
  }
  BACKTRACK(e, r) {
    return function() {
      this.isBackTrackingStack.push(1);
      const n = this.saveRecogState();
      try {
        return e.apply(this, r), !0;
      } catch (i) {
        if (a2(i))
          return !1;
        throw i;
      } finally {
        this.reloadRecogState(n), this.isBackTrackingStack.pop();
      }
    };
  }
  // GAST export APIs
  getGAstProductions() {
    return this.gastProductionsCache;
  }
  getSerializedGastProductions() {
    return xwe(Pr(this.gastProductionsCache));
  }
}
class h6e {
  initRecognizerEngine(e, r) {
    if (this.className = this.constructor.name, this.shortRuleNameToFull = {}, this.fullRuleNameToShort = {}, this.ruleShortNameIdx = 256, this.tokenMatcher = i2, this.subruleIdx = 0, this.definedRulesNames = [], this.tokensMap = {}, this.isBackTrackingStack = [], this.RULE_STACK = [], this.RULE_OCCURRENCE_STACK = [], this.gastProductionsCache = {}, Ft(r, "serializedGrammar"))
      throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
	For Further details.`);
    if (ir(e)) {
      if (Sr(e))
        throw Error(`A Token Vocabulary cannot be empty.
	Note that the first argument for the parser constructor
	is no longer a Token vector (since v4.0).`);
      if (typeof e[0].startOffset == "number")
        throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
	See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
	For Further details.`);
    }
    if (ir(e))
      this.tokensMap = An(e, (a, s) => (a[s.name] = s, a), {});
    else if (Ft(e, "modes") && ys(jn(Pr(e.modes)), cTe)) {
      const a = jn(Pr(e.modes)), s = Bk(a);
      this.tokensMap = An(s, (o, l) => (o[l.name] = l, o), {});
    } else if (da(e))
      this.tokensMap = $n(e);
    else
      throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");
    this.tokensMap.EOF = Kl;
    const n = Ft(e, "modes") ? jn(Pr(e.modes)) : Pr(e), i = ys(n, (a) => Sr(a.categoryMatches));
    this.tokenMatcher = i ? i2 : d1, f1(Pr(this.tokensMap));
  }
  defineRule(e, r, n) {
    if (this.selfAnalysisDone)
      throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);
    const i = Ft(n, "resyncEnabled") ? n.resyncEnabled : l2.resyncEnabled, a = Ft(n, "recoveryValueFunc") ? n.recoveryValueFunc : l2.recoveryValueFunc, s = this.ruleShortNameIdx << KTe + dc;
    this.ruleShortNameIdx++, this.shortRuleNameToFull[s] = e, this.fullRuleNameToShort[e] = s;
    let o;
    return this.outputCst === !0 ? o = function(...h) {
      try {
        this.ruleInvocationStateUpdate(s, e, this.subruleIdx), r.apply(this, h);
        const d = this.CST_STACK[this.CST_STACK.length - 1];
        return this.cstPostRule(d), d;
      } catch (d) {
        return this.invokeRuleCatch(d, i, a);
      } finally {
        this.ruleFinallyStateUpdate();
      }
    } : o = function(...h) {
      try {
        return this.ruleInvocationStateUpdate(s, e, this.subruleIdx), r.apply(this, h);
      } catch (d) {
        return this.invokeRuleCatch(d, i, a);
      } finally {
        this.ruleFinallyStateUpdate();
      }
    }, Object.assign(o, { ruleName: e, originalGrammarAction: r });
  }
  invokeRuleCatch(e, r, n) {
    const i = this.RULE_STACK.length === 1, a = r && !this.isBackTracking() && this.recoveryEnabled;
    if (a2(e)) {
      const s = e;
      if (a) {
        const o = this.findReSyncTokenType();
        if (this.isInCurrentRuleReSyncSet(o))
          if (s.resyncedTokens = this.reSyncTo(o), this.outputCst) {
            const l = this.CST_STACK[this.CST_STACK.length - 1];
            return l.recoveredNode = !0, l;
          } else
            return n(e);
        else {
          if (this.outputCst) {
            const l = this.CST_STACK[this.CST_STACK.length - 1];
            l.recoveredNode = !0, s.partialCstResult = l;
          }
          throw s;
        }
      } else {
        if (i)
          return this.moveToTerminatedState(), n(e);
        throw s;
      }
    } else
      throw e;
  }
  // Implementation of parsing DSL
  optionInternal(e, r) {
    const n = this.getKeyForAutomaticLookahead(hW, r);
    return this.optionInternalLogic(e, r, n);
  }
  optionInternalLogic(e, r, n) {
    let i = this.getLaFuncFromCache(n), a;
    if (typeof e != "function") {
      a = e.DEF;
      const s = e.GATE;
      if (s !== void 0) {
        const o = i;
        i = () => s.call(this) && o.call(this);
      }
    } else
      a = e;
    if (i.call(this) === !0)
      return a.call(this);
  }
  atLeastOneInternal(e, r) {
    const n = this.getKeyForAutomaticLookahead(UT, e);
    return this.atLeastOneInternalLogic(e, r, n);
  }
  atLeastOneInternalLogic(e, r, n) {
    let i = this.getLaFuncFromCache(n), a;
    if (typeof r != "function") {
      a = r.DEF;
      const s = r.GATE;
      if (s !== void 0) {
        const o = i;
        i = () => s.call(this) && o.call(this);
      }
    } else
      a = r;
    if (i.call(this) === !0) {
      let s = this.doSingleRepetition(a);
      for (; i.call(this) === !0 && s === !0; )
        s = this.doSingleRepetition(a);
    } else
      throw this.raiseEarlyExitException(e, tn.REPETITION_MANDATORY, r.ERR_MSG);
    this.attemptInRepetitionRecovery(this.atLeastOneInternal, [e, r], i, UT, e, yTe);
  }
  atLeastOneSepFirstInternal(e, r) {
    const n = this.getKeyForAutomaticLookahead(xv, e);
    this.atLeastOneSepFirstInternalLogic(e, r, n);
  }
  atLeastOneSepFirstInternalLogic(e, r, n) {
    const i = r.DEF, a = r.SEP;
    if (this.getLaFuncFromCache(n).call(this) === !0) {
      i.call(this);
      const o = () => this.tokenMatcher(this.LA(1), a);
      for (; this.tokenMatcher(this.LA(1), a) === !0; )
        this.CONSUME(a), i.call(this);
      this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
        e,
        a,
        o,
        i,
        ML
      ], o, xv, e, ML);
    } else
      throw this.raiseEarlyExitException(e, tn.REPETITION_MANDATORY_WITH_SEPARATOR, r.ERR_MSG);
  }
  manyInternal(e, r) {
    const n = this.getKeyForAutomaticLookahead(GT, e);
    return this.manyInternalLogic(e, r, n);
  }
  manyInternalLogic(e, r, n) {
    let i = this.getLaFuncFromCache(n), a;
    if (typeof r != "function") {
      a = r.DEF;
      const o = r.GATE;
      if (o !== void 0) {
        const l = i;
        i = () => o.call(this) && l.call(this);
      }
    } else
      a = r;
    let s = !0;
    for (; i.call(this) === !0 && s === !0; )
      s = this.doSingleRepetition(a);
    this.attemptInRepetitionRecovery(
      this.manyInternal,
      [e, r],
      i,
      GT,
      e,
      vTe,
      // The notStuck parameter is only relevant when "attemptInRepetitionRecovery"
      // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP]
      // An infinite loop cannot occur as:
      // - Either the lookahead is guaranteed to consume something (Single Token Separator)
      // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out).
      s
    );
  }
  manySepFirstInternal(e, r) {
    const n = this.getKeyForAutomaticLookahead(WT, e);
    this.manySepFirstInternalLogic(e, r, n);
  }
  manySepFirstInternalLogic(e, r, n) {
    const i = r.DEF, a = r.SEP;
    if (this.getLaFuncFromCache(n).call(this) === !0) {
      i.call(this);
      const o = () => this.tokenMatcher(this.LA(1), a);
      for (; this.tokenMatcher(this.LA(1), a) === !0; )
        this.CONSUME(a), i.call(this);
      this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
        e,
        a,
        o,
        i,
        NL
      ], o, WT, e, NL);
    }
  }
  repetitionSepSecondInternal(e, r, n, i, a) {
    for (; n(); )
      this.CONSUME(r), i.call(this);
    this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [
      e,
      r,
      n,
      i,
      a
    ], n, xv, e, a);
  }
  doSingleRepetition(e) {
    const r = this.getLexerPosition();
    return e.call(this), this.getLexerPosition() > r;
  }
  orInternal(e, r) {
    const n = this.getKeyForAutomaticLookahead(uW, r), i = ir(e) ? e : e.DEF, s = this.getLaFuncFromCache(n).call(this, i);
    if (s !== void 0)
      return i[s].ALT.call(this);
    this.raiseNoAltException(r, e.ERR_MSG);
  }
  ruleFinallyStateUpdate() {
    if (this.RULE_STACK.pop(), this.RULE_OCCURRENCE_STACK.pop(), this.cstFinallyStateUpdate(), this.RULE_STACK.length === 0 && this.isAtEndOfInput() === !1) {
      const e = this.LA(1), r = this.errorMessageProvider.buildNotAllInputParsedMessage({
        firstRedundant: e,
        ruleName: this.getCurrRuleFullName()
      });
      this.SAVE_ERROR(new HTe(r, e));
    }
  }
  subruleInternal(e, r, n) {
    let i;
    try {
      const a = n !== void 0 ? n.ARGS : void 0;
      return this.subruleIdx = r, i = e.apply(this, a), this.cstPostNonTerminal(i, n !== void 0 && n.LABEL !== void 0 ? n.LABEL : e.ruleName), i;
    } catch (a) {
      throw this.subruleInternalError(a, n, e.ruleName);
    }
  }
  subruleInternalError(e, r, n) {
    throw a2(e) && e.partialCstResult !== void 0 && (this.cstPostNonTerminal(e.partialCstResult, r !== void 0 && r.LABEL !== void 0 ? r.LABEL : n), delete e.partialCstResult), e;
  }
  consumeInternal(e, r, n) {
    let i;
    try {
      const a = this.LA(1);
      this.tokenMatcher(a, e) === !0 ? (this.consumeToken(), i = a) : this.consumeInternalError(e, a, n);
    } catch (a) {
      i = this.consumeInternalRecovery(e, r, a);
    }
    return this.cstPostTerminal(n !== void 0 && n.LABEL !== void 0 ? n.LABEL : e.name, i), i;
  }
  consumeInternalError(e, r, n) {
    let i;
    const a = this.LA(0);
    throw n !== void 0 && n.ERR_MSG ? i = n.ERR_MSG : i = this.errorMessageProvider.buildMismatchTokenMessage({
      expected: e,
      actual: r,
      previous: a,
      ruleName: this.getCurrRuleFullName()
    }), this.SAVE_ERROR(new lW(i, r, a));
  }
  consumeInternalRecovery(e, r, n) {
    if (this.recoveryEnabled && // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions?
    n.name === "MismatchedTokenException" && !this.isBackTracking()) {
      const i = this.getFollowsForInRuleRecovery(e, r);
      try {
        return this.tryInRuleRecovery(e, i);
      } catch (a) {
        throw a.name === cW ? n : a;
      }
    } else
      throw n;
  }
  saveRecogState() {
    const e = this.errors, r = $n(this.RULE_STACK);
    return {
      errors: e,
      lexerState: this.exportLexerState(),
      RULE_STACK: r,
      CST_STACK: this.CST_STACK
    };
  }
  reloadRecogState(e) {
    this.errors = e.errors, this.importLexerState(e.lexerState), this.RULE_STACK = e.RULE_STACK;
  }
  ruleInvocationStateUpdate(e, r, n) {
    this.RULE_OCCURRENCE_STACK.push(n), this.RULE_STACK.push(e), this.cstInvocationStateUpdate(r);
  }
  isBackTracking() {
    return this.isBackTrackingStack.length !== 0;
  }
  getCurrRuleFullName() {
    const e = this.getLastExplicitRuleShortName();
    return this.shortRuleNameToFull[e];
  }
  shortRuleNameToFullName(e) {
    return this.shortRuleNameToFull[e];
  }
  isAtEndOfInput() {
    return this.tokenMatcher(this.LA(1), Kl);
  }
  reset() {
    this.resetLexerState(), this.subruleIdx = 0, this.isBackTrackingStack = [], this.errors = [], this.RULE_STACK = [], this.CST_STACK = [], this.RULE_OCCURRENCE_STACK = [];
  }
}
class d6e {
  initErrorHandler(e) {
    this._errors = [], this.errorMessageProvider = Ft(e, "errorMessageProvider") ? e.errorMessageProvider : el.errorMessageProvider;
  }
  SAVE_ERROR(e) {
    if (a2(e))
      return e.context = {
        ruleStack: this.getHumanReadableRuleStack(),
        ruleOccurrenceStack: $n(this.RULE_OCCURRENCE_STACK)
      }, this._errors.push(e), e;
    throw Error("Trying to save an Error which is not a RecognitionException");
  }
  get errors() {
    return $n(this._errors);
  }
  set errors(e) {
    this._errors = e;
  }
  // TODO: consider caching the error message computed information
  raiseEarlyExitException(e, r, n) {
    const i = this.getCurrRuleFullName(), a = this.getGAstProductions()[i], o = rb(e, a, r, this.maxLookahead)[0], l = [];
    for (let h = 1; h <= this.maxLookahead; h++)
      l.push(this.LA(h));
    const u = this.errorMessageProvider.buildEarlyExitMessage({
      expectedIterationPaths: o,
      actual: l,
      previous: this.LA(0),
      customUserDescription: n,
      ruleName: i
    });
    throw this.SAVE_ERROR(new qTe(u, this.LA(1), this.LA(0)));
  }
  // TODO: consider caching the error message computed information
  raiseNoAltException(e, r) {
    const n = this.getCurrRuleFullName(), i = this.getGAstProductions()[n], a = tb(e, i, this.maxLookahead), s = [];
    for (let u = 1; u <= this.maxLookahead; u++)
      s.push(this.LA(u));
    const o = this.LA(0), l = this.errorMessageProvider.buildNoViableAltMessage({
      expectedPathsPerAlt: a,
      actual: s,
      previous: o,
      customUserDescription: r,
      ruleName: this.getCurrRuleFullName()
    });
    throw this.SAVE_ERROR(new WTe(l, this.LA(1), o));
  }
}
class f6e {
  initContentAssist() {
  }
  computeContentAssist(e, r) {
    const n = this.gastProductionsCache[e];
    if (Rr(n))
      throw Error(`Rule ->${e}<- does not exist in this grammar.`);
    return ZU([n], r, this.tokenMatcher, this.maxLookahead);
  }
  // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'...
  // TODO: should this be more explicitly part of the public API?
  getNextPossibleTokenTypes(e) {
    const r = Es(e.ruleStack), i = this.getGAstProductions()[r];
    return new mTe(i, e).startWalking();
  }
}
const ib = {
  description: "This Object indicates the Parser is during Recording Phase"
};
Object.freeze(ib);
const BL = !0, FL = Math.pow(2, dc) - 1, fW = jU({ name: "RECORDING_PHASE_TOKEN", pattern: ua.NA });
f1([fW]);
const pW = NS(
  fW,
  `This IToken indicates the Parser is in Recording Phase
	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,
  // Using "-1" instead of NaN (as in EOF) because an actual number is less likely to
  // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase.
  -1,
  -1,
  -1,
  -1,
  -1,
  -1
);
Object.freeze(pW);
const p6e = {
  name: `This CSTNode indicates the Parser is in Recording Phase
	See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,
  children: {}
};
class g6e {
  initGastRecorder(e) {
    this.recordingProdStack = [], this.RECORDING_PHASE = !1;
  }
  enableRecording() {
    this.RECORDING_PHASE = !0, this.TRACE_INIT("Enable Recording", () => {
      for (let e = 0; e < 10; e++) {
        const r = e > 0 ? e : "";
        this[`CONSUME${r}`] = function(n, i) {
          return this.consumeInternalRecord(n, e, i);
        }, this[`SUBRULE${r}`] = function(n, i) {
          return this.subruleInternalRecord(n, e, i);
        }, this[`OPTION${r}`] = function(n) {
          return this.optionInternalRecord(n, e);
        }, this[`OR${r}`] = function(n) {
          return this.orInternalRecord(n, e);
        }, this[`MANY${r}`] = function(n) {
          this.manyInternalRecord(e, n);
        }, this[`MANY_SEP${r}`] = function(n) {
          this.manySepFirstInternalRecord(e, n);
        }, this[`AT_LEAST_ONE${r}`] = function(n) {
          this.atLeastOneInternalRecord(e, n);
        }, this[`AT_LEAST_ONE_SEP${r}`] = function(n) {
          this.atLeastOneSepFirstInternalRecord(e, n);
        };
      }
      this.consume = function(e, r, n) {
        return this.consumeInternalRecord(r, e, n);
      }, this.subrule = function(e, r, n) {
        return this.subruleInternalRecord(r, e, n);
      }, this.option = function(e, r) {
        return this.optionInternalRecord(r, e);
      }, this.or = function(e, r) {
        return this.orInternalRecord(r, e);
      }, this.many = function(e, r) {
        this.manyInternalRecord(e, r);
      }, this.atLeastOne = function(e, r) {
        this.atLeastOneInternalRecord(e, r);
      }, this.ACTION = this.ACTION_RECORD, this.BACKTRACK = this.BACKTRACK_RECORD, this.LA = this.LA_RECORD;
    });
  }
  disableRecording() {
    this.RECORDING_PHASE = !1, this.TRACE_INIT("Deleting Recording methods", () => {
      const e = this;
      for (let r = 0; r < 10; r++) {
        const n = r > 0 ? r : "";
        delete e[`CONSUME${n}`], delete e[`SUBRULE${n}`], delete e[`OPTION${n}`], delete e[`OR${n}`], delete e[`MANY${n}`], delete e[`MANY_SEP${n}`], delete e[`AT_LEAST_ONE${n}`], delete e[`AT_LEAST_ONE_SEP${n}`];
      }
      delete e.consume, delete e.subrule, delete e.option, delete e.or, delete e.many, delete e.atLeastOne, delete e.ACTION, delete e.BACKTRACK, delete e.LA;
    });
  }
  //   Parser methods are called inside an ACTION?
  //   Maybe try/catch/finally on ACTIONS while disabling the recorders state changes?
  // @ts-expect-error -- noop place holder
  ACTION_RECORD(e) {
  }
  // Executing backtracking logic will break our recording logic assumptions
  BACKTRACK_RECORD(e, r) {
    return () => !0;
  }
  // LA is part of the official API and may be used for custom lookahead logic
  // by end users who may forget to wrap it in ACTION or inside a GATE
  LA_RECORD(e) {
    return o2;
  }
  topLevelRuleRecord(e, r) {
    try {
      const n = new zf({ definition: [], name: e });
      return n.name = e, this.recordingProdStack.push(n), r.call(this), this.recordingProdStack.pop(), n;
    } catch (n) {
      if (n.KNOWN_RECORDER_ERROR !== !0)
        try {
          n.message = n.message + `
	 This error was thrown during the "grammar recording phase" For more info see:
	https://chevrotain.io/docs/guide/internals.html#grammar-recording`;
        } catch {
          throw n;
        }
      throw n;
    }
  }
  // Implementation of parsing DSL
  optionInternalRecord(e, r) {
    return p0.call(this, hi, e, r);
  }
  atLeastOneInternalRecord(e, r) {
    p0.call(this, Oa, r, e);
  }
  atLeastOneSepFirstInternalRecord(e, r) {
    p0.call(this, Pa, r, e, BL);
  }
  manyInternalRecord(e, r) {
    p0.call(this, on, r, e);
  }
  manySepFirstInternalRecord(e, r) {
    p0.call(this, ya, r, e, BL);
  }
  orInternalRecord(e, r) {
    return m6e.call(this, e, r);
  }
  subruleInternalRecord(e, r, n) {
    if (s2(r), !e || Ft(e, "ruleName") === !1) {
      const o = new Error(`<SUBRULE${$L(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
 inside top level rule: <${this.recordingProdStack[0].name}>`);
      throw o.KNOWN_RECORDER_ERROR = !0, o;
    }
    const i = Qs(this.recordingProdStack), a = e.ruleName, s = new Xi({
      idx: r,
      nonTerminalName: a,
      label: n == null ? void 0 : n.LABEL,
      // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created
      referencedRule: void 0
    });
    return i.definition.push(s), this.outputCst ? p6e : ib;
  }
  consumeInternalRecord(e, r, n) {
    if (s2(r), !YU(e)) {
      const s = new Error(`<CONSUME${$L(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
 inside top level rule: <${this.recordingProdStack[0].name}>`);
      throw s.KNOWN_RECORDER_ERROR = !0, s;
    }
    const i = Qs(this.recordingProdStack), a = new qr({
      idx: r,
      terminalType: e,
      label: n == null ? void 0 : n.LABEL
    });
    return i.definition.push(a), pW;
  }
}
function p0(t, e, r, n = !1) {
  s2(r);
  const i = Qs(this.recordingProdStack), a = Ja(e) ? e : e.DEF, s = new t({ definition: [], idx: r });
  return n && (s.separator = e.SEP), Ft(e, "MAX_LOOKAHEAD") && (s.maxLookahead = e.MAX_LOOKAHEAD), this.recordingProdStack.push(s), a.call(this), i.definition.push(s), this.recordingProdStack.pop(), ib;
}
function m6e(t, e) {
  s2(e);
  const r = Qs(this.recordingProdStack), n = ir(t) === !1, i = n === !1 ? t : t.DEF, a = new xa({
    definition: [],
    idx: e,
    ignoreAmbiguities: n && t.IGNORE_AMBIGUITIES === !0
  });
  Ft(t, "MAX_LOOKAHEAD") && (a.maxLookahead = t.MAX_LOOKAHEAD);
  const s = Pz(i, (o) => Ja(o.GATE));
  return a.hasPredicates = s, r.definition.push(a), Ie(i, (o) => {
    const l = new pa({ definition: [] });
    a.definition.push(l), Ft(o, "IGNORE_AMBIGUITIES") ? l.ignoreAmbiguities = o.IGNORE_AMBIGUITIES : Ft(o, "GATE") && (l.ignoreAmbiguities = !0), this.recordingProdStack.push(l), o.ALT.call(this), this.recordingProdStack.pop();
  }), ib;
}
function $L(t) {
  return t === 0 ? "" : `${t}`;
}
function s2(t) {
  if (t < 0 || t > FL) {
    const e = new Error(
      // The stack trace will contain all the needed details
      `Invalid DSL Method idx value: <${t}>
	Idx value must be a none negative value smaller than ${FL + 1}`
    );
    throw e.KNOWN_RECORDER_ERROR = !0, e;
  }
}
class v6e {
  initPerformanceTracer(e) {
    if (Ft(e, "traceInitPerf")) {
      const r = e.traceInitPerf, n = typeof r == "number";
      this.traceInitMaxIdent = n ? r : 1 / 0, this.traceInitPerf = n ? r > 0 : r;
    } else
      this.traceInitMaxIdent = 0, this.traceInitPerf = el.traceInitPerf;
    this.traceInitIndent = -1;
  }
  TRACE_INIT(e, r) {
    if (this.traceInitPerf === !0) {
      this.traceInitIndent++;
      const n = new Array(this.traceInitIndent + 1).join("	");
      this.traceInitIndent < this.traceInitMaxIdent && console.log(`${n}--> <${e}>`);
      const { time: i, value: a } = BU(r), s = i > 10 ? console.warn : console.log;
      return this.traceInitIndent < this.traceInitMaxIdent && s(`${n}<-- <${e}> time: ${i}ms`), this.traceInitIndent--, a;
    } else
      return r();
  }
}
function y6e(t, e) {
  e.forEach((r) => {
    const n = r.prototype;
    Object.getOwnPropertyNames(n).forEach((i) => {
      if (i === "constructor")
        return;
      const a = Object.getOwnPropertyDescriptor(n, i);
      a && (a.get || a.set) ? Object.defineProperty(t.prototype, i, a) : t.prototype[i] = r.prototype[i];
    });
  });
}
const o2 = NS(Kl, "", NaN, NaN, NaN, NaN, NaN, NaN);
Object.freeze(o2);
const el = Object.freeze({
  recoveryEnabled: !1,
  maxLookahead: 3,
  dynamicTokensEnabled: !1,
  outputCst: !0,
  errorMessageProvider: Sh,
  nodeLocationTracking: "none",
  traceInitPerf: !1,
  skipValidations: !1
}), l2 = Object.freeze({
  recoveryValueFunc: () => {
  },
  resyncEnabled: !0
});
var ji;
(function(t) {
  t[t.INVALID_RULE_NAME = 0] = "INVALID_RULE_NAME", t[t.DUPLICATE_RULE_NAME = 1] = "DUPLICATE_RULE_NAME", t[t.INVALID_RULE_OVERRIDE = 2] = "INVALID_RULE_OVERRIDE", t[t.DUPLICATE_PRODUCTIONS = 3] = "DUPLICATE_PRODUCTIONS", t[t.UNRESOLVED_SUBRULE_REF = 4] = "UNRESOLVED_SUBRULE_REF", t[t.LEFT_RECURSION = 5] = "LEFT_RECURSION", t[t.NONE_LAST_EMPTY_ALT = 6] = "NONE_LAST_EMPTY_ALT", t[t.AMBIGUOUS_ALTS = 7] = "AMBIGUOUS_ALTS", t[t.CONFLICT_TOKENS_RULES_NAMESPACE = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE", t[t.INVALID_TOKEN_NAME = 9] = "INVALID_TOKEN_NAME", t[t.NO_NON_EMPTY_LOOKAHEAD = 10] = "NO_NON_EMPTY_LOOKAHEAD", t[t.AMBIGUOUS_PREFIX_ALTS = 11] = "AMBIGUOUS_PREFIX_ALTS", t[t.TOO_MANY_ALTS = 12] = "TOO_MANY_ALTS", t[t.CUSTOM_LOOKAHEAD_VALIDATION = 13] = "CUSTOM_LOOKAHEAD_VALIDATION";
})(ji || (ji = {}));
function zL(t = void 0) {
  return function() {
    return t;
  };
}
class p1 {
  /**
   *  @deprecated use the **instance** method with the same name instead
   */
  static performSelfAnalysis(e) {
    throw Error("The **static** `performSelfAnalysis` method has been deprecated.	\nUse the **instance** method with the same name instead.");
  }
  performSelfAnalysis() {
    this.TRACE_INIT("performSelfAnalysis", () => {
      let e;
      this.selfAnalysisDone = !0;
      const r = this.className;
      this.TRACE_INIT("toFastProps", () => {
        FU(this);
      }), this.TRACE_INIT("Grammar Recording", () => {
        try {
          this.enableRecording(), Ie(this.definedRulesNames, (i) => {
            const s = this[i].originalGrammarAction;
            let o;
            this.TRACE_INIT(`${i} Rule`, () => {
              o = this.topLevelRuleRecord(i, s);
            }), this.gastProductionsCache[i] = o;
          });
        } finally {
          this.disableRecording();
        }
      });
      let n = [];
      if (this.TRACE_INIT("Grammar Resolving", () => {
        n = GTe({
          rules: Pr(this.gastProductionsCache)
        }), this.definitionErrors = this.definitionErrors.concat(n);
      }), this.TRACE_INIT("Grammar Validations", () => {
        if (Sr(n) && this.skipValidations === !1) {
          const i = UTe({
            rules: Pr(this.gastProductionsCache),
            tokenTypes: Pr(this.tokensMap),
            errMsgProvider: jc,
            grammarName: r
          }), a = ATe({
            lookaheadStrategy: this.lookaheadStrategy,
            rules: Pr(this.gastProductionsCache),
            tokenTypes: Pr(this.tokensMap),
            grammarName: r
          });
          this.definitionErrors = this.definitionErrors.concat(i, a);
        }
      }), Sr(this.definitionErrors) && (this.recoveryEnabled && this.TRACE_INIT("computeAllProdsFollows", () => {
        const i = Cwe(Pr(this.gastProductionsCache));
        this.resyncFollows = i;
      }), this.TRACE_INIT("ComputeLookaheadFunctions", () => {
        var i, a;
        (a = (i = this.lookaheadStrategy).initialize) === null || a === void 0 || a.call(i, {
          rules: Pr(this.gastProductionsCache)
        }), this.preComputeLookaheadFunctions(Pr(this.gastProductionsCache));
      })), !p1.DEFER_DEFINITION_ERRORS_HANDLING && !Sr(this.definitionErrors))
        throw e = ft(this.definitionErrors, (i) => i.message), new Error(`Parser Definition Errors detected:
 ${e.join(`
-------------------------------
`)}`);
    });
  }
  constructor(e, r) {
    this.definitionErrors = [], this.selfAnalysisDone = !1;
    const n = this;
    if (n.initErrorHandler(r), n.initLexerAdapter(), n.initLooksAhead(r), n.initRecognizerEngine(e, r), n.initRecoverable(r), n.initTreeBuilder(r), n.initContentAssist(), n.initGastRecorder(r), n.initPerformanceTracer(r), Ft(r, "ignoredIssues"))
      throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
	Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
	See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
	For further details.`);
    this.skipValidations = Ft(r, "skipValidations") ? r.skipValidations : el.skipValidations;
  }
}
p1.DEFER_DEFINITION_ERRORS_HANDLING = !1;
y6e(p1, [
  XTe,
  ZTe,
  l6e,
  c6e,
  h6e,
  u6e,
  d6e,
  f6e,
  g6e,
  v6e
]);
class x6e extends p1 {
  constructor(e, r = el) {
    const n = $n(r);
    n.outputCst = !1, super(e, n);
  }
}
function uf(t, e, r) {
  return `${t.name}_${e}_${r}`;
}
const Zl = 1, b6e = 2, gW = 4, mW = 5, g1 = 7, w6e = 8, T6e = 9, E6e = 10, k6e = 11, vW = 12;
class OS {
  constructor(e) {
    this.target = e;
  }
  isEpsilon() {
    return !1;
  }
}
class PS extends OS {
  constructor(e, r) {
    super(e), this.tokenType = r;
  }
}
class yW extends OS {
  constructor(e) {
    super(e);
  }
  isEpsilon() {
    return !0;
  }
}
class BS extends OS {
  constructor(e, r, n) {
    super(e), this.rule = r, this.followState = n;
  }
  isEpsilon() {
    return !0;
  }
}
function S6e(t) {
  const e = {
    decisionMap: {},
    decisionStates: [],
    ruleToStartState: /* @__PURE__ */ new Map(),
    ruleToStopState: /* @__PURE__ */ new Map(),
    states: []
  };
  C6e(e, t);
  const r = t.length;
  for (let n = 0; n < r; n++) {
    const i = t[n], a = Uu(e, i, i);
    a !== void 0 && B6e(e, i, a);
  }
  return e;
}
function C6e(t, e) {
  const r = e.length;
  for (let n = 0; n < r; n++) {
    const i = e[n], a = Zn(t, i, void 0, {
      type: b6e
    }), s = Zn(t, i, void 0, {
      type: g1
    });
    a.stop = s, t.ruleToStartState.set(i, a), t.ruleToStopState.set(i, s);
  }
}
function xW(t, e, r) {
  return r instanceof qr ? FS(t, e, r.terminalType, r) : r instanceof Xi ? P6e(t, e, r) : r instanceof xa ? N6e(t, e, r) : r instanceof hi ? M6e(t, e, r) : r instanceof on ? A6e(t, e, r) : r instanceof ya ? _6e(t, e, r) : r instanceof Oa ? L6e(t, e, r) : r instanceof Pa ? R6e(t, e, r) : Uu(t, e, r);
}
function A6e(t, e, r) {
  const n = Zn(t, e, r, {
    type: mW
  });
  fc(t, n);
  const i = Gf(t, e, n, r, Uu(t, e, r));
  return wW(t, e, r, i);
}
function _6e(t, e, r) {
  const n = Zn(t, e, r, {
    type: mW
  });
  fc(t, n);
  const i = Gf(t, e, n, r, Uu(t, e, r)), a = FS(t, e, r.separator, r);
  return wW(t, e, r, i, a);
}
function L6e(t, e, r) {
  const n = Zn(t, e, r, {
    type: gW
  });
  fc(t, n);
  const i = Gf(t, e, n, r, Uu(t, e, r));
  return bW(t, e, r, i);
}
function R6e(t, e, r) {
  const n = Zn(t, e, r, {
    type: gW
  });
  fc(t, n);
  const i = Gf(t, e, n, r, Uu(t, e, r)), a = FS(t, e, r.separator, r);
  return bW(t, e, r, i, a);
}
function N6e(t, e, r) {
  const n = Zn(t, e, r, {
    type: Zl
  });
  fc(t, n);
  const i = ft(r.definition, (s) => xW(t, e, s));
  return Gf(t, e, n, r, ...i);
}
function M6e(t, e, r) {
  const n = Zn(t, e, r, {
    type: Zl
  });
  fc(t, n);
  const i = Gf(t, e, n, r, Uu(t, e, r));
  return D6e(t, e, r, i);
}
function Uu(t, e, r) {
  const n = cn(ft(r.definition, (i) => xW(t, e, i)), (i) => i !== void 0);
  return n.length === 1 ? n[0] : n.length === 0 ? void 0 : O6e(t, n);
}
function bW(t, e, r, n, i) {
  const a = n.left, s = n.right, o = Zn(t, e, r, {
    type: k6e
  });
  fc(t, o);
  const l = Zn(t, e, r, {
    type: vW
  });
  return a.loopback = o, l.loopback = o, t.decisionMap[uf(e, i ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", r.idx)] = o, En(s, o), i === void 0 ? (En(o, a), En(o, l)) : (En(o, l), En(o, i.left), En(i.right, a)), {
    left: a,
    right: l
  };
}
function wW(t, e, r, n, i) {
  const a = n.left, s = n.right, o = Zn(t, e, r, {
    type: E6e
  });
  fc(t, o);
  const l = Zn(t, e, r, {
    type: vW
  }), u = Zn(t, e, r, {
    type: T6e
  });
  return o.loopback = u, l.loopback = u, En(o, a), En(o, l), En(s, u), i !== void 0 ? (En(u, l), En(u, i.left), En(i.right, a)) : En(u, o), t.decisionMap[uf(e, i ? "RepetitionWithSeparator" : "Repetition", r.idx)] = o, {
    left: o,
    right: l
  };
}
function D6e(t, e, r, n) {
  const i = n.left, a = n.right;
  return En(i, a), t.decisionMap[uf(e, "Option", r.idx)] = i, n;
}
function fc(t, e) {
  return t.decisionStates.push(e), e.decision = t.decisionStates.length - 1, e.decision;
}
function Gf(t, e, r, n, ...i) {
  const a = Zn(t, e, n, {
    type: w6e,
    start: r
  });
  r.end = a;
  for (const o of i)
    o !== void 0 ? (En(r, o.left), En(o.right, a)) : En(r, a);
  const s = {
    left: r,
    right: a
  };
  return t.decisionMap[uf(e, I6e(n), n.idx)] = r, s;
}
function I6e(t) {
  if (t instanceof xa)
    return "Alternation";
  if (t instanceof hi)
    return "Option";
  if (t instanceof on)
    return "Repetition";
  if (t instanceof ya)
    return "RepetitionWithSeparator";
  if (t instanceof Oa)
    return "RepetitionMandatory";
  if (t instanceof Pa)
    return "RepetitionMandatoryWithSeparator";
  throw new Error("Invalid production type encountered");
}
function O6e(t, e) {
  const r = e.length;
  for (let a = 0; a < r - 1; a++) {
    const s = e[a];
    let o;
    s.left.transitions.length === 1 && (o = s.left.transitions[0]);
    const l = o instanceof BS, u = o, h = e[a + 1].left;
    s.left.type === Zl && s.right.type === Zl && o !== void 0 && (l && u.followState === s.right || o.target === s.right) ? (l ? u.followState = h : o.target = h, F6e(t, s.right)) : En(s.right, h);
  }
  const n = e[0], i = e[r - 1];
  return {
    left: n.left,
    right: i.right
  };
}
function FS(t, e, r, n) {
  const i = Zn(t, e, n, {
    type: Zl
  }), a = Zn(t, e, n, {
    type: Zl
  });
  return $S(i, new PS(a, r)), {
    left: i,
    right: a
  };
}
function P6e(t, e, r) {
  const n = r.referencedRule, i = t.ruleToStartState.get(n), a = Zn(t, e, r, {
    type: Zl
  }), s = Zn(t, e, r, {
    type: Zl
  }), o = new BS(i, n, s);
  return $S(a, o), {
    left: a,
    right: s
  };
}
function B6e(t, e, r) {
  const n = t.ruleToStartState.get(e);
  En(n, r.left);
  const i = t.ruleToStopState.get(e);
  return En(r.right, i), {
    left: n,
    right: i
  };
}
function En(t, e) {
  const r = new yW(e);
  $S(t, r);
}
function Zn(t, e, r, n) {
  const i = Object.assign({
    atn: t,
    production: r,
    epsilonOnlyTransitions: !1,
    rule: e,
    transitions: [],
    nextTokenWithinRule: [],
    stateNumber: t.states.length
  }, n);
  return t.states.push(i), i;
}
function $S(t, e) {
  t.transitions.length === 0 && (t.epsilonOnlyTransitions = e.isEpsilon()), t.transitions.push(e);
}
function F6e(t, e) {
  t.states.splice(t.states.indexOf(e), 1);
}
const c2 = {};
class qT {
  constructor() {
    this.map = {}, this.configs = [];
  }
  get size() {
    return this.configs.length;
  }
  finalize() {
    this.map = {};
  }
  add(e) {
    const r = TW(e);
    r in this.map || (this.map[r] = this.configs.length, this.configs.push(e));
  }
  get elements() {
    return this.configs;
  }
  get alts() {
    return ft(this.configs, (e) => e.alt);
  }
  get key() {
    let e = "";
    for (const r in this.map)
      e += r + ":";
    return e;
  }
}
function TW(t, e = !0) {
  return `${e ? `a${t.alt}` : ""}s${t.state.stateNumber}:${t.stack.map((r) => r.stateNumber.toString()).join("_")}`;
}
function $6e(t, e) {
  const r = {};
  return (n) => {
    const i = n.toString();
    let a = r[i];
    return a !== void 0 || (a = {
      atnStartState: t,
      decision: e,
      states: {}
    }, r[i] = a), a;
  };
}
class EW {
  constructor() {
    this.predicates = [];
  }
  is(e) {
    return e >= this.predicates.length || this.predicates[e];
  }
  set(e, r) {
    this.predicates[e] = r;
  }
  toString() {
    let e = "";
    const r = this.predicates.length;
    for (let n = 0; n < r; n++)
      e += this.predicates[n] === !0 ? "1" : "0";
    return e;
  }
}
const VL = new EW();
class z6e extends IS {
  constructor(e) {
    var r;
    super(), this.logging = (r = e == null ? void 0 : e.logging) !== null && r !== void 0 ? r : (n) => console.log(n);
  }
  initialize(e) {
    this.atn = S6e(e.rules), this.dfas = V6e(this.atn);
  }
  validateAmbiguousAlternationAlternatives() {
    return [];
  }
  validateEmptyOrAlternatives() {
    return [];
  }
  buildLookaheadForAlternation(e) {
    const { prodOccurrence: r, rule: n, hasPredicates: i, dynamicTokensEnabled: a } = e, s = this.dfas, o = this.logging, l = uf(n, "Alternation", r), h = this.atn.decisionMap[l].decision, d = ft(DL({
      maxLookahead: 1,
      occurrence: r,
      prodType: "Alternation",
      rule: n
    }), (f) => ft(f, (p) => p[0]));
    if (GL(d, !1) && !a) {
      const f = An(d, (p, g, m) => (Ie(g, (v) => {
        v && (p[v.tokenTypeIdx] = m, Ie(v.categoryMatches, (y) => {
          p[y] = m;
        }));
      }), p), {});
      return i ? function(p) {
        var g;
        const m = this.LA(1), v = f[m.tokenTypeIdx];
        if (p !== void 0 && v !== void 0) {
          const y = (g = p[v]) === null || g === void 0 ? void 0 : g.GATE;
          if (y !== void 0 && y.call(this) === !1)
            return;
        }
        return v;
      } : function() {
        const p = this.LA(1);
        return f[p.tokenTypeIdx];
      };
    } else return i ? function(f) {
      const p = new EW(), g = f === void 0 ? 0 : f.length;
      for (let v = 0; v < g; v++) {
        const y = f == null ? void 0 : f[v].GATE;
        p.set(v, y === void 0 || y.call(this));
      }
      const m = m5.call(this, s, h, p, o);
      return typeof m == "number" ? m : void 0;
    } : function() {
      const f = m5.call(this, s, h, VL, o);
      return typeof f == "number" ? f : void 0;
    };
  }
  buildLookaheadForOptional(e) {
    const { prodOccurrence: r, rule: n, prodType: i, dynamicTokensEnabled: a } = e, s = this.dfas, o = this.logging, l = uf(n, i, r), h = this.atn.decisionMap[l].decision, d = ft(DL({
      maxLookahead: 1,
      occurrence: r,
      prodType: i,
      rule: n
    }), (f) => ft(f, (p) => p[0]));
    if (GL(d) && d[0][0] && !a) {
      const f = d[0], p = jn(f);
      if (p.length === 1 && Sr(p[0].categoryMatches)) {
        const m = p[0].tokenTypeIdx;
        return function() {
          return this.LA(1).tokenTypeIdx === m;
        };
      } else {
        const g = An(p, (m, v) => (v !== void 0 && (m[v.tokenTypeIdx] = !0, Ie(v.categoryMatches, (y) => {
          m[y] = !0;
        })), m), {});
        return function() {
          const m = this.LA(1);
          return g[m.tokenTypeIdx] === !0;
        };
      }
    }
    return function() {
      const f = m5.call(this, s, h, VL, o);
      return typeof f == "object" ? !1 : f === 0;
    };
  }
}
function GL(t, e = !0) {
  const r = /* @__PURE__ */ new Set();
  for (const n of t) {
    const i = /* @__PURE__ */ new Set();
    for (const a of n) {
      if (a === void 0) {
        if (e)
          break;
        return !1;
      }
      const s = [a.tokenTypeIdx].concat(a.categoryMatches);
      for (const o of s)
        if (r.has(o)) {
          if (!i.has(o))
            return !1;
        } else
          r.add(o), i.add(o);
    }
  }
  return !0;
}
function V6e(t) {
  const e = t.decisionStates.length, r = Array(e);
  for (let n = 0; n < e; n++)
    r[n] = $6e(t.decisionStates[n], n);
  return r;
}
function m5(t, e, r, n) {
  const i = t[e](r);
  let a = i.start;
  if (a === void 0) {
    const o = Q6e(i.atnStartState);
    a = SW(i, kW(o)), i.start = a;
  }
  return G6e.apply(this, [i, a, r, n]);
}
function G6e(t, e, r, n) {
  let i = e, a = 1;
  const s = [];
  let o = this.LA(a++);
  for (; ; ) {
    let l = X6e(i, o);
    if (l === void 0 && (l = U6e.apply(this, [t, i, o, a, r, n])), l === c2)
      return Y6e(s, i, o);
    if (l.isAcceptState === !0)
      return l.prediction;
    i = l, s.push(o), o = this.LA(a++);
  }
}
function U6e(t, e, r, n, i, a) {
  const s = j6e(e.configs, r, i);
  if (s.size === 0)
    return UL(t, e, r, c2), c2;
  let o = kW(s);
  const l = Z6e(s, i);
  if (l !== void 0)
    o.isAcceptState = !0, o.prediction = l, o.configs.uniqueAlt = l;
  else if (rEe(s)) {
    const u = af(s.alts);
    o.isAcceptState = !0, o.prediction = u, o.configs.uniqueAlt = u, W6e.apply(this, [t, n, s.alts, a]);
  }
  return o = UL(t, e, r, o), o;
}
function W6e(t, e, r, n) {
  const i = [];
  for (let u = 1; u <= e; u++)
    i.push(this.LA(u).tokenType);
  const a = t.atnStartState, s = a.rule, o = a.production, l = H6e({
    topLevelRule: s,
    ambiguityIndices: r,
    production: o,
    prefixPath: i
  });
  n(l);
}
function H6e(t) {
  const e = ft(t.prefixPath, (i) => zh(i)).join(", "), r = t.production.idx === 0 ? "" : t.production.idx;
  let n = `Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${q6e(t.production)}${r}> inside <${t.topLevelRule.name}> Rule,
<${e}> may appears as a prefix path in all these alternatives.
`;
  return n = n + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`, n;
}
function q6e(t) {
  if (t instanceof Xi)
    return "SUBRULE";
  if (t instanceof hi)
    return "OPTION";
  if (t instanceof xa)
    return "OR";
  if (t instanceof Oa)
    return "AT_LEAST_ONE";
  if (t instanceof Pa)
    return "AT_LEAST_ONE_SEP";
  if (t instanceof ya)
    return "MANY_SEP";
  if (t instanceof on)
    return "MANY";
  if (t instanceof qr)
    return "CONSUME";
  throw Error("non exhaustive match");
}
function Y6e(t, e, r) {
  const n = _a(e.configs.elements, (a) => a.state.transitions), i = gge(n.filter((a) => a instanceof PS).map((a) => a.tokenType), (a) => a.tokenTypeIdx);
  return {
    actualToken: r,
    possibleTokenTypes: i,
    tokenPath: t
  };
}
function X6e(t, e) {
  return t.edges[e.tokenTypeIdx];
}
function j6e(t, e, r) {
  const n = new qT(), i = [];
  for (const s of t.elements) {
    if (r.is(s.alt) === !1)
      continue;
    if (s.state.type === g1) {
      i.push(s);
      continue;
    }
    const o = s.state.transitions.length;
    for (let l = 0; l < o; l++) {
      const u = s.state.transitions[l], h = K6e(u, e);
      h !== void 0 && n.add({
        state: h,
        alt: s.alt,
        stack: s.stack
      });
    }
  }
  let a;
  if (i.length === 0 && n.size === 1 && (a = n), a === void 0) {
    a = new qT();
    for (const s of n.elements)
      u2(s, a);
  }
  if (i.length > 0 && !eEe(a))
    for (const s of i)
      a.add(s);
  return a;
}
function K6e(t, e) {
  if (t instanceof PS && KU(e, t.tokenType))
    return t.target;
}
function Z6e(t, e) {
  let r;
  for (const n of t.elements)
    if (e.is(n.alt) === !0) {
      if (r === void 0)
        r = n.alt;
      else if (r !== n.alt)
        return;
    }
  return r;
}
function kW(t) {
  return {
    configs: t,
    edges: {},
    isAcceptState: !1,
    prediction: -1
  };
}
function UL(t, e, r, n) {
  return n = SW(t, n), e.edges[r.tokenTypeIdx] = n, n;
}
function SW(t, e) {
  if (e === c2)
    return e;
  const r = e.configs.key, n = t.states[r];
  return n !== void 0 ? n : (e.configs.finalize(), t.states[r] = e, e);
}
function Q6e(t) {
  const e = new qT(), r = t.transitions.length;
  for (let n = 0; n < r; n++) {
    const a = {
      state: t.transitions[n].target,
      alt: n,
      stack: []
    };
    u2(a, e);
  }
  return e;
}
function u2(t, e) {
  const r = t.state;
  if (r.type === g1) {
    if (t.stack.length > 0) {
      const i = [...t.stack], s = {
        state: i.pop(),
        alt: t.alt,
        stack: i
      };
      u2(s, e);
    } else
      e.add(t);
    return;
  }
  r.epsilonOnlyTransitions || e.add(t);
  const n = r.transitions.length;
  for (let i = 0; i < n; i++) {
    const a = r.transitions[i], s = J6e(t, a);
    s !== void 0 && u2(s, e);
  }
}
function J6e(t, e) {
  if (e instanceof yW)
    return {
      state: e.target,
      alt: t.alt,
      stack: t.stack
    };
  if (e instanceof BS) {
    const r = [...t.stack, e.followState];
    return {
      state: e.target,
      alt: t.alt,
      stack: r
    };
  }
}
function eEe(t) {
  for (const e of t.elements)
    if (e.state.type === g1)
      return !0;
  return !1;
}
function tEe(t) {
  for (const e of t.elements)
    if (e.state.type !== g1)
      return !1;
  return !0;
}
function rEe(t) {
  if (tEe(t))
    return !0;
  const e = nEe(t.elements);
  return iEe(e) && !aEe(e);
}
function nEe(t) {
  const e = /* @__PURE__ */ new Map();
  for (const r of t) {
    const n = TW(r, !1);
    let i = e.get(n);
    i === void 0 && (i = {}, e.set(n, i)), i[r.alt] = !0;
  }
  return e;
}
function iEe(t) {
  for (const e of Array.from(t.values()))
    if (Object.keys(e).length > 1)
      return !0;
  return !1;
}
function aEe(t) {
  for (const e of Array.from(t.values()))
    if (Object.keys(e).length === 1)
      return !0;
  return !1;
}
var WL;
(function(t) {
  function e(r) {
    return typeof r == "string";
  }
  t.is = e;
})(WL || (WL = {}));
var YT;
(function(t) {
  function e(r) {
    return typeof r == "string";
  }
  t.is = e;
})(YT || (YT = {}));
var HL;
(function(t) {
  t.MIN_VALUE = -2147483648, t.MAX_VALUE = 2147483647;
  function e(r) {
    return typeof r == "number" && t.MIN_VALUE <= r && r <= t.MAX_VALUE;
  }
  t.is = e;
})(HL || (HL = {}));
var h2;
(function(t) {
  t.MIN_VALUE = 0, t.MAX_VALUE = 2147483647;
  function e(r) {
    return typeof r == "number" && t.MIN_VALUE <= r && r <= t.MAX_VALUE;
  }
  t.is = e;
})(h2 || (h2 = {}));
var Cr;
(function(t) {
  function e(n, i) {
    return n === Number.MAX_VALUE && (n = h2.MAX_VALUE), i === Number.MAX_VALUE && (i = h2.MAX_VALUE), { line: n, character: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.objectLiteral(i) && $e.uinteger(i.line) && $e.uinteger(i.character);
  }
  t.is = r;
})(Cr || (Cr = {}));
var pr;
(function(t) {
  function e(n, i, a, s) {
    if ($e.uinteger(n) && $e.uinteger(i) && $e.uinteger(a) && $e.uinteger(s))
      return { start: Cr.create(n, i), end: Cr.create(a, s) };
    if (Cr.is(n) && Cr.is(i))
      return { start: n, end: i };
    throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${a}, ${s}]`);
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.objectLiteral(i) && Cr.is(i.start) && Cr.is(i.end);
  }
  t.is = r;
})(pr || (pr = {}));
var d2;
(function(t) {
  function e(n, i) {
    return { uri: n, range: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.objectLiteral(i) && pr.is(i.range) && ($e.string(i.uri) || $e.undefined(i.uri));
  }
  t.is = r;
})(d2 || (d2 = {}));
var qL;
(function(t) {
  function e(n, i, a, s) {
    return { targetUri: n, targetRange: i, targetSelectionRange: a, originSelectionRange: s };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.objectLiteral(i) && pr.is(i.targetRange) && $e.string(i.targetUri) && pr.is(i.targetSelectionRange) && (pr.is(i.originSelectionRange) || $e.undefined(i.originSelectionRange));
  }
  t.is = r;
})(qL || (qL = {}));
var XT;
(function(t) {
  function e(n, i, a, s) {
    return {
      red: n,
      green: i,
      blue: a,
      alpha: s
    };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && $e.numberRange(i.red, 0, 1) && $e.numberRange(i.green, 0, 1) && $e.numberRange(i.blue, 0, 1) && $e.numberRange(i.alpha, 0, 1);
  }
  t.is = r;
})(XT || (XT = {}));
var YL;
(function(t) {
  function e(n, i) {
    return {
      range: n,
      color: i
    };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && pr.is(i.range) && XT.is(i.color);
  }
  t.is = r;
})(YL || (YL = {}));
var XL;
(function(t) {
  function e(n, i, a) {
    return {
      label: n,
      textEdit: i,
      additionalTextEdits: a
    };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && $e.string(i.label) && ($e.undefined(i.textEdit) || df.is(i)) && ($e.undefined(i.additionalTextEdits) || $e.typedArray(i.additionalTextEdits, df.is));
  }
  t.is = r;
})(XL || (XL = {}));
var jL;
(function(t) {
  t.Comment = "comment", t.Imports = "imports", t.Region = "region";
})(jL || (jL = {}));
var KL;
(function(t) {
  function e(n, i, a, s, o, l) {
    const u = {
      startLine: n,
      endLine: i
    };
    return $e.defined(a) && (u.startCharacter = a), $e.defined(s) && (u.endCharacter = s), $e.defined(o) && (u.kind = o), $e.defined(l) && (u.collapsedText = l), u;
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && $e.uinteger(i.startLine) && $e.uinteger(i.startLine) && ($e.undefined(i.startCharacter) || $e.uinteger(i.startCharacter)) && ($e.undefined(i.endCharacter) || $e.uinteger(i.endCharacter)) && ($e.undefined(i.kind) || $e.string(i.kind));
  }
  t.is = r;
})(KL || (KL = {}));
var jT;
(function(t) {
  function e(n, i) {
    return {
      location: n,
      message: i
    };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && d2.is(i.location) && $e.string(i.message);
  }
  t.is = r;
})(jT || (jT = {}));
var ZL;
(function(t) {
  t.Error = 1, t.Warning = 2, t.Information = 3, t.Hint = 4;
})(ZL || (ZL = {}));
var QL;
(function(t) {
  t.Unnecessary = 1, t.Deprecated = 2;
})(QL || (QL = {}));
var JL;
(function(t) {
  function e(r) {
    const n = r;
    return $e.objectLiteral(n) && $e.string(n.href);
  }
  t.is = e;
})(JL || (JL = {}));
var f2;
(function(t) {
  function e(n, i, a, s, o, l) {
    let u = { range: n, message: i };
    return $e.defined(a) && (u.severity = a), $e.defined(s) && (u.code = s), $e.defined(o) && (u.source = o), $e.defined(l) && (u.relatedInformation = l), u;
  }
  t.create = e;
  function r(n) {
    var i;
    let a = n;
    return $e.defined(a) && pr.is(a.range) && $e.string(a.message) && ($e.number(a.severity) || $e.undefined(a.severity)) && ($e.integer(a.code) || $e.string(a.code) || $e.undefined(a.code)) && ($e.undefined(a.codeDescription) || $e.string((i = a.codeDescription) === null || i === void 0 ? void 0 : i.href)) && ($e.string(a.source) || $e.undefined(a.source)) && ($e.undefined(a.relatedInformation) || $e.typedArray(a.relatedInformation, jT.is));
  }
  t.is = r;
})(f2 || (f2 = {}));
var hf;
(function(t) {
  function e(n, i, ...a) {
    let s = { title: n, command: i };
    return $e.defined(a) && a.length > 0 && (s.arguments = a), s;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.string(i.title) && $e.string(i.command);
  }
  t.is = r;
})(hf || (hf = {}));
var df;
(function(t) {
  function e(a, s) {
    return { range: a, newText: s };
  }
  t.replace = e;
  function r(a, s) {
    return { range: { start: a, end: a }, newText: s };
  }
  t.insert = r;
  function n(a) {
    return { range: a, newText: "" };
  }
  t.del = n;
  function i(a) {
    const s = a;
    return $e.objectLiteral(s) && $e.string(s.newText) && pr.is(s.range);
  }
  t.is = i;
})(df || (df = {}));
var KT;
(function(t) {
  function e(n, i, a) {
    const s = { label: n };
    return i !== void 0 && (s.needsConfirmation = i), a !== void 0 && (s.description = a), s;
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && $e.string(i.label) && ($e.boolean(i.needsConfirmation) || i.needsConfirmation === void 0) && ($e.string(i.description) || i.description === void 0);
  }
  t.is = r;
})(KT || (KT = {}));
var ff;
(function(t) {
  function e(r) {
    const n = r;
    return $e.string(n);
  }
  t.is = e;
})(ff || (ff = {}));
var eR;
(function(t) {
  function e(a, s, o) {
    return { range: a, newText: s, annotationId: o };
  }
  t.replace = e;
  function r(a, s, o) {
    return { range: { start: a, end: a }, newText: s, annotationId: o };
  }
  t.insert = r;
  function n(a, s) {
    return { range: a, newText: "", annotationId: s };
  }
  t.del = n;
  function i(a) {
    const s = a;
    return df.is(s) && (KT.is(s.annotationId) || ff.is(s.annotationId));
  }
  t.is = i;
})(eR || (eR = {}));
var ZT;
(function(t) {
  function e(n, i) {
    return { textDocument: n, edits: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && r6.is(i.textDocument) && Array.isArray(i.edits);
  }
  t.is = r;
})(ZT || (ZT = {}));
var QT;
(function(t) {
  function e(n, i, a) {
    let s = {
      kind: "create",
      uri: n
    };
    return i !== void 0 && (i.overwrite !== void 0 || i.ignoreIfExists !== void 0) && (s.options = i), a !== void 0 && (s.annotationId = a), s;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return i && i.kind === "create" && $e.string(i.uri) && (i.options === void 0 || (i.options.overwrite === void 0 || $e.boolean(i.options.overwrite)) && (i.options.ignoreIfExists === void 0 || $e.boolean(i.options.ignoreIfExists))) && (i.annotationId === void 0 || ff.is(i.annotationId));
  }
  t.is = r;
})(QT || (QT = {}));
var JT;
(function(t) {
  function e(n, i, a, s) {
    let o = {
      kind: "rename",
      oldUri: n,
      newUri: i
    };
    return a !== void 0 && (a.overwrite !== void 0 || a.ignoreIfExists !== void 0) && (o.options = a), s !== void 0 && (o.annotationId = s), o;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return i && i.kind === "rename" && $e.string(i.oldUri) && $e.string(i.newUri) && (i.options === void 0 || (i.options.overwrite === void 0 || $e.boolean(i.options.overwrite)) && (i.options.ignoreIfExists === void 0 || $e.boolean(i.options.ignoreIfExists))) && (i.annotationId === void 0 || ff.is(i.annotationId));
  }
  t.is = r;
})(JT || (JT = {}));
var e6;
(function(t) {
  function e(n, i, a) {
    let s = {
      kind: "delete",
      uri: n
    };
    return i !== void 0 && (i.recursive !== void 0 || i.ignoreIfNotExists !== void 0) && (s.options = i), a !== void 0 && (s.annotationId = a), s;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return i && i.kind === "delete" && $e.string(i.uri) && (i.options === void 0 || (i.options.recursive === void 0 || $e.boolean(i.options.recursive)) && (i.options.ignoreIfNotExists === void 0 || $e.boolean(i.options.ignoreIfNotExists))) && (i.annotationId === void 0 || ff.is(i.annotationId));
  }
  t.is = r;
})(e6 || (e6 = {}));
var t6;
(function(t) {
  function e(r) {
    let n = r;
    return n && (n.changes !== void 0 || n.documentChanges !== void 0) && (n.documentChanges === void 0 || n.documentChanges.every((i) => $e.string(i.kind) ? QT.is(i) || JT.is(i) || e6.is(i) : ZT.is(i)));
  }
  t.is = e;
})(t6 || (t6 = {}));
var tR;
(function(t) {
  function e(n) {
    return { uri: n };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.string(i.uri);
  }
  t.is = r;
})(tR || (tR = {}));
var rR;
(function(t) {
  function e(n, i) {
    return { uri: n, version: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.string(i.uri) && $e.integer(i.version);
  }
  t.is = r;
})(rR || (rR = {}));
var r6;
(function(t) {
  function e(n, i) {
    return { uri: n, version: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.string(i.uri) && (i.version === null || $e.integer(i.version));
  }
  t.is = r;
})(r6 || (r6 = {}));
var nR;
(function(t) {
  function e(n, i, a, s) {
    return { uri: n, languageId: i, version: a, text: s };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.string(i.uri) && $e.string(i.languageId) && $e.integer(i.version) && $e.string(i.text);
  }
  t.is = r;
})(nR || (nR = {}));
var n6;
(function(t) {
  t.PlainText = "plaintext", t.Markdown = "markdown";
  function e(r) {
    const n = r;
    return n === t.PlainText || n === t.Markdown;
  }
  t.is = e;
})(n6 || (n6 = {}));
var mg;
(function(t) {
  function e(r) {
    const n = r;
    return $e.objectLiteral(r) && n6.is(n.kind) && $e.string(n.value);
  }
  t.is = e;
})(mg || (mg = {}));
var iR;
(function(t) {
  t.Text = 1, t.Method = 2, t.Function = 3, t.Constructor = 4, t.Field = 5, t.Variable = 6, t.Class = 7, t.Interface = 8, t.Module = 9, t.Property = 10, t.Unit = 11, t.Value = 12, t.Enum = 13, t.Keyword = 14, t.Snippet = 15, t.Color = 16, t.File = 17, t.Reference = 18, t.Folder = 19, t.EnumMember = 20, t.Constant = 21, t.Struct = 22, t.Event = 23, t.Operator = 24, t.TypeParameter = 25;
})(iR || (iR = {}));
var aR;
(function(t) {
  t.PlainText = 1, t.Snippet = 2;
})(aR || (aR = {}));
var sR;
(function(t) {
  t.Deprecated = 1;
})(sR || (sR = {}));
var oR;
(function(t) {
  function e(n, i, a) {
    return { newText: n, insert: i, replace: a };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return i && $e.string(i.newText) && pr.is(i.insert) && pr.is(i.replace);
  }
  t.is = r;
})(oR || (oR = {}));
var lR;
(function(t) {
  t.asIs = 1, t.adjustIndentation = 2;
})(lR || (lR = {}));
var cR;
(function(t) {
  function e(r) {
    const n = r;
    return n && ($e.string(n.detail) || n.detail === void 0) && ($e.string(n.description) || n.description === void 0);
  }
  t.is = e;
})(cR || (cR = {}));
var uR;
(function(t) {
  function e(r) {
    return { label: r };
  }
  t.create = e;
})(uR || (uR = {}));
var hR;
(function(t) {
  function e(r, n) {
    return { items: r || [], isIncomplete: !!n };
  }
  t.create = e;
})(hR || (hR = {}));
var p2;
(function(t) {
  function e(n) {
    return n.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
  }
  t.fromPlainText = e;
  function r(n) {
    const i = n;
    return $e.string(i) || $e.objectLiteral(i) && $e.string(i.language) && $e.string(i.value);
  }
  t.is = r;
})(p2 || (p2 = {}));
var dR;
(function(t) {
  function e(r) {
    let n = r;
    return !!n && $e.objectLiteral(n) && (mg.is(n.contents) || p2.is(n.contents) || $e.typedArray(n.contents, p2.is)) && (r.range === void 0 || pr.is(r.range));
  }
  t.is = e;
})(dR || (dR = {}));
var fR;
(function(t) {
  function e(r, n) {
    return n ? { label: r, documentation: n } : { label: r };
  }
  t.create = e;
})(fR || (fR = {}));
var pR;
(function(t) {
  function e(r, n, ...i) {
    let a = { label: r };
    return $e.defined(n) && (a.documentation = n), $e.defined(i) ? a.parameters = i : a.parameters = [], a;
  }
  t.create = e;
})(pR || (pR = {}));
var gR;
(function(t) {
  t.Text = 1, t.Read = 2, t.Write = 3;
})(gR || (gR = {}));
var mR;
(function(t) {
  function e(r, n) {
    let i = { range: r };
    return $e.number(n) && (i.kind = n), i;
  }
  t.create = e;
})(mR || (mR = {}));
var vR;
(function(t) {
  t.File = 1, t.Module = 2, t.Namespace = 3, t.Package = 4, t.Class = 5, t.Method = 6, t.Property = 7, t.Field = 8, t.Constructor = 9, t.Enum = 10, t.Interface = 11, t.Function = 12, t.Variable = 13, t.Constant = 14, t.String = 15, t.Number = 16, t.Boolean = 17, t.Array = 18, t.Object = 19, t.Key = 20, t.Null = 21, t.EnumMember = 22, t.Struct = 23, t.Event = 24, t.Operator = 25, t.TypeParameter = 26;
})(vR || (vR = {}));
var yR;
(function(t) {
  t.Deprecated = 1;
})(yR || (yR = {}));
var xR;
(function(t) {
  function e(r, n, i, a, s) {
    let o = {
      name: r,
      kind: n,
      location: { uri: a, range: i }
    };
    return s && (o.containerName = s), o;
  }
  t.create = e;
})(xR || (xR = {}));
var bR;
(function(t) {
  function e(r, n, i, a) {
    return a !== void 0 ? { name: r, kind: n, location: { uri: i, range: a } } : { name: r, kind: n, location: { uri: i } };
  }
  t.create = e;
})(bR || (bR = {}));
var wR;
(function(t) {
  function e(n, i, a, s, o, l) {
    let u = {
      name: n,
      detail: i,
      kind: a,
      range: s,
      selectionRange: o
    };
    return l !== void 0 && (u.children = l), u;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return i && $e.string(i.name) && $e.number(i.kind) && pr.is(i.range) && pr.is(i.selectionRange) && (i.detail === void 0 || $e.string(i.detail)) && (i.deprecated === void 0 || $e.boolean(i.deprecated)) && (i.children === void 0 || Array.isArray(i.children)) && (i.tags === void 0 || Array.isArray(i.tags));
  }
  t.is = r;
})(wR || (wR = {}));
var TR;
(function(t) {
  t.Empty = "", t.QuickFix = "quickfix", t.Refactor = "refactor", t.RefactorExtract = "refactor.extract", t.RefactorInline = "refactor.inline", t.RefactorRewrite = "refactor.rewrite", t.Source = "source", t.SourceOrganizeImports = "source.organizeImports", t.SourceFixAll = "source.fixAll";
})(TR || (TR = {}));
var g2;
(function(t) {
  t.Invoked = 1, t.Automatic = 2;
})(g2 || (g2 = {}));
var ER;
(function(t) {
  function e(n, i, a) {
    let s = { diagnostics: n };
    return i != null && (s.only = i), a != null && (s.triggerKind = a), s;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.typedArray(i.diagnostics, f2.is) && (i.only === void 0 || $e.typedArray(i.only, $e.string)) && (i.triggerKind === void 0 || i.triggerKind === g2.Invoked || i.triggerKind === g2.Automatic);
  }
  t.is = r;
})(ER || (ER = {}));
var kR;
(function(t) {
  function e(n, i, a) {
    let s = { title: n }, o = !0;
    return typeof i == "string" ? (o = !1, s.kind = i) : hf.is(i) ? s.command = i : s.edit = i, o && a !== void 0 && (s.kind = a), s;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return i && $e.string(i.title) && (i.diagnostics === void 0 || $e.typedArray(i.diagnostics, f2.is)) && (i.kind === void 0 || $e.string(i.kind)) && (i.edit !== void 0 || i.command !== void 0) && (i.command === void 0 || hf.is(i.command)) && (i.isPreferred === void 0 || $e.boolean(i.isPreferred)) && (i.edit === void 0 || t6.is(i.edit));
  }
  t.is = r;
})(kR || (kR = {}));
var SR;
(function(t) {
  function e(n, i) {
    let a = { range: n };
    return $e.defined(i) && (a.data = i), a;
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && pr.is(i.range) && ($e.undefined(i.command) || hf.is(i.command));
  }
  t.is = r;
})(SR || (SR = {}));
var CR;
(function(t) {
  function e(n, i) {
    return { tabSize: n, insertSpaces: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && $e.uinteger(i.tabSize) && $e.boolean(i.insertSpaces);
  }
  t.is = r;
})(CR || (CR = {}));
var AR;
(function(t) {
  function e(n, i, a) {
    return { range: n, target: i, data: a };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.defined(i) && pr.is(i.range) && ($e.undefined(i.target) || $e.string(i.target));
  }
  t.is = r;
})(AR || (AR = {}));
var _R;
(function(t) {
  function e(n, i) {
    return { range: n, parent: i };
  }
  t.create = e;
  function r(n) {
    let i = n;
    return $e.objectLiteral(i) && pr.is(i.range) && (i.parent === void 0 || t.is(i.parent));
  }
  t.is = r;
})(_R || (_R = {}));
var LR;
(function(t) {
  t.namespace = "namespace", t.type = "type", t.class = "class", t.enum = "enum", t.interface = "interface", t.struct = "struct", t.typeParameter = "typeParameter", t.parameter = "parameter", t.variable = "variable", t.property = "property", t.enumMember = "enumMember", t.event = "event", t.function = "function", t.method = "method", t.macro = "macro", t.keyword = "keyword", t.modifier = "modifier", t.comment = "comment", t.string = "string", t.number = "number", t.regexp = "regexp", t.operator = "operator", t.decorator = "decorator";
})(LR || (LR = {}));
var RR;
(function(t) {
  t.declaration = "declaration", t.definition = "definition", t.readonly = "readonly", t.static = "static", t.deprecated = "deprecated", t.abstract = "abstract", t.async = "async", t.modification = "modification", t.documentation = "documentation", t.defaultLibrary = "defaultLibrary";
})(RR || (RR = {}));
var NR;
(function(t) {
  function e(r) {
    const n = r;
    return $e.objectLiteral(n) && (n.resultId === void 0 || typeof n.resultId == "string") && Array.isArray(n.data) && (n.data.length === 0 || typeof n.data[0] == "number");
  }
  t.is = e;
})(NR || (NR = {}));
var MR;
(function(t) {
  function e(n, i) {
    return { range: n, text: i };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return i != null && pr.is(i.range) && $e.string(i.text);
  }
  t.is = r;
})(MR || (MR = {}));
var DR;
(function(t) {
  function e(n, i, a) {
    return { range: n, variableName: i, caseSensitiveLookup: a };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return i != null && pr.is(i.range) && $e.boolean(i.caseSensitiveLookup) && ($e.string(i.variableName) || i.variableName === void 0);
  }
  t.is = r;
})(DR || (DR = {}));
var IR;
(function(t) {
  function e(n, i) {
    return { range: n, expression: i };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return i != null && pr.is(i.range) && ($e.string(i.expression) || i.expression === void 0);
  }
  t.is = r;
})(IR || (IR = {}));
var OR;
(function(t) {
  function e(n, i) {
    return { frameId: n, stoppedLocation: i };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.defined(i) && pr.is(n.stoppedLocation);
  }
  t.is = r;
})(OR || (OR = {}));
var i6;
(function(t) {
  t.Type = 1, t.Parameter = 2;
  function e(r) {
    return r === 1 || r === 2;
  }
  t.is = e;
})(i6 || (i6 = {}));
var a6;
(function(t) {
  function e(n) {
    return { value: n };
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && (i.tooltip === void 0 || $e.string(i.tooltip) || mg.is(i.tooltip)) && (i.location === void 0 || d2.is(i.location)) && (i.command === void 0 || hf.is(i.command));
  }
  t.is = r;
})(a6 || (a6 = {}));
var PR;
(function(t) {
  function e(n, i, a) {
    const s = { position: n, label: i };
    return a !== void 0 && (s.kind = a), s;
  }
  t.create = e;
  function r(n) {
    const i = n;
    return $e.objectLiteral(i) && Cr.is(i.position) && ($e.string(i.label) || $e.typedArray(i.label, a6.is)) && (i.kind === void 0 || i6.is(i.kind)) && i.textEdits === void 0 || $e.typedArray(i.textEdits, df.is) && (i.tooltip === void 0 || $e.string(i.tooltip) || mg.is(i.tooltip)) && (i.paddingLeft === void 0 || $e.boolean(i.paddingLeft)) && (i.paddingRight === void 0 || $e.boolean(i.paddingRight));
  }
  t.is = r;
})(PR || (PR = {}));
var BR;
(function(t) {
  function e(r) {
    return { kind: "snippet", value: r };
  }
  t.createSnippet = e;
})(BR || (BR = {}));
var FR;
(function(t) {
  function e(r, n, i, a) {
    return { insertText: r, filterText: n, range: i, command: a };
  }
  t.create = e;
})(FR || (FR = {}));
var $R;
(function(t) {
  function e(r) {
    return { items: r };
  }
  t.create = e;
})($R || ($R = {}));
var zR;
(function(t) {
  t.Invoked = 0, t.Automatic = 1;
})(zR || (zR = {}));
var VR;
(function(t) {
  function e(r, n) {
    return { range: r, text: n };
  }
  t.create = e;
})(VR || (VR = {}));
var GR;
(function(t) {
  function e(r, n) {
    return { triggerKind: r, selectedCompletionInfo: n };
  }
  t.create = e;
})(GR || (GR = {}));
var UR;
(function(t) {
  function e(r) {
    const n = r;
    return $e.objectLiteral(n) && YT.is(n.uri) && $e.string(n.name);
  }
  t.is = e;
})(UR || (UR = {}));
var WR;
(function(t) {
  function e(a, s, o, l) {
    return new sEe(a, s, o, l);
  }
  t.create = e;
  function r(a) {
    let s = a;
    return !!($e.defined(s) && $e.string(s.uri) && ($e.undefined(s.languageId) || $e.string(s.languageId)) && $e.uinteger(s.lineCount) && $e.func(s.getText) && $e.func(s.positionAt) && $e.func(s.offsetAt));
  }
  t.is = r;
  function n(a, s) {
    let o = a.getText(), l = i(s, (h, d) => {
      let f = h.range.start.line - d.range.start.line;
      return f === 0 ? h.range.start.character - d.range.start.character : f;
    }), u = o.length;
    for (let h = l.length - 1; h >= 0; h--) {
      let d = l[h], f = a.offsetAt(d.range.start), p = a.offsetAt(d.range.end);
      if (p <= u)
        o = o.substring(0, f) + d.newText + o.substring(p, o.length);
      else
        throw new Error("Overlapping edit");
      u = f;
    }
    return o;
  }
  t.applyEdits = n;
  function i(a, s) {
    if (a.length <= 1)
      return a;
    const o = a.length / 2 | 0, l = a.slice(0, o), u = a.slice(o);
    i(l, s), i(u, s);
    let h = 0, d = 0, f = 0;
    for (; h < l.length && d < u.length; )
      s(l[h], u[d]) <= 0 ? a[f++] = l[h++] : a[f++] = u[d++];
    for (; h < l.length; )
      a[f++] = l[h++];
    for (; d < u.length; )
      a[f++] = u[d++];
    return a;
  }
})(WR || (WR = {}));
let sEe = class {
  constructor(e, r, n, i) {
    this._uri = e, this._languageId = r, this._version = n, this._content = i, this._lineOffsets = void 0;
  }
  get uri() {
    return this._uri;
  }
  get languageId() {
    return this._languageId;
  }
  get version() {
    return this._version;
  }
  getText(e) {
    if (e) {
      let r = this.offsetAt(e.start), n = this.offsetAt(e.end);
      return this._content.substring(r, n);
    }
    return this._content;
  }
  update(e, r) {
    this._content = e.text, this._version = r, this._lineOffsets = void 0;
  }
  getLineOffsets() {
    if (this._lineOffsets === void 0) {
      let e = [], r = this._content, n = !0;
      for (let i = 0; i < r.length; i++) {
        n && (e.push(i), n = !1);
        let a = r.charAt(i);
        n = a === "\r" || a === `
`, a === "\r" && i + 1 < r.length && r.charAt(i + 1) === `
` && i++;
      }
      n && r.length > 0 && e.push(r.length), this._lineOffsets = e;
    }
    return this._lineOffsets;
  }
  positionAt(e) {
    e = Math.max(Math.min(e, this._content.length), 0);
    let r = this.getLineOffsets(), n = 0, i = r.length;
    if (i === 0)
      return Cr.create(0, e);
    for (; n < i; ) {
      let s = Math.floor((n + i) / 2);
      r[s] > e ? i = s : n = s + 1;
    }
    let a = n - 1;
    return Cr.create(a, e - r[a]);
  }
  offsetAt(e) {
    let r = this.getLineOffsets();
    if (e.line >= r.length)
      return this._content.length;
    if (e.line < 0)
      return 0;
    let n = r[e.line], i = e.line + 1 < r.length ? r[e.line + 1] : this._content.length;
    return Math.max(Math.min(n + e.character, i), n);
  }
  get lineCount() {
    return this.getLineOffsets().length;
  }
};
var $e;
(function(t) {
  const e = Object.prototype.toString;
  function r(p) {
    return typeof p < "u";
  }
  t.defined = r;
  function n(p) {
    return typeof p > "u";
  }
  t.undefined = n;
  function i(p) {
    return p === !0 || p === !1;
  }
  t.boolean = i;
  function a(p) {
    return e.call(p) === "[object String]";
  }
  t.string = a;
  function s(p) {
    return e.call(p) === "[object Number]";
  }
  t.number = s;
  function o(p, g, m) {
    return e.call(p) === "[object Number]" && g <= p && p <= m;
  }
  t.numberRange = o;
  function l(p) {
    return e.call(p) === "[object Number]" && -2147483648 <= p && p <= 2147483647;
  }
  t.integer = l;
  function u(p) {
    return e.call(p) === "[object Number]" && 0 <= p && p <= 2147483647;
  }
  t.uinteger = u;
  function h(p) {
    return e.call(p) === "[object Function]";
  }
  t.func = h;
  function d(p) {
    return p !== null && typeof p == "object";
  }
  t.objectLiteral = d;
  function f(p, g) {
    return Array.isArray(p) && p.every(g);
  }
  t.typedArray = f;
})($e || ($e = {}));
class oEe {
  constructor() {
    this.nodeStack = [];
  }
  get current() {
    var e;
    return (e = this.nodeStack[this.nodeStack.length - 1]) !== null && e !== void 0 ? e : this.rootNode;
  }
  buildRootNode(e) {
    return this.rootNode = new AW(e), this.rootNode.root = this.rootNode, this.nodeStack = [this.rootNode], this.rootNode;
  }
  buildCompositeNode(e) {
    const r = new zS();
    return r.grammarSource = e, r.root = this.rootNode, this.current.content.push(r), this.nodeStack.push(r), r;
  }
  buildLeafNode(e, r) {
    const n = new s6(e.startOffset, e.image.length, DT(e), e.tokenType, !r);
    return n.grammarSource = r, n.root = this.rootNode, this.current.content.push(n), n;
  }
  removeNode(e) {
    const r = e.container;
    if (r) {
      const n = r.content.indexOf(e);
      n >= 0 && r.content.splice(n, 1);
    }
  }
  addHiddenNodes(e) {
    const r = [];
    for (const a of e) {
      const s = new s6(a.startOffset, a.image.length, DT(a), a.tokenType, !0);
      s.root = this.rootNode, r.push(s);
    }
    let n = this.current, i = !1;
    if (n.content.length > 0) {
      n.content.push(...r);
      return;
    }
    for (; n.container; ) {
      const a = n.container.content.indexOf(n);
      if (a > 0) {
        n.container.content.splice(a, 0, ...r), i = !0;
        break;
      }
      n = n.container;
    }
    i || this.rootNode.content.unshift(...r);
  }
  construct(e) {
    const r = this.current;
    typeof e.$type == "string" && (this.current.astNode = e), e.$cstNode = r;
    const n = this.nodeStack.pop();
    (n == null ? void 0 : n.content.length) === 0 && this.removeNode(n);
  }
}
class CW {
  /** @deprecated use `container` instead. */
  get parent() {
    return this.container;
  }
  /** @deprecated use `grammarSource` instead. */
  get feature() {
    return this.grammarSource;
  }
  get hidden() {
    return !1;
  }
  get astNode() {
    var e, r;
    const n = typeof ((e = this._astNode) === null || e === void 0 ? void 0 : e.$type) == "string" ? this._astNode : (r = this.container) === null || r === void 0 ? void 0 : r.astNode;
    if (!n)
      throw new Error("This node has no associated AST element");
    return n;
  }
  set astNode(e) {
    this._astNode = e;
  }
  /** @deprecated use `astNode` instead. */
  get element() {
    return this.astNode;
  }
  get text() {
    return this.root.fullText.substring(this.offset, this.end);
  }
}
class s6 extends CW {
  get offset() {
    return this._offset;
  }
  get length() {
    return this._length;
  }
  get end() {
    return this._offset + this._length;
  }
  get hidden() {
    return this._hidden;
  }
  get tokenType() {
    return this._tokenType;
  }
  get range() {
    return this._range;
  }
  constructor(e, r, n, i, a = !1) {
    super(), this._hidden = a, this._offset = e, this._tokenType = i, this._length = r, this._range = n;
  }
}
class zS extends CW {
  constructor() {
    super(...arguments), this.content = new VS(this);
  }
  /** @deprecated use `content` instead. */
  get children() {
    return this.content;
  }
  get offset() {
    var e, r;
    return (r = (e = this.firstNonHiddenNode) === null || e === void 0 ? void 0 : e.offset) !== null && r !== void 0 ? r : 0;
  }
  get length() {
    return this.end - this.offset;
  }
  get end() {
    var e, r;
    return (r = (e = this.lastNonHiddenNode) === null || e === void 0 ? void 0 : e.end) !== null && r !== void 0 ? r : 0;
  }
  get range() {
    const e = this.firstNonHiddenNode, r = this.lastNonHiddenNode;
    if (e && r) {
      if (this._rangeCache === void 0) {
        const { range: n } = e, { range: i } = r;
        this._rangeCache = { start: n.start, end: i.end.line < n.start.line ? n.start : i.end };
      }
      return this._rangeCache;
    } else
      return { start: Cr.create(0, 0), end: Cr.create(0, 0) };
  }
  get firstNonHiddenNode() {
    for (const e of this.content)
      if (!e.hidden)
        return e;
    return this.content[0];
  }
  get lastNonHiddenNode() {
    for (let e = this.content.length - 1; e >= 0; e--) {
      const r = this.content[e];
      if (!r.hidden)
        return r;
    }
    return this.content[this.content.length - 1];
  }
}
class VS extends Array {
  constructor(e) {
    super(), this.parent = e, Object.setPrototypeOf(this, VS.prototype);
  }
  push(...e) {
    return this.addParents(e), super.push(...e);
  }
  unshift(...e) {
    return this.addParents(e), super.unshift(...e);
  }
  splice(e, r, ...n) {
    return this.addParents(n), super.splice(e, r, ...n);
  }
  addParents(e) {
    for (const r of e)
      r.container = this.parent;
  }
}
class AW extends zS {
  get text() {
    return this._text.substring(this.offset, this.end);
  }
  get fullText() {
    return this._text;
  }
  constructor(e) {
    super(), this._text = "", this._text = e ?? "";
  }
}
const o6 = Symbol("Datatype");
function v5(t) {
  return t.$type === o6;
}
const HR = "​", _W = (t) => t.endsWith(HR) ? t : t + HR;
class LW {
  constructor(e) {
    this._unorderedGroups = /* @__PURE__ */ new Map(), this.allRules = /* @__PURE__ */ new Map(), this.lexer = e.parser.Lexer;
    const r = this.lexer.definition, n = e.LanguageMetaData.mode === "production";
    this.wrapper = new dEe(r, Object.assign(Object.assign({}, e.parser.ParserConfig), { skipValidations: n, errorMessageProvider: e.parser.ParserErrorMessageProvider }));
  }
  alternatives(e, r) {
    this.wrapper.wrapOr(e, r);
  }
  optional(e, r) {
    this.wrapper.wrapOption(e, r);
  }
  many(e, r) {
    this.wrapper.wrapMany(e, r);
  }
  atLeastOne(e, r) {
    this.wrapper.wrapAtLeastOne(e, r);
  }
  getRule(e) {
    return this.allRules.get(e);
  }
  isRecording() {
    return this.wrapper.IS_RECORDING;
  }
  get unorderedGroups() {
    return this._unorderedGroups;
  }
  getRuleStack() {
    return this.wrapper.RULE_STACK;
  }
  finalize() {
    this.wrapper.wrapSelfAnalysis();
  }
}
class lEe extends LW {
  get current() {
    return this.stack[this.stack.length - 1];
  }
  constructor(e) {
    super(e), this.nodeBuilder = new oEe(), this.stack = [], this.assignmentMap = /* @__PURE__ */ new Map(), this.linker = e.references.Linker, this.converter = e.parser.ValueConverter, this.astReflection = e.shared.AstReflection;
  }
  rule(e, r) {
    const n = this.computeRuleType(e), i = this.wrapper.DEFINE_RULE(_W(e.name), this.startImplementation(n, r).bind(this));
    return this.allRules.set(e.name, i), e.entry && (this.mainRule = i), i;
  }
  computeRuleType(e) {
    if (!e.fragment) {
      if (IU(e))
        return o6;
      {
        const r = CS(e);
        return r ?? e.name;
      }
    }
  }
  parse(e, r = {}) {
    this.nodeBuilder.buildRootNode(e);
    const n = this.lexerResult = this.lexer.tokenize(e);
    this.wrapper.input = n.tokens;
    const i = r.rule ? this.allRules.get(r.rule) : this.mainRule;
    if (!i)
      throw new Error(r.rule ? `No rule found with name '${r.rule}'` : "No main rule available.");
    const a = i.call(this.wrapper, {});
    return this.nodeBuilder.addHiddenNodes(n.hidden), this.unorderedGroups.clear(), this.lexerResult = void 0, {
      value: a,
      lexerErrors: n.errors,
      lexerReport: n.report,
      parserErrors: this.wrapper.errors
    };
  }
  startImplementation(e, r) {
    return (n) => {
      const i = !this.isRecording() && e !== void 0;
      if (i) {
        const s = { $type: e };
        this.stack.push(s), e === o6 && (s.value = "");
      }
      let a;
      try {
        a = r(n);
      } catch {
        a = void 0;
      }
      return a === void 0 && i && (a = this.construct()), a;
    };
  }
  extractHiddenTokens(e) {
    const r = this.lexerResult.hidden;
    if (!r.length)
      return [];
    const n = e.startOffset;
    for (let i = 0; i < r.length; i++)
      if (r[i].startOffset > n)
        return r.splice(0, i);
    return r.splice(0, r.length);
  }
  consume(e, r, n) {
    const i = this.wrapper.wrapConsume(e, r);
    if (!this.isRecording() && this.isValidToken(i)) {
      const a = this.extractHiddenTokens(i);
      this.nodeBuilder.addHiddenNodes(a);
      const s = this.nodeBuilder.buildLeafNode(i, n), { assignment: o, isCrossRef: l } = this.getAssignment(n), u = this.current;
      if (o) {
        const h = wu(n) ? i.image : this.converter.convert(i.image, s);
        this.assign(o.operator, o.feature, h, s, l);
      } else if (v5(u)) {
        let h = i.image;
        wu(n) || (h = this.converter.convert(h, s).toString()), u.value += h;
      }
    }
  }
  /**
   * Most consumed parser tokens are valid. However there are two cases in which they are not valid:
   *
   * 1. They were inserted during error recovery by the parser. These tokens don't really exist and should not be further processed
   * 2. They contain invalid token ranges. This might include the special EOF token, or other tokens produced by invalid token builders.
   */
  isValidToken(e) {
    return !e.isInsertedInRecovery && !isNaN(e.startOffset) && typeof e.endOffset == "number" && !isNaN(e.endOffset);
  }
  subrule(e, r, n, i, a) {
    let s;
    !this.isRecording() && !n && (s = this.nodeBuilder.buildCompositeNode(i));
    const o = this.wrapper.wrapSubrule(e, r, a);
    !this.isRecording() && s && s.length > 0 && this.performSubruleAssignment(o, i, s);
  }
  performSubruleAssignment(e, r, n) {
    const { assignment: i, isCrossRef: a } = this.getAssignment(r);
    if (i)
      this.assign(i.operator, i.feature, e, n, a);
    else if (!i) {
      const s = this.current;
      if (v5(s))
        s.value += e.toString();
      else if (typeof e == "object" && e) {
        const l = this.assignWithoutOverride(e, s);
        this.stack.pop(), this.stack.push(l);
      }
    }
  }
  action(e, r) {
    if (!this.isRecording()) {
      let n = this.current;
      if (r.feature && r.operator) {
        n = this.construct(), this.nodeBuilder.removeNode(n.$cstNode), this.nodeBuilder.buildCompositeNode(r).content.push(n.$cstNode);
        const a = { $type: e };
        this.stack.push(a), this.assign(r.operator, r.feature, n, n.$cstNode, !1);
      } else
        n.$type = e;
    }
  }
  construct() {
    if (this.isRecording())
      return;
    const e = this.current;
    return G5e(e), this.nodeBuilder.construct(e), this.stack.pop(), v5(e) ? this.converter.convert(e.value, e.$cstNode) : (U5e(this.astReflection, e), e);
  }
  getAssignment(e) {
    if (!this.assignmentMap.has(e)) {
      const r = jx(e, bu);
      this.assignmentMap.set(e, {
        assignment: r,
        isCrossRef: r ? TS(r.terminal) : !1
      });
    }
    return this.assignmentMap.get(e);
  }
  assign(e, r, n, i, a) {
    const s = this.current;
    let o;
    switch (a && typeof n == "string" ? o = this.linker.buildReference(s, r, i, n) : o = n, e) {
      case "=": {
        s[r] = o;
        break;
      }
      case "?=": {
        s[r] = !0;
        break;
      }
      case "+=":
        Array.isArray(s[r]) || (s[r] = []), s[r].push(o);
    }
  }
  assignWithoutOverride(e, r) {
    for (const [i, a] of Object.entries(r)) {
      const s = e[i];
      s === void 0 ? e[i] = a : Array.isArray(s) && Array.isArray(a) && (a.push(...s), e[i] = a);
    }
    const n = e.$cstNode;
    return n && (n.astNode = void 0, e.$cstNode = void 0), e;
  }
  get definitionErrors() {
    return this.wrapper.definitionErrors;
  }
}
class cEe {
  buildMismatchTokenMessage(e) {
    return Sh.buildMismatchTokenMessage(e);
  }
  buildNotAllInputParsedMessage(e) {
    return Sh.buildNotAllInputParsedMessage(e);
  }
  buildNoViableAltMessage(e) {
    return Sh.buildNoViableAltMessage(e);
  }
  buildEarlyExitMessage(e) {
    return Sh.buildEarlyExitMessage(e);
  }
}
class RW extends cEe {
  buildMismatchTokenMessage({ expected: e, actual: r }) {
    return `Expecting ${e.LABEL ? "`" + e.LABEL + "`" : e.name.endsWith(":KW") ? `keyword '${e.name.substring(0, e.name.length - 3)}'` : `token of type '${e.name}'`} but found \`${r.image}\`.`;
  }
  buildNotAllInputParsedMessage({ firstRedundant: e }) {
    return `Expecting end of file but found \`${e.image}\`.`;
  }
}
class uEe extends LW {
  constructor() {
    super(...arguments), this.tokens = [], this.elementStack = [], this.lastElementStack = [], this.nextTokenIndex = 0, this.stackSize = 0;
  }
  action() {
  }
  construct() {
  }
  parse(e) {
    this.resetState();
    const r = this.lexer.tokenize(e, { mode: "partial" });
    return this.tokens = r.tokens, this.wrapper.input = [...this.tokens], this.mainRule.call(this.wrapper, {}), this.unorderedGroups.clear(), {
      tokens: this.tokens,
      elementStack: [...this.lastElementStack],
      tokenIndex: this.nextTokenIndex
    };
  }
  rule(e, r) {
    const n = this.wrapper.DEFINE_RULE(_W(e.name), this.startImplementation(r).bind(this));
    return this.allRules.set(e.name, n), e.entry && (this.mainRule = n), n;
  }
  resetState() {
    this.elementStack = [], this.lastElementStack = [], this.nextTokenIndex = 0, this.stackSize = 0;
  }
  startImplementation(e) {
    return (r) => {
      const n = this.keepStackSize();
      try {
        e(r);
      } finally {
        this.resetStackSize(n);
      }
    };
  }
  removeUnexpectedElements() {
    this.elementStack.splice(this.stackSize);
  }
  keepStackSize() {
    const e = this.elementStack.length;
    return this.stackSize = e, e;
  }
  resetStackSize(e) {
    this.removeUnexpectedElements(), this.stackSize = e;
  }
  consume(e, r, n) {
    this.wrapper.wrapConsume(e, r), this.isRecording() || (this.lastElementStack = [...this.elementStack, n], this.nextTokenIndex = this.currIdx + 1);
  }
  subrule(e, r, n, i, a) {
    this.before(i), this.wrapper.wrapSubrule(e, r, a), this.after(i);
  }
  before(e) {
    this.isRecording() || this.elementStack.push(e);
  }
  after(e) {
    if (!this.isRecording()) {
      const r = this.elementStack.lastIndexOf(e);
      r >= 0 && this.elementStack.splice(r);
    }
  }
  get currIdx() {
    return this.wrapper.currIdx;
  }
}
const hEe = {
  recoveryEnabled: !0,
  nodeLocationTracking: "full",
  skipValidations: !0,
  errorMessageProvider: new RW()
};
class dEe extends x6e {
  constructor(e, r) {
    const n = r && "maxLookahead" in r;
    super(e, Object.assign(Object.assign(Object.assign({}, hEe), { lookaheadStrategy: n ? new IS({ maxLookahead: r.maxLookahead }) : new z6e({
      // If validations are skipped, don't log the lookahead warnings
      logging: r.skipValidations ? () => {
      } : void 0
    }) }), r));
  }
  get IS_RECORDING() {
    return this.RECORDING_PHASE;
  }
  DEFINE_RULE(e, r) {
    return this.RULE(e, r);
  }
  wrapSelfAnalysis() {
    this.performSelfAnalysis();
  }
  wrapConsume(e, r) {
    return this.consume(e, r);
  }
  wrapSubrule(e, r, n) {
    return this.subrule(e, r, {
      ARGS: [n]
    });
  }
  wrapOr(e, r) {
    this.or(e, r);
  }
  wrapOption(e, r) {
    this.option(e, r);
  }
  wrapMany(e, r) {
    this.many(e, r);
  }
  wrapAtLeastOne(e, r) {
    this.atLeastOne(e, r);
  }
}
function NW(t, e, r) {
  return fEe({
    parser: e,
    tokens: r,
    ruleNames: /* @__PURE__ */ new Map()
  }, t), e;
}
function fEe(t, e) {
  const r = LU(e, !1), n = oi(e.rules).filter(is).filter((i) => r.has(i));
  for (const i of n) {
    const a = Object.assign(Object.assign({}, t), { consume: 1, optional: 1, subrule: 1, many: 1, or: 1 });
    t.parser.rule(i, ku(a, i.definition));
  }
}
function ku(t, e, r = !1) {
  let n;
  if (wu(e))
    n = bEe(t, e);
  else if (Xx(e))
    n = pEe(t, e);
  else if (bu(e))
    n = ku(t, e.terminal);
  else if (TS(e))
    n = MW(t, e);
  else if (Tu(e))
    n = gEe(t, e);
  else if (EU(e))
    n = vEe(t, e);
  else if (kU(e))
    n = yEe(t, e);
  else if (ES(e))
    n = xEe(t, e);
  else if (I5e(e)) {
    const i = t.consume++;
    n = () => t.parser.consume(i, Kl, e);
  } else
    throw new xU(e.$cstNode, `Unexpected element type: ${e.$type}`);
  return DW(t, r ? void 0 : m2(e), n, e.cardinality);
}
function pEe(t, e) {
  const r = AS(e);
  return () => t.parser.action(r, e);
}
function gEe(t, e) {
  const r = e.rule.ref;
  if (is(r)) {
    const n = t.subrule++, i = r.fragment, a = e.arguments.length > 0 ? mEe(r, e.arguments) : () => ({});
    return (s) => t.parser.subrule(n, IW(t, r), i, e, a(s));
  } else if (Gu(r)) {
    const n = t.consume++, i = l6(t, r.name);
    return () => t.parser.consume(n, i, e);
  } else if (r)
    c1();
  else
    throw new xU(e.$cstNode, `Undefined rule: ${e.rule.$refText}`);
}
function mEe(t, e) {
  const r = e.map((n) => Ro(n.value));
  return (n) => {
    const i = {};
    for (let a = 0; a < r.length; a++) {
      const s = t.parameters[a], o = r[a];
      i[s.name] = o(n);
    }
    return i;
  };
}
function Ro(t) {
  if (_5e(t)) {
    const e = Ro(t.left), r = Ro(t.right);
    return (n) => e(n) || r(n);
  } else if (A5e(t)) {
    const e = Ro(t.left), r = Ro(t.right);
    return (n) => e(n) && r(n);
  } else if (L5e(t)) {
    const e = Ro(t.value);
    return (r) => !e(r);
  } else if (R5e(t)) {
    const e = t.parameter.ref.name;
    return (r) => r !== void 0 && r[e] === !0;
  } else if (C5e(t)) {
    const e = !!t.true;
    return () => e;
  }
  c1();
}
function vEe(t, e) {
  if (e.elements.length === 1)
    return ku(t, e.elements[0]);
  {
    const r = [];
    for (const i of e.elements) {
      const a = {
        // Since we handle the guard condition in the alternative already
        // We can ignore the group guard condition inside
        ALT: ku(t, i, !0)
      }, s = m2(i);
      s && (a.GATE = Ro(s)), r.push(a);
    }
    const n = t.or++;
    return (i) => t.parser.alternatives(n, r.map((a) => {
      const s = {
        ALT: () => a.ALT(i)
      }, o = a.GATE;
      return o && (s.GATE = () => o(i)), s;
    }));
  }
}
function yEe(t, e) {
  if (e.elements.length === 1)
    return ku(t, e.elements[0]);
  const r = [];
  for (const o of e.elements) {
    const l = {
      // Since we handle the guard condition in the alternative already
      // We can ignore the group guard condition inside
      ALT: ku(t, o, !0)
    }, u = m2(o);
    u && (l.GATE = Ro(u)), r.push(l);
  }
  const n = t.or++, i = (o, l) => {
    const u = l.getRuleStack().join("-");
    return `uGroup_${o}_${u}`;
  }, a = (o) => t.parser.alternatives(n, r.map((l, u) => {
    const h = { ALT: () => !0 }, d = t.parser;
    h.ALT = () => {
      if (l.ALT(o), !d.isRecording()) {
        const p = i(n, d);
        d.unorderedGroups.get(p) || d.unorderedGroups.set(p, []);
        const g = d.unorderedGroups.get(p);
        typeof (g == null ? void 0 : g[u]) > "u" && (g[u] = !0);
      }
    };
    const f = l.GATE;
    return f ? h.GATE = () => f(o) : h.GATE = () => {
      const p = d.unorderedGroups.get(i(n, d));
      return !(p != null && p[u]);
    }, h;
  })), s = DW(t, m2(e), a, "*");
  return (o) => {
    s(o), t.parser.isRecording() || t.parser.unorderedGroups.delete(i(n, t.parser));
  };
}
function xEe(t, e) {
  const r = e.elements.map((n) => ku(t, n));
  return (n) => r.forEach((i) => i(n));
}
function m2(t) {
  if (ES(t))
    return t.guardCondition;
}
function MW(t, e, r = e.terminal) {
  if (r)
    if (Tu(r) && is(r.rule.ref)) {
      const n = r.rule.ref, i = t.subrule++;
      return (a) => t.parser.subrule(i, IW(t, n), !1, e, a);
    } else if (Tu(r) && Gu(r.rule.ref)) {
      const n = t.consume++, i = l6(t, r.rule.ref.name);
      return () => t.parser.consume(n, i, e);
    } else if (wu(r)) {
      const n = t.consume++, i = l6(t, r.value);
      return () => t.parser.consume(n, i, e);
    } else
      throw new Error("Could not build cross reference parser");
  else {
    if (!e.type.ref)
      throw new Error("Could not resolve reference to type: " + e.type.$refText);
    const n = MU(e.type.ref), i = n == null ? void 0 : n.terminal;
    if (!i)
      throw new Error("Could not find name assignment for type: " + AS(e.type.ref));
    return MW(t, e, i);
  }
}
function bEe(t, e) {
  const r = t.consume++, n = t.tokens[e.value];
  if (!n)
    throw new Error("Could not find token for keyword: " + e.value);
  return () => t.parser.consume(r, n, e);
}
function DW(t, e, r, n) {
  const i = e && Ro(e);
  if (!n)
    if (i) {
      const a = t.or++;
      return (s) => t.parser.alternatives(a, [
        {
          ALT: () => r(s),
          GATE: () => i(s)
        },
        {
          ALT: zL(),
          GATE: () => !i(s)
        }
      ]);
    } else
      return r;
  if (n === "*") {
    const a = t.many++;
    return (s) => t.parser.many(a, {
      DEF: () => r(s),
      GATE: i ? () => i(s) : void 0
    });
  } else if (n === "+") {
    const a = t.many++;
    if (i) {
      const s = t.or++;
      return (o) => t.parser.alternatives(s, [
        {
          ALT: () => t.parser.atLeastOne(a, {
            DEF: () => r(o)
          }),
          GATE: () => i(o)
        },
        {
          ALT: zL(),
          GATE: () => !i(o)
        }
      ]);
    } else
      return (s) => t.parser.atLeastOne(a, {
        DEF: () => r(s)
      });
  } else if (n === "?") {
    const a = t.optional++;
    return (s) => t.parser.optional(a, {
      DEF: () => r(s),
      GATE: i ? () => i(s) : void 0
    });
  } else
    c1();
}
function IW(t, e) {
  const r = wEe(t, e), n = t.parser.getRule(r);
  if (!n)
    throw new Error(`Rule "${r}" not found."`);
  return n;
}
function wEe(t, e) {
  if (is(e))
    return e.name;
  if (t.ruleNames.has(e))
    return t.ruleNames.get(e);
  {
    let r = e, n = r.$container, i = e.$type;
    for (; !is(n); )
      (ES(n) || EU(n) || kU(n)) && (i = n.elements.indexOf(r).toString() + ":" + i), r = n, n = n.$container;
    return i = n.name + ":" + i, t.ruleNames.set(e, i), i;
  }
}
function l6(t, e) {
  const r = t.tokens[e];
  if (!r)
    throw new Error(`Token "${e}" not found."`);
  return r;
}
function TEe(t) {
  const e = t.Grammar, r = t.parser.Lexer, n = new uEe(t);
  return NW(e, n, r.definition), n.finalize(), n;
}
function EEe(t) {
  const e = kEe(t);
  return e.finalize(), e;
}
function kEe(t) {
  const e = t.Grammar, r = t.parser.Lexer, n = new lEe(t);
  return NW(e, n, r.definition);
}
class OW {
  constructor() {
    this.diagnostics = [];
  }
  buildTokens(e, r) {
    const n = oi(LU(e, !1)), i = this.buildTerminalTokens(n), a = this.buildKeywordTokens(n, i, r);
    return i.forEach((s) => {
      const o = s.PATTERN;
      typeof o == "object" && o && "test" in o && OT(o) ? a.unshift(s) : a.push(s);
    }), a;
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  flushLexingReport(e) {
    return { diagnostics: this.popDiagnostics() };
  }
  popDiagnostics() {
    const e = [...this.diagnostics];
    return this.diagnostics = [], e;
  }
  buildTerminalTokens(e) {
    return e.filter(Gu).filter((r) => !r.fragment).map((r) => this.buildTerminalToken(r)).toArray();
  }
  buildTerminalToken(e) {
    const r = _S(e), n = this.requiresCustomPattern(r) ? this.regexPatternFunction(r) : r, i = {
      name: e.name,
      PATTERN: n
    };
    return typeof n == "function" && (i.LINE_BREAKS = !0), e.hidden && (i.GROUP = OT(r) ? ua.SKIPPED : "hidden"), i;
  }
  requiresCustomPattern(e) {
    return e.flags.includes("u") || e.flags.includes("s") ? !0 : !!(e.source.includes("?<=") || e.source.includes("?<!"));
  }
  regexPatternFunction(e) {
    const r = new RegExp(e, e.flags + "y");
    return (n, i) => (r.lastIndex = i, r.exec(n));
  }
  buildKeywordTokens(e, r, n) {
    return e.filter(is).flatMap((i) => u1(i).filter(wu)).distinct((i) => i.value).toArray().sort((i, a) => a.value.length - i.value.length).map((i) => this.buildKeywordToken(i, r, !!(n != null && n.caseInsensitive)));
  }
  buildKeywordToken(e, r, n) {
    const i = this.buildKeywordPattern(e, n), a = {
      name: e.value,
      PATTERN: i,
      LONGER_ALT: this.findLongerAlt(e, r)
    };
    return typeof i == "function" && (a.LINE_BREAKS = !0), a;
  }
  buildKeywordPattern(e, r) {
    return r ? new RegExp(Q5e(e.value)) : e.value;
  }
  findLongerAlt(e, r) {
    return r.reduce((n, i) => {
      const a = i == null ? void 0 : i.PATTERN;
      return a != null && a.source && J5e("^" + a.source + "$", e.value) && n.push(i), n;
    }, []);
  }
}
class PW {
  convert(e, r) {
    let n = r.grammarSource;
    if (TS(n) && (n = nwe(n)), Tu(n)) {
      const i = n.rule.ref;
      if (!i)
        throw new Error("This cst node was not parsed by a rule.");
      return this.runConverter(i, e, r);
    }
    return e;
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  runConverter(e, r, n) {
    var i;
    switch (e.name.toUpperCase()) {
      case "INT":
        return ko.convertInt(r);
      case "STRING":
        return ko.convertString(r);
      case "ID":
        return ko.convertID(r);
    }
    switch ((i = uwe(e)) === null || i === void 0 ? void 0 : i.toLowerCase()) {
      case "number":
        return ko.convertNumber(r);
      case "boolean":
        return ko.convertBoolean(r);
      case "bigint":
        return ko.convertBigint(r);
      case "date":
        return ko.convertDate(r);
      default:
        return r;
    }
  }
}
var ko;
(function(t) {
  function e(u) {
    let h = "";
    for (let d = 1; d < u.length - 1; d++) {
      const f = u.charAt(d);
      if (f === "\\") {
        const p = u.charAt(++d);
        h += r(p);
      } else
        h += f;
    }
    return h;
  }
  t.convertString = e;
  function r(u) {
    switch (u) {
      case "b":
        return "\b";
      case "f":
        return "\f";
      case "n":
        return `
`;
      case "r":
        return "\r";
      case "t":
        return "	";
      case "v":
        return "\v";
      case "0":
        return "\0";
      default:
        return u;
    }
  }
  function n(u) {
    return u.charAt(0) === "^" ? u.substring(1) : u;
  }
  t.convertID = n;
  function i(u) {
    return parseInt(u);
  }
  t.convertInt = i;
  function a(u) {
    return BigInt(u);
  }
  t.convertBigint = a;
  function s(u) {
    return new Date(u);
  }
  t.convertDate = s;
  function o(u) {
    return Number(u);
  }
  t.convertNumber = o;
  function l(u) {
    return u.toLowerCase() === "true";
  }
  t.convertBoolean = l;
})(ko || (ko = {}));
var vg = {}, ab = {};
Object.defineProperty(ab, "__esModule", { value: !0 });
let c6;
function u6() {
  if (c6 === void 0)
    throw new Error("No runtime abstraction layer installed");
  return c6;
}
(function(t) {
  function e(r) {
    if (r === void 0)
      throw new Error("No runtime abstraction layer provided");
    c6 = r;
  }
  t.install = e;
})(u6 || (u6 = {}));
ab.default = u6;
var wi = {};
Object.defineProperty(wi, "__esModule", { value: !0 });
wi.stringArray = wi.array = wi.func = wi.error = wi.number = wi.string = wi.boolean = void 0;
function SEe(t) {
  return t === !0 || t === !1;
}
wi.boolean = SEe;
function BW(t) {
  return typeof t == "string" || t instanceof String;
}
wi.string = BW;
function CEe(t) {
  return typeof t == "number" || t instanceof Number;
}
wi.number = CEe;
function AEe(t) {
  return t instanceof Error;
}
wi.error = AEe;
function _Ee(t) {
  return typeof t == "function";
}
wi.func = _Ee;
function FW(t) {
  return Array.isArray(t);
}
wi.array = FW;
function LEe(t) {
  return FW(t) && t.every((e) => BW(e));
}
wi.stringArray = LEe;
var pf = {};
Object.defineProperty(pf, "__esModule", { value: !0 });
var $W = pf.Emitter = pf.Event = void 0;
const REe = ab;
var qR;
(function(t) {
  const e = { dispose() {
  } };
  t.None = function() {
    return e;
  };
})(qR || (pf.Event = qR = {}));
class NEe {
  add(e, r = null, n) {
    this._callbacks || (this._callbacks = [], this._contexts = []), this._callbacks.push(e), this._contexts.push(r), Array.isArray(n) && n.push({ dispose: () => this.remove(e, r) });
  }
  remove(e, r = null) {
    if (!this._callbacks)
      return;
    let n = !1;
    for (let i = 0, a = this._callbacks.length; i < a; i++)
      if (this._callbacks[i] === e)
        if (this._contexts[i] === r) {
          this._callbacks.splice(i, 1), this._contexts.splice(i, 1);
          return;
        } else
          n = !0;
    if (n)
      throw new Error("When adding a listener with a context, you should remove it with the same context");
  }
  invoke(...e) {
    if (!this._callbacks)
      return [];
    const r = [], n = this._callbacks.slice(0), i = this._contexts.slice(0);
    for (let a = 0, s = n.length; a < s; a++)
      try {
        r.push(n[a].apply(i[a], e));
      } catch (o) {
        (0, REe.default)().console.error(o);
      }
    return r;
  }
  isEmpty() {
    return !this._callbacks || this._callbacks.length === 0;
  }
  dispose() {
    this._callbacks = void 0, this._contexts = void 0;
  }
}
class sb {
  constructor(e) {
    this._options = e;
  }
  /**
   * For the public to allow to subscribe
   * to events from this Emitter
   */
  get event() {
    return this._event || (this._event = (e, r, n) => {
      this._callbacks || (this._callbacks = new NEe()), this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty() && this._options.onFirstListenerAdd(this), this._callbacks.add(e, r);
      const i = {
        dispose: () => {
          this._callbacks && (this._callbacks.remove(e, r), i.dispose = sb._noop, this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty() && this._options.onLastListenerRemove(this));
        }
      };
      return Array.isArray(n) && n.push(i), i;
    }), this._event;
  }
  /**
   * To be kept private to fire an event to
   * subscribers
   */
  fire(e) {
    this._callbacks && this._callbacks.invoke.call(this._callbacks, e);
  }
  dispose() {
    this._callbacks && (this._callbacks.dispose(), this._callbacks = void 0);
  }
}
$W = pf.Emitter = sb;
sb._noop = function() {
};
var rn;
Object.defineProperty(vg, "__esModule", { value: !0 });
var GS = vg.CancellationTokenSource = rn = vg.CancellationToken = void 0;
const MEe = ab, DEe = wi, h6 = pf;
var v2;
(function(t) {
  t.None = Object.freeze({
    isCancellationRequested: !1,
    onCancellationRequested: h6.Event.None
  }), t.Cancelled = Object.freeze({
    isCancellationRequested: !0,
    onCancellationRequested: h6.Event.None
  });
  function e(r) {
    const n = r;
    return n && (n === t.None || n === t.Cancelled || DEe.boolean(n.isCancellationRequested) && !!n.onCancellationRequested);
  }
  t.is = e;
})(v2 || (rn = vg.CancellationToken = v2 = {}));
const IEe = Object.freeze(function(t, e) {
  const r = (0, MEe.default)().timer.setTimeout(t.bind(e), 0);
  return { dispose() {
    r.dispose();
  } };
});
class YR {
  constructor() {
    this._isCancelled = !1;
  }
  cancel() {
    this._isCancelled || (this._isCancelled = !0, this._emitter && (this._emitter.fire(void 0), this.dispose()));
  }
  get isCancellationRequested() {
    return this._isCancelled;
  }
  get onCancellationRequested() {
    return this._isCancelled ? IEe : (this._emitter || (this._emitter = new h6.Emitter()), this._emitter.event);
  }
  dispose() {
    this._emitter && (this._emitter.dispose(), this._emitter = void 0);
  }
}
class OEe {
  get token() {
    return this._token || (this._token = new YR()), this._token;
  }
  cancel() {
    this._token ? this._token.cancel() : this._token = v2.Cancelled;
  }
  dispose() {
    this._token ? this._token instanceof YR && this._token.dispose() : this._token = v2.None;
  }
}
GS = vg.CancellationTokenSource = OEe;
function PEe() {
  return new Promise((t) => {
    typeof setImmediate > "u" ? setTimeout(t, 0) : setImmediate(t);
  });
}
let bv = 0, BEe = 10;
function FEe() {
  return bv = performance.now(), new GS();
}
const y2 = Symbol("OperationCancelled");
function ob(t) {
  return t === y2;
}
async function Sa(t) {
  if (t === rn.None)
    return;
  const e = performance.now();
  if (e - bv >= BEe && (bv = e, await PEe(), bv = performance.now()), t.isCancellationRequested)
    throw y2;
}
class US {
  constructor() {
    this.promise = new Promise((e, r) => {
      this.resolve = (n) => (e(n), this), this.reject = (n) => (r(n), this);
    });
  }
}
class yg {
  constructor(e, r, n, i) {
    this._uri = e, this._languageId = r, this._version = n, this._content = i, this._lineOffsets = void 0;
  }
  get uri() {
    return this._uri;
  }
  get languageId() {
    return this._languageId;
  }
  get version() {
    return this._version;
  }
  getText(e) {
    if (e) {
      const r = this.offsetAt(e.start), n = this.offsetAt(e.end);
      return this._content.substring(r, n);
    }
    return this._content;
  }
  update(e, r) {
    for (const n of e)
      if (yg.isIncremental(n)) {
        const i = VW(n.range), a = this.offsetAt(i.start), s = this.offsetAt(i.end);
        this._content = this._content.substring(0, a) + n.text + this._content.substring(s, this._content.length);
        const o = Math.max(i.start.line, 0), l = Math.max(i.end.line, 0);
        let u = this._lineOffsets;
        const h = XR(n.text, !1, a);
        if (l - o === h.length)
          for (let f = 0, p = h.length; f < p; f++)
            u[f + o + 1] = h[f];
        else
          h.length < 1e4 ? u.splice(o + 1, l - o, ...h) : this._lineOffsets = u = u.slice(0, o + 1).concat(h, u.slice(l + 1));
        const d = n.text.length - (s - a);
        if (d !== 0)
          for (let f = o + 1 + h.length, p = u.length; f < p; f++)
            u[f] = u[f] + d;
      } else if (yg.isFull(n))
        this._content = n.text, this._lineOffsets = void 0;
      else
        throw new Error("Unknown change event received");
    this._version = r;
  }
  getLineOffsets() {
    return this._lineOffsets === void 0 && (this._lineOffsets = XR(this._content, !0)), this._lineOffsets;
  }
  positionAt(e) {
    e = Math.max(Math.min(e, this._content.length), 0);
    const r = this.getLineOffsets();
    let n = 0, i = r.length;
    if (i === 0)
      return { line: 0, character: e };
    for (; n < i; ) {
      const s = Math.floor((n + i) / 2);
      r[s] > e ? i = s : n = s + 1;
    }
    const a = n - 1;
    return e = this.ensureBeforeEOL(e, r[a]), { line: a, character: e - r[a] };
  }
  offsetAt(e) {
    const r = this.getLineOffsets();
    if (e.line >= r.length)
      return this._content.length;
    if (e.line < 0)
      return 0;
    const n = r[e.line];
    if (e.character <= 0)
      return n;
    const i = e.line + 1 < r.length ? r[e.line + 1] : this._content.length, a = Math.min(n + e.character, i);
    return this.ensureBeforeEOL(a, n);
  }
  ensureBeforeEOL(e, r) {
    for (; e > r && zW(this._content.charCodeAt(e - 1)); )
      e--;
    return e;
  }
  get lineCount() {
    return this.getLineOffsets().length;
  }
  static isIncremental(e) {
    const r = e;
    return r != null && typeof r.text == "string" && r.range !== void 0 && (r.rangeLength === void 0 || typeof r.rangeLength == "number");
  }
  static isFull(e) {
    const r = e;
    return r != null && typeof r.text == "string" && r.range === void 0 && r.rangeLength === void 0;
  }
}
var d6;
(function(t) {
  function e(i, a, s, o) {
    return new yg(i, a, s, o);
  }
  t.create = e;
  function r(i, a, s) {
    if (i instanceof yg)
      return i.update(a, s), i;
    throw new Error("TextDocument.update: document must be created by TextDocument.create");
  }
  t.update = r;
  function n(i, a) {
    const s = i.getText(), o = f6(a.map($Ee), (h, d) => {
      const f = h.range.start.line - d.range.start.line;
      return f === 0 ? h.range.start.character - d.range.start.character : f;
    });
    let l = 0;
    const u = [];
    for (const h of o) {
      const d = i.offsetAt(h.range.start);
      if (d < l)
        throw new Error("Overlapping edit");
      d > l && u.push(s.substring(l, d)), h.newText.length && u.push(h.newText), l = i.offsetAt(h.range.end);
    }
    return u.push(s.substr(l)), u.join("");
  }
  t.applyEdits = n;
})(d6 || (d6 = {}));
function f6(t, e) {
  if (t.length <= 1)
    return t;
  const r = t.length / 2 | 0, n = t.slice(0, r), i = t.slice(r);
  f6(n, e), f6(i, e);
  let a = 0, s = 0, o = 0;
  for (; a < n.length && s < i.length; )
    e(n[a], i[s]) <= 0 ? t[o++] = n[a++] : t[o++] = i[s++];
  for (; a < n.length; )
    t[o++] = n[a++];
  for (; s < i.length; )
    t[o++] = i[s++];
  return t;
}
function XR(t, e, r = 0) {
  const n = e ? [r] : [];
  for (let i = 0; i < t.length; i++) {
    const a = t.charCodeAt(i);
    zW(a) && (a === 13 && i + 1 < t.length && t.charCodeAt(i + 1) === 10 && i++, n.push(r + i + 1));
  }
  return n;
}
function zW(t) {
  return t === 13 || t === 10;
}
function VW(t) {
  const e = t.start, r = t.end;
  return e.line > r.line || e.line === r.line && e.character > r.character ? { start: r, end: e } : t;
}
function $Ee(t) {
  const e = VW(t.range);
  return e !== t.range ? { newText: t.newText, range: e } : t;
}
var GW;
(() => {
  var t = { 470: (i) => {
    function a(l) {
      if (typeof l != "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(l));
    }
    function s(l, u) {
      for (var h, d = "", f = 0, p = -1, g = 0, m = 0; m <= l.length; ++m) {
        if (m < l.length) h = l.charCodeAt(m);
        else {
          if (h === 47) break;
          h = 47;
        }
        if (h === 47) {
          if (!(p === m - 1 || g === 1)) if (p !== m - 1 && g === 2) {
            if (d.length < 2 || f !== 2 || d.charCodeAt(d.length - 1) !== 46 || d.charCodeAt(d.length - 2) !== 46) {
              if (d.length > 2) {
                var v = d.lastIndexOf("/");
                if (v !== d.length - 1) {
                  v === -1 ? (d = "", f = 0) : f = (d = d.slice(0, v)).length - 1 - d.lastIndexOf("/"), p = m, g = 0;
                  continue;
                }
              } else if (d.length === 2 || d.length === 1) {
                d = "", f = 0, p = m, g = 0;
                continue;
              }
            }
            u && (d.length > 0 ? d += "/.." : d = "..", f = 2);
          } else d.length > 0 ? d += "/" + l.slice(p + 1, m) : d = l.slice(p + 1, m), f = m - p - 1;
          p = m, g = 0;
        } else h === 46 && g !== -1 ? ++g : g = -1;
      }
      return d;
    }
    var o = { resolve: function() {
      for (var l, u = "", h = !1, d = arguments.length - 1; d >= -1 && !h; d--) {
        var f;
        d >= 0 ? f = arguments[d] : (l === void 0 && (l = process.cwd()), f = l), a(f), f.length !== 0 && (u = f + "/" + u, h = f.charCodeAt(0) === 47);
      }
      return u = s(u, !h), h ? u.length > 0 ? "/" + u : "/" : u.length > 0 ? u : ".";
    }, normalize: function(l) {
      if (a(l), l.length === 0) return ".";
      var u = l.charCodeAt(0) === 47, h = l.charCodeAt(l.length - 1) === 47;
      return (l = s(l, !u)).length !== 0 || u || (l = "."), l.length > 0 && h && (l += "/"), u ? "/" + l : l;
    }, isAbsolute: function(l) {
      return a(l), l.length > 0 && l.charCodeAt(0) === 47;
    }, join: function() {
      if (arguments.length === 0) return ".";
      for (var l, u = 0; u < arguments.length; ++u) {
        var h = arguments[u];
        a(h), h.length > 0 && (l === void 0 ? l = h : l += "/" + h);
      }
      return l === void 0 ? "." : o.normalize(l);
    }, relative: function(l, u) {
      if (a(l), a(u), l === u || (l = o.resolve(l)) === (u = o.resolve(u))) return "";
      for (var h = 1; h < l.length && l.charCodeAt(h) === 47; ++h) ;
      for (var d = l.length, f = d - h, p = 1; p < u.length && u.charCodeAt(p) === 47; ++p) ;
      for (var g = u.length - p, m = f < g ? f : g, v = -1, y = 0; y <= m; ++y) {
        if (y === m) {
          if (g > m) {
            if (u.charCodeAt(p + y) === 47) return u.slice(p + y + 1);
            if (y === 0) return u.slice(p + y);
          } else f > m && (l.charCodeAt(h + y) === 47 ? v = y : y === 0 && (v = 0));
          break;
        }
        var b = l.charCodeAt(h + y);
        if (b !== u.charCodeAt(p + y)) break;
        b === 47 && (v = y);
      }
      var w = "";
      for (y = h + v + 1; y <= d; ++y) y !== d && l.charCodeAt(y) !== 47 || (w.length === 0 ? w += ".." : w += "/..");
      return w.length > 0 ? w + u.slice(p + v) : (p += v, u.charCodeAt(p) === 47 && ++p, u.slice(p));
    }, _makeLong: function(l) {
      return l;
    }, dirname: function(l) {
      if (a(l), l.length === 0) return ".";
      for (var u = l.charCodeAt(0), h = u === 47, d = -1, f = !0, p = l.length - 1; p >= 1; --p) if ((u = l.charCodeAt(p)) === 47) {
        if (!f) {
          d = p;
          break;
        }
      } else f = !1;
      return d === -1 ? h ? "/" : "." : h && d === 1 ? "//" : l.slice(0, d);
    }, basename: function(l, u) {
      if (u !== void 0 && typeof u != "string") throw new TypeError('"ext" argument must be a string');
      a(l);
      var h, d = 0, f = -1, p = !0;
      if (u !== void 0 && u.length > 0 && u.length <= l.length) {
        if (u.length === l.length && u === l) return "";
        var g = u.length - 1, m = -1;
        for (h = l.length - 1; h >= 0; --h) {
          var v = l.charCodeAt(h);
          if (v === 47) {
            if (!p) {
              d = h + 1;
              break;
            }
          } else m === -1 && (p = !1, m = h + 1), g >= 0 && (v === u.charCodeAt(g) ? --g == -1 && (f = h) : (g = -1, f = m));
        }
        return d === f ? f = m : f === -1 && (f = l.length), l.slice(d, f);
      }
      for (h = l.length - 1; h >= 0; --h) if (l.charCodeAt(h) === 47) {
        if (!p) {
          d = h + 1;
          break;
        }
      } else f === -1 && (p = !1, f = h + 1);
      return f === -1 ? "" : l.slice(d, f);
    }, extname: function(l) {
      a(l);
      for (var u = -1, h = 0, d = -1, f = !0, p = 0, g = l.length - 1; g >= 0; --g) {
        var m = l.charCodeAt(g);
        if (m !== 47) d === -1 && (f = !1, d = g + 1), m === 46 ? u === -1 ? u = g : p !== 1 && (p = 1) : u !== -1 && (p = -1);
        else if (!f) {
          h = g + 1;
          break;
        }
      }
      return u === -1 || d === -1 || p === 0 || p === 1 && u === d - 1 && u === h + 1 ? "" : l.slice(u, d);
    }, format: function(l) {
      if (l === null || typeof l != "object") throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof l);
      return function(u, h) {
        var d = h.dir || h.root, f = h.base || (h.name || "") + (h.ext || "");
        return d ? d === h.root ? d + f : d + "/" + f : f;
      }(0, l);
    }, parse: function(l) {
      a(l);
      var u = { root: "", dir: "", base: "", ext: "", name: "" };
      if (l.length === 0) return u;
      var h, d = l.charCodeAt(0), f = d === 47;
      f ? (u.root = "/", h = 1) : h = 0;
      for (var p = -1, g = 0, m = -1, v = !0, y = l.length - 1, b = 0; y >= h; --y) if ((d = l.charCodeAt(y)) !== 47) m === -1 && (v = !1, m = y + 1), d === 46 ? p === -1 ? p = y : b !== 1 && (b = 1) : p !== -1 && (b = -1);
      else if (!v) {
        g = y + 1;
        break;
      }
      return p === -1 || m === -1 || b === 0 || b === 1 && p === m - 1 && p === g + 1 ? m !== -1 && (u.base = u.name = g === 0 && f ? l.slice(1, m) : l.slice(g, m)) : (g === 0 && f ? (u.name = l.slice(1, p), u.base = l.slice(1, m)) : (u.name = l.slice(g, p), u.base = l.slice(g, m)), u.ext = l.slice(p, m)), g > 0 ? u.dir = l.slice(0, g - 1) : f && (u.dir = "/"), u;
    }, sep: "/", delimiter: ":", win32: null, posix: null };
    o.posix = o, i.exports = o;
  } }, e = {};
  function r(i) {
    var a = e[i];
    if (a !== void 0) return a.exports;
    var s = e[i] = { exports: {} };
    return t[i](s, s.exports, r), s.exports;
  }
  r.d = (i, a) => {
    for (var s in a) r.o(a, s) && !r.o(i, s) && Object.defineProperty(i, s, { enumerable: !0, get: a[s] });
  }, r.o = (i, a) => Object.prototype.hasOwnProperty.call(i, a), r.r = (i) => {
    typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 });
  };
  var n = {};
  (() => {
    let i;
    r.r(n), r.d(n, { URI: () => f, Utils: () => N }), typeof process == "object" ? i = process.platform === "win32" : typeof navigator == "object" && (i = navigator.userAgent.indexOf("Windows") >= 0);
    const a = /^\w[\w\d+.-]*$/, s = /^\//, o = /^\/\//;
    function l(A, O) {
      if (!A.scheme && O) throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${A.authority}", path: "${A.path}", query: "${A.query}", fragment: "${A.fragment}"}`);
      if (A.scheme && !a.test(A.scheme)) throw new Error("[UriError]: Scheme contains illegal characters.");
      if (A.path) {
        if (A.authority) {
          if (!s.test(A.path)) throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character');
        } else if (o.test(A.path)) throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
      }
    }
    const u = "", h = "/", d = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
    class f {
      constructor(O, P, S, R, I, D = !1) {
        ur(this, "scheme");
        ur(this, "authority");
        ur(this, "path");
        ur(this, "query");
        ur(this, "fragment");
        typeof O == "object" ? (this.scheme = O.scheme || u, this.authority = O.authority || u, this.path = O.path || u, this.query = O.query || u, this.fragment = O.fragment || u) : (this.scheme = /* @__PURE__ */ function(M, B) {
          return M || B ? M : "file";
        }(O, D), this.authority = P || u, this.path = function(M, B) {
          switch (M) {
            case "https":
            case "http":
            case "file":
              B ? B[0] !== h && (B = h + B) : B = h;
          }
          return B;
        }(this.scheme, S || u), this.query = R || u, this.fragment = I || u, l(this, D));
      }
      static isUri(O) {
        return O instanceof f || !!O && typeof O.authority == "string" && typeof O.fragment == "string" && typeof O.path == "string" && typeof O.query == "string" && typeof O.scheme == "string" && typeof O.fsPath == "string" && typeof O.with == "function" && typeof O.toString == "function";
      }
      get fsPath() {
        return b(this);
      }
      with(O) {
        if (!O) return this;
        let { scheme: P, authority: S, path: R, query: I, fragment: D } = O;
        return P === void 0 ? P = this.scheme : P === null && (P = u), S === void 0 ? S = this.authority : S === null && (S = u), R === void 0 ? R = this.path : R === null && (R = u), I === void 0 ? I = this.query : I === null && (I = u), D === void 0 ? D = this.fragment : D === null && (D = u), P === this.scheme && S === this.authority && R === this.path && I === this.query && D === this.fragment ? this : new g(P, S, R, I, D);
      }
      static parse(O, P = !1) {
        const S = d.exec(O);
        return S ? new g(S[2] || u, C(S[4] || u), C(S[5] || u), C(S[7] || u), C(S[9] || u), P) : new g(u, u, u, u, u);
      }
      static file(O) {
        let P = u;
        if (i && (O = O.replace(/\\/g, h)), O[0] === h && O[1] === h) {
          const S = O.indexOf(h, 2);
          S === -1 ? (P = O.substring(2), O = h) : (P = O.substring(2, S), O = O.substring(S) || h);
        }
        return new g("file", P, O, u, u);
      }
      static from(O) {
        const P = new g(O.scheme, O.authority, O.path, O.query, O.fragment);
        return l(P, !0), P;
      }
      toString(O = !1) {
        return w(this, O);
      }
      toJSON() {
        return this;
      }
      static revive(O) {
        if (O) {
          if (O instanceof f) return O;
          {
            const P = new g(O);
            return P._formatted = O.external, P._fsPath = O._sep === p ? O.fsPath : null, P;
          }
        }
        return O;
      }
    }
    const p = i ? 1 : void 0;
    class g extends f {
      constructor() {
        super(...arguments);
        ur(this, "_formatted", null);
        ur(this, "_fsPath", null);
      }
      get fsPath() {
        return this._fsPath || (this._fsPath = b(this)), this._fsPath;
      }
      toString(P = !1) {
        return P ? w(this, !0) : (this._formatted || (this._formatted = w(this, !1)), this._formatted);
      }
      toJSON() {
        const P = { $mid: 1 };
        return this._fsPath && (P.fsPath = this._fsPath, P._sep = p), this._formatted && (P.external = this._formatted), this.path && (P.path = this.path), this.scheme && (P.scheme = this.scheme), this.authority && (P.authority = this.authority), this.query && (P.query = this.query), this.fragment && (P.fragment = this.fragment), P;
      }
    }
    const m = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" };
    function v(A, O, P) {
      let S, R = -1;
      for (let I = 0; I < A.length; I++) {
        const D = A.charCodeAt(I);
        if (D >= 97 && D <= 122 || D >= 65 && D <= 90 || D >= 48 && D <= 57 || D === 45 || D === 46 || D === 95 || D === 126 || O && D === 47 || P && D === 91 || P && D === 93 || P && D === 58) R !== -1 && (S += encodeURIComponent(A.substring(R, I)), R = -1), S !== void 0 && (S += A.charAt(I));
        else {
          S === void 0 && (S = A.substr(0, I));
          const M = m[D];
          M !== void 0 ? (R !== -1 && (S += encodeURIComponent(A.substring(R, I)), R = -1), S += M) : R === -1 && (R = I);
        }
      }
      return R !== -1 && (S += encodeURIComponent(A.substring(R))), S !== void 0 ? S : A;
    }
    function y(A) {
      let O;
      for (let P = 0; P < A.length; P++) {
        const S = A.charCodeAt(P);
        S === 35 || S === 63 ? (O === void 0 && (O = A.substr(0, P)), O += m[S]) : O !== void 0 && (O += A[P]);
      }
      return O !== void 0 ? O : A;
    }
    function b(A, O) {
      let P;
      return P = A.authority && A.path.length > 1 && A.scheme === "file" ? `//${A.authority}${A.path}` : A.path.charCodeAt(0) === 47 && (A.path.charCodeAt(1) >= 65 && A.path.charCodeAt(1) <= 90 || A.path.charCodeAt(1) >= 97 && A.path.charCodeAt(1) <= 122) && A.path.charCodeAt(2) === 58 ? A.path[1].toLowerCase() + A.path.substr(2) : A.path, i && (P = P.replace(/\//g, "\\")), P;
    }
    function w(A, O) {
      const P = O ? y : v;
      let S = "", { scheme: R, authority: I, path: D, query: M, fragment: B } = A;
      if (R && (S += R, S += ":"), (I || R === "file") && (S += h, S += h), I) {
        let $ = I.indexOf("@");
        if ($ !== -1) {
          const F = I.substr(0, $);
          I = I.substr($ + 1), $ = F.lastIndexOf(":"), $ === -1 ? S += P(F, !1, !1) : (S += P(F.substr(0, $), !1, !1), S += ":", S += P(F.substr($ + 1), !1, !0)), S += "@";
        }
        I = I.toLowerCase(), $ = I.lastIndexOf(":"), $ === -1 ? S += P(I, !1, !0) : (S += P(I.substr(0, $), !1, !0), S += I.substr($));
      }
      if (D) {
        if (D.length >= 3 && D.charCodeAt(0) === 47 && D.charCodeAt(2) === 58) {
          const $ = D.charCodeAt(1);
          $ >= 65 && $ <= 90 && (D = `/${String.fromCharCode($ + 32)}:${D.substr(3)}`);
        } else if (D.length >= 2 && D.charCodeAt(1) === 58) {
          const $ = D.charCodeAt(0);
          $ >= 65 && $ <= 90 && (D = `${String.fromCharCode($ + 32)}:${D.substr(2)}`);
        }
        S += P(D, !0, !1);
      }
      return M && (S += "?", S += P(M, !1, !1)), B && (S += "#", S += O ? B : v(B, !1, !1)), S;
    }
    function T(A) {
      try {
        return decodeURIComponent(A);
      } catch {
        return A.length > 3 ? A.substr(0, 3) + T(A.substr(3)) : A;
      }
    }
    const E = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
    function C(A) {
      return A.match(E) ? A.replace(E, (O) => T(O)) : A;
    }
    var k = r(470);
    const _ = k.posix || k, L = "/";
    var N;
    (function(A) {
      A.joinPath = function(O, ...P) {
        return O.with({ path: _.join(O.path, ...P) });
      }, A.resolvePath = function(O, ...P) {
        let S = O.path, R = !1;
        S[0] !== L && (S = L + S, R = !0);
        let I = _.resolve(S, ...P);
        return R && I[0] === L && !O.authority && (I = I.substring(1)), O.with({ path: I });
      }, A.dirname = function(O) {
        if (O.path.length === 0 || O.path === L) return O;
        let P = _.dirname(O.path);
        return P.length === 1 && P.charCodeAt(0) === 46 && (P = ""), O.with({ path: P });
      }, A.basename = function(O) {
        return _.basename(O.path);
      }, A.extname = function(O) {
        return _.extname(O.path);
      };
    })(N || (N = {}));
  })(), GW = n;
})();
const { URI: Su, Utils: g0 } = GW;
var Ql;
(function(t) {
  t.basename = g0.basename, t.dirname = g0.dirname, t.extname = g0.extname, t.joinPath = g0.joinPath, t.resolvePath = g0.resolvePath;
  function e(i, a) {
    return (i == null ? void 0 : i.toString()) === (a == null ? void 0 : a.toString());
  }
  t.equals = e;
  function r(i, a) {
    const s = typeof i == "string" ? i : i.path, o = typeof a == "string" ? a : a.path, l = s.split("/").filter((p) => p.length > 0), u = o.split("/").filter((p) => p.length > 0);
    let h = 0;
    for (; h < l.length && l[h] === u[h]; h++)
      ;
    const d = "../".repeat(l.length - h), f = u.slice(h).join("/");
    return d + f;
  }
  t.relative = r;
  function n(i) {
    return Su.parse(i.toString()).toString();
  }
  t.normalize = n;
})(Ql || (Ql = {}));
var jr;
(function(t) {
  t[t.Changed = 0] = "Changed", t[t.Parsed = 1] = "Parsed", t[t.IndexedContent = 2] = "IndexedContent", t[t.ComputedScopes = 3] = "ComputedScopes", t[t.Linked = 4] = "Linked", t[t.IndexedReferences = 5] = "IndexedReferences", t[t.Validated = 6] = "Validated";
})(jr || (jr = {}));
class zEe {
  constructor(e) {
    this.serviceRegistry = e.ServiceRegistry, this.textDocuments = e.workspace.TextDocuments, this.fileSystemProvider = e.workspace.FileSystemProvider;
  }
  async fromUri(e, r = rn.None) {
    const n = await this.fileSystemProvider.readFile(e);
    return this.createAsync(e, n, r);
  }
  fromTextDocument(e, r, n) {
    return r = r ?? Su.parse(e.uri), rn.is(n) ? this.createAsync(r, e, n) : this.create(r, e, n);
  }
  fromString(e, r, n) {
    return rn.is(n) ? this.createAsync(r, e, n) : this.create(r, e, n);
  }
  fromModel(e, r) {
    return this.create(r, { $model: e });
  }
  create(e, r, n) {
    if (typeof r == "string") {
      const i = this.parse(e, r, n);
      return this.createLangiumDocument(i, e, void 0, r);
    } else if ("$model" in r) {
      const i = { value: r.$model, parserErrors: [], lexerErrors: [] };
      return this.createLangiumDocument(i, e);
    } else {
      const i = this.parse(e, r.getText(), n);
      return this.createLangiumDocument(i, e, r);
    }
  }
  async createAsync(e, r, n) {
    if (typeof r == "string") {
      const i = await this.parseAsync(e, r, n);
      return this.createLangiumDocument(i, e, void 0, r);
    } else {
      const i = await this.parseAsync(e, r.getText(), n);
      return this.createLangiumDocument(i, e, r);
    }
  }
  /**
   * Create a LangiumDocument from a given parse result.
   *
   * A TextDocument is created on demand if it is not provided as argument here. Usually this
   * should not be necessary because the main purpose of the TextDocument is to convert between
   * text ranges and offsets, which is done solely in LSP request handling.
   *
   * With the introduction of {@link update} below this method is supposed to be mainly called
   * during workspace initialization and on addition/recognition of new files, while changes in
   * existing documents are processed via {@link update}.
   */
  createLangiumDocument(e, r, n, i) {
    let a;
    if (n)
      a = {
        parseResult: e,
        uri: r,
        state: jr.Parsed,
        references: [],
        textDocument: n
      };
    else {
      const s = this.createTextDocumentGetter(r, i);
      a = {
        parseResult: e,
        uri: r,
        state: jr.Parsed,
        references: [],
        get textDocument() {
          return s();
        }
      };
    }
    return e.value.$document = a, a;
  }
  async update(e, r) {
    var n, i;
    const a = (n = e.parseResult.value.$cstNode) === null || n === void 0 ? void 0 : n.root.fullText, s = (i = this.textDocuments) === null || i === void 0 ? void 0 : i.get(e.uri.toString()), o = s ? s.getText() : await this.fileSystemProvider.readFile(e.uri);
    if (s)
      Object.defineProperty(e, "textDocument", {
        value: s
      });
    else {
      const l = this.createTextDocumentGetter(e.uri, o);
      Object.defineProperty(e, "textDocument", {
        get: l
      });
    }
    return a !== o && (e.parseResult = await this.parseAsync(e.uri, o, r), e.parseResult.value.$document = e), e.state = jr.Parsed, e;
  }
  parse(e, r, n) {
    return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r, n);
  }
  parseAsync(e, r, n) {
    return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(r, n);
  }
  createTextDocumentGetter(e, r) {
    const n = this.serviceRegistry;
    let i;
    return () => i ?? (i = d6.create(e.toString(), n.getServices(e).LanguageMetaData.languageId, 0, r ?? ""));
  }
}
class VEe {
  constructor(e) {
    this.documentMap = /* @__PURE__ */ new Map(), this.langiumDocumentFactory = e.workspace.LangiumDocumentFactory, this.serviceRegistry = e.ServiceRegistry;
  }
  get all() {
    return oi(this.documentMap.values());
  }
  addDocument(e) {
    const r = e.uri.toString();
    if (this.documentMap.has(r))
      throw new Error(`A document with the URI '${r}' is already present.`);
    this.documentMap.set(r, e);
  }
  getDocument(e) {
    const r = e.toString();
    return this.documentMap.get(r);
  }
  async getOrCreateDocument(e, r) {
    let n = this.getDocument(e);
    return n || (n = await this.langiumDocumentFactory.fromUri(e, r), this.addDocument(n), n);
  }
  createDocument(e, r, n) {
    if (n)
      return this.langiumDocumentFactory.fromString(r, e, n).then((i) => (this.addDocument(i), i));
    {
      const i = this.langiumDocumentFactory.fromString(r, e);
      return this.addDocument(i), i;
    }
  }
  hasDocument(e) {
    return this.documentMap.has(e.toString());
  }
  invalidateDocument(e) {
    const r = e.toString(), n = this.documentMap.get(r);
    return n && (this.serviceRegistry.getServices(e).references.Linker.unlink(n), n.state = jr.Changed, n.precomputedScopes = void 0, n.diagnostics = void 0), n;
  }
  deleteDocument(e) {
    const r = e.toString(), n = this.documentMap.get(r);
    return n && (n.state = jr.Changed, this.documentMap.delete(r)), n;
  }
}
const y5 = Symbol("ref_resolving");
class GEe {
  constructor(e) {
    this.reflection = e.shared.AstReflection, this.langiumDocuments = () => e.shared.workspace.LangiumDocuments, this.scopeProvider = e.references.ScopeProvider, this.astNodeLocator = e.workspace.AstNodeLocator;
  }
  async link(e, r = rn.None) {
    for (const n of $h(e.parseResult.value))
      await Sa(r), CU(n).forEach((i) => this.doLink(i, e));
  }
  doLink(e, r) {
    var n;
    const i = e.reference;
    if (i._ref === void 0) {
      i._ref = y5;
      try {
        const a = this.getCandidate(e);
        if (fv(a))
          i._ref = a;
        else if (i._nodeDescription = a, this.langiumDocuments().hasDocument(a.documentUri)) {
          const s = this.loadAstNode(a);
          i._ref = s ?? this.createLinkingError(e, a);
        } else
          i._ref = void 0;
      } catch (a) {
        console.error(`An error occurred while resolving reference to '${i.$refText}':`, a);
        const s = (n = a.message) !== null && n !== void 0 ? n : String(a);
        i._ref = Object.assign(Object.assign({}, e), { message: `An error occurred while resolving reference to '${i.$refText}': ${s}` });
      }
      r.references.push(i);
    }
  }
  unlink(e) {
    for (const r of e.references)
      delete r._ref, delete r._nodeDescription;
    e.references = [];
  }
  getCandidate(e) {
    const n = this.scopeProvider.getScope(e).getElement(e.reference.$refText);
    return n ?? this.createLinkingError(e);
  }
  buildReference(e, r, n, i) {
    const a = this, s = {
      $refNode: n,
      $refText: i,
      get ref() {
        var o;
        if (ki(this._ref))
          return this._ref;
        if (m5e(this._nodeDescription)) {
          const l = a.loadAstNode(this._nodeDescription);
          this._ref = l ?? a.createLinkingError({ reference: s, container: e, property: r }, this._nodeDescription);
        } else if (this._ref === void 0) {
          this._ref = y5;
          const l = IT(e).$document, u = a.getLinkedNode({ reference: s, container: e, property: r });
          if (u.error && l && l.state < jr.ComputedScopes)
            return this._ref = void 0;
          this._ref = (o = u.node) !== null && o !== void 0 ? o : u.error, this._nodeDescription = u.descr, l == null || l.references.push(this);
        } else if (this._ref === y5)
          throw new Error(`Cyclic reference resolution detected: ${a.astNodeLocator.getAstNodePath(e)}/${r} (symbol '${i}')`);
        return ki(this._ref) ? this._ref : void 0;
      },
      get $nodeDescription() {
        return this._nodeDescription;
      },
      get error() {
        return fv(this._ref) ? this._ref : void 0;
      }
    };
    return s;
  }
  getLinkedNode(e) {
    var r;
    try {
      const n = this.getCandidate(e);
      if (fv(n))
        return { error: n };
      const i = this.loadAstNode(n);
      return i ? { node: i, descr: n } : {
        descr: n,
        error: this.createLinkingError(e, n)
      };
    } catch (n) {
      console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`, n);
      const i = (r = n.message) !== null && r !== void 0 ? r : String(n);
      return {
        error: Object.assign(Object.assign({}, e), { message: `An error occurred while resolving reference to '${e.reference.$refText}': ${i}` })
      };
    }
  }
  loadAstNode(e) {
    if (e.node)
      return e.node;
    const r = this.langiumDocuments().getDocument(e.documentUri);
    if (r)
      return this.astNodeLocator.getAstNode(r.parseResult.value, e.path);
  }
  createLinkingError(e, r) {
    const n = IT(e.container).$document;
    n && n.state < jr.ComputedScopes && console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);
    const i = this.reflection.getReferenceType(e);
    return Object.assign(Object.assign({}, e), { message: `Could not resolve reference to ${i} named '${e.reference.$refText}'.`, targetDescription: r });
  }
}
function UEe(t) {
  return typeof t.name == "string";
}
class WEe {
  getName(e) {
    if (UEe(e))
      return e.name;
  }
  getNameNode(e) {
    return NU(e.$cstNode, "name");
  }
}
class HEe {
  constructor(e) {
    this.nameProvider = e.references.NameProvider, this.index = e.shared.workspace.IndexManager, this.nodeLocator = e.workspace.AstNodeLocator;
  }
  findDeclaration(e) {
    if (e) {
      const r = lwe(e), n = e.astNode;
      if (r && n) {
        const i = n[r.feature];
        if (qs(i))
          return i.ref;
        if (Array.isArray(i)) {
          for (const a of i)
            if (qs(a) && a.$refNode && a.$refNode.offset <= e.offset && a.$refNode.end >= e.end)
              return a.ref;
        }
      }
      if (n) {
        const i = this.nameProvider.getNameNode(n);
        if (i && (i === e || x5e(e, i)))
          return n;
      }
    }
  }
  findDeclarationNode(e) {
    const r = this.findDeclaration(e);
    if (r != null && r.$cstNode) {
      const n = this.nameProvider.getNameNode(r);
      return n ?? r.$cstNode;
    }
  }
  findReferences(e, r) {
    const n = [];
    if (r.includeDeclaration) {
      const a = this.getReferenceToSelf(e);
      a && n.push(a);
    }
    let i = this.index.findAllReferences(e, this.nodeLocator.getAstNodePath(e));
    return r.documentUri && (i = i.filter((a) => Ql.equals(a.sourceUri, r.documentUri))), n.push(...i), oi(n);
  }
  getReferenceToSelf(e) {
    const r = this.nameProvider.getNameNode(e);
    if (r) {
      const n = Xl(e), i = this.nodeLocator.getAstNodePath(e);
      return {
        sourceUri: n.uri,
        sourcePath: i,
        targetUri: n.uri,
        targetPath: i,
        segment: Jy(r),
        local: !0
      };
    }
  }
}
class x2 {
  constructor(e) {
    if (this.map = /* @__PURE__ */ new Map(), e)
      for (const [r, n] of e)
        this.add(r, n);
  }
  /**
   * The total number of values in the multimap.
   */
  get size() {
    return NT.sum(oi(this.map.values()).map((e) => e.length));
  }
  /**
   * Clear all entries in the multimap.
   */
  clear() {
    this.map.clear();
  }
  /**
   * Operates differently depending on whether a `value` is given:
   *  * With a value, this method deletes the specific key / value pair from the multimap.
   *  * Without a value, all values associated with the given key are deleted.
   *
   * @returns `true` if a value existed and has been removed, or `false` if the specified
   *     key / value does not exist.
   */
  delete(e, r) {
    if (r === void 0)
      return this.map.delete(e);
    {
      const n = this.map.get(e);
      if (n) {
        const i = n.indexOf(r);
        if (i >= 0)
          return n.length === 1 ? this.map.delete(e) : n.splice(i, 1), !0;
      }
      return !1;
    }
  }
  /**
   * Returns an array of all values associated with the given key. If no value exists,
   * an empty array is returned.
   *
   * _Note:_ The returned array is assumed not to be modified. Use the `set` method to add a
   * value and `delete` to remove a value from the multimap.
   */
  get(e) {
    var r;
    return (r = this.map.get(e)) !== null && r !== void 0 ? r : [];
  }
  /**
   * Operates differently depending on whether a `value` is given:
   *  * With a value, this method returns `true` if the specific key / value pair is present in the multimap.
   *  * Without a value, this method returns `true` if the given key is present in the multimap.
   */
  has(e, r) {
    if (r === void 0)
      return this.map.has(e);
    {
      const n = this.map.get(e);
      return n ? n.indexOf(r) >= 0 : !1;
    }
  }
  /**
   * Add the given key / value pair to the multimap.
   */
  add(e, r) {
    return this.map.has(e) ? this.map.get(e).push(r) : this.map.set(e, [r]), this;
  }
  /**
   * Add the given set of key / value pairs to the multimap.
   */
  addAll(e, r) {
    return this.map.has(e) ? this.map.get(e).push(...r) : this.map.set(e, Array.from(r)), this;
  }
  /**
   * Invokes the given callback function for every key / value pair in the multimap.
   */
  forEach(e) {
    this.map.forEach((r, n) => r.forEach((i) => e(i, n, this)));
  }
  /**
   * Returns an iterator of key, value pairs for every entry in the map.
   */
  [Symbol.iterator]() {
    return this.entries().iterator();
  }
  /**
   * Returns a stream of key, value pairs for every entry in the map.
   */
  entries() {
    return oi(this.map.entries()).flatMap(([e, r]) => r.map((n) => [e, n]));
  }
  /**
   * Returns a stream of keys in the map.
   */
  keys() {
    return oi(this.map.keys());
  }
  /**
   * Returns a stream of values in the map.
   */
  values() {
    return oi(this.map.values()).flat();
  }
  /**
   * Returns a stream of key, value set pairs for every key in the map.
   */
  entriesGroupedByKey() {
    return oi(this.map.entries());
  }
}
class jR {
  get size() {
    return this.map.size;
  }
  constructor(e) {
    if (this.map = /* @__PURE__ */ new Map(), this.inverse = /* @__PURE__ */ new Map(), e)
      for (const [r, n] of e)
        this.set(r, n);
  }
  clear() {
    this.map.clear(), this.inverse.clear();
  }
  set(e, r) {
    return this.map.set(e, r), this.inverse.set(r, e), this;
  }
  get(e) {
    return this.map.get(e);
  }
  getKey(e) {
    return this.inverse.get(e);
  }
  delete(e) {
    const r = this.map.get(e);
    return r !== void 0 ? (this.map.delete(e), this.inverse.delete(r), !0) : !1;
  }
}
class qEe {
  constructor(e) {
    this.nameProvider = e.references.NameProvider, this.descriptions = e.workspace.AstNodeDescriptionProvider;
  }
  async computeExports(e, r = rn.None) {
    return this.computeExportsForNode(e.parseResult.value, e, void 0, r);
  }
  /**
   * Creates {@link AstNodeDescription AstNodeDescriptions} for the given {@link AstNode parentNode} and its children.
   * The list of children to be considered is determined by the function parameter {@link children}.
   * By default only the direct children of {@link parentNode} are visited, nested nodes are not exported.
   *
   * @param parentNode AST node to be exported, i.e., of which an {@link AstNodeDescription} shall be added to the returned list.
   * @param document The document containing the AST node to be exported.
   * @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}.
   * @param cancelToken Indicates when to cancel the current operation.
   * @throws `OperationCancelled` if a user action occurs during execution.
   * @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index.
   */
  async computeExportsForNode(e, r, n = kS, i = rn.None) {
    const a = [];
    this.exportNode(e, a, r);
    for (const s of n(e))
      await Sa(i), this.exportNode(s, a, r);
    return a;
  }
  /**
   * Add a single node to the list of exports if it has a name. Override this method to change how
   * symbols are exported, e.g. by modifying their exported name.
   */
  exportNode(e, r, n) {
    const i = this.nameProvider.getName(e);
    i && r.push(this.descriptions.createDescription(e, i, n));
  }
  async computeLocalScopes(e, r = rn.None) {
    const n = e.parseResult.value, i = new x2();
    for (const a of u1(n))
      await Sa(r), this.processNode(a, e, i);
    return i;
  }
  /**
   * Process a single node during scopes computation. The default implementation makes the node visible
   * in the subtree of its container (if the node has a name). Override this method to change this,
   * e.g. by increasing the visibility to a higher level in the AST.
   */
  processNode(e, r, n) {
    const i = e.$container;
    if (i) {
      const a = this.nameProvider.getName(e);
      a && n.add(i, this.descriptions.createDescription(e, a, r));
    }
  }
}
class KR {
  constructor(e, r, n) {
    var i;
    this.elements = e, this.outerScope = r, this.caseInsensitive = (i = n == null ? void 0 : n.caseInsensitive) !== null && i !== void 0 ? i : !1;
  }
  getAllElements() {
    return this.outerScope ? this.elements.concat(this.outerScope.getAllElements()) : this.elements;
  }
  getElement(e) {
    const r = this.caseInsensitive ? this.elements.find((n) => n.name.toLowerCase() === e.toLowerCase()) : this.elements.find((n) => n.name === e);
    if (r)
      return r;
    if (this.outerScope)
      return this.outerScope.getElement(e);
  }
}
class YEe {
  constructor(e, r, n) {
    var i;
    this.elements = /* @__PURE__ */ new Map(), this.caseInsensitive = (i = n == null ? void 0 : n.caseInsensitive) !== null && i !== void 0 ? i : !1;
    for (const a of e) {
      const s = this.caseInsensitive ? a.name.toLowerCase() : a.name;
      this.elements.set(s, a);
    }
    this.outerScope = r;
  }
  getElement(e) {
    const r = this.caseInsensitive ? e.toLowerCase() : e, n = this.elements.get(r);
    if (n)
      return n;
    if (this.outerScope)
      return this.outerScope.getElement(e);
  }
  getAllElements() {
    let e = oi(this.elements.values());
    return this.outerScope && (e = e.concat(this.outerScope.getAllElements())), e;
  }
}
class UW {
  constructor() {
    this.toDispose = [], this.isDisposed = !1;
  }
  onDispose(e) {
    this.toDispose.push(e);
  }
  dispose() {
    this.throwIfDisposed(), this.clear(), this.isDisposed = !0, this.toDispose.forEach((e) => e.dispose());
  }
  throwIfDisposed() {
    if (this.isDisposed)
      throw new Error("This cache has already been disposed");
  }
}
class XEe extends UW {
  constructor() {
    super(...arguments), this.cache = /* @__PURE__ */ new Map();
  }
  has(e) {
    return this.throwIfDisposed(), this.cache.has(e);
  }
  set(e, r) {
    this.throwIfDisposed(), this.cache.set(e, r);
  }
  get(e, r) {
    if (this.throwIfDisposed(), this.cache.has(e))
      return this.cache.get(e);
    if (r) {
      const n = r();
      return this.cache.set(e, n), n;
    } else
      return;
  }
  delete(e) {
    return this.throwIfDisposed(), this.cache.delete(e);
  }
  clear() {
    this.throwIfDisposed(), this.cache.clear();
  }
}
class jEe extends UW {
  constructor(e) {
    super(), this.cache = /* @__PURE__ */ new Map(), this.converter = e ?? ((r) => r);
  }
  has(e, r) {
    return this.throwIfDisposed(), this.cacheForContext(e).has(r);
  }
  set(e, r, n) {
    this.throwIfDisposed(), this.cacheForContext(e).set(r, n);
  }
  get(e, r, n) {
    this.throwIfDisposed();
    const i = this.cacheForContext(e);
    if (i.has(r))
      return i.get(r);
    if (n) {
      const a = n();
      return i.set(r, a), a;
    } else
      return;
  }
  delete(e, r) {
    return this.throwIfDisposed(), this.cacheForContext(e).delete(r);
  }
  clear(e) {
    if (this.throwIfDisposed(), e) {
      const r = this.converter(e);
      this.cache.delete(r);
    } else
      this.cache.clear();
  }
  cacheForContext(e) {
    const r = this.converter(e);
    let n = this.cache.get(r);
    return n || (n = /* @__PURE__ */ new Map(), this.cache.set(r, n)), n;
  }
}
class KEe extends XEe {
  /**
   * Creates a new workspace cache.
   *
   * @param sharedServices Service container instance to hook into document lifecycle events.
   * @param state Optional document state on which the cache should evict.
   * If not provided, the cache will evict on `DocumentBuilder#onUpdate`.
   * *Deleted* documents are considered in both cases.
   */
  constructor(e, r) {
    super(), r ? (this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(r, () => {
      this.clear();
    })), this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((n, i) => {
      i.length > 0 && this.clear();
    }))) : this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(() => {
      this.clear();
    }));
  }
}
class ZEe {
  constructor(e) {
    this.reflection = e.shared.AstReflection, this.nameProvider = e.references.NameProvider, this.descriptions = e.workspace.AstNodeDescriptionProvider, this.indexManager = e.shared.workspace.IndexManager, this.globalScopeCache = new KEe(e.shared);
  }
  getScope(e) {
    const r = [], n = this.reflection.getReferenceType(e), i = Xl(e.container).precomputedScopes;
    if (i) {
      let s = e.container;
      do {
        const o = i.get(s);
        o.length > 0 && r.push(oi(o).filter((l) => this.reflection.isSubtype(l.type, n))), s = s.$container;
      } while (s);
    }
    let a = this.getGlobalScope(n, e);
    for (let s = r.length - 1; s >= 0; s--)
      a = this.createScope(r[s], a);
    return a;
  }
  /**
   * Create a scope for the given collection of AST node descriptions.
   */
  createScope(e, r, n) {
    return new KR(oi(e), r, n);
  }
  /**
   * Create a scope for the given collection of AST nodes, which need to be transformed into respective
   * descriptions first. This is done using the `NameProvider` and `AstNodeDescriptionProvider` services.
   */
  createScopeForNodes(e, r, n) {
    const i = oi(e).map((a) => {
      const s = this.nameProvider.getName(a);
      if (s)
        return this.descriptions.createDescription(a, s);
    }).nonNullable();
    return new KR(i, r, n);
  }
  /**
   * Create a global scope filtered for the given reference type.
   */
  getGlobalScope(e, r) {
    return this.globalScopeCache.get(e, () => new YEe(this.indexManager.allElements(e)));
  }
}
function QEe(t) {
  return typeof t.$comment == "string";
}
function ZR(t) {
  return typeof t == "object" && !!t && ("$ref" in t || "$error" in t);
}
class JEe {
  constructor(e) {
    this.ignoreProperties = /* @__PURE__ */ new Set(["$container", "$containerProperty", "$containerIndex", "$document", "$cstNode"]), this.langiumDocuments = e.shared.workspace.LangiumDocuments, this.astNodeLocator = e.workspace.AstNodeLocator, this.nameProvider = e.references.NameProvider, this.commentProvider = e.documentation.CommentProvider;
  }
  serialize(e, r) {
    const n = r ?? {}, i = r == null ? void 0 : r.replacer, a = (o, l) => this.replacer(o, l, n), s = i ? (o, l) => i(o, l, a) : a;
    try {
      return this.currentDocument = Xl(e), JSON.stringify(e, s, r == null ? void 0 : r.space);
    } finally {
      this.currentDocument = void 0;
    }
  }
  deserialize(e, r) {
    const n = r ?? {}, i = JSON.parse(e);
    return this.linkNode(i, i, n), i;
  }
  replacer(e, r, { refText: n, sourceText: i, textRegions: a, comments: s, uriConverter: o }) {
    var l, u, h, d;
    if (!this.ignoreProperties.has(e))
      if (qs(r)) {
        const f = r.ref, p = n ? r.$refText : void 0;
        if (f) {
          const g = Xl(f);
          let m = "";
          this.currentDocument && this.currentDocument !== g && (o ? m = o(g.uri, r) : m = g.uri.toString());
          const v = this.astNodeLocator.getAstNodePath(f);
          return {
            $ref: `${m}#${v}`,
            $refText: p
          };
        } else
          return {
            $error: (u = (l = r.error) === null || l === void 0 ? void 0 : l.message) !== null && u !== void 0 ? u : "Could not resolve reference",
            $refText: p
          };
      } else if (ki(r)) {
        let f;
        if (a && (f = this.addAstNodeRegionWithAssignmentsTo(Object.assign({}, r)), (!e || r.$document) && (f != null && f.$textRegion) && (f.$textRegion.documentURI = (h = this.currentDocument) === null || h === void 0 ? void 0 : h.uri.toString())), i && !e && (f ?? (f = Object.assign({}, r)), f.$sourceText = (d = r.$cstNode) === null || d === void 0 ? void 0 : d.text), s) {
          f ?? (f = Object.assign({}, r));
          const p = this.commentProvider.getComment(r);
          p && (f.$comment = p.replace(/\r/g, ""));
        }
        return f ?? r;
      } else
        return r;
  }
  addAstNodeRegionWithAssignmentsTo(e) {
    const r = (n) => ({
      offset: n.offset,
      end: n.end,
      length: n.length,
      range: n.range
    });
    if (e.$cstNode) {
      const n = e.$textRegion = r(e.$cstNode), i = n.assignments = {};
      return Object.keys(e).filter((a) => !a.startsWith("$")).forEach((a) => {
        const s = awe(e.$cstNode, a).map(r);
        s.length !== 0 && (i[a] = s);
      }), e;
    }
  }
  linkNode(e, r, n, i, a, s) {
    for (const [l, u] of Object.entries(e))
      if (Array.isArray(u))
        for (let h = 0; h < u.length; h++) {
          const d = u[h];
          ZR(d) ? u[h] = this.reviveReference(e, l, r, d, n) : ki(d) && this.linkNode(d, r, n, e, l, h);
        }
      else ZR(u) ? e[l] = this.reviveReference(e, l, r, u, n) : ki(u) && this.linkNode(u, r, n, e, l);
    const o = e;
    o.$container = i, o.$containerProperty = a, o.$containerIndex = s;
  }
  reviveReference(e, r, n, i, a) {
    let s = i.$refText, o = i.$error;
    if (i.$ref) {
      const l = this.getRefNode(n, i.$ref, a.uriConverter);
      if (ki(l))
        return s || (s = this.nameProvider.getName(l)), {
          $refText: s ?? "",
          ref: l
        };
      o = l;
    }
    if (o) {
      const l = {
        $refText: s ?? ""
      };
      return l.error = {
        container: e,
        property: r,
        message: o,
        reference: l
      }, l;
    } else
      return;
  }
  getRefNode(e, r, n) {
    try {
      const i = r.indexOf("#");
      if (i === 0) {
        const l = this.astNodeLocator.getAstNode(e, r.substring(1));
        return l || "Could not resolve path: " + r;
      }
      if (i < 0) {
        const l = n ? n(r) : Su.parse(r), u = this.langiumDocuments.getDocument(l);
        return u ? u.parseResult.value : "Could not find document for URI: " + r;
      }
      const a = n ? n(r.substring(0, i)) : Su.parse(r.substring(0, i)), s = this.langiumDocuments.getDocument(a);
      if (!s)
        return "Could not find document for URI: " + r;
      if (i === r.length - 1)
        return s.parseResult.value;
      const o = this.astNodeLocator.getAstNode(s.parseResult.value, r.substring(i + 1));
      return o || "Could not resolve URI: " + r;
    } catch (i) {
      return String(i);
    }
  }
}
class eke {
  /**
   * @deprecated Use the new `fileExtensionMap` (or `languageIdMap`) property instead.
   */
  get map() {
    return this.fileExtensionMap;
  }
  constructor(e) {
    this.languageIdMap = /* @__PURE__ */ new Map(), this.fileExtensionMap = /* @__PURE__ */ new Map(), this.textDocuments = e == null ? void 0 : e.workspace.TextDocuments;
  }
  register(e) {
    const r = e.LanguageMetaData;
    for (const n of r.fileExtensions)
      this.fileExtensionMap.has(n) && console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${r.languageId}'.`), this.fileExtensionMap.set(n, e);
    this.languageIdMap.set(r.languageId, e), this.languageIdMap.size === 1 ? this.singleton = e : this.singleton = void 0;
  }
  getServices(e) {
    var r, n;
    if (this.singleton !== void 0)
      return this.singleton;
    if (this.languageIdMap.size === 0)
      throw new Error("The service registry is empty. Use `register` to register the services of a language.");
    const i = (n = (r = this.textDocuments) === null || r === void 0 ? void 0 : r.get(e)) === null || n === void 0 ? void 0 : n.languageId;
    if (i !== void 0) {
      const o = this.languageIdMap.get(i);
      if (o)
        return o;
    }
    const a = Ql.extname(e), s = this.fileExtensionMap.get(a);
    if (!s)
      throw i ? new Error(`The service registry contains no services for the extension '${a}' for language '${i}'.`) : new Error(`The service registry contains no services for the extension '${a}'.`);
    return s;
  }
  hasServices(e) {
    try {
      return this.getServices(e), !0;
    } catch {
      return !1;
    }
  }
  get all() {
    return Array.from(this.languageIdMap.values());
  }
}
function lp(t) {
  return { code: t };
}
var b2;
(function(t) {
  t.all = ["fast", "slow", "built-in"];
})(b2 || (b2 = {}));
class tke {
  constructor(e) {
    this.entries = new x2(), this.entriesBefore = [], this.entriesAfter = [], this.reflection = e.shared.AstReflection;
  }
  /**
   * Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function)
   * or an array of validation checks.
   *
   * @param checksRecord Set of validation checks to register.
   * @param category Optional category for the validation checks (defaults to `'fast'`).
   * @param thisObj Optional object to be used as `this` when calling the validation check functions.
   */
  register(e, r = this, n = "fast") {
    if (n === "built-in")
      throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");
    for (const [i, a] of Object.entries(e)) {
      const s = a;
      if (Array.isArray(s))
        for (const o of s) {
          const l = {
            check: this.wrapValidationException(o, r),
            category: n
          };
          this.addEntry(i, l);
        }
      else if (typeof s == "function") {
        const o = {
          check: this.wrapValidationException(s, r),
          category: n
        };
        this.addEntry(i, o);
      } else
        c1();
    }
  }
  wrapValidationException(e, r) {
    return async (n, i, a) => {
      await this.handleException(() => e.call(r, n, i, a), "An error occurred during validation", i, n);
    };
  }
  async handleException(e, r, n, i) {
    try {
      await e();
    } catch (a) {
      if (ob(a))
        throw a;
      console.error(`${r}:`, a), a instanceof Error && a.stack && console.error(a.stack);
      const s = a instanceof Error ? a.message : String(a);
      n("error", `${r}: ${s}`, { node: i });
    }
  }
  addEntry(e, r) {
    if (e === "AstNode") {
      this.entries.add("AstNode", r);
      return;
    }
    for (const n of this.reflection.getAllSubTypes(e))
      this.entries.add(n, r);
  }
  getChecks(e, r) {
    let n = oi(this.entries.get(e)).concat(this.entries.get("AstNode"));
    return r && (n = n.filter((i) => r.includes(i.category))), n.map((i) => i.check);
  }
  /**
   * Register logic which will be executed once before validating all the nodes of an AST/Langium document.
   * This helps to prepare or initialize some information which are required or reusable for the following checks on the AstNodes.
   *
   * As an example, for validating unique fully-qualified names of nodes in the AST,
   * here the map for mapping names to nodes could be established.
   * During the usual checks on the nodes, they are put into this map with their name.
   *
   * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation.
   * Therefore it is recommended to clear stored information
   * _before_ validating an AST to validate each AST unaffected from other ASTs
   * AND _after_ validating the AST to free memory by information which are no longer used.
   *
   * @param checkBefore a set-up function which will be called once before actually validating an AST
   * @param thisObj Optional object to be used as `this` when calling the validation check functions.
   */
  registerBeforeDocument(e, r = this) {
    this.entriesBefore.push(this.wrapPreparationException(e, "An error occurred during set-up of the validation", r));
  }
  /**
   * Register logic which will be executed once after validating all the nodes of an AST/Langium document.
   * This helps to finally evaluate information which are collected during the checks on the AstNodes.
   *
   * As an example, for validating unique fully-qualified names of nodes in the AST,
   * here the map with all the collected nodes and their names is checked
   * and validation hints are created for all nodes with the same name.
   *
   * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation.
   * Therefore it is recommended to clear stored information
   * _before_ validating an AST to validate each AST unaffected from other ASTs
   * AND _after_ validating the AST to free memory by information which are no longer used.
   *
   * @param checkBefore a set-up function which will be called once before actually validating an AST
   * @param thisObj Optional object to be used as `this` when calling the validation check functions.
   */
  registerAfterDocument(e, r = this) {
    this.entriesAfter.push(this.wrapPreparationException(e, "An error occurred during tear-down of the validation", r));
  }
  wrapPreparationException(e, r, n) {
    return async (i, a, s, o) => {
      await this.handleException(() => e.call(n, i, a, s, o), r, a, i);
    };
  }
  get checksBefore() {
    return this.entriesBefore;
  }
  get checksAfter() {
    return this.entriesAfter;
  }
}
class rke {
  constructor(e) {
    this.validationRegistry = e.validation.ValidationRegistry, this.metadata = e.LanguageMetaData;
  }
  async validateDocument(e, r = {}, n = rn.None) {
    const i = e.parseResult, a = [];
    if (await Sa(n), (!r.categories || r.categories.includes("built-in")) && (this.processLexingErrors(i, a, r), r.stopAfterLexingErrors && a.some((s) => {
      var o;
      return ((o = s.data) === null || o === void 0 ? void 0 : o.code) === ps.LexingError;
    }) || (this.processParsingErrors(i, a, r), r.stopAfterParsingErrors && a.some((s) => {
      var o;
      return ((o = s.data) === null || o === void 0 ? void 0 : o.code) === ps.ParsingError;
    })) || (this.processLinkingErrors(e, a, r), r.stopAfterLinkingErrors && a.some((s) => {
      var o;
      return ((o = s.data) === null || o === void 0 ? void 0 : o.code) === ps.LinkingError;
    }))))
      return a;
    try {
      a.push(...await this.validateAst(i.value, r, n));
    } catch (s) {
      if (ob(s))
        throw s;
      console.error("An error occurred during validation:", s);
    }
    return await Sa(n), a;
  }
  processLexingErrors(e, r, n) {
    var i, a, s;
    const o = [...e.lexerErrors, ...(a = (i = e.lexerReport) === null || i === void 0 ? void 0 : i.diagnostics) !== null && a !== void 0 ? a : []];
    for (const l of o) {
      const u = (s = l.severity) !== null && s !== void 0 ? s : "error", h = {
        severity: x5(u),
        range: {
          start: {
            line: l.line - 1,
            character: l.column - 1
          },
          end: {
            line: l.line - 1,
            character: l.column + l.length - 1
          }
        },
        message: l.message,
        data: ike(u),
        source: this.getSource()
      };
      r.push(h);
    }
  }
  processParsingErrors(e, r, n) {
    for (const i of e.parserErrors) {
      let a;
      if (isNaN(i.token.startOffset)) {
        if ("previousToken" in i) {
          const s = i.previousToken;
          if (isNaN(s.startOffset)) {
            const o = { line: 0, character: 0 };
            a = { start: o, end: o };
          } else {
            const o = { line: s.endLine - 1, character: s.endColumn };
            a = { start: o, end: o };
          }
        }
      } else
        a = DT(i.token);
      if (a) {
        const s = {
          severity: x5("error"),
          range: a,
          message: i.message,
          data: lp(ps.ParsingError),
          source: this.getSource()
        };
        r.push(s);
      }
    }
  }
  processLinkingErrors(e, r, n) {
    for (const i of e.references) {
      const a = i.error;
      if (a) {
        const s = {
          node: a.container,
          property: a.property,
          index: a.index,
          data: {
            code: ps.LinkingError,
            containerType: a.container.$type,
            property: a.property,
            refText: a.reference.$refText
          }
        };
        r.push(this.toDiagnostic("error", a.message, s));
      }
    }
  }
  async validateAst(e, r, n = rn.None) {
    const i = [], a = (s, o, l) => {
      i.push(this.toDiagnostic(s, o, l));
    };
    return await this.validateAstBefore(e, r, a, n), await this.validateAstNodes(e, r, a, n), await this.validateAstAfter(e, r, a, n), i;
  }
  async validateAstBefore(e, r, n, i = rn.None) {
    var a;
    const s = this.validationRegistry.checksBefore;
    for (const o of s)
      await Sa(i), await o(e, n, (a = r.categories) !== null && a !== void 0 ? a : [], i);
  }
  async validateAstNodes(e, r, n, i = rn.None) {
    await Promise.all($h(e).map(async (a) => {
      await Sa(i);
      const s = this.validationRegistry.getChecks(a.$type, r.categories);
      for (const o of s)
        await o(a, n, i);
    }));
  }
  async validateAstAfter(e, r, n, i = rn.None) {
    var a;
    const s = this.validationRegistry.checksAfter;
    for (const o of s)
      await Sa(i), await o(e, n, (a = r.categories) !== null && a !== void 0 ? a : [], i);
  }
  toDiagnostic(e, r, n) {
    return {
      message: r,
      range: nke(n),
      severity: x5(e),
      code: n.code,
      codeDescription: n.codeDescription,
      tags: n.tags,
      relatedInformation: n.relatedInformation,
      data: n.data,
      source: this.getSource()
    };
  }
  getSource() {
    return this.metadata.languageId;
  }
}
function nke(t) {
  if (t.range)
    return t.range;
  let e;
  return typeof t.property == "string" ? e = NU(t.node.$cstNode, t.property, t.index) : typeof t.keyword == "string" && (e = swe(t.node.$cstNode, t.keyword, t.index)), e ?? (e = t.node.$cstNode), e ? e.range : {
    start: { line: 0, character: 0 },
    end: { line: 0, character: 0 }
  };
}
function x5(t) {
  switch (t) {
    case "error":
      return 1;
    case "warning":
      return 2;
    case "info":
      return 3;
    case "hint":
      return 4;
    default:
      throw new Error("Invalid diagnostic severity: " + t);
  }
}
function ike(t) {
  switch (t) {
    case "error":
      return lp(ps.LexingError);
    case "warning":
      return lp(ps.LexingWarning);
    case "info":
      return lp(ps.LexingInfo);
    case "hint":
      return lp(ps.LexingHint);
    default:
      throw new Error("Invalid diagnostic severity: " + t);
  }
}
var ps;
(function(t) {
  t.LexingError = "lexing-error", t.LexingWarning = "lexing-warning", t.LexingInfo = "lexing-info", t.LexingHint = "lexing-hint", t.ParsingError = "parsing-error", t.LinkingError = "linking-error";
})(ps || (ps = {}));
class ake {
  constructor(e) {
    this.astNodeLocator = e.workspace.AstNodeLocator, this.nameProvider = e.references.NameProvider;
  }
  createDescription(e, r, n) {
    const i = n ?? Xl(e);
    r ?? (r = this.nameProvider.getName(e));
    const a = this.astNodeLocator.getAstNodePath(e);
    if (!r)
      throw new Error(`Node at path ${a} has no name.`);
    let s;
    const o = () => {
      var l;
      return s ?? (s = Jy((l = this.nameProvider.getNameNode(e)) !== null && l !== void 0 ? l : e.$cstNode));
    };
    return {
      node: e,
      name: r,
      get nameSegment() {
        return o();
      },
      selectionSegment: Jy(e.$cstNode),
      type: e.$type,
      documentUri: i.uri,
      path: a
    };
  }
}
class ske {
  constructor(e) {
    this.nodeLocator = e.workspace.AstNodeLocator;
  }
  async createDescriptions(e, r = rn.None) {
    const n = [], i = e.parseResult.value;
    for (const a of $h(i))
      await Sa(r), CU(a).filter((s) => !fv(s)).forEach((s) => {
        const o = this.createDescription(s);
        o && n.push(o);
      });
    return n;
  }
  createDescription(e) {
    const r = e.reference.$nodeDescription, n = e.reference.$refNode;
    if (!r || !n)
      return;
    const i = Xl(e.container).uri;
    return {
      sourceUri: i,
      sourcePath: this.nodeLocator.getAstNodePath(e.container),
      targetUri: r.documentUri,
      targetPath: r.path,
      segment: Jy(n),
      local: Ql.equals(r.documentUri, i)
    };
  }
}
class oke {
  constructor() {
    this.segmentSeparator = "/", this.indexSeparator = "@";
  }
  getAstNodePath(e) {
    if (e.$container) {
      const r = this.getAstNodePath(e.$container), n = this.getPathSegment(e);
      return r + this.segmentSeparator + n;
    }
    return "";
  }
  getPathSegment({ $containerProperty: e, $containerIndex: r }) {
    if (!e)
      throw new Error("Missing '$containerProperty' in AST node.");
    return r !== void 0 ? e + this.indexSeparator + r : e;
  }
  getAstNode(e, r) {
    return r.split(this.segmentSeparator).reduce((i, a) => {
      if (!i || a.length === 0)
        return i;
      const s = a.indexOf(this.indexSeparator);
      if (s > 0) {
        const o = a.substring(0, s), l = parseInt(a.substring(s + 1)), u = i[o];
        return u == null ? void 0 : u[l];
      }
      return i[a];
    }, e);
  }
}
class lke {
  constructor(e) {
    this._ready = new US(), this.settings = {}, this.workspaceConfig = !1, this.onConfigurationSectionUpdateEmitter = new $W(), this.serviceRegistry = e.ServiceRegistry;
  }
  get ready() {
    return this._ready.promise;
  }
  initialize(e) {
    var r, n;
    this.workspaceConfig = (n = (r = e.capabilities.workspace) === null || r === void 0 ? void 0 : r.configuration) !== null && n !== void 0 ? n : !1;
  }
  async initialized(e) {
    if (this.workspaceConfig) {
      if (e.register) {
        const r = this.serviceRegistry.all;
        e.register({
          // Listen to configuration changes for all languages
          section: r.map((n) => this.toSectionName(n.LanguageMetaData.languageId))
        });
      }
      if (e.fetchConfiguration) {
        const r = this.serviceRegistry.all.map((i) => ({
          // Fetch the configuration changes for all languages
          section: this.toSectionName(i.LanguageMetaData.languageId)
        })), n = await e.fetchConfiguration(r);
        r.forEach((i, a) => {
          this.updateSectionConfiguration(i.section, n[a]);
        });
      }
    }
    this._ready.resolve();
  }
  /**
   *  Updates the cached configurations using the `change` notification parameters.
   *
   * @param change The parameters of a change configuration notification.
   * `settings` property of the change object could be expressed as `Record<string, Record<string, any>>`
   */
  updateConfiguration(e) {
    e.settings && Object.keys(e.settings).forEach((r) => {
      const n = e.settings[r];
      this.updateSectionConfiguration(r, n), this.onConfigurationSectionUpdateEmitter.fire({ section: r, configuration: n });
    });
  }
  updateSectionConfiguration(e, r) {
    this.settings[e] = r;
  }
  /**
  * Returns a configuration value stored for the given language.
  *
  * @param language The language id
  * @param configuration Configuration name
  */
  async getConfiguration(e, r) {
    await this.ready;
    const n = this.toSectionName(e);
    if (this.settings[n])
      return this.settings[n][r];
  }
  toSectionName(e) {
    return `${e}`;
  }
  get onConfigurationSectionUpdate() {
    return this.onConfigurationSectionUpdateEmitter.event;
  }
}
var Np;
(function(t) {
  function e(r) {
    return {
      dispose: async () => await r()
    };
  }
  t.create = e;
})(Np || (Np = {}));
class cke {
  constructor(e) {
    this.updateBuildOptions = {
      // Default: run only the built-in validation checks and those in the _fast_ category (includes those without category)
      validation: {
        categories: ["built-in", "fast"]
      }
    }, this.updateListeners = [], this.buildPhaseListeners = new x2(), this.documentPhaseListeners = new x2(), this.buildState = /* @__PURE__ */ new Map(), this.documentBuildWaiters = /* @__PURE__ */ new Map(), this.currentState = jr.Changed, this.langiumDocuments = e.workspace.LangiumDocuments, this.langiumDocumentFactory = e.workspace.LangiumDocumentFactory, this.textDocuments = e.workspace.TextDocuments, this.indexManager = e.workspace.IndexManager, this.serviceRegistry = e.ServiceRegistry;
  }
  async build(e, r = {}, n = rn.None) {
    var i, a;
    for (const s of e) {
      const o = s.uri.toString();
      if (s.state === jr.Validated) {
        if (typeof r.validation == "boolean" && r.validation)
          s.state = jr.IndexedReferences, s.diagnostics = void 0, this.buildState.delete(o);
        else if (typeof r.validation == "object") {
          const l = this.buildState.get(o), u = (i = l == null ? void 0 : l.result) === null || i === void 0 ? void 0 : i.validationChecks;
          if (u) {
            const d = ((a = r.validation.categories) !== null && a !== void 0 ? a : b2.all).filter((f) => !u.includes(f));
            d.length > 0 && (this.buildState.set(o, {
              completed: !1,
              options: {
                validation: Object.assign(Object.assign({}, r.validation), { categories: d })
              },
              result: l.result
            }), s.state = jr.IndexedReferences);
          }
        }
      } else
        this.buildState.delete(o);
    }
    this.currentState = jr.Changed, await this.emitUpdate(e.map((s) => s.uri), []), await this.buildDocuments(e, r, n);
  }
  async update(e, r, n = rn.None) {
    this.currentState = jr.Changed;
    for (const s of r)
      this.langiumDocuments.deleteDocument(s), this.buildState.delete(s.toString()), this.indexManager.remove(s);
    for (const s of e) {
      if (!this.langiumDocuments.invalidateDocument(s)) {
        const l = this.langiumDocumentFactory.fromModel({ $type: "INVALID" }, s);
        l.state = jr.Changed, this.langiumDocuments.addDocument(l);
      }
      this.buildState.delete(s.toString());
    }
    const i = oi(e).concat(r).map((s) => s.toString()).toSet();
    this.langiumDocuments.all.filter((s) => !i.has(s.uri.toString()) && this.shouldRelink(s, i)).forEach((s) => {
      this.serviceRegistry.getServices(s.uri).references.Linker.unlink(s), s.state = Math.min(s.state, jr.ComputedScopes), s.diagnostics = void 0;
    }), await this.emitUpdate(e, r), await Sa(n);
    const a = this.sortDocuments(this.langiumDocuments.all.filter((s) => {
      var o;
      return s.state < jr.Linked || !(!((o = this.buildState.get(s.uri.toString())) === null || o === void 0) && o.completed);
    }).toArray());
    await this.buildDocuments(a, this.updateBuildOptions, n);
  }
  async emitUpdate(e, r) {
    await Promise.all(this.updateListeners.map((n) => n(e, r)));
  }
  /**
   * Sort the given documents by priority. By default, documents with an open text document are prioritized.
   * This is useful to ensure that visible documents show their diagnostics before all other documents.
   *
   * This improves the responsiveness in large workspaces as users usually don't care about diagnostics
   * in files that are currently not opened in the editor.
   */
  sortDocuments(e) {
    let r = 0, n = e.length - 1;
    for (; r < n; ) {
      for (; r < e.length && this.hasTextDocument(e[r]); )
        r++;
      for (; n >= 0 && !this.hasTextDocument(e[n]); )
        n--;
      r < n && ([e[r], e[n]] = [e[n], e[r]]);
    }
    return e;
  }
  hasTextDocument(e) {
    var r;
    return !!(!((r = this.textDocuments) === null || r === void 0) && r.get(e.uri));
  }
  /**
   * Check whether the given document should be relinked after changes were found in the given URIs.
   */
  shouldRelink(e, r) {
    return e.references.some((n) => n.error !== void 0) ? !0 : this.indexManager.isAffected(e, r);
  }
  onUpdate(e) {
    return this.updateListeners.push(e), Np.create(() => {
      const r = this.updateListeners.indexOf(e);
      r >= 0 && this.updateListeners.splice(r, 1);
    });
  }
  /**
   * Build the given documents by stepping through all build phases. If a document's state indicates
   * that a certain build phase is already done, the phase is skipped for that document.
   *
   * @param documents The documents to build.
   * @param options the {@link BuildOptions} to use.
   * @param cancelToken A cancellation token that can be used to cancel the build.
   * @returns A promise that resolves when the build is done.
   */
  async buildDocuments(e, r, n) {
    this.prepareBuild(e, r), await this.runCancelable(e, jr.Parsed, n, (a) => this.langiumDocumentFactory.update(a, n)), await this.runCancelable(e, jr.IndexedContent, n, (a) => this.indexManager.updateContent(a, n)), await this.runCancelable(e, jr.ComputedScopes, n, async (a) => {
      const s = this.serviceRegistry.getServices(a.uri).references.ScopeComputation;
      a.precomputedScopes = await s.computeLocalScopes(a, n);
    }), await this.runCancelable(e, jr.Linked, n, (a) => this.serviceRegistry.getServices(a.uri).references.Linker.link(a, n)), await this.runCancelable(e, jr.IndexedReferences, n, (a) => this.indexManager.updateReferences(a, n));
    const i = e.filter((a) => this.shouldValidate(a));
    await this.runCancelable(i, jr.Validated, n, (a) => this.validate(a, n));
    for (const a of e) {
      const s = this.buildState.get(a.uri.toString());
      s && (s.completed = !0);
    }
  }
  /**
   * Runs prior to beginning the build process to update the {@link DocumentBuildState} for each document
   *
   * @param documents collection of documents to be built
   * @param options the {@link BuildOptions} to use
   */
  prepareBuild(e, r) {
    for (const n of e) {
      const i = n.uri.toString(), a = this.buildState.get(i);
      (!a || a.completed) && this.buildState.set(i, {
        completed: !1,
        options: r,
        result: a == null ? void 0 : a.result
      });
    }
  }
  /**
   * Runs a cancelable operation on a set of documents to bring them to a specified {@link DocumentState}.
   *
   * @param documents The array of documents to process.
   * @param targetState The target {@link DocumentState} to bring the documents to.
   * @param cancelToken A token that can be used to cancel the operation.
   * @param callback A function to be called for each document.
   * @returns A promise that resolves when all documents have been processed or the operation is canceled.
   * @throws Will throw `OperationCancelled` if the operation is canceled via a `CancellationToken`.
   */
  async runCancelable(e, r, n, i) {
    const a = e.filter((o) => o.state < r);
    for (const o of a)
      await Sa(n), await i(o), o.state = r, await this.notifyDocumentPhase(o, r, n);
    const s = e.filter((o) => o.state === r);
    await this.notifyBuildPhase(s, r, n), this.currentState = r;
  }
  onBuildPhase(e, r) {
    return this.buildPhaseListeners.add(e, r), Np.create(() => {
      this.buildPhaseListeners.delete(e, r);
    });
  }
  onDocumentPhase(e, r) {
    return this.documentPhaseListeners.add(e, r), Np.create(() => {
      this.documentPhaseListeners.delete(e, r);
    });
  }
  waitUntil(e, r, n) {
    let i;
    if (r && "path" in r ? i = r : n = r, n ?? (n = rn.None), i) {
      const a = this.langiumDocuments.getDocument(i);
      if (a && a.state > e)
        return Promise.resolve(i);
    }
    return this.currentState >= e ? Promise.resolve(void 0) : n.isCancellationRequested ? Promise.reject(y2) : new Promise((a, s) => {
      const o = this.onBuildPhase(e, () => {
        if (o.dispose(), l.dispose(), i) {
          const u = this.langiumDocuments.getDocument(i);
          a(u == null ? void 0 : u.uri);
        } else
          a(void 0);
      }), l = n.onCancellationRequested(() => {
        o.dispose(), l.dispose(), s(y2);
      });
    });
  }
  async notifyDocumentPhase(e, r, n) {
    const a = this.documentPhaseListeners.get(r).slice();
    for (const s of a)
      try {
        await s(e, n);
      } catch (o) {
        if (!ob(o))
          throw o;
      }
  }
  async notifyBuildPhase(e, r, n) {
    if (e.length === 0)
      return;
    const a = this.buildPhaseListeners.get(r).slice();
    for (const s of a)
      await Sa(n), await s(e, n);
  }
  /**
   * Determine whether the given document should be validated during a build. The default
   * implementation checks the `validation` property of the build options. If it's set to `true`
   * or a `ValidationOptions` object, the document is included in the validation phase.
   */
  shouldValidate(e) {
    return !!this.getBuildOptions(e).validation;
  }
  /**
   * Run validation checks on the given document and store the resulting diagnostics in the document.
   * If the document already contains diagnostics, the new ones are added to the list.
   */
  async validate(e, r) {
    var n, i;
    const a = this.serviceRegistry.getServices(e.uri).validation.DocumentValidator, s = this.getBuildOptions(e).validation, o = typeof s == "object" ? s : void 0, l = await a.validateDocument(e, o, r);
    e.diagnostics ? e.diagnostics.push(...l) : e.diagnostics = l;
    const u = this.buildState.get(e.uri.toString());
    if (u) {
      (n = u.result) !== null && n !== void 0 || (u.result = {});
      const h = (i = o == null ? void 0 : o.categories) !== null && i !== void 0 ? i : b2.all;
      u.result.validationChecks ? u.result.validationChecks.push(...h) : u.result.validationChecks = [...h];
    }
  }
  getBuildOptions(e) {
    var r, n;
    return (n = (r = this.buildState.get(e.uri.toString())) === null || r === void 0 ? void 0 : r.options) !== null && n !== void 0 ? n : {};
  }
}
class uke {
  constructor(e) {
    this.symbolIndex = /* @__PURE__ */ new Map(), this.symbolByTypeIndex = new jEe(), this.referenceIndex = /* @__PURE__ */ new Map(), this.documents = e.workspace.LangiumDocuments, this.serviceRegistry = e.ServiceRegistry, this.astReflection = e.AstReflection;
  }
  findAllReferences(e, r) {
    const n = Xl(e).uri, i = [];
    return this.referenceIndex.forEach((a) => {
      a.forEach((s) => {
        Ql.equals(s.targetUri, n) && s.targetPath === r && i.push(s);
      });
    }), oi(i);
  }
  allElements(e, r) {
    let n = oi(this.symbolIndex.keys());
    return r && (n = n.filter((i) => !r || r.has(i))), n.map((i) => this.getFileDescriptions(i, e)).flat();
  }
  getFileDescriptions(e, r) {
    var n;
    return r ? this.symbolByTypeIndex.get(e, r, () => {
      var a;
      return ((a = this.symbolIndex.get(e)) !== null && a !== void 0 ? a : []).filter((o) => this.astReflection.isSubtype(o.type, r));
    }) : (n = this.symbolIndex.get(e)) !== null && n !== void 0 ? n : [];
  }
  remove(e) {
    const r = e.toString();
    this.symbolIndex.delete(r), this.symbolByTypeIndex.clear(r), this.referenceIndex.delete(r);
  }
  async updateContent(e, r = rn.None) {
    const i = await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e, r), a = e.uri.toString();
    this.symbolIndex.set(a, i), this.symbolByTypeIndex.clear(a);
  }
  async updateReferences(e, r = rn.None) {
    const i = await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e, r);
    this.referenceIndex.set(e.uri.toString(), i);
  }
  isAffected(e, r) {
    const n = this.referenceIndex.get(e.uri.toString());
    return n ? n.some((i) => !i.local && r.has(i.targetUri.toString())) : !1;
  }
}
class hke {
  constructor(e) {
    this.initialBuildOptions = {}, this._ready = new US(), this.serviceRegistry = e.ServiceRegistry, this.langiumDocuments = e.workspace.LangiumDocuments, this.documentBuilder = e.workspace.DocumentBuilder, this.fileSystemProvider = e.workspace.FileSystemProvider, this.mutex = e.workspace.WorkspaceLock;
  }
  get ready() {
    return this._ready.promise;
  }
  get workspaceFolders() {
    return this.folders;
  }
  initialize(e) {
    var r;
    this.folders = (r = e.workspaceFolders) !== null && r !== void 0 ? r : void 0;
  }
  initialized(e) {
    return this.mutex.write((r) => {
      var n;
      return this.initializeWorkspace((n = this.folders) !== null && n !== void 0 ? n : [], r);
    });
  }
  async initializeWorkspace(e, r = rn.None) {
    const n = await this.performStartup(e);
    await Sa(r), await this.documentBuilder.build(n, this.initialBuildOptions, r);
  }
  /**
   * Performs the uninterruptable startup sequence of the workspace manager.
   * This methods loads all documents in the workspace and other documents and returns them.
   */
  async performStartup(e) {
    const r = this.serviceRegistry.all.flatMap((a) => a.LanguageMetaData.fileExtensions), n = [], i = (a) => {
      n.push(a), this.langiumDocuments.hasDocument(a.uri) || this.langiumDocuments.addDocument(a);
    };
    return await this.loadAdditionalDocuments(e, i), await Promise.all(e.map((a) => [a, this.getRootFolder(a)]).map(async (a) => this.traverseFolder(...a, r, i))), this._ready.resolve(), n;
  }
  /**
   * Load all additional documents that shall be visible in the context of the given workspace
   * folders and add them to the collector. This can be used to include built-in libraries of
   * your language, which can be either loaded from provided files or constructed in memory.
   */
  loadAdditionalDocuments(e, r) {
    return Promise.resolve();
  }
  /**
   * Determine the root folder of the source documents in the given workspace folder.
   * The default implementation returns the URI of the workspace folder, but you can override
   * this to return a subfolder like `src` instead.
   */
  getRootFolder(e) {
    return Su.parse(e.uri);
  }
  /**
   * Traverse the file system folder identified by the given URI and its subfolders. All
   * contained files that match the file extensions are added to the collector.
   */
  async traverseFolder(e, r, n, i) {
    const a = await this.fileSystemProvider.readDirectory(r);
    await Promise.all(a.map(async (s) => {
      if (this.includeEntry(e, s, n)) {
        if (s.isDirectory)
          await this.traverseFolder(e, s.uri, n, i);
        else if (s.isFile) {
          const o = await this.langiumDocuments.getOrCreateDocument(s.uri);
          i(o);
        }
      }
    }));
  }
  /**
   * Determine whether the given folder entry shall be included while indexing the workspace.
   */
  includeEntry(e, r, n) {
    const i = Ql.basename(r.uri);
    if (i.startsWith("."))
      return !1;
    if (r.isDirectory)
      return i !== "node_modules" && i !== "out";
    if (r.isFile) {
      const a = Ql.extname(r.uri);
      return n.includes(a);
    }
    return !1;
  }
}
class dke {
  buildUnexpectedCharactersMessage(e, r, n, i, a) {
    return $T.buildUnexpectedCharactersMessage(e, r, n, i, a);
  }
  buildUnableToPopLexerModeMessage(e) {
    return $T.buildUnableToPopLexerModeMessage(e);
  }
}
const fke = { mode: "full" };
class pke {
  constructor(e) {
    this.errorMessageProvider = e.parser.LexerErrorMessageProvider, this.tokenBuilder = e.parser.TokenBuilder;
    const r = this.tokenBuilder.buildTokens(e.Grammar, {
      caseInsensitive: e.LanguageMetaData.caseInsensitive
    });
    this.tokenTypes = this.toTokenTypeDictionary(r);
    const n = QR(r) ? Object.values(r) : r, i = e.LanguageMetaData.mode === "production";
    this.chevrotainLexer = new ua(n, {
      positionTracking: "full",
      skipValidations: i,
      errorMessageProvider: this.errorMessageProvider
    });
  }
  get definition() {
    return this.tokenTypes;
  }
  tokenize(e, r = fke) {
    var n, i, a;
    const s = this.chevrotainLexer.tokenize(e);
    return {
      tokens: s.tokens,
      errors: s.errors,
      hidden: (n = s.groups.hidden) !== null && n !== void 0 ? n : [],
      report: (a = (i = this.tokenBuilder).flushLexingReport) === null || a === void 0 ? void 0 : a.call(i, e)
    };
  }
  toTokenTypeDictionary(e) {
    if (QR(e))
      return e;
    const r = WW(e) ? Object.values(e.modes).flat() : e, n = {};
    return r.forEach((i) => n[i.name] = i), n;
  }
}
function gke(t) {
  return Array.isArray(t) && (t.length === 0 || "name" in t[0]);
}
function WW(t) {
  return t && "modes" in t && "defaultMode" in t;
}
function QR(t) {
  return !gke(t) && !WW(t);
}
function mke(t, e, r) {
  let n, i;
  typeof t == "string" ? (i = e, n = r) : (i = t.range.start, n = e), i || (i = Cr.create(0, 0));
  const a = HW(t), s = WS(n), o = xke({
    lines: a,
    position: i,
    options: s
  });
  return kke({
    index: 0,
    tokens: o,
    position: i
  });
}
function vke(t, e) {
  const r = WS(e), n = HW(t);
  if (n.length === 0)
    return !1;
  const i = n[0], a = n[n.length - 1], s = r.start, o = r.end;
  return !!(s != null && s.exec(i)) && !!(o != null && o.exec(a));
}
function HW(t) {
  let e = "";
  return typeof t == "string" ? e = t : e = t.text, e.split(Y5e);
}
const JR = /\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy, yke = /\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;
function xke(t) {
  var e, r, n;
  const i = [];
  let a = t.position.line, s = t.position.character;
  for (let o = 0; o < t.lines.length; o++) {
    const l = o === 0, u = o === t.lines.length - 1;
    let h = t.lines[o], d = 0;
    if (l && t.options.start) {
      const p = (e = t.options.start) === null || e === void 0 ? void 0 : e.exec(h);
      p && (d = p.index + p[0].length);
    } else {
      const p = (r = t.options.line) === null || r === void 0 ? void 0 : r.exec(h);
      p && (d = p.index + p[0].length);
    }
    if (u) {
      const p = (n = t.options.end) === null || n === void 0 ? void 0 : n.exec(h);
      p && (h = h.substring(0, p.index));
    }
    if (h = h.substring(0, Eke(h)), p6(h, d) >= h.length) {
      if (i.length > 0) {
        const p = Cr.create(a, s);
        i.push({
          type: "break",
          content: "",
          range: pr.create(p, p)
        });
      }
    } else {
      JR.lastIndex = d;
      const p = JR.exec(h);
      if (p) {
        const g = p[0], m = p[1], v = Cr.create(a, s + d), y = Cr.create(a, s + d + g.length);
        i.push({
          type: "tag",
          content: m,
          range: pr.create(v, y)
        }), d += g.length, d = p6(h, d);
      }
      if (d < h.length) {
        const g = h.substring(d), m = Array.from(g.matchAll(yke));
        i.push(...bke(m, g, a, s + d));
      }
    }
    a++, s = 0;
  }
  return i.length > 0 && i[i.length - 1].type === "break" ? i.slice(0, -1) : i;
}
function bke(t, e, r, n) {
  const i = [];
  if (t.length === 0) {
    const a = Cr.create(r, n), s = Cr.create(r, n + e.length);
    i.push({
      type: "text",
      content: e,
      range: pr.create(a, s)
    });
  } else {
    let a = 0;
    for (const o of t) {
      const l = o.index, u = e.substring(a, l);
      u.length > 0 && i.push({
        type: "text",
        content: e.substring(a, l),
        range: pr.create(Cr.create(r, a + n), Cr.create(r, l + n))
      });
      let h = u.length + 1;
      const d = o[1];
      if (i.push({
        type: "inline-tag",
        content: d,
        range: pr.create(Cr.create(r, a + h + n), Cr.create(r, a + h + d.length + n))
      }), h += d.length, o.length === 4) {
        h += o[2].length;
        const f = o[3];
        i.push({
          type: "text",
          content: f,
          range: pr.create(Cr.create(r, a + h + n), Cr.create(r, a + h + f.length + n))
        });
      } else
        i.push({
          type: "text",
          content: "",
          range: pr.create(Cr.create(r, a + h + n), Cr.create(r, a + h + n))
        });
      a = l + o[0].length;
    }
    const s = e.substring(a);
    s.length > 0 && i.push({
      type: "text",
      content: s,
      range: pr.create(Cr.create(r, a + n), Cr.create(r, a + n + s.length))
    });
  }
  return i;
}
const wke = /\S/, Tke = /\s*$/;
function p6(t, e) {
  const r = t.substring(e).match(wke);
  return r ? e + r.index : t.length;
}
function Eke(t) {
  const e = t.match(Tke);
  if (e && typeof e.index == "number")
    return e.index;
}
function kke(t) {
  var e, r, n, i;
  const a = Cr.create(t.position.line, t.position.character);
  if (t.tokens.length === 0)
    return new eN([], pr.create(a, a));
  const s = [];
  for (; t.index < t.tokens.length; ) {
    const u = Ske(t, s[s.length - 1]);
    u && s.push(u);
  }
  const o = (r = (e = s[0]) === null || e === void 0 ? void 0 : e.range.start) !== null && r !== void 0 ? r : a, l = (i = (n = s[s.length - 1]) === null || n === void 0 ? void 0 : n.range.end) !== null && i !== void 0 ? i : a;
  return new eN(s, pr.create(o, l));
}
function Ske(t, e) {
  const r = t.tokens[t.index];
  if (r.type === "tag")
    return YW(t, !1);
  if (r.type === "text" || r.type === "inline-tag")
    return qW(t);
  Cke(r, e), t.index++;
}
function Cke(t, e) {
  if (e) {
    const r = new jW("", t.range);
    "inlines" in e ? e.inlines.push(r) : e.content.inlines.push(r);
  }
}
function qW(t) {
  let e = t.tokens[t.index];
  const r = e;
  let n = e;
  const i = [];
  for (; e && e.type !== "break" && e.type !== "tag"; )
    i.push(Ake(t)), n = e, e = t.tokens[t.index];
  return new g6(i, pr.create(r.range.start, n.range.end));
}
function Ake(t) {
  return t.tokens[t.index].type === "inline-tag" ? YW(t, !0) : XW(t);
}
function YW(t, e) {
  const r = t.tokens[t.index++], n = r.content.substring(1), i = t.tokens[t.index];
  if ((i == null ? void 0 : i.type) === "text")
    if (e) {
      const a = XW(t);
      return new w5(n, new g6([a], a.range), e, pr.create(r.range.start, a.range.end));
    } else {
      const a = qW(t);
      return new w5(n, a, e, pr.create(r.range.start, a.range.end));
    }
  else {
    const a = r.range;
    return new w5(n, new g6([], a), e, a);
  }
}
function XW(t) {
  const e = t.tokens[t.index++];
  return new jW(e.content, e.range);
}
function WS(t) {
  if (!t)
    return WS({
      start: "/**",
      end: "*/",
      line: "*"
    });
  const { start: e, end: r, line: n } = t;
  return {
    start: b5(e, !0),
    end: b5(r, !1),
    line: b5(n, !0)
  };
}
function b5(t, e) {
  if (typeof t == "string" || typeof t == "object") {
    const r = typeof t == "string" ? Zx(t) : t.source;
    return e ? new RegExp(`^\\s*${r}`) : new RegExp(`\\s*${r}\\s*$`);
  } else
    return t;
}
class eN {
  constructor(e, r) {
    this.elements = e, this.range = r;
  }
  getTag(e) {
    return this.getAllTags().find((r) => r.name === e);
  }
  getTags(e) {
    return this.getAllTags().filter((r) => r.name === e);
  }
  getAllTags() {
    return this.elements.filter((e) => "name" in e);
  }
  toString() {
    let e = "";
    for (const r of this.elements)
      if (e.length === 0)
        e = r.toString();
      else {
        const n = r.toString();
        e += tN(e) + n;
      }
    return e.trim();
  }
  toMarkdown(e) {
    let r = "";
    for (const n of this.elements)
      if (r.length === 0)
        r = n.toMarkdown(e);
      else {
        const i = n.toMarkdown(e);
        r += tN(r) + i;
      }
    return r.trim();
  }
}
class w5 {
  constructor(e, r, n, i) {
    this.name = e, this.content = r, this.inline = n, this.range = i;
  }
  toString() {
    let e = `@${this.name}`;
    const r = this.content.toString();
    return this.content.inlines.length === 1 ? e = `${e} ${r}` : this.content.inlines.length > 1 && (e = `${e}
${r}`), this.inline ? `{${e}}` : e;
  }
  toMarkdown(e) {
    var r, n;
    return (n = (r = e == null ? void 0 : e.renderTag) === null || r === void 0 ? void 0 : r.call(e, this)) !== null && n !== void 0 ? n : this.toMarkdownDefault(e);
  }
  toMarkdownDefault(e) {
    const r = this.content.toMarkdown(e);
    if (this.inline) {
      const a = _ke(this.name, r, e ?? {});
      if (typeof a == "string")
        return a;
    }
    let n = "";
    (e == null ? void 0 : e.tag) === "italic" || (e == null ? void 0 : e.tag) === void 0 ? n = "*" : (e == null ? void 0 : e.tag) === "bold" ? n = "**" : (e == null ? void 0 : e.tag) === "bold-italic" && (n = "***");
    let i = `${n}@${this.name}${n}`;
    return this.content.inlines.length === 1 ? i = `${i} — ${r}` : this.content.inlines.length > 1 && (i = `${i}
${r}`), this.inline ? `{${i}}` : i;
  }
}
function _ke(t, e, r) {
  var n, i;
  if (t === "linkplain" || t === "linkcode" || t === "link") {
    const a = e.indexOf(" ");
    let s = e;
    if (a > 0) {
      const l = p6(e, a);
      s = e.substring(l), e = e.substring(0, a);
    }
    return (t === "linkcode" || t === "link" && r.link === "code") && (s = `\`${s}\``), (i = (n = r.renderLink) === null || n === void 0 ? void 0 : n.call(r, e, s)) !== null && i !== void 0 ? i : Lke(e, s);
  }
}
function Lke(t, e) {
  try {
    return Su.parse(t, !0), `[${e}](${t})`;
  } catch {
    return t;
  }
}
class g6 {
  constructor(e, r) {
    this.inlines = e, this.range = r;
  }
  toString() {
    let e = "";
    for (let r = 0; r < this.inlines.length; r++) {
      const n = this.inlines[r], i = this.inlines[r + 1];
      e += n.toString(), i && i.range.start.line > n.range.start.line && (e += `
`);
    }
    return e;
  }
  toMarkdown(e) {
    let r = "";
    for (let n = 0; n < this.inlines.length; n++) {
      const i = this.inlines[n], a = this.inlines[n + 1];
      r += i.toMarkdown(e), a && a.range.start.line > i.range.start.line && (r += `
`);
    }
    return r;
  }
}
class jW {
  constructor(e, r) {
    this.text = e, this.range = r;
  }
  toString() {
    return this.text;
  }
  toMarkdown() {
    return this.text;
  }
}
function tN(t) {
  return t.endsWith(`
`) ? `
` : `

`;
}
class Rke {
  constructor(e) {
    this.indexManager = e.shared.workspace.IndexManager, this.commentProvider = e.documentation.CommentProvider;
  }
  getDocumentation(e) {
    const r = this.commentProvider.getComment(e);
    if (r && vke(r))
      return mke(r).toMarkdown({
        renderLink: (i, a) => this.documentationLinkRenderer(e, i, a),
        renderTag: (i) => this.documentationTagRenderer(e, i)
      });
  }
  documentationLinkRenderer(e, r, n) {
    var i;
    const a = (i = this.findNameInPrecomputedScopes(e, r)) !== null && i !== void 0 ? i : this.findNameInGlobalScope(e, r);
    if (a && a.nameSegment) {
      const s = a.nameSegment.range.start.line + 1, o = a.nameSegment.range.start.character + 1, l = a.documentUri.with({ fragment: `L${s},${o}` });
      return `[${n}](${l.toString()})`;
    } else
      return;
  }
  documentationTagRenderer(e, r) {
  }
  findNameInPrecomputedScopes(e, r) {
    const i = Xl(e).precomputedScopes;
    if (!i)
      return;
    let a = e;
    do {
      const o = i.get(a).find((l) => l.name === r);
      if (o)
        return o;
      a = a.$container;
    } while (a);
  }
  findNameInGlobalScope(e, r) {
    return this.indexManager.allElements().find((i) => i.name === r);
  }
}
class Nke {
  constructor(e) {
    this.grammarConfig = () => e.parser.GrammarConfig;
  }
  getComment(e) {
    var r;
    return QEe(e) ? e.$comment : (r = E5e(e.$cstNode, this.grammarConfig().multilineCommentRules)) === null || r === void 0 ? void 0 : r.text;
  }
}
class Mke {
  constructor(e) {
    this.syncParser = e.parser.LangiumParser;
  }
  parse(e, r) {
    return Promise.resolve(this.syncParser.parse(e));
  }
}
class Dke {
  constructor() {
    this.previousTokenSource = new GS(), this.writeQueue = [], this.readQueue = [], this.done = !0;
  }
  write(e) {
    this.cancelWrite();
    const r = FEe();
    return this.previousTokenSource = r, this.enqueue(this.writeQueue, e, r.token);
  }
  read(e) {
    return this.enqueue(this.readQueue, e);
  }
  enqueue(e, r, n = rn.None) {
    const i = new US(), a = {
      action: r,
      deferred: i,
      cancellationToken: n
    };
    return e.push(a), this.performNextOperation(), i.promise;
  }
  async performNextOperation() {
    if (!this.done)
      return;
    const e = [];
    if (this.writeQueue.length > 0)
      e.push(this.writeQueue.shift());
    else if (this.readQueue.length > 0)
      e.push(...this.readQueue.splice(0, this.readQueue.length));
    else
      return;
    this.done = !1, await Promise.all(e.map(async ({ action: r, deferred: n, cancellationToken: i }) => {
      try {
        const a = await Promise.resolve().then(() => r(i));
        n.resolve(a);
      } catch (a) {
        ob(a) ? n.resolve(void 0) : n.reject(a);
      }
    })), this.done = !0, this.performNextOperation();
  }
  cancelWrite() {
    this.previousTokenSource.cancel();
  }
}
class Ike {
  constructor(e) {
    this.grammarElementIdMap = new jR(), this.tokenTypeIdMap = new jR(), this.grammar = e.Grammar, this.lexer = e.parser.Lexer, this.linker = e.references.Linker;
  }
  dehydrate(e) {
    return {
      lexerErrors: e.lexerErrors,
      lexerReport: e.lexerReport ? this.dehydrateLexerReport(e.lexerReport) : void 0,
      // We need to create shallow copies of the errors
      // The original errors inherit from the `Error` class, which is not transferable across worker threads
      parserErrors: e.parserErrors.map((r) => Object.assign(Object.assign({}, r), { message: r.message })),
      value: this.dehydrateAstNode(e.value, this.createDehyrationContext(e.value))
    };
  }
  dehydrateLexerReport(e) {
    return e;
  }
  createDehyrationContext(e) {
    const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
    for (const i of $h(e))
      r.set(i, {});
    if (e.$cstNode)
      for (const i of MT(e.$cstNode))
        n.set(i, {});
    return {
      astNodes: r,
      cstNodes: n
    };
  }
  dehydrateAstNode(e, r) {
    const n = r.astNodes.get(e);
    n.$type = e.$type, n.$containerIndex = e.$containerIndex, n.$containerProperty = e.$containerProperty, e.$cstNode !== void 0 && (n.$cstNode = this.dehydrateCstNode(e.$cstNode, r));
    for (const [i, a] of Object.entries(e))
      if (!i.startsWith("$"))
        if (Array.isArray(a)) {
          const s = [];
          n[i] = s;
          for (const o of a)
            ki(o) ? s.push(this.dehydrateAstNode(o, r)) : qs(o) ? s.push(this.dehydrateReference(o, r)) : s.push(o);
        } else ki(a) ? n[i] = this.dehydrateAstNode(a, r) : qs(a) ? n[i] = this.dehydrateReference(a, r) : a !== void 0 && (n[i] = a);
    return n;
  }
  dehydrateReference(e, r) {
    const n = {};
    return n.$refText = e.$refText, e.$refNode && (n.$refNode = r.cstNodes.get(e.$refNode)), n;
  }
  dehydrateCstNode(e, r) {
    const n = r.cstNodes.get(e);
    return yU(e) ? n.fullText = e.fullText : n.grammarSource = this.getGrammarElementId(e.grammarSource), n.hidden = e.hidden, n.astNode = r.astNodes.get(e.astNode), gg(e) ? n.content = e.content.map((i) => this.dehydrateCstNode(i, r)) : vU(e) && (n.tokenType = e.tokenType.name, n.offset = e.offset, n.length = e.length, n.startLine = e.range.start.line, n.startColumn = e.range.start.character, n.endLine = e.range.end.line, n.endColumn = e.range.end.character), n;
  }
  hydrate(e) {
    const r = e.value, n = this.createHydrationContext(r);
    return "$cstNode" in r && this.hydrateCstNode(r.$cstNode, n), {
      lexerErrors: e.lexerErrors,
      lexerReport: e.lexerReport,
      parserErrors: e.parserErrors,
      value: this.hydrateAstNode(r, n)
    };
  }
  createHydrationContext(e) {
    const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
    for (const a of $h(e))
      r.set(a, {});
    let i;
    if (e.$cstNode)
      for (const a of MT(e.$cstNode)) {
        let s;
        "fullText" in a ? (s = new AW(a.fullText), i = s) : "content" in a ? s = new zS() : "tokenType" in a && (s = this.hydrateCstLeafNode(a)), s && (n.set(a, s), s.root = i);
      }
    return {
      astNodes: r,
      cstNodes: n
    };
  }
  hydrateAstNode(e, r) {
    const n = r.astNodes.get(e);
    n.$type = e.$type, n.$containerIndex = e.$containerIndex, n.$containerProperty = e.$containerProperty, e.$cstNode && (n.$cstNode = r.cstNodes.get(e.$cstNode));
    for (const [i, a] of Object.entries(e))
      if (!i.startsWith("$"))
        if (Array.isArray(a)) {
          const s = [];
          n[i] = s;
          for (const o of a)
            ki(o) ? s.push(this.setParent(this.hydrateAstNode(o, r), n)) : qs(o) ? s.push(this.hydrateReference(o, n, i, r)) : s.push(o);
        } else ki(a) ? n[i] = this.setParent(this.hydrateAstNode(a, r), n) : qs(a) ? n[i] = this.hydrateReference(a, n, i, r) : a !== void 0 && (n[i] = a);
    return n;
  }
  setParent(e, r) {
    return e.$container = r, e;
  }
  hydrateReference(e, r, n, i) {
    return this.linker.buildReference(r, n, i.cstNodes.get(e.$refNode), e.$refText);
  }
  hydrateCstNode(e, r, n = 0) {
    const i = r.cstNodes.get(e);
    if (typeof e.grammarSource == "number" && (i.grammarSource = this.getGrammarElement(e.grammarSource)), i.astNode = r.astNodes.get(e.astNode), gg(i))
      for (const a of e.content) {
        const s = this.hydrateCstNode(a, r, n++);
        i.content.push(s);
      }
    return i;
  }
  hydrateCstLeafNode(e) {
    const r = this.getTokenType(e.tokenType), n = e.offset, i = e.length, a = e.startLine, s = e.startColumn, o = e.endLine, l = e.endColumn, u = e.hidden;
    return new s6(n, i, {
      start: {
        line: a,
        character: s
      },
      end: {
        line: o,
        character: l
      }
    }, r, u);
  }
  getTokenType(e) {
    return this.lexer.definition[e];
  }
  getGrammarElementId(e) {
    if (e)
      return this.grammarElementIdMap.size === 0 && this.createGrammarElementIdMap(), this.grammarElementIdMap.get(e);
  }
  getGrammarElement(e) {
    return this.grammarElementIdMap.size === 0 && this.createGrammarElementIdMap(), this.grammarElementIdMap.getKey(e);
  }
  createGrammarElementIdMap() {
    let e = 0;
    for (const r of $h(this.grammar))
      S5e(r) && this.grammarElementIdMap.set(r, e++);
  }
}
function pc(t) {
  return {
    documentation: {
      CommentProvider: (e) => new Nke(e),
      DocumentationProvider: (e) => new Rke(e)
    },
    parser: {
      AsyncParser: (e) => new Mke(e),
      GrammarConfig: (e) => mwe(e),
      LangiumParser: (e) => EEe(e),
      CompletionParser: (e) => TEe(e),
      ValueConverter: () => new PW(),
      TokenBuilder: () => new OW(),
      Lexer: (e) => new pke(e),
      ParserErrorMessageProvider: () => new RW(),
      LexerErrorMessageProvider: () => new dke()
    },
    workspace: {
      AstNodeLocator: () => new oke(),
      AstNodeDescriptionProvider: (e) => new ake(e),
      ReferenceDescriptionProvider: (e) => new ske(e)
    },
    references: {
      Linker: (e) => new GEe(e),
      NameProvider: () => new WEe(),
      ScopeProvider: (e) => new ZEe(e),
      ScopeComputation: (e) => new qEe(e),
      References: (e) => new HEe(e)
    },
    serializer: {
      Hydrator: (e) => new Ike(e),
      JsonSerializer: (e) => new JEe(e)
    },
    validation: {
      DocumentValidator: (e) => new rke(e),
      ValidationRegistry: (e) => new tke(e)
    },
    shared: () => t.shared
  };
}
function gc(t) {
  return {
    ServiceRegistry: (e) => new eke(e),
    workspace: {
      LangiumDocuments: (e) => new VEe(e),
      LangiumDocumentFactory: (e) => new zEe(e),
      DocumentBuilder: (e) => new cke(e),
      IndexManager: (e) => new uke(e),
      WorkspaceManager: (e) => new hke(e),
      FileSystemProvider: (e) => t.fileSystemProvider(e),
      WorkspaceLock: () => new Dke(),
      ConfigurationProvider: (e) => new lke(e)
    }
  };
}
var rN;
(function(t) {
  t.merge = (e, r) => w2(w2({}, e), r);
})(rN || (rN = {}));
function Li(t, e, r, n, i, a, s, o, l) {
  const u = [t, e, r, n, i, a, s, o, l].reduce(w2, {});
  return KW(u);
}
const Oke = Symbol("isProxy");
function KW(t, e) {
  const r = new Proxy({}, {
    deleteProperty: () => !1,
    set: () => {
      throw new Error("Cannot set property on injected service container");
    },
    get: (n, i) => i === Oke ? !0 : iN(n, i, t, e || r),
    getOwnPropertyDescriptor: (n, i) => (iN(n, i, t, e || r), Object.getOwnPropertyDescriptor(n, i)),
    // used by for..in
    has: (n, i) => i in t,
    // used by ..in..
    ownKeys: () => [...Object.getOwnPropertyNames(t)]
    // used by for..in
  });
  return r;
}
const nN = Symbol();
function iN(t, e, r, n) {
  if (e in t) {
    if (t[e] instanceof Error)
      throw new Error("Construction failure. Please make sure that your dependencies are constructable.", { cause: t[e] });
    if (t[e] === nN)
      throw new Error('Cycle detected. Please make "' + String(e) + '" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');
    return t[e];
  } else if (e in r) {
    const i = r[e];
    t[e] = nN;
    try {
      t[e] = typeof i == "function" ? i(n) : KW(i, n);
    } catch (a) {
      throw t[e] = a instanceof Error ? a : void 0, a;
    }
    return t[e];
  } else
    return;
}
function w2(t, e) {
  if (e) {
    for (const [r, n] of Object.entries(e))
      if (n !== void 0) {
        const i = t[r];
        i !== null && n !== null && typeof i == "object" && typeof n == "object" ? t[r] = w2(i, n) : t[r] = n;
      }
  }
  return t;
}
class Pke {
  readFile() {
    throw new Error("No file system is available.");
  }
  async readDirectory() {
    return [];
  }
}
const mc = {
  fileSystemProvider: () => new Pke()
}, Bke = {
  Grammar: () => {
  },
  LanguageMetaData: () => ({
    caseInsensitive: !1,
    fileExtensions: [".langium"],
    languageId: "langium"
  })
}, Fke = {
  AstReflection: () => new SU()
};
function $ke() {
  const t = Li(gc(mc), Fke), e = Li(pc({ shared: t }), Bke);
  return t.ServiceRegistry.register(e), e;
}
function Wu(t) {
  var e;
  const r = $ke(), n = r.serializer.JsonSerializer.deserialize(t);
  return r.shared.workspace.LangiumDocumentFactory.fromModel(n, Su.parse(`memory://${(e = n.name) !== null && e !== void 0 ? e : "grammar"}.langium`)), n;
}
var zke = Object.defineProperty, mt = (t, e) => zke(t, "name", { value: e, configurable: !0 }), aN = "Statement", wv = "Architecture";
function Vke(t) {
  return _s.isInstance(t, wv);
}
mt(Vke, "isArchitecture");
var Tm = "Axis", cp = "Branch";
function Gke(t) {
  return _s.isInstance(t, cp);
}
mt(Gke, "isBranch");
var Em = "Checkout", km = "CherryPicking", T5 = "ClassDefStatement", up = "Commit";
function Uke(t) {
  return _s.isInstance(t, up);
}
mt(Uke, "isCommit");
var E5 = "Curve", k5 = "Edge", S5 = "Entry", hp = "GitGraph";
function Wke(t) {
  return _s.isInstance(t, hp);
}
mt(Wke, "isGitGraph");
var C5 = "Group", Tv = "Info";
function Hke(t) {
  return _s.isInstance(t, Tv);
}
mt(Hke, "isInfo");
var Sm = "Item", A5 = "Junction", dp = "Merge";
function qke(t) {
  return _s.isInstance(t, dp);
}
mt(qke, "isMerge");
var _5 = "Option", Ev = "Packet";
function Yke(t) {
  return _s.isInstance(t, Ev);
}
mt(Yke, "isPacket");
var kv = "PacketBlock";
function Xke(t) {
  return _s.isInstance(t, kv);
}
mt(Xke, "isPacketBlock");
var Sv = "Pie";
function jke(t) {
  return _s.isInstance(t, Sv);
}
mt(jke, "isPie");
var Cv = "PieSection";
function Kke(t) {
  return _s.isInstance(t, Cv);
}
mt(Kke, "isPieSection");
var L5 = "Radar", R5 = "Service", Av = "Treemap";
function Zke(t) {
  return _s.isInstance(t, Av);
}
mt(Zke, "isTreemap");
var N5 = "TreemapRow", Cm = "Direction", Am = "Leaf", _m = "Section", rd, ZW = (rd = class extends mU {
  getAllTypes() {
    return [wv, Tm, cp, Em, km, T5, up, E5, Cm, k5, S5, hp, C5, Tv, Sm, A5, Am, dp, _5, Ev, kv, Sv, Cv, L5, _m, R5, aN, Av, N5];
  }
  computeIsSubtype(e, r) {
    switch (e) {
      case cp:
      case Em:
      case km:
      case up:
      case dp:
        return this.isSubtype(aN, r);
      case Cm:
        return this.isSubtype(hp, r);
      case Am:
      case _m:
        return this.isSubtype(Sm, r);
      default:
        return !1;
    }
  }
  getReferenceType(e) {
    const r = `${e.container.$type}:${e.property}`;
    switch (r) {
      case "Entry:axis":
        return Tm;
      default:
        throw new Error(`${r} is not a valid reference id.`);
    }
  }
  getTypeMetaData(e) {
    switch (e) {
      case wv:
        return {
          name: wv,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "edges", defaultValue: [] },
            { name: "groups", defaultValue: [] },
            { name: "junctions", defaultValue: [] },
            { name: "services", defaultValue: [] },
            { name: "title" }
          ]
        };
      case Tm:
        return {
          name: Tm,
          properties: [
            { name: "label" },
            { name: "name" }
          ]
        };
      case cp:
        return {
          name: cp,
          properties: [
            { name: "name" },
            { name: "order" }
          ]
        };
      case Em:
        return {
          name: Em,
          properties: [
            { name: "branch" }
          ]
        };
      case km:
        return {
          name: km,
          properties: [
            { name: "id" },
            { name: "parent" },
            { name: "tags", defaultValue: [] }
          ]
        };
      case T5:
        return {
          name: T5,
          properties: [
            { name: "className" },
            { name: "styleText" }
          ]
        };
      case up:
        return {
          name: up,
          properties: [
            { name: "id" },
            { name: "message" },
            { name: "tags", defaultValue: [] },
            { name: "type" }
          ]
        };
      case E5:
        return {
          name: E5,
          properties: [
            { name: "entries", defaultValue: [] },
            { name: "label" },
            { name: "name" }
          ]
        };
      case k5:
        return {
          name: k5,
          properties: [
            { name: "lhsDir" },
            { name: "lhsGroup", defaultValue: !1 },
            { name: "lhsId" },
            { name: "lhsInto", defaultValue: !1 },
            { name: "rhsDir" },
            { name: "rhsGroup", defaultValue: !1 },
            { name: "rhsId" },
            { name: "rhsInto", defaultValue: !1 },
            { name: "title" }
          ]
        };
      case S5:
        return {
          name: S5,
          properties: [
            { name: "axis" },
            { name: "value" }
          ]
        };
      case hp:
        return {
          name: hp,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "statements", defaultValue: [] },
            { name: "title" }
          ]
        };
      case C5:
        return {
          name: C5,
          properties: [
            { name: "icon" },
            { name: "id" },
            { name: "in" },
            { name: "title" }
          ]
        };
      case Tv:
        return {
          name: Tv,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "title" }
          ]
        };
      case Sm:
        return {
          name: Sm,
          properties: [
            { name: "classSelector" },
            { name: "name" }
          ]
        };
      case A5:
        return {
          name: A5,
          properties: [
            { name: "id" },
            { name: "in" }
          ]
        };
      case dp:
        return {
          name: dp,
          properties: [
            { name: "branch" },
            { name: "id" },
            { name: "tags", defaultValue: [] },
            { name: "type" }
          ]
        };
      case _5:
        return {
          name: _5,
          properties: [
            { name: "name" },
            { name: "value", defaultValue: !1 }
          ]
        };
      case Ev:
        return {
          name: Ev,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "blocks", defaultValue: [] },
            { name: "title" }
          ]
        };
      case kv:
        return {
          name: kv,
          properties: [
            { name: "bits" },
            { name: "end" },
            { name: "label" },
            { name: "start" }
          ]
        };
      case Sv:
        return {
          name: Sv,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "sections", defaultValue: [] },
            { name: "showData", defaultValue: !1 },
            { name: "title" }
          ]
        };
      case Cv:
        return {
          name: Cv,
          properties: [
            { name: "label" },
            { name: "value" }
          ]
        };
      case L5:
        return {
          name: L5,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "axes", defaultValue: [] },
            { name: "curves", defaultValue: [] },
            { name: "options", defaultValue: [] },
            { name: "title" }
          ]
        };
      case R5:
        return {
          name: R5,
          properties: [
            { name: "icon" },
            { name: "iconText" },
            { name: "id" },
            { name: "in" },
            { name: "title" }
          ]
        };
      case Av:
        return {
          name: Av,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "title" },
            { name: "TreemapRows", defaultValue: [] }
          ]
        };
      case N5:
        return {
          name: N5,
          properties: [
            { name: "indent" },
            { name: "item" }
          ]
        };
      case Cm:
        return {
          name: Cm,
          properties: [
            { name: "accDescr" },
            { name: "accTitle" },
            { name: "dir" },
            { name: "statements", defaultValue: [] },
            { name: "title" }
          ]
        };
      case Am:
        return {
          name: Am,
          properties: [
            { name: "classSelector" },
            { name: "name" },
            { name: "value" }
          ]
        };
      case _m:
        return {
          name: _m,
          properties: [
            { name: "classSelector" },
            { name: "name" }
          ]
        };
      default:
        return {
          name: e,
          properties: []
        };
    }
  }
}, mt(rd, "MermaidAstReflection"), rd), _s = new ZW(), sN, Qke = /* @__PURE__ */ mt(() => sN ?? (sN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)), "InfoGrammar"), oN, Jke = /* @__PURE__ */ mt(() => oN ?? (oN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)), "PacketGrammar"), lN, eSe = /* @__PURE__ */ mt(() => lN ?? (lN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"}}]},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)), "PieGrammar"), cN, tSe = /* @__PURE__ */ mt(() => cN ?? (cN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)), "ArchitectureGrammar"), uN, rSe = /* @__PURE__ */ mt(() => uN ?? (uN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[],"types":[],"usedGrammars":[]}`)), "GitGraphGrammar"), hN, nSe = /* @__PURE__ */ mt(() => hN ?? (hN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"Radar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"}}]},"fragment":false,"hidden":false},{"$type":"ParserRule","fragment":true,"name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"}},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}}}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"definesHiddenTokens":false,"hiddenTokens":[],"types":[],"usedGrammars":[]}`)), "RadarGrammar"), dN, iSe = /* @__PURE__ */ mt(() => dN ?? (dN = Wu(`{"$type":"Grammar","isDeclared":true,"name":"Treemap","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}],"cardinality":"*"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"}},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","}},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@14"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)), "TreemapGrammar"), aSe = {
  languageId: "info",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, sSe = {
  languageId: "packet",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, oSe = {
  languageId: "pie",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, lSe = {
  languageId: "architecture",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, cSe = {
  languageId: "gitGraph",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, uSe = {
  languageId: "radar",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, hSe = {
  languageId: "treemap",
  fileExtensions: [".mmd", ".mermaid"],
  caseInsensitive: !1,
  mode: "production"
}, Hu = {
  AstReflection: /* @__PURE__ */ mt(() => new ZW(), "AstReflection")
}, dSe = {
  Grammar: /* @__PURE__ */ mt(() => Qke(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => aSe, "LanguageMetaData"),
  parser: {}
}, fSe = {
  Grammar: /* @__PURE__ */ mt(() => Jke(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => sSe, "LanguageMetaData"),
  parser: {}
}, pSe = {
  Grammar: /* @__PURE__ */ mt(() => eSe(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => oSe, "LanguageMetaData"),
  parser: {}
}, gSe = {
  Grammar: /* @__PURE__ */ mt(() => tSe(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => lSe, "LanguageMetaData"),
  parser: {}
}, mSe = {
  Grammar: /* @__PURE__ */ mt(() => rSe(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => cSe, "LanguageMetaData"),
  parser: {}
}, vSe = {
  Grammar: /* @__PURE__ */ mt(() => nSe(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => uSe, "LanguageMetaData"),
  parser: {}
}, ySe = {
  Grammar: /* @__PURE__ */ mt(() => iSe(), "Grammar"),
  LanguageMetaData: /* @__PURE__ */ mt(() => hSe, "LanguageMetaData"),
  parser: {}
}, xSe = /accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/, bSe = /accTitle[\t ]*:([^\n\r]*)/, wSe = /title([\t ][^\n\r]*|)/, TSe = {
  ACC_DESCR: xSe,
  ACC_TITLE: bSe,
  TITLE: wSe
}, nd, lb = (nd = class extends PW {
  runConverter(e, r, n) {
    let i = this.runCommonConverter(e, r, n);
    return i === void 0 && (i = this.runCustomConverter(e, r, n)), i === void 0 ? super.runConverter(e, r, n) : i;
  }
  runCommonConverter(e, r, n) {
    const i = TSe[e.name];
    if (i === void 0)
      return;
    const a = i.exec(r);
    if (a !== null) {
      if (a[1] !== void 0)
        return a[1].trim().replace(/[\t ]{2,}/gm, " ");
      if (a[2] !== void 0)
        return a[2].replace(/^\s*/gm, "").replace(/\s+$/gm, "").replace(/[\t ]{2,}/gm, " ").replace(/[\n\r]{2,}/gm, `
`);
    }
  }
}, mt(nd, "AbstractMermaidValueConverter"), nd), id, cb = (id = class extends lb {
  runCustomConverter(e, r, n) {
  }
}, mt(id, "CommonValueConverter"), id), ad, vc = (ad = class extends OW {
  constructor(e) {
    super(), this.keywords = new Set(e);
  }
  buildKeywordTokens(e, r, n) {
    const i = super.buildKeywordTokens(e, r, n);
    return i.forEach((a) => {
      this.keywords.has(a.name) && a.PATTERN !== void 0 && (a.PATTERN = new RegExp(a.PATTERN.toString() + "(?:(?=%%)|(?!\\S))"));
    }), i;
  }
}, mt(ad, "AbstractMermaidTokenBuilder"), ad), sd;
sd = class extends vc {
}, mt(sd, "CommonTokenBuilder");
var od, ESe = (od = class extends vc {
  constructor() {
    super(["gitGraph"]);
  }
}, mt(od, "GitGraphTokenBuilder"), od), QW = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new ESe(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new cb(), "ValueConverter")
  }
};
function JW(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    mSe,
    QW
  );
  return e.ServiceRegistry.register(r), { shared: e, GitGraph: r };
}
mt(JW, "createGitGraphServices");
var ld, kSe = (ld = class extends vc {
  constructor() {
    super(["info", "showInfo"]);
  }
}, mt(ld, "InfoTokenBuilder"), ld), eH = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new kSe(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new cb(), "ValueConverter")
  }
};
function tH(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    dSe,
    eH
  );
  return e.ServiceRegistry.register(r), { shared: e, Info: r };
}
mt(tH, "createInfoServices");
var cd, SSe = (cd = class extends vc {
  constructor() {
    super(["packet"]);
  }
}, mt(cd, "PacketTokenBuilder"), cd), rH = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new SSe(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new cb(), "ValueConverter")
  }
};
function nH(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    fSe,
    rH
  );
  return e.ServiceRegistry.register(r), { shared: e, Packet: r };
}
mt(nH, "createPacketServices");
var ud, CSe = (ud = class extends vc {
  constructor() {
    super(["pie", "showData"]);
  }
}, mt(ud, "PieTokenBuilder"), ud), hd, ASe = (hd = class extends lb {
  runCustomConverter(e, r, n) {
    if (e.name === "PIE_SECTION_LABEL")
      return r.replace(/"/g, "").trim();
  }
}, mt(hd, "PieValueConverter"), hd), iH = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new CSe(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new ASe(), "ValueConverter")
  }
};
function aH(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    pSe,
    iH
  );
  return e.ServiceRegistry.register(r), { shared: e, Pie: r };
}
mt(aH, "createPieServices");
var dd, _Se = (dd = class extends vc {
  constructor() {
    super(["architecture"]);
  }
}, mt(dd, "ArchitectureTokenBuilder"), dd), fd, LSe = (fd = class extends lb {
  runCustomConverter(e, r, n) {
    if (e.name === "ARCH_ICON")
      return r.replace(/[()]/g, "").trim();
    if (e.name === "ARCH_TEXT_ICON")
      return r.replace(/["()]/g, "");
    if (e.name === "ARCH_TITLE")
      return r.replace(/[[\]]/g, "").trim();
  }
}, mt(fd, "ArchitectureValueConverter"), fd), sH = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new _Se(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new LSe(), "ValueConverter")
  }
};
function oH(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    gSe,
    sH
  );
  return e.ServiceRegistry.register(r), { shared: e, Architecture: r };
}
mt(oH, "createArchitectureServices");
var pd, RSe = (pd = class extends vc {
  constructor() {
    super(["radar-beta"]);
  }
}, mt(pd, "RadarTokenBuilder"), pd), lH = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new RSe(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new cb(), "ValueConverter")
  }
};
function cH(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    vSe,
    lH
  );
  return e.ServiceRegistry.register(r), { shared: e, Radar: r };
}
mt(cH, "createRadarServices");
var gd, NSe = (gd = class extends vc {
  constructor() {
    super(["treemap"]);
  }
}, mt(gd, "TreemapTokenBuilder"), gd), MSe = /classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/, md, DSe = (md = class extends lb {
  runCustomConverter(e, r, n) {
    if (e.name === "NUMBER2")
      return parseFloat(r.replace(/,/g, ""));
    if (e.name === "SEPARATOR")
      return r.substring(1, r.length - 1);
    if (e.name === "STRING2")
      return r.substring(1, r.length - 1);
    if (e.name === "INDENTATION")
      return r.length;
    if (e.name === "ClassDef") {
      if (typeof r != "string")
        return r;
      const i = MSe.exec(r);
      if (i)
        return {
          $type: "ClassDefStatement",
          className: i[1],
          styleText: i[2] || void 0
        };
    }
  }
}, mt(md, "TreemapValueConverter"), md);
function uH(t) {
  const e = t.validation.TreemapValidator, r = t.validation.ValidationRegistry;
  if (r) {
    const n = {
      Treemap: e.checkSingleRoot.bind(e)
      // Remove unused validation for TreemapRow
    };
    r.register(n, e);
  }
}
mt(uH, "registerValidationChecks");
var vd, ISe = (vd = class {
  /**
   * Validates that a treemap has only one root node.
   * A root node is defined as a node that has no indentation.
   */
  checkSingleRoot(e, r) {
    let n;
    for (const i of e.TreemapRows)
      i.item && (n === void 0 && // Check if this is a root node (no indentation)
      i.indent === void 0 ? n = 0 : i.indent === void 0 ? r("error", "Multiple root nodes are not allowed in a treemap.", {
        node: i,
        property: "item"
      }) : n !== void 0 && n >= parseInt(i.indent, 10) && r("error", "Multiple root nodes are not allowed in a treemap.", {
        node: i,
        property: "item"
      }));
  }
}, mt(vd, "TreemapValidator"), vd), hH = {
  parser: {
    TokenBuilder: /* @__PURE__ */ mt(() => new NSe(), "TokenBuilder"),
    ValueConverter: /* @__PURE__ */ mt(() => new DSe(), "ValueConverter")
  },
  validation: {
    TreemapValidator: /* @__PURE__ */ mt(() => new ISe(), "TreemapValidator")
  }
};
function dH(t = mc) {
  const e = Li(
    gc(t),
    Hu
  ), r = Li(
    pc({ shared: e }),
    ySe,
    hH
  );
  return e.ServiceRegistry.register(r), uH(r), { shared: e, Treemap: r };
}
mt(dH, "createTreemapServices");
var So = {}, OSe = {
  info: /* @__PURE__ */ mt(async () => {
    const { createInfoServices: t } = await Promise.resolve().then(() => cMe), e = t().Info.parser.LangiumParser;
    So.info = e;
  }, "info"),
  packet: /* @__PURE__ */ mt(async () => {
    const { createPacketServices: t } = await Promise.resolve().then(() => uMe), e = t().Packet.parser.LangiumParser;
    So.packet = e;
  }, "packet"),
  pie: /* @__PURE__ */ mt(async () => {
    const { createPieServices: t } = await Promise.resolve().then(() => hMe), e = t().Pie.parser.LangiumParser;
    So.pie = e;
  }, "pie"),
  architecture: /* @__PURE__ */ mt(async () => {
    const { createArchitectureServices: t } = await Promise.resolve().then(() => dMe), e = t().Architecture.parser.LangiumParser;
    So.architecture = e;
  }, "architecture"),
  gitGraph: /* @__PURE__ */ mt(async () => {
    const { createGitGraphServices: t } = await Promise.resolve().then(() => fMe), e = t().GitGraph.parser.LangiumParser;
    So.gitGraph = e;
  }, "gitGraph"),
  radar: /* @__PURE__ */ mt(async () => {
    const { createRadarServices: t } = await Promise.resolve().then(() => pMe), e = t().Radar.parser.LangiumParser;
    So.radar = e;
  }, "radar"),
  treemap: /* @__PURE__ */ mt(async () => {
    const { createTreemapServices: t } = await Promise.resolve().then(() => gMe), e = t().Treemap.parser.LangiumParser;
    So.treemap = e;
  }, "treemap")
};
async function yc(t, e) {
  const r = OSe[t];
  if (!r)
    throw new Error(`Unknown diagram type: ${t}`);
  So[t] || await r();
  const i = So[t].parse(e);
  if (i.lexerErrors.length > 0 || i.parserErrors.length > 0)
    throw new PSe(i);
  return i.value;
}
mt(yc, "parse");
var yd, PSe = (yd = class extends Error {
  constructor(e) {
    const r = e.lexerErrors.map((i) => i.message).join(`
`), n = e.parserErrors.map((i) => i.message).join(`
`);
    super(`Parsing failed: ${r} ${n}`), this.result = e;
  }
}, mt(yd, "MermaidParseError"), yd), Dr = {
  NORMAL: 0,
  REVERSE: 1,
  HIGHLIGHT: 2,
  MERGE: 3,
  CHERRY_PICK: 4
}, BSe = hr.gitGraph, qu = /* @__PURE__ */ x(() => qi({
  ...BSe,
  ...gr().gitGraph
}), "getConfig"), yt = new gU(() => {
  const t = qu(), e = t.mainBranchName, r = t.mainBranchOrder;
  return {
    mainBranchName: e,
    commits: /* @__PURE__ */ new Map(),
    head: null,
    branchConfig: /* @__PURE__ */ new Map([[e, { name: e, order: r }]]),
    branches: /* @__PURE__ */ new Map([[e, null]]),
    currBranch: e,
    direction: "LR",
    seq: 0,
    options: {}
  };
});
function ub() {
  return iP({ length: 7 });
}
x(ub, "getID");
function fH(t, e) {
  const r = /* @__PURE__ */ Object.create(null);
  return t.reduce((n, i) => {
    const a = e(i);
    return r[a] || (r[a] = !0, n.push(i)), n;
  }, []);
}
x(fH, "uniqBy");
var FSe = /* @__PURE__ */ x(function(t) {
  yt.records.direction = t;
}, "setDirection"), $Se = /* @__PURE__ */ x(function(t) {
  ae.debug("options str", t), t = t == null ? void 0 : t.trim(), t = t || "{}";
  try {
    yt.records.options = JSON.parse(t);
  } catch (e) {
    ae.error("error while parsing gitGraph options", e.message);
  }
}, "setOptions"), zSe = /* @__PURE__ */ x(function() {
  return yt.records.options;
}, "getOptions"), VSe = /* @__PURE__ */ x(function(t) {
  let e = t.msg, r = t.id;
  const n = t.type;
  let i = t.tags;
  ae.info("commit", e, r, n, i), ae.debug("Entering commit:", e, r, n, i);
  const a = qu();
  r = at.sanitizeText(r, a), e = at.sanitizeText(e, a), i = i == null ? void 0 : i.map((o) => at.sanitizeText(o, a));
  const s = {
    id: r || yt.records.seq + "-" + ub(),
    message: e,
    seq: yt.records.seq++,
    type: n ?? Dr.NORMAL,
    tags: i ?? [],
    parents: yt.records.head == null ? [] : [yt.records.head.id],
    branch: yt.records.currBranch
  };
  yt.records.head = s, ae.info("main branch", a.mainBranchName), yt.records.commits.has(s.id) && ae.warn(`Commit ID ${s.id} already exists`), yt.records.commits.set(s.id, s), yt.records.branches.set(yt.records.currBranch, s.id), ae.debug("in pushCommit " + s.id);
}, "commit"), GSe = /* @__PURE__ */ x(function(t) {
  let e = t.name;
  const r = t.order;
  if (e = at.sanitizeText(e, qu()), yt.records.branches.has(e))
    throw 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 ${e}")`
    );
  yt.records.branches.set(e, yt.records.head != null ? yt.records.head.id : null), yt.records.branchConfig.set(e, { name: e, order: r }), pH(e), ae.debug("in createBranch");
}, "branch"), USe = /* @__PURE__ */ x((t) => {
  let e = t.branch, r = t.id;
  const n = t.type, i = t.tags, a = qu();
  e = at.sanitizeText(e, a), r && (r = at.sanitizeText(r, a));
  const s = yt.records.branches.get(yt.records.currBranch), o = yt.records.branches.get(e), l = s ? yt.records.commits.get(s) : void 0, u = o ? yt.records.commits.get(o) : void 0;
  if (l && u && l.branch === e)
    throw new Error(`Cannot merge branch '${e}' into itself.`);
  if (yt.records.currBranch === e) {
    const f = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
    throw f.hash = {
      text: `merge ${e}`,
      token: `merge ${e}`,
      expected: ["branch abc"]
    }, f;
  }
  if (l === void 0 || !l) {
    const f = new Error(
      `Incorrect usage of "merge". Current branch (${yt.records.currBranch})has no commits`
    );
    throw f.hash = {
      text: `merge ${e}`,
      token: `merge ${e}`,
      expected: ["commit"]
    }, f;
  }
  if (!yt.records.branches.has(e)) {
    const f = new Error(
      'Incorrect usage of "merge". Branch to be merged (' + e + ") does not exist"
    );
    throw f.hash = {
      text: `merge ${e}`,
      token: `merge ${e}`,
      expected: [`branch ${e}`]
    }, f;
  }
  if (u === void 0 || !u) {
    const f = new Error(
      'Incorrect usage of "merge". Branch to be merged (' + e + ") has no commits"
    );
    throw f.hash = {
      text: `merge ${e}`,
      token: `merge ${e}`,
      expected: ['"commit"']
    }, f;
  }
  if (l === u) {
    const f = new Error('Incorrect usage of "merge". Both branches have same head');
    throw f.hash = {
      text: `merge ${e}`,
      token: `merge ${e}`,
      expected: ["branch abc"]
    }, f;
  }
  if (r && yt.records.commits.has(r)) {
    const f = new Error(
      'Incorrect usage of "merge". Commit with id:' + r + " already exists, use different custom id"
    );
    throw f.hash = {
      text: `merge ${e} ${r} ${n} ${i == null ? void 0 : i.join(" ")}`,
      token: `merge ${e} ${r} ${n} ${i == null ? void 0 : i.join(" ")}`,
      expected: [
        `merge ${e} ${r}_UNIQUE ${n} ${i == null ? void 0 : i.join(" ")}`
      ]
    }, f;
  }
  const h = o || "", d = {
    id: r || `${yt.records.seq}-${ub()}`,
    message: `merged branch ${e} into ${yt.records.currBranch}`,
    seq: yt.records.seq++,
    parents: yt.records.head == null ? [] : [yt.records.head.id, h],
    branch: yt.records.currBranch,
    type: Dr.MERGE,
    customType: n,
    customId: !!r,
    tags: i ?? []
  };
  yt.records.head = d, yt.records.commits.set(d.id, d), yt.records.branches.set(yt.records.currBranch, d.id), ae.debug(yt.records.branches), ae.debug("in mergeBranch");
}, "merge"), WSe = /* @__PURE__ */ x(function(t) {
  let e = t.id, r = t.targetId, n = t.tags, i = t.parent;
  ae.debug("Entering cherryPick:", e, r, n);
  const a = qu();
  if (e = at.sanitizeText(e, a), r = at.sanitizeText(r, a), n = n == null ? void 0 : n.map((l) => at.sanitizeText(l, a)), i = at.sanitizeText(i, a), !e || !yt.records.commits.has(e)) {
    const l = new Error(
      'Incorrect usage of "cherryPick". Source commit id should exist and provided'
    );
    throw l.hash = {
      text: `cherryPick ${e} ${r}`,
      token: `cherryPick ${e} ${r}`,
      expected: ["cherry-pick abc"]
    }, l;
  }
  const s = yt.records.commits.get(e);
  if (s === void 0 || !s)
    throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
  if (i && !(Array.isArray(s.parents) && s.parents.includes(i)))
    throw new Error(
      "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
    );
  const o = s.branch;
  if (s.type === Dr.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 (!r || !yt.records.commits.has(r)) {
    if (o === yt.records.currBranch) {
      const d = new Error(
        'Incorrect usage of "cherryPick". Source commit is already on current branch'
      );
      throw d.hash = {
        text: `cherryPick ${e} ${r}`,
        token: `cherryPick ${e} ${r}`,
        expected: ["cherry-pick abc"]
      }, d;
    }
    const l = yt.records.branches.get(yt.records.currBranch);
    if (l === void 0 || !l) {
      const d = new Error(
        `Incorrect usage of "cherry-pick". Current branch (${yt.records.currBranch})has no commits`
      );
      throw d.hash = {
        text: `cherryPick ${e} ${r}`,
        token: `cherryPick ${e} ${r}`,
        expected: ["cherry-pick abc"]
      }, d;
    }
    const u = yt.records.commits.get(l);
    if (u === void 0 || !u) {
      const d = new Error(
        `Incorrect usage of "cherry-pick". Current branch (${yt.records.currBranch})has no commits`
      );
      throw d.hash = {
        text: `cherryPick ${e} ${r}`,
        token: `cherryPick ${e} ${r}`,
        expected: ["cherry-pick abc"]
      }, d;
    }
    const h = {
      id: yt.records.seq + "-" + ub(),
      message: `cherry-picked ${s == null ? void 0 : s.message} into ${yt.records.currBranch}`,
      seq: yt.records.seq++,
      parents: yt.records.head == null ? [] : [yt.records.head.id, s.id],
      branch: yt.records.currBranch,
      type: Dr.CHERRY_PICK,
      tags: n ? n.filter(Boolean) : [
        `cherry-pick:${s.id}${s.type === Dr.MERGE ? `|parent:${i}` : ""}`
      ]
    };
    yt.records.head = h, yt.records.commits.set(h.id, h), yt.records.branches.set(yt.records.currBranch, h.id), ae.debug(yt.records.branches), ae.debug("in cherryPick");
  }
}, "cherryPick"), pH = /* @__PURE__ */ x(function(t) {
  if (t = at.sanitizeText(t, qu()), yt.records.branches.has(t)) {
    yt.records.currBranch = t;
    const e = yt.records.branches.get(yt.records.currBranch);
    e === void 0 || !e ? yt.records.head = null : yt.records.head = yt.records.commits.get(e) ?? null;
  } else {
    const 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}`,
      expected: [`branch ${t}`]
    }, e;
  }
}, "checkout");
function m6(t, e, r) {
  const n = t.indexOf(e);
  n === -1 ? t.push(r) : t.splice(n, 1, r);
}
x(m6, "upsert");
function HS(t) {
  const e = t.reduce((i, a) => i.seq > a.seq ? i : a, t[0]);
  let r = "";
  t.forEach(function(i) {
    i === e ? r += "	*" : r += "	|";
  });
  const n = [r, e.id, e.seq];
  for (const i in yt.records.branches)
    yt.records.branches.get(i) === e.id && n.push(i);
  if (ae.debug(n.join(" ")), e.parents && e.parents.length == 2 && e.parents[0] && e.parents[1]) {
    const i = yt.records.commits.get(e.parents[0]);
    m6(t, e, i), e.parents[1] && t.push(yt.records.commits.get(e.parents[1]));
  } else {
    if (e.parents.length == 0)
      return;
    if (e.parents[0]) {
      const i = yt.records.commits.get(e.parents[0]);
      m6(t, e, i);
    }
  }
  t = fH(t, (i) => i.id), HS(t);
}
x(HS, "prettyPrintCommitHistory");
var HSe = /* @__PURE__ */ x(function() {
  ae.debug(yt.records.commits);
  const t = gH()[0];
  HS([t]);
}, "prettyPrint"), qSe = /* @__PURE__ */ x(function() {
  yt.reset(), _n();
}, "clear"), YSe = /* @__PURE__ */ x(function() {
  return [...yt.records.branchConfig.values()].map((e, r) => e.order !== null && e.order !== void 0 ? e : {
    ...e,
    order: parseFloat(`0.${r}`)
  }).sort((e, r) => (e.order ?? 0) - (r.order ?? 0)).map(({ name: e }) => ({ name: e }));
}, "getBranchesAsObjArray"), XSe = /* @__PURE__ */ x(function() {
  return yt.records.branches;
}, "getBranches"), jSe = /* @__PURE__ */ x(function() {
  return yt.records.commits;
}, "getCommits"), gH = /* @__PURE__ */ x(function() {
  const t = [...yt.records.commits.values()];
  return t.forEach(function(e) {
    ae.debug(e.id);
  }), t.sort((e, r) => e.seq - r.seq), t;
}, "getCommitsArray"), KSe = /* @__PURE__ */ x(function() {
  return yt.records.currBranch;
}, "getCurrentBranch"), ZSe = /* @__PURE__ */ x(function() {
  return yt.records.direction;
}, "getDirection"), QSe = /* @__PURE__ */ x(function() {
  return yt.records.head;
}, "getHead"), mH = {
  commitType: Dr,
  getConfig: qu,
  setDirection: FSe,
  setOptions: $Se,
  getOptions: zSe,
  commit: VSe,
  branch: GSe,
  merge: USe,
  cherryPick: WSe,
  checkout: pH,
  //reset,
  prettyPrint: HSe,
  clear: qSe,
  getBranchesAsObjArray: YSe,
  getBranches: XSe,
  getCommits: jSe,
  getCommitsArray: gH,
  getCurrentBranch: KSe,
  getDirection: ZSe,
  getHead: QSe,
  setAccTitle: Cn,
  getAccTitle: Vn,
  getAccDescription: Un,
  setAccDescription: Gn,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln
}, JSe = /* @__PURE__ */ x((t, e) => {
  Vu(t, e), t.dir && e.setDirection(t.dir);
  for (const r of t.statements)
    e7e(r, e);
}, "populate"), e7e = /* @__PURE__ */ x((t, e) => {
  const n = {
    Commit: /* @__PURE__ */ x((i) => e.commit(t7e(i)), "Commit"),
    Branch: /* @__PURE__ */ x((i) => e.branch(r7e(i)), "Branch"),
    Merge: /* @__PURE__ */ x((i) => e.merge(n7e(i)), "Merge"),
    Checkout: /* @__PURE__ */ x((i) => e.checkout(i7e(i)), "Checkout"),
    CherryPicking: /* @__PURE__ */ x((i) => e.cherryPick(a7e(i)), "CherryPicking")
  }[t.$type];
  n ? n(t) : ae.error(`Unknown statement type: ${t.$type}`);
}, "parseStatement"), t7e = /* @__PURE__ */ x((t) => ({
  id: t.id,
  msg: t.message ?? "",
  type: t.type !== void 0 ? Dr[t.type] : Dr.NORMAL,
  tags: t.tags ?? void 0
}), "parseCommit"), r7e = /* @__PURE__ */ x((t) => ({
  name: t.name,
  order: t.order ?? 0
}), "parseBranch"), n7e = /* @__PURE__ */ x((t) => ({
  branch: t.branch,
  id: t.id ?? "",
  type: t.type !== void 0 ? Dr[t.type] : void 0,
  tags: t.tags ?? void 0
}), "parseMerge"), i7e = /* @__PURE__ */ x((t) => t.branch, "parseCheckout"), a7e = /* @__PURE__ */ x((t) => {
  var r;
  return {
    id: t.id,
    targetId: "",
    tags: ((r = t.tags) == null ? void 0 : r.length) === 0 ? void 0 : t.tags,
    parent: t.parent
  };
}, "parseCherryPicking"), s7e = {
  parse: /* @__PURE__ */ x(async (t) => {
    const e = await yc("gitGraph", t);
    ae.debug(e), JSe(e, mH);
  }, "parse")
}, M5 = we(), Sn = M5 == null ? void 0 : M5.gitGraph, Cl = 10, Al = 40, Bs = 4, Lo = 2, $c = 8, la = /* @__PURE__ */ new Map(), ha = /* @__PURE__ */ new Map(), T2 = 30, fp = /* @__PURE__ */ new Map(), E2 = [], yl = 0, dr = "LR", o7e = /* @__PURE__ */ x(() => {
  la.clear(), ha.clear(), fp.clear(), yl = 0, E2 = [], dr = "LR";
}, "clear"), vH = /* @__PURE__ */ x((t) => {
  const e = document.createElementNS("http://www.w3.org/2000/svg", "text");
  return (typeof t == "string" ? t.split(/\\n|\n|<br\s*\/?>/gi) : t).forEach((n) => {
    const i = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
    i.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), i.setAttribute("dy", "1em"), i.setAttribute("x", "0"), i.setAttribute("class", "row"), i.textContent = n.trim(), e.appendChild(i);
  }), e;
}, "drawText"), yH = /* @__PURE__ */ x((t) => {
  let e, r, n;
  return dr === "BT" ? (r = /* @__PURE__ */ x((i, a) => i <= a, "comparisonFunc"), n = 1 / 0) : (r = /* @__PURE__ */ x((i, a) => i >= a, "comparisonFunc"), n = 0), t.forEach((i) => {
    var s, o;
    const a = dr === "TB" || dr == "BT" ? (s = ha.get(i)) == null ? void 0 : s.y : (o = ha.get(i)) == null ? void 0 : o.x;
    a !== void 0 && r(a, n) && (e = i, n = a);
  }), e;
}, "findClosestParent"), l7e = /* @__PURE__ */ x((t) => {
  let e = "", r = 1 / 0;
  return t.forEach((n) => {
    const i = ha.get(n).y;
    i <= r && (e = n, r = i);
  }), e || void 0;
}, "findClosestParentBT"), c7e = /* @__PURE__ */ x((t, e, r) => {
  let n = r, i = r;
  const a = [];
  t.forEach((s) => {
    const o = e.get(s);
    if (!o)
      throw new Error(`Commit not found for key ${s}`);
    o.parents.length ? (n = h7e(o), i = Math.max(n, i)) : a.push(o), d7e(o, n);
  }), n = i, a.forEach((s) => {
    f7e(s, n, r);
  }), t.forEach((s) => {
    const o = e.get(s);
    if (o != null && o.parents.length) {
      const l = l7e(o.parents);
      n = ha.get(l).y - Al, n <= i && (i = n);
      const u = la.get(o.branch).pos, h = n - Cl;
      ha.set(o.id, { x: u, y: h });
    }
  });
}, "setParallelBTPos"), u7e = /* @__PURE__ */ x((t) => {
  var n;
  const e = yH(t.parents.filter((i) => i !== null));
  if (!e)
    throw new Error(`Closest parent not found for commit ${t.id}`);
  const r = (n = ha.get(e)) == null ? void 0 : n.y;
  if (r === void 0)
    throw new Error(`Closest parent position not found for commit ${t.id}`);
  return r;
}, "findClosestParentPos"), h7e = /* @__PURE__ */ x((t) => u7e(t) + Al, "calculateCommitPosition"), d7e = /* @__PURE__ */ x((t, e) => {
  const r = la.get(t.branch);
  if (!r)
    throw new Error(`Branch not found for commit ${t.id}`);
  const n = r.pos, i = e + Cl;
  return ha.set(t.id, { x: n, y: i }), { x: n, y: i };
}, "setCommitPosition"), f7e = /* @__PURE__ */ x((t, e, r) => {
  const n = la.get(t.branch);
  if (!n)
    throw new Error(`Branch not found for commit ${t.id}`);
  const i = e + r, a = n.pos;
  ha.set(t.id, { x: a, y: i });
}, "setRootPosition"), p7e = /* @__PURE__ */ x((t, e, r, n, i, a) => {
  if (a === Dr.HIGHLIGHT)
    t.append("rect").attr("x", r.x - 10).attr("y", r.y - 10).attr("width", 20).attr("height", 20).attr(
      "class",
      `commit ${e.id} commit-highlight${i % $c} ${n}-outer`
    ), t.append("rect").attr("x", r.x - 6).attr("y", r.y - 6).attr("width", 12).attr("height", 12).attr(
      "class",
      `commit ${e.id} commit${i % $c} ${n}-inner`
    );
  else if (a === Dr.CHERRY_PICK)
    t.append("circle").attr("cx", r.x).attr("cy", r.y).attr("r", 10).attr("class", `commit ${e.id} ${n}`), t.append("circle").attr("cx", r.x - 3).attr("cy", r.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${e.id} ${n}`), t.append("circle").attr("cx", r.x + 3).attr("cy", r.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${e.id} ${n}`), t.append("line").attr("x1", r.x + 3).attr("y1", r.y + 1).attr("x2", r.x).attr("y2", r.y - 5).attr("stroke", "#fff").attr("class", `commit ${e.id} ${n}`), t.append("line").attr("x1", r.x - 3).attr("y1", r.y + 1).attr("x2", r.x).attr("y2", r.y - 5).attr("stroke", "#fff").attr("class", `commit ${e.id} ${n}`);
  else {
    const s = t.append("circle");
    if (s.attr("cx", r.x), s.attr("cy", r.y), s.attr("r", e.type === Dr.MERGE ? 9 : 10), s.attr("class", `commit ${e.id} commit${i % $c}`), a === Dr.MERGE) {
      const o = t.append("circle");
      o.attr("cx", r.x), o.attr("cy", r.y), o.attr("r", 6), o.attr(
        "class",
        `commit ${n} ${e.id} commit${i % $c}`
      );
    }
    a === Dr.REVERSE && t.append("path").attr(
      "d",
      `M ${r.x - 5},${r.y - 5}L${r.x + 5},${r.y + 5}M${r.x - 5},${r.y + 5}L${r.x + 5},${r.y - 5}`
    ).attr("class", `commit ${n} ${e.id} commit${i % $c}`);
  }
}, "drawCommitBullet"), g7e = /* @__PURE__ */ x((t, e, r, n) => {
  var i;
  if (e.type !== Dr.CHERRY_PICK && (e.customId && e.type === Dr.MERGE || e.type !== Dr.MERGE) && (Sn != null && Sn.showCommitLabel)) {
    const a = t.append("g"), s = a.insert("rect").attr("class", "commit-label-bkg"), o = a.append("text").attr("x", n).attr("y", r.y + 25).attr("class", "commit-label").text(e.id), l = (i = o.node()) == null ? void 0 : i.getBBox();
    if (l && (s.attr("x", r.posWithOffset - l.width / 2 - Lo).attr("y", r.y + 13.5).attr("width", l.width + 2 * Lo).attr("height", l.height + 2 * Lo), dr === "TB" || dr === "BT" ? (s.attr("x", r.x - (l.width + 4 * Bs + 5)).attr("y", r.y - 12), o.attr("x", r.x - (l.width + 4 * Bs)).attr("y", r.y + l.height - 12)) : o.attr("x", r.posWithOffset - l.width / 2), Sn.rotateCommitLabel))
      if (dr === "TB" || dr === "BT")
        o.attr(
          "transform",
          "rotate(-45, " + r.x + ", " + r.y + ")"
        ), s.attr(
          "transform",
          "rotate(-45, " + r.x + ", " + r.y + ")"
        );
      else {
        const u = -7.5 - (l.width + 10) / 25 * 9.5, h = 10 + l.width / 25 * 8.5;
        a.attr(
          "transform",
          "translate(" + u + ", " + h + ") rotate(-45, " + n + ", " + r.y + ")"
        );
      }
  }
}, "drawCommitLabel"), m7e = /* @__PURE__ */ x((t, e, r, n) => {
  var i;
  if (e.tags.length > 0) {
    let a = 0, s = 0, o = 0;
    const l = [];
    for (const u of e.tags.reverse()) {
      const h = t.insert("polygon"), d = t.append("circle"), f = t.append("text").attr("y", r.y - 16 - a).attr("class", "tag-label").text(u), p = (i = f.node()) == null ? void 0 : i.getBBox();
      if (!p)
        throw new Error("Tag bbox not found");
      s = Math.max(s, p.width), o = Math.max(o, p.height), f.attr("x", r.posWithOffset - p.width / 2), l.push({
        tag: f,
        hole: d,
        rect: h,
        yOffset: a
      }), a += 20;
    }
    for (const { tag: u, hole: h, rect: d, yOffset: f } of l) {
      const p = o / 2, g = r.y - 19.2 - f;
      if (d.attr("class", "tag-label-bkg").attr(
        "points",
        `
      ${n - s / 2 - Bs / 2},${g + Lo}  
      ${n - s / 2 - Bs / 2},${g - Lo}
      ${r.posWithOffset - s / 2 - Bs},${g - p - Lo}
      ${r.posWithOffset + s / 2 + Bs},${g - p - Lo}
      ${r.posWithOffset + s / 2 + Bs},${g + p + Lo}
      ${r.posWithOffset - s / 2 - Bs},${g + p + Lo}`
      ), h.attr("cy", g).attr("cx", n - s / 2 + Bs / 2).attr("r", 1.5).attr("class", "tag-hole"), dr === "TB" || dr === "BT") {
        const m = n + f;
        d.attr("class", "tag-label-bkg").attr(
          "points",
          `
        ${r.x},${m + 2}
        ${r.x},${m - 2}
        ${r.x + Cl},${m - p - 2}
        ${r.x + Cl + s + 4},${m - p - 2}
        ${r.x + Cl + s + 4},${m + p + 2}
        ${r.x + Cl},${m + p + 2}`
        ).attr("transform", "translate(12,12) rotate(45, " + r.x + "," + n + ")"), h.attr("cx", r.x + Bs / 2).attr("cy", m).attr("transform", "translate(12,12) rotate(45, " + r.x + "," + n + ")"), u.attr("x", r.x + 5).attr("y", m + 3).attr("transform", "translate(14,14) rotate(45, " + r.x + "," + n + ")");
      }
    }
  }
}, "drawCommitTags"), v7e = /* @__PURE__ */ x((t) => {
  switch (t.customType ?? t.type) {
    case Dr.NORMAL:
      return "commit-normal";
    case Dr.REVERSE:
      return "commit-reverse";
    case Dr.HIGHLIGHT:
      return "commit-highlight";
    case Dr.MERGE:
      return "commit-merge";
    case Dr.CHERRY_PICK:
      return "commit-cherry-pick";
    default:
      return "commit-normal";
  }
}, "getCommitClassType"), y7e = /* @__PURE__ */ x((t, e, r, n) => {
  const i = { x: 0, y: 0 };
  if (t.parents.length > 0) {
    const a = yH(t.parents);
    if (a) {
      const s = n.get(a) ?? i;
      return e === "TB" ? s.y + Al : e === "BT" ? (n.get(t.id) ?? i).y - Al : s.x + Al;
    }
  } else
    return e === "TB" ? T2 : e === "BT" ? (n.get(t.id) ?? i).y - Al : 0;
  return 0;
}, "calculatePosition"), x7e = /* @__PURE__ */ x((t, e, r) => {
  var s, o;
  const n = dr === "BT" && r ? e : e + Cl, i = dr === "TB" || dr === "BT" ? n : (s = la.get(t.branch)) == null ? void 0 : s.pos, a = dr === "TB" || dr === "BT" ? (o = la.get(t.branch)) == null ? void 0 : o.pos : n;
  if (a === void 0 || i === void 0)
    throw new Error(`Position were undefined for commit ${t.id}`);
  return { x: a, y: i, posWithOffset: n };
}, "getCommitPosition"), fN = /* @__PURE__ */ x((t, e, r) => {
  if (!Sn)
    throw new Error("GitGraph config not found");
  const n = t.append("g").attr("class", "commit-bullets"), i = t.append("g").attr("class", "commit-labels");
  let a = dr === "TB" || dr === "BT" ? T2 : 0;
  const s = [...e.keys()], o = (Sn == null ? void 0 : Sn.parallelCommits) ?? !1, l = /* @__PURE__ */ x((h, d) => {
    var g, m;
    const f = (g = e.get(h)) == null ? void 0 : g.seq, p = (m = e.get(d)) == null ? void 0 : m.seq;
    return f !== void 0 && p !== void 0 ? f - p : 0;
  }, "sortKeys");
  let u = s.sort(l);
  dr === "BT" && (o && c7e(u, e, a), u = u.reverse()), u.forEach((h) => {
    var p;
    const d = e.get(h);
    if (!d)
      throw new Error(`Commit not found for key ${h}`);
    o && (a = y7e(d, dr, a, ha));
    const f = x7e(d, a, o);
    if (r) {
      const g = v7e(d), m = d.customType ?? d.type, v = ((p = la.get(d.branch)) == null ? void 0 : p.index) ?? 0;
      p7e(n, d, f, g, v, m), g7e(i, d, f, a), m7e(i, d, f, a);
    }
    dr === "TB" || dr === "BT" ? ha.set(d.id, { x: f.x, y: f.posWithOffset }) : ha.set(d.id, { x: f.posWithOffset, y: f.y }), a = dr === "BT" && o ? a + Al : a + Al + Cl, a > yl && (yl = a);
  });
}, "drawCommits"), b7e = /* @__PURE__ */ x((t, e, r, n, i) => {
  const s = (dr === "TB" || dr === "BT" ? r.x < n.x : r.y < n.y) ? e.branch : t.branch, o = /* @__PURE__ */ x((u) => u.branch === s, "isOnBranchToGetCurve"), l = /* @__PURE__ */ x((u) => u.seq > t.seq && u.seq < e.seq, "isBetweenCommits");
  return [...i.values()].some((u) => l(u) && o(u));
}, "shouldRerouteArrow"), pp = /* @__PURE__ */ x((t, e, r = 0) => {
  const n = t + Math.abs(t - e) / 2;
  if (r > 5)
    return n;
  if (E2.every((s) => Math.abs(s - n) >= 10))
    return E2.push(n), n;
  const a = Math.abs(t - e);
  return pp(t, e - a / 5, r + 1);
}, "findLane"), w7e = /* @__PURE__ */ x((t, e, r, n) => {
  var p, g, m, v, y;
  const i = ha.get(e.id), a = ha.get(r.id);
  if (i === void 0 || a === void 0)
    throw new Error(`Commit positions not found for commits ${e.id} and ${r.id}`);
  const s = b7e(e, r, i, a, n);
  let o = "", l = "", u = 0, h = 0, d = (p = la.get(r.branch)) == null ? void 0 : p.index;
  r.type === Dr.MERGE && e.id !== r.parents[0] && (d = (g = la.get(e.branch)) == null ? void 0 : g.index);
  let f;
  if (s) {
    o = "A 10 10, 0, 0, 0,", l = "A 10 10, 0, 0, 1,", u = 10, h = 10;
    const b = i.y < a.y ? pp(i.y, a.y) : pp(a.y, i.y), w = i.x < a.x ? pp(i.x, a.x) : pp(a.x, i.x);
    dr === "TB" ? i.x < a.x ? f = `M ${i.x} ${i.y} L ${w - u} ${i.y} ${l} ${w} ${i.y + h} L ${w} ${a.y - u} ${o} ${w + h} ${a.y} L ${a.x} ${a.y}` : (d = (m = la.get(e.branch)) == null ? void 0 : m.index, f = `M ${i.x} ${i.y} L ${w + u} ${i.y} ${o} ${w} ${i.y + h} L ${w} ${a.y - u} ${l} ${w - h} ${a.y} L ${a.x} ${a.y}`) : dr === "BT" ? i.x < a.x ? f = `M ${i.x} ${i.y} L ${w - u} ${i.y} ${o} ${w} ${i.y - h} L ${w} ${a.y + u} ${l} ${w + h} ${a.y} L ${a.x} ${a.y}` : (d = (v = la.get(e.branch)) == null ? void 0 : v.index, f = `M ${i.x} ${i.y} L ${w + u} ${i.y} ${l} ${w} ${i.y - h} L ${w} ${a.y + u} ${o} ${w - h} ${a.y} L ${a.x} ${a.y}`) : i.y < a.y ? f = `M ${i.x} ${i.y} L ${i.x} ${b - u} ${o} ${i.x + h} ${b} L ${a.x - u} ${b} ${l} ${a.x} ${b + h} L ${a.x} ${a.y}` : (d = (y = la.get(e.branch)) == null ? void 0 : y.index, f = `M ${i.x} ${i.y} L ${i.x} ${b + u} ${l} ${i.x + h} ${b} L ${a.x - u} ${b} ${o} ${a.x} ${b - h} L ${a.x} ${a.y}`);
  } else
    o = "A 20 20, 0, 0, 0,", l = "A 20 20, 0, 0, 1,", u = 20, h = 20, dr === "TB" ? (i.x < a.x && (r.type === Dr.MERGE && e.id !== r.parents[0] ? f = `M ${i.x} ${i.y} L ${i.x} ${a.y - u} ${o} ${i.x + h} ${a.y} L ${a.x} ${a.y}` : f = `M ${i.x} ${i.y} L ${a.x - u} ${i.y} ${l} ${a.x} ${i.y + h} L ${a.x} ${a.y}`), i.x > a.x && (o = "A 20 20, 0, 0, 0,", l = "A 20 20, 0, 0, 1,", u = 20, h = 20, r.type === Dr.MERGE && e.id !== r.parents[0] ? f = `M ${i.x} ${i.y} L ${i.x} ${a.y - u} ${l} ${i.x - h} ${a.y} L ${a.x} ${a.y}` : f = `M ${i.x} ${i.y} L ${a.x + u} ${i.y} ${o} ${a.x} ${i.y + h} L ${a.x} ${a.y}`), i.x === a.x && (f = `M ${i.x} ${i.y} L ${a.x} ${a.y}`)) : dr === "BT" ? (i.x < a.x && (r.type === Dr.MERGE && e.id !== r.parents[0] ? f = `M ${i.x} ${i.y} L ${i.x} ${a.y + u} ${l} ${i.x + h} ${a.y} L ${a.x} ${a.y}` : f = `M ${i.x} ${i.y} L ${a.x - u} ${i.y} ${o} ${a.x} ${i.y - h} L ${a.x} ${a.y}`), i.x > a.x && (o = "A 20 20, 0, 0, 0,", l = "A 20 20, 0, 0, 1,", u = 20, h = 20, r.type === Dr.MERGE && e.id !== r.parents[0] ? f = `M ${i.x} ${i.y} L ${i.x} ${a.y + u} ${o} ${i.x - h} ${a.y} L ${a.x} ${a.y}` : f = `M ${i.x} ${i.y} L ${a.x - u} ${i.y} ${o} ${a.x} ${i.y - h} L ${a.x} ${a.y}`), i.x === a.x && (f = `M ${i.x} ${i.y} L ${a.x} ${a.y}`)) : (i.y < a.y && (r.type === Dr.MERGE && e.id !== r.parents[0] ? f = `M ${i.x} ${i.y} L ${a.x - u} ${i.y} ${l} ${a.x} ${i.y + h} L ${a.x} ${a.y}` : f = `M ${i.x} ${i.y} L ${i.x} ${a.y - u} ${o} ${i.x + h} ${a.y} L ${a.x} ${a.y}`), i.y > a.y && (r.type === Dr.MERGE && e.id !== r.parents[0] ? f = `M ${i.x} ${i.y} L ${a.x - u} ${i.y} ${o} ${a.x} ${i.y - h} L ${a.x} ${a.y}` : f = `M ${i.x} ${i.y} L ${i.x} ${a.y + u} ${l} ${i.x + h} ${a.y} L ${a.x} ${a.y}`), i.y === a.y && (f = `M ${i.x} ${i.y} L ${a.x} ${a.y}`));
  if (f === void 0)
    throw new Error("Line definition not found");
  t.append("path").attr("d", f).attr("class", "arrow arrow" + d % $c);
}, "drawArrow"), T7e = /* @__PURE__ */ x((t, e) => {
  const r = t.append("g").attr("class", "commit-arrows");
  [...e.keys()].forEach((n) => {
    const i = e.get(n);
    i.parents && i.parents.length > 0 && i.parents.forEach((a) => {
      w7e(r, e.get(a), i, e);
    });
  });
}, "drawArrows"), E7e = /* @__PURE__ */ x((t, e) => {
  const r = t.append("g");
  e.forEach((n, i) => {
    var g;
    const a = i % $c, s = (g = la.get(n.name)) == null ? void 0 : g.pos;
    if (s === void 0)
      throw new Error(`Position not found for branch ${n.name}`);
    const o = r.append("line");
    o.attr("x1", 0), o.attr("y1", s), o.attr("x2", yl), o.attr("y2", s), o.attr("class", "branch branch" + a), dr === "TB" ? (o.attr("y1", T2), o.attr("x1", s), o.attr("y2", yl), o.attr("x2", s)) : dr === "BT" && (o.attr("y1", yl), o.attr("x1", s), o.attr("y2", T2), o.attr("x2", s)), E2.push(s);
    const l = n.name, u = vH(l), h = r.insert("rect"), f = r.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + a);
    f.node().appendChild(u);
    const p = u.getBBox();
    h.attr("class", "branchLabelBkg label" + a).attr("rx", 4).attr("ry", 4).attr("x", -p.width - 4 - ((Sn == null ? void 0 : Sn.rotateCommitLabel) === !0 ? 30 : 0)).attr("y", -p.height / 2 + 8).attr("width", p.width + 18).attr("height", p.height + 4), f.attr(
      "transform",
      "translate(" + (-p.width - 14 - ((Sn == null ? void 0 : Sn.rotateCommitLabel) === !0 ? 30 : 0)) + ", " + (s - p.height / 2 - 1) + ")"
    ), dr === "TB" ? (h.attr("x", s - p.width / 2 - 10).attr("y", 0), f.attr("transform", "translate(" + (s - p.width / 2 - 5) + ", 0)")) : dr === "BT" ? (h.attr("x", s - p.width / 2 - 10).attr("y", yl), f.attr("transform", "translate(" + (s - p.width / 2 - 5) + ", " + yl + ")")) : h.attr("transform", "translate(-19, " + (s - p.height / 2) + ")");
  });
}, "drawBranches"), k7e = /* @__PURE__ */ x(function(t, e, r, n, i) {
  return la.set(t, { pos: e, index: r }), e += 50 + (i ? 40 : 0) + (dr === "TB" || dr === "BT" ? n.width / 2 : 0), e;
}, "setBranchPosition"), S7e = /* @__PURE__ */ x(function(t, e, r, n) {
  if (o7e(), ae.debug("in gitgraph renderer", t + `
`, "id:", e, r), !Sn)
    throw new Error("GitGraph config not found");
  const i = Sn.rotateCommitLabel ?? !1, a = n.db;
  fp = a.getCommits();
  const s = a.getBranchesAsObjArray();
  dr = a.getDirection();
  const o = Qe(`[id="${e}"]`);
  let l = 0;
  s.forEach((u, h) => {
    var v;
    const d = vH(u.name), f = o.append("g"), p = f.insert("g").attr("class", "branchLabel"), g = p.insert("g").attr("class", "label branch-label");
    (v = g.node()) == null || v.appendChild(d);
    const m = d.getBBox();
    l = k7e(u.name, l, h, m, i), g.remove(), p.remove(), f.remove();
  }), fN(o, fp, !1), Sn.showBranches && E7e(o, s), T7e(o, fp), fN(o, fp, !0), Kt.insertTitle(
    o,
    "gitTitleText",
    Sn.titleTopMargin ?? 0,
    a.getDiagramTitle()
  ), NM(
    void 0,
    o,
    Sn.diagramPadding,
    Sn.useMaxWidth
  );
}, "draw"), C7e = {
  draw: S7e
}, A7e = /* @__PURE__ */ x((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};
  }
`, "getStyles"), _7e = A7e, L7e = {
  parser: s7e,
  db: mH,
  renderer: C7e,
  styles: _7e
};
const R7e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: L7e
}, Symbol.toStringTag, { value: "Module" }));
var xH = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(ro, function() {
    var r = "day";
    return function(n, i, a) {
      var s = function(u) {
        return u.add(4 - u.isoWeekday(), r);
      }, o = i.prototype;
      o.isoWeekYear = function() {
        return s(this).year();
      }, o.isoWeek = function(u) {
        if (!this.$utils().u(u)) return this.add(7 * (u - this.isoWeek()), r);
        var h, d, f, p, g = s(this), m = (h = this.isoWeekYear(), d = this.$u, f = (d ? a.utc : a)().year(h).startOf("year"), p = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (p += 7), f.add(p, r));
        return g.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 d = this.$utils(), f = !!d.u(h) || h;
        return d.p(u) === "isoweek" ? f ? 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);
      };
    };
  });
})(xH);
var N7e = xH.exports;
const M7e = /* @__PURE__ */ bf(N7e);
var bH = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(ro, function() {
    var r = { 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" }, n = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, i = /\d/, a = /\d\d/, s = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, l = {}, u = function(v) {
      return (v = +v) + (v > 68 ? 1900 : 2e3);
    }, h = function(v) {
      return function(y) {
        this[v] = +y;
      };
    }, d = [/[+-]\d\d:?(\d\d)?|Z/, function(v) {
      (this.zone || (this.zone = {})).offset = function(y) {
        if (!y || y === "Z") return 0;
        var b = y.match(/([+-]|\d\d)/g), w = 60 * b[1] + (+b[2] || 0);
        return w === 0 ? 0 : b[0] === "+" ? -w : w;
      }(v);
    }], f = function(v) {
      var y = l[v];
      return y && (y.indexOf ? y : y.s.concat(y.f));
    }, p = function(v, y) {
      var b, w = l.meridiem;
      if (w) {
        for (var T = 1; T <= 24; T += 1) if (v.indexOf(w(T, 0, y)) > -1) {
          b = T > 12;
          break;
        }
      } else b = v === (y ? "pm" : "PM");
      return b;
    }, g = { A: [o, function(v) {
      this.afternoon = p(v, !1);
    }], a: [o, function(v) {
      this.afternoon = p(v, !0);
    }], Q: [i, function(v) {
      this.month = 3 * (v - 1) + 1;
    }], S: [i, function(v) {
      this.milliseconds = 100 * +v;
    }], SS: [a, function(v) {
      this.milliseconds = 10 * +v;
    }], SSS: [/\d{3}/, function(v) {
      this.milliseconds = +v;
    }], s: [s, h("seconds")], ss: [s, h("seconds")], m: [s, h("minutes")], mm: [s, h("minutes")], H: [s, h("hours")], h: [s, h("hours")], HH: [s, h("hours")], hh: [s, h("hours")], D: [s, h("day")], DD: [a, h("day")], Do: [o, function(v) {
      var y = l.ordinal, b = v.match(/\d+/);
      if (this.day = b[0], y) for (var w = 1; w <= 31; w += 1) y(w).replace(/\[|\]/g, "") === v && (this.day = w);
    }], w: [s, h("week")], ww: [a, h("week")], M: [s, h("month")], MM: [a, h("month")], MMM: [o, function(v) {
      var y = f("months"), b = (f("monthsShort") || y.map(function(w) {
        return w.slice(0, 3);
      })).indexOf(v) + 1;
      if (b < 1) throw new Error();
      this.month = b % 12 || b;
    }], MMMM: [o, function(v) {
      var y = f("months").indexOf(v) + 1;
      if (y < 1) throw new Error();
      this.month = y % 12 || y;
    }], Y: [/[+-]?\d+/, h("year")], YY: [a, function(v) {
      this.year = u(v);
    }], YYYY: [/\d{4}/, h("year")], Z: d, ZZ: d };
    function m(v) {
      var y, b;
      y = v, b = l && l.formats;
      for (var w = (v = y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(N, A, O) {
        var P = O && O.toUpperCase();
        return A || b[O] || r[O] || b[P].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(S, R, I) {
          return R || I.slice(1);
        });
      })).match(n), T = w.length, E = 0; E < T; E += 1) {
        var C = w[E], k = g[C], _ = k && k[0], L = k && k[1];
        w[E] = L ? { regex: _, parser: L } : C.replace(/^\[|\]$/g, "");
      }
      return function(N) {
        for (var A = {}, O = 0, P = 0; O < T; O += 1) {
          var S = w[O];
          if (typeof S == "string") P += S.length;
          else {
            var R = S.regex, I = S.parser, D = N.slice(P), M = R.exec(D)[0];
            I.call(A, M), N = N.replace(M, "");
          }
        }
        return function(B) {
          var $ = B.afternoon;
          if ($ !== void 0) {
            var F = B.hours;
            $ ? F < 12 && (B.hours += 12) : F === 12 && (B.hours = 0), delete B.afternoon;
          }
        }(A), A;
      };
    }
    return function(v, y, b) {
      b.p.customParseFormat = !0, v && v.parseTwoDigitYear && (u = v.parseTwoDigitYear);
      var w = y.prototype, T = w.parse;
      w.parse = function(E) {
        var C = E.date, k = E.utc, _ = E.args;
        this.$u = k;
        var L = _[1];
        if (typeof L == "string") {
          var N = _[2] === !0, A = _[3] === !0, O = N || A, P = _[2];
          A && (P = _[2]), l = this.$locale(), !N && P && (l = b.Ls[P]), this.$d = function(D, M, B, $) {
            try {
              if (["x", "X"].indexOf(M) > -1) return new Date((M === "X" ? 1e3 : 1) * D);
              var F = m(M)(D), G = F.year, H = F.month, ee = F.day, Y = F.hours, re = F.minutes, ne = F.seconds, he = F.milliseconds, K = F.zone, Z = F.week, X = /* @__PURE__ */ new Date(), q = ee || (G || H ? 1 : X.getDate()), J = G || X.getFullYear(), j = 0;
              G && !H || (j = H > 0 ? H - 1 : X.getMonth());
              var pe, te = Y || 0, Ae = re || 0, W = ne || 0, Oe = he || 0;
              return K ? new Date(Date.UTC(J, j, q, te, Ae, W, Oe + 60 * K.offset * 1e3)) : B ? new Date(Date.UTC(J, j, q, te, Ae, W, Oe)) : (pe = new Date(J, j, q, te, Ae, W, Oe), Z && (pe = $(pe).week(Z).toDate()), pe);
            } catch {
              return /* @__PURE__ */ new Date("");
            }
          }(C, L, k, b), this.init(), P && P !== !0 && (this.$L = this.locale(P).$L), O && C != this.format(L) && (this.$d = /* @__PURE__ */ new Date("")), l = {};
        } else if (L instanceof Array) for (var S = L.length, R = 1; R <= S; R += 1) {
          _[1] = L[R - 1];
          var I = b.apply(this, _);
          if (I.isValid()) {
            this.$d = I.$d, this.$L = I.$L, this.init();
            break;
          }
          R === S && (this.$d = /* @__PURE__ */ new Date(""));
        }
        else T.call(this, E);
      };
    };
  });
})(bH);
var D7e = bH.exports;
const I7e = /* @__PURE__ */ bf(D7e);
var wH = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(ro, function() {
    return function(r, n) {
      var i = n.prototype, a = i.format;
      i.format = function(s) {
        var o = this, l = this.$locale();
        if (!this.isValid()) return a.bind(this)(s);
        var u = this.$utils(), h = (s || "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(d) {
          switch (d) {
            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(), d === "w" ? 1 : 2, "0");
            case "W":
            case "WW":
              return u.s(o.isoWeek(), d === "W" ? 1 : 2, "0");
            case "k":
            case "kk":
              return u.s(String(o.$H === 0 ? 24 : o.$H), d === "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 d;
          }
        });
        return a.bind(this)(h);
      };
    };
  });
})(wH);
var O7e = wH.exports;
const P7e = /* @__PURE__ */ bf(O7e);
var v6 = function() {
  var t = /* @__PURE__ */ x(function(P, S, R, I) {
    for (R = R || {}, I = P.length; I--; R[P[I]] = S) ;
    return R;
  }, "o"), e = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 38, 40], r = [1, 26], n = [1, 27], i = [1, 28], a = [1, 29], s = [1, 30], o = [1, 31], l = [1, 32], u = [1, 33], h = [1, 34], d = [1, 9], f = [1, 10], p = [1, 11], g = [1, 12], m = [1, 13], v = [1, 14], y = [1, 15], b = [1, 16], w = [1, 19], T = [1, 20], E = [1, 21], C = [1, 22], k = [1, 23], _ = [1, 25], L = [1, 35], N = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    yy: {},
    symbols_: { error: 2, start: 3, gantt: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NL: 10, weekday: 11, weekday_monday: 12, weekday_tuesday: 13, weekday_wednesday: 14, weekday_thursday: 15, weekday_friday: 16, weekday_saturday: 17, weekday_sunday: 18, weekend: 19, weekend_friday: 20, weekend_saturday: 21, dateFormat: 22, inclusiveEndDates: 23, topAxis: 24, axisFormat: 25, tickInterval: 26, excludes: 27, includes: 28, todayMarker: 29, title: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, section: 36, clickStatement: 37, taskTxt: 38, taskData: 39, click: 40, callbackname: 41, callbackargs: 42, href: 43, clickStatementDebug: 44, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "gantt", 6: "EOF", 8: "SPACE", 10: "NL", 12: "weekday_monday", 13: "weekday_tuesday", 14: "weekday_wednesday", 15: "weekday_thursday", 16: "weekday_friday", 17: "weekday_saturday", 18: "weekday_sunday", 20: "weekend_friday", 21: "weekend_saturday", 22: "dateFormat", 23: "inclusiveEndDates", 24: "topAxis", 25: "axisFormat", 26: "tickInterval", 27: "excludes", 28: "includes", 29: "todayMarker", 30: "title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "section", 38: "taskTxt", 39: "taskData", 40: "click", 41: "callbackname", 42: "callbackargs", 43: "href" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [19, 1], [19, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [37, 2], [37, 3], [37, 3], [37, 4], [37, 3], [37, 4], [37, 2], [44, 2], [44, 3], [44, 3], [44, 4], [44, 3], [44, 4], [44, 2]],
    performAction: /* @__PURE__ */ x(function(S, R, I, D, M, B, $) {
      var F = B.length - 1;
      switch (M) {
        case 1:
          return B[F - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          B[F - 1].push(B[F]), this.$ = B[F - 1];
          break;
        case 4:
        case 5:
          this.$ = B[F];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          D.setWeekday("monday");
          break;
        case 9:
          D.setWeekday("tuesday");
          break;
        case 10:
          D.setWeekday("wednesday");
          break;
        case 11:
          D.setWeekday("thursday");
          break;
        case 12:
          D.setWeekday("friday");
          break;
        case 13:
          D.setWeekday("saturday");
          break;
        case 14:
          D.setWeekday("sunday");
          break;
        case 15:
          D.setWeekend("friday");
          break;
        case 16:
          D.setWeekend("saturday");
          break;
        case 17:
          D.setDateFormat(B[F].substr(11)), this.$ = B[F].substr(11);
          break;
        case 18:
          D.enableInclusiveEndDates(), this.$ = B[F].substr(18);
          break;
        case 19:
          D.TopAxis(), this.$ = B[F].substr(8);
          break;
        case 20:
          D.setAxisFormat(B[F].substr(11)), this.$ = B[F].substr(11);
          break;
        case 21:
          D.setTickInterval(B[F].substr(13)), this.$ = B[F].substr(13);
          break;
        case 22:
          D.setExcludes(B[F].substr(9)), this.$ = B[F].substr(9);
          break;
        case 23:
          D.setIncludes(B[F].substr(9)), this.$ = B[F].substr(9);
          break;
        case 24:
          D.setTodayMarker(B[F].substr(12)), this.$ = B[F].substr(12);
          break;
        case 27:
          D.setDiagramTitle(B[F].substr(6)), this.$ = B[F].substr(6);
          break;
        case 28:
          this.$ = B[F].trim(), D.setAccTitle(this.$);
          break;
        case 29:
        case 30:
          this.$ = B[F].trim(), D.setAccDescription(this.$);
          break;
        case 31:
          D.addSection(B[F].substr(8)), this.$ = B[F].substr(8);
          break;
        case 33:
          D.addTask(B[F - 1], B[F]), this.$ = "task";
          break;
        case 34:
          this.$ = B[F - 1], D.setClickEvent(B[F - 1], B[F], null);
          break;
        case 35:
          this.$ = B[F - 2], D.setClickEvent(B[F - 2], B[F - 1], B[F]);
          break;
        case 36:
          this.$ = B[F - 2], D.setClickEvent(B[F - 2], B[F - 1], null), D.setLink(B[F - 2], B[F]);
          break;
        case 37:
          this.$ = B[F - 3], D.setClickEvent(B[F - 3], B[F - 2], B[F - 1]), D.setLink(B[F - 3], B[F]);
          break;
        case 38:
          this.$ = B[F - 2], D.setClickEvent(B[F - 2], B[F], null), D.setLink(B[F - 2], B[F - 1]);
          break;
        case 39:
          this.$ = B[F - 3], D.setClickEvent(B[F - 3], B[F - 1], B[F]), D.setLink(B[F - 3], B[F - 2]);
          break;
        case 40:
          this.$ = B[F - 1], D.setLink(B[F - 1], B[F]);
          break;
        case 41:
        case 47:
          this.$ = B[F - 1] + " " + B[F];
          break;
        case 42:
        case 43:
        case 45:
          this.$ = B[F - 2] + " " + B[F - 1] + " " + B[F];
          break;
        case 44:
        case 46:
          this.$ = B[F - 3] + " " + B[F - 2] + " " + B[F - 1] + " " + B[F];
          break;
      }
    }, "anonymous"),
    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: r, 13: n, 14: i, 15: a, 16: s, 17: o, 18: l, 19: 18, 20: u, 21: h, 22: d, 23: f, 24: p, 25: g, 26: m, 27: v, 28: y, 29: b, 30: w, 31: T, 33: E, 35: C, 36: k, 37: 24, 38: _, 40: L }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 36, 11: 17, 12: r, 13: n, 14: i, 15: a, 16: s, 17: o, 18: l, 19: 18, 20: u, 21: h, 22: d, 23: f, 24: p, 25: g, 26: m, 27: v, 28: y, 29: b, 30: w, 31: T, 33: E, 35: C, 36: k, 37: 24, 38: _, 40: L }, t(e, [2, 5]), t(e, [2, 6]), 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]), t(e, [2, 25]), t(e, [2, 26]), t(e, [2, 27]), { 32: [1, 37] }, { 34: [1, 38] }, t(e, [2, 30]), t(e, [2, 31]), t(e, [2, 32]), { 39: [1, 39] }, 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]), t(e, [2, 15]), t(e, [2, 16]), { 41: [1, 40], 43: [1, 41] }, t(e, [2, 4]), t(e, [2, 28]), t(e, [2, 29]), t(e, [2, 33]), t(e, [2, 34], { 42: [1, 42], 43: [1, 43] }), t(e, [2, 40], { 41: [1, 44] }), t(e, [2, 35], { 43: [1, 45] }), t(e, [2, 36]), t(e, [2, 38], { 42: [1, 46] }), t(e, [2, 37]), t(e, [2, 39])],
    defaultActions: {},
    parseError: /* @__PURE__ */ x(function(S, R) {
      if (R.recoverable)
        this.trace(S);
      else {
        var I = new Error(S);
        throw I.hash = R, I;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(S) {
      var R = this, I = [0], D = [], M = [null], B = [], $ = this.table, F = "", G = 0, H = 0, ee = 2, Y = 1, re = B.slice.call(arguments, 1), ne = Object.create(this.lexer), he = { yy: {} };
      for (var K in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, K) && (he.yy[K] = this.yy[K]);
      ne.setInput(S, he.yy), he.yy.lexer = ne, he.yy.parser = this, typeof ne.yylloc > "u" && (ne.yylloc = {});
      var Z = ne.yylloc;
      B.push(Z);
      var X = ne.options && ne.options.ranges;
      typeof he.yy.parseError == "function" ? this.parseError = he.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function q(ke) {
        I.length = I.length - 2 * ke, M.length = M.length - ke, B.length = B.length - ke;
      }
      x(q, "popStack");
      function J() {
        var ke;
        return ke = D.pop() || ne.lex() || Y, typeof ke != "number" && (ke instanceof Array && (D = ke, ke = D.pop()), ke = R.symbols_[ke] || ke), ke;
      }
      x(J, "lex");
      for (var j, pe, te, Ae, W = {}, Oe, ue, Ve, Ge; ; ) {
        if (pe = I[I.length - 1], this.defaultActions[pe] ? te = this.defaultActions[pe] : ((j === null || typeof j > "u") && (j = J()), te = $[pe] && $[pe][j]), typeof te > "u" || !te.length || !te[0]) {
          var Ue = "";
          Ge = [];
          for (Oe in $[pe])
            this.terminals_[Oe] && Oe > ee && Ge.push("'" + this.terminals_[Oe] + "'");
          ne.showPosition ? Ue = "Parse error on line " + (G + 1) + `:
` + ne.showPosition() + `
Expecting ` + Ge.join(", ") + ", got '" + (this.terminals_[j] || j) + "'" : Ue = "Parse error on line " + (G + 1) + ": Unexpected " + (j == Y ? "end of input" : "'" + (this.terminals_[j] || j) + "'"), this.parseError(Ue, {
            text: ne.match,
            token: this.terminals_[j] || j,
            line: ne.yylineno,
            loc: Z,
            expected: Ge
          });
        }
        if (te[0] instanceof Array && te.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + pe + ", token: " + j);
        switch (te[0]) {
          case 1:
            I.push(j), M.push(ne.yytext), B.push(ne.yylloc), I.push(te[1]), j = null, H = ne.yyleng, F = ne.yytext, G = ne.yylineno, Z = ne.yylloc;
            break;
          case 2:
            if (ue = this.productions_[te[1]][1], W.$ = M[M.length - ue], W._$ = {
              first_line: B[B.length - (ue || 1)].first_line,
              last_line: B[B.length - 1].last_line,
              first_column: B[B.length - (ue || 1)].first_column,
              last_column: B[B.length - 1].last_column
            }, X && (W._$.range = [
              B[B.length - (ue || 1)].range[0],
              B[B.length - 1].range[1]
            ]), Ae = this.performAction.apply(W, [
              F,
              H,
              G,
              he.yy,
              te[1],
              M,
              B
            ].concat(re)), typeof Ae < "u")
              return Ae;
            ue && (I = I.slice(0, -1 * ue * 2), M = M.slice(0, -1 * ue), B = B.slice(0, -1 * ue)), I.push(this.productions_[te[1]][0]), M.push(W.$), B.push(W._$), Ve = $[I[I.length - 2]][I[I.length - 1]], I.push(Ve);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, A = /* @__PURE__ */ function() {
    var P = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(R, I) {
        if (this.yy.parser)
          this.yy.parser.parseError(R, I);
        else
          throw new Error(R);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(S, R) {
        return this.yy = R || this.yy || {}, this._input = S, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var S = this._input[0];
        this.yytext += S, this.yyleng++, this.offset++, this.match += S, this.matched += S;
        var R = S.match(/(?:\r\n?|\n).*/g);
        return R ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), S;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(S) {
        var R = S.length, I = S.split(/(?:\r\n?|\n)/g);
        this._input = S + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - R), this.offset -= R;
        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), I.length - 1 && (this.yylineno -= I.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: I ? (I.length === D.length ? this.yylloc.first_column : 0) + D[D.length - I.length].length - I[0].length : this.yylloc.first_column - R
        }, this.options.ranges && (this.yylloc.range = [M[0], M[0] + this.yyleng - R]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(S) {
        this.unput(this.match.slice(S));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var S = this.matched.substr(0, this.matched.length - this.match.length);
        return (S.length > 20 ? "..." : "") + S.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var S = this.match;
        return S.length < 20 && (S += this._input.substr(0, 20 - S.length)), (S.substr(0, 20) + (S.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var S = this.pastInput(), R = new Array(S.length + 1).join("-");
        return S + this.upcomingInput() + `
` + R + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(S, R) {
        var I, D, 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))), D = S[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 + S[0].length
        }, this.yytext += S[0], this.match += S[0], this.matches = S, 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(S[0].length), this.matched += S[0], I = this.performAction.call(this, this.yy, this, R, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), I)
          return I;
        if (this._backtrack) {
          for (var B in M)
            this[B] = M[B];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var S, R, I, D;
        this._more || (this.yytext = "", this.match = "");
        for (var M = this._currentRules(), B = 0; B < M.length; B++)
          if (I = this._input.match(this.rules[M[B]]), I && (!R || I[0].length > R[0].length)) {
            if (R = I, D = B, this.options.backtrack_lexer) {
              if (S = this.test_match(I, M[B]), S !== !1)
                return S;
              if (this._backtrack) {
                R = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return R ? (S = this.test_match(R, M[D]), S !== !1 ? S : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var R = this.next();
        return R || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(R) {
        this.conditionStack.push(R);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var R = this.conditionStack.length - 1;
        return R > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(R) {
        return R = this.conditionStack.length - 1 - Math.abs(R || 0), R >= 0 ? this.conditionStack[R] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(R) {
        this.begin(R);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(R, I, D, M) {
        switch (D) {
          case 0:
            return this.begin("open_directive"), "open_directive";
          case 1:
            return this.begin("acc_title"), 31;
          case 2:
            return this.popState(), "acc_title_value";
          case 3:
            return this.begin("acc_descr"), 33;
          case 4:
            return this.popState(), "acc_descr_value";
          case 5:
            this.begin("acc_descr_multiline");
            break;
          case 6:
            this.popState();
            break;
          case 7:
            return "acc_descr_multiline_value";
          case 8:
            break;
          case 9:
            break;
          case 10:
            break;
          case 11:
            return 10;
          case 12:
            break;
          case 13:
            break;
          case 14:
            this.begin("href");
            break;
          case 15:
            this.popState();
            break;
          case 16:
            return 43;
          case 17:
            this.begin("callbackname");
            break;
          case 18:
            this.popState();
            break;
          case 19:
            this.popState(), this.begin("callbackargs");
            break;
          case 20:
            return 41;
          case 21:
            this.popState();
            break;
          case 22:
            return 42;
          case 23:
            this.begin("click");
            break;
          case 24:
            this.popState();
            break;
          case 25:
            return 40;
          case 26:
            return 4;
          case 27:
            return 22;
          case 28:
            return 23;
          case 29:
            return 24;
          case 30:
            return 25;
          case 31:
            return 26;
          case 32:
            return 28;
          case 33:
            return 27;
          case 34:
            return 29;
          case 35:
            return 12;
          case 36:
            return 13;
          case 37:
            return 14;
          case 38:
            return 15;
          case 39:
            return 16;
          case 40:
            return 17;
          case 41:
            return 18;
          case 42:
            return 20;
          case 43:
            return 21;
          case 44:
            return "date";
          case 45:
            return 30;
          case 46:
            return "accDescription";
          case 47:
            return 36;
          case 48:
            return 38;
          case 49:
            return 39;
          case 50:
            return ":";
          case 51:
            return 6;
          case 52:
            return "INVALID";
        }
      }, "anonymous"),
      rules: [/^(?:%%\{)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%(?!\{)*[^\n]*)/i, /^(?:[^\}]%%*[^\n]*)/i, /^(?:%%*[^\n]*[\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:%[^\n]*)/i, /^(?:href[\s]+["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:call[\s]+)/i, /^(?:\([\s]*\))/i, /^(?:\()/i, /^(?:[^(]*)/i, /^(?:\))/i, /^(?:[^)]*)/i, /^(?:click[\s]+)/i, /^(?:[\s\n])/i, /^(?:[^\s\n]*)/i, /^(?:gantt\b)/i, /^(?:dateFormat\s[^#\n;]+)/i, /^(?:inclusiveEndDates\b)/i, /^(?:topAxis\b)/i, /^(?:axisFormat\s[^#\n;]+)/i, /^(?:tickInterval\s[^#\n;]+)/i, /^(?:includes\s[^#\n;]+)/i, /^(?:excludes\s[^#\n;]+)/i, /^(?:todayMarker\s[^\n;]+)/i, /^(?:weekday\s+monday\b)/i, /^(?:weekday\s+tuesday\b)/i, /^(?:weekday\s+wednesday\b)/i, /^(?:weekday\s+thursday\b)/i, /^(?:weekday\s+friday\b)/i, /^(?:weekday\s+saturday\b)/i, /^(?:weekday\s+sunday\b)/i, /^(?:weekend\s+friday\b)/i, /^(?:weekend\s+saturday\b)/i, /^(?:\d\d\d\d-\d\d-\d\d\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accDescription\s[^#\n;]+)/i, /^(?:section\s[^\n]+)/i, /^(?:[^:\n]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { acc_descr_multiline: { rules: [6, 7], inclusive: !1 }, acc_descr: { rules: [4], inclusive: !1 }, acc_title: { rules: [2], inclusive: !1 }, callbackargs: { rules: [21, 22], inclusive: !1 }, callbackname: { rules: [18, 19, 20], inclusive: !1 }, href: { rules: [15, 16], inclusive: !1 }, click: { rules: [24, 25], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 17, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52], inclusive: !0 } }
    };
    return P;
  }();
  N.lexer = A;
  function O() {
    this.yy = {};
  }
  return x(O, "Parser"), O.prototype = N, N.Parser = O, new O();
}();
v6.parser = v6;
var B7e = v6;
Ti.extend(M7e);
Ti.extend(I7e);
Ti.extend(P7e);
var pN = { friday: 5, saturday: 6 }, Ys = "", qS = "", YS = void 0, XS = "", m1 = [], v1 = [], jS = /* @__PURE__ */ new Map(), KS = [], k2 = [], gf = "", ZS = "", TH = ["active", "done", "crit", "milestone", "vert"], QS = [], y1 = !1, JS = !1, e7 = "sunday", S2 = "saturday", y6 = 0, F7e = /* @__PURE__ */ x(function() {
  KS = [], k2 = [], gf = "", QS = [], _v = 0, b6 = void 0, Lv = void 0, Mn = [], Ys = "", qS = "", ZS = "", YS = void 0, XS = "", m1 = [], v1 = [], y1 = !1, JS = !1, y6 = 0, jS = /* @__PURE__ */ new Map(), _n(), e7 = "sunday", S2 = "saturday";
}, "clear"), $7e = /* @__PURE__ */ x(function(t) {
  qS = t;
}, "setAxisFormat"), z7e = /* @__PURE__ */ x(function() {
  return qS;
}, "getAxisFormat"), V7e = /* @__PURE__ */ x(function(t) {
  YS = t;
}, "setTickInterval"), G7e = /* @__PURE__ */ x(function() {
  return YS;
}, "getTickInterval"), U7e = /* @__PURE__ */ x(function(t) {
  XS = t;
}, "setTodayMarker"), W7e = /* @__PURE__ */ x(function() {
  return XS;
}, "getTodayMarker"), H7e = /* @__PURE__ */ x(function(t) {
  Ys = t;
}, "setDateFormat"), q7e = /* @__PURE__ */ x(function() {
  y1 = !0;
}, "enableInclusiveEndDates"), Y7e = /* @__PURE__ */ x(function() {
  return y1;
}, "endDatesAreInclusive"), X7e = /* @__PURE__ */ x(function() {
  JS = !0;
}, "enableTopAxis"), j7e = /* @__PURE__ */ x(function() {
  return JS;
}, "topAxisEnabled"), K7e = /* @__PURE__ */ x(function(t) {
  ZS = t;
}, "setDisplayMode"), Z7e = /* @__PURE__ */ x(function() {
  return ZS;
}, "getDisplayMode"), Q7e = /* @__PURE__ */ x(function() {
  return Ys;
}, "getDateFormat"), J7e = /* @__PURE__ */ x(function(t) {
  m1 = t.toLowerCase().split(/[\s,]+/);
}, "setIncludes"), eCe = /* @__PURE__ */ x(function() {
  return m1;
}, "getIncludes"), tCe = /* @__PURE__ */ x(function(t) {
  v1 = t.toLowerCase().split(/[\s,]+/);
}, "setExcludes"), rCe = /* @__PURE__ */ x(function() {
  return v1;
}, "getExcludes"), nCe = /* @__PURE__ */ x(function() {
  return jS;
}, "getLinks"), iCe = /* @__PURE__ */ x(function(t) {
  gf = t, KS.push(t);
}, "addSection"), aCe = /* @__PURE__ */ x(function() {
  return KS;
}, "getSections"), sCe = /* @__PURE__ */ x(function() {
  let t = gN();
  const e = 10;
  let r = 0;
  for (; !t && r < e; )
    t = gN(), r++;
  return k2 = Mn, k2;
}, "getTasks"), EH = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = t.format(e.trim()), a = t.format("YYYY-MM-DD");
  return n.includes(i) || n.includes(a) ? !1 : r.includes("weekends") && (t.isoWeekday() === pN[S2] || t.isoWeekday() === pN[S2] + 1) || r.includes(t.format("dddd").toLowerCase()) ? !0 : r.includes(i) || r.includes(a);
}, "isInvalidDate"), oCe = /* @__PURE__ */ x(function(t) {
  e7 = t;
}, "setWeekday"), lCe = /* @__PURE__ */ x(function() {
  return e7;
}, "getWeekday"), cCe = /* @__PURE__ */ x(function(t) {
  S2 = t;
}, "setWeekend"), kH = /* @__PURE__ */ x(function(t, e, r, n) {
  if (!r.length || t.manualEndTime)
    return;
  let i;
  t.startTime instanceof Date ? i = Ti(t.startTime) : i = Ti(t.startTime, e, !0), i = i.add(1, "d");
  let a;
  t.endTime instanceof Date ? a = Ti(t.endTime) : a = Ti(t.endTime, e, !0);
  const [s, o] = uCe(
    i,
    a,
    e,
    r,
    n
  );
  t.endTime = s.toDate(), t.renderEndTime = o;
}, "checkTaskDates"), uCe = /* @__PURE__ */ x(function(t, e, r, n, i) {
  let a = !1, s = null;
  for (; t <= e; )
    a || (s = e.toDate()), a = EH(t, r, n, i), a && (e = e.add(1, "d")), t = t.add(1, "d");
  return [e, s];
}, "fixTaskDates"), x6 = /* @__PURE__ */ x(function(t, e, r) {
  if (r = r.trim(), (e.trim() === "x" || e.trim() === "X") && /^\d+$/.test(r))
    return new Date(Number(r));
  const i = /^after\s+(?<ids>[\d\w- ]+)/.exec(r);
  if (i !== null) {
    let s = null;
    for (const l of i.groups.ids.split(" ")) {
      let u = Yu(l);
      u !== void 0 && (!s || u.endTime > s.endTime) && (s = u);
    }
    if (s)
      return s.endTime;
    const o = /* @__PURE__ */ new Date();
    return o.setHours(0, 0, 0, 0), o;
  }
  let a = Ti(r, e.trim(), !0);
  if (a.isValid())
    return a.toDate();
  {
    ae.debug("Invalid date:" + r), ae.debug("With date format:" + e.trim());
    const s = new Date(r);
    if (s === void 0 || isNaN(s.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.
    s.getFullYear() < -1e4 || s.getFullYear() > 1e4)
      throw new Error("Invalid date:" + r);
    return s;
  }
}, "getStartDate"), SH = /* @__PURE__ */ x(function(t) {
  const e = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());
  return e !== null ? [Number.parseFloat(e[1]), e[2]] : [NaN, "ms"];
}, "parseDuration"), CH = /* @__PURE__ */ x(function(t, e, r, n = !1) {
  r = r.trim();
  const a = /^until\s+(?<ids>[\d\w- ]+)/.exec(r);
  if (a !== null) {
    let h = null;
    for (const f of a.groups.ids.split(" ")) {
      let p = Yu(f);
      p !== void 0 && (!h || p.startTime < h.startTime) && (h = p);
    }
    if (h)
      return h.startTime;
    const d = /* @__PURE__ */ new Date();
    return d.setHours(0, 0, 0, 0), d;
  }
  let s = Ti(r, e.trim(), !0);
  if (s.isValid())
    return n && (s = s.add(1, "d")), s.toDate();
  let o = Ti(t);
  const [l, u] = SH(r);
  if (!Number.isNaN(l)) {
    const h = o.add(l, u);
    h.isValid() && (o = h);
  }
  return o.toDate();
}, "getEndDate"), _v = 0, Vh = /* @__PURE__ */ x(function(t) {
  return t === void 0 ? (_v = _v + 1, "task" + _v) : t;
}, "parseId"), hCe = /* @__PURE__ */ x(function(t, e) {
  let r;
  e.substr(0, 1) === ":" ? r = e.substr(1, e.length) : r = e;
  const n = r.split(","), i = {};
  t7(n, i, TH);
  for (let s = 0; s < n.length; s++)
    n[s] = n[s].trim();
  let a = "";
  switch (n.length) {
    case 1:
      i.id = Vh(), i.startTime = t.endTime, a = n[0];
      break;
    case 2:
      i.id = Vh(), i.startTime = x6(void 0, Ys, n[0]), a = n[1];
      break;
    case 3:
      i.id = Vh(n[0]), i.startTime = x6(void 0, Ys, n[1]), a = n[2];
      break;
  }
  return a && (i.endTime = CH(i.startTime, Ys, a, y1), i.manualEndTime = Ti(a, "YYYY-MM-DD", !0).isValid(), kH(i, Ys, v1, m1)), i;
}, "compileData"), dCe = /* @__PURE__ */ x(function(t, e) {
  let r;
  e.substr(0, 1) === ":" ? r = e.substr(1, e.length) : r = e;
  const n = r.split(","), i = {};
  t7(n, i, TH);
  for (let a = 0; a < n.length; a++)
    n[a] = n[a].trim();
  switch (n.length) {
    case 1:
      i.id = Vh(), i.startTime = {
        type: "prevTaskEnd",
        id: t
      }, i.endTime = {
        data: n[0]
      };
      break;
    case 2:
      i.id = Vh(), i.startTime = {
        type: "getStartDate",
        startData: n[0]
      }, i.endTime = {
        data: n[1]
      };
      break;
    case 3:
      i.id = Vh(n[0]), i.startTime = {
        type: "getStartDate",
        startData: n[1]
      }, i.endTime = {
        data: n[2]
      };
      break;
  }
  return i;
}, "parseData"), b6, Lv, Mn = [], AH = {}, fCe = /* @__PURE__ */ x(function(t, e) {
  const r = {
    section: gf,
    type: gf,
    processed: !1,
    manualEndTime: !1,
    renderEndTime: null,
    raw: { data: e },
    task: t,
    classes: []
  }, n = dCe(Lv, e);
  r.raw.startTime = n.startTime, r.raw.endTime = n.endTime, r.id = n.id, r.prevTaskId = Lv, r.active = n.active, r.done = n.done, r.crit = n.crit, r.milestone = n.milestone, r.vert = n.vert, r.order = y6, y6++;
  const i = Mn.push(r);
  Lv = r.id, AH[r.id] = i - 1;
}, "addTask"), Yu = /* @__PURE__ */ x(function(t) {
  const e = AH[t];
  return Mn[e];
}, "findTaskById"), pCe = /* @__PURE__ */ x(function(t, e) {
  const r = {
    section: gf,
    type: gf,
    description: t,
    task: t,
    classes: []
  }, n = hCe(b6, e);
  r.startTime = n.startTime, r.endTime = n.endTime, r.id = n.id, r.active = n.active, r.done = n.done, r.crit = n.crit, r.milestone = n.milestone, r.vert = n.vert, b6 = r, k2.push(r);
}, "addTaskOrg"), gN = /* @__PURE__ */ x(function() {
  const t = /* @__PURE__ */ x(function(r) {
    const n = Mn[r];
    let i = "";
    switch (Mn[r].raw.startTime.type) {
      case "prevTaskEnd": {
        const a = Yu(n.prevTaskId);
        n.startTime = a.endTime;
        break;
      }
      case "getStartDate":
        i = x6(void 0, Ys, Mn[r].raw.startTime.startData), i && (Mn[r].startTime = i);
        break;
    }
    return Mn[r].startTime && (Mn[r].endTime = CH(
      Mn[r].startTime,
      Ys,
      Mn[r].raw.endTime.data,
      y1
    ), Mn[r].endTime && (Mn[r].processed = !0, Mn[r].manualEndTime = Ti(
      Mn[r].raw.endTime.data,
      "YYYY-MM-DD",
      !0
    ).isValid(), kH(Mn[r], Ys, v1, m1))), Mn[r].processed;
  }, "compileTask");
  let e = !0;
  for (const [r, n] of Mn.entries())
    t(r), e = e && n.processed;
  return e;
}, "compileTasks"), gCe = /* @__PURE__ */ x(function(t, e) {
  let r = e;
  we().securityLevel !== "loose" && (r = rc(e)), t.split(",").forEach(function(n) {
    Yu(n) !== void 0 && (LH(n, () => {
      window.open(r, "_self");
    }), jS.set(n, r));
  }), _H(t, "clickable");
}, "setLink"), _H = /* @__PURE__ */ x(function(t, e) {
  t.split(",").forEach(function(r) {
    let n = Yu(r);
    n !== void 0 && n.classes.push(e);
  });
}, "setClass"), mCe = /* @__PURE__ */ x(function(t, e, r) {
  if (we().securityLevel !== "loose" || e === void 0)
    return;
  let n = [];
  if (typeof r == "string") {
    n = r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
    for (let a = 0; a < n.length; a++) {
      let s = n[a].trim();
      s.startsWith('"') && s.endsWith('"') && (s = s.substr(1, s.length - 2)), n[a] = s;
    }
  }
  n.length === 0 && n.push(t), Yu(t) !== void 0 && LH(t, () => {
    Kt.runFunc(e, ...n);
  });
}, "setClickFun"), LH = /* @__PURE__ */ x(function(t, e) {
  QS.push(
    function() {
      const r = document.querySelector(`[id="${t}"]`);
      r !== null && r.addEventListener("click", function() {
        e();
      });
    },
    function() {
      const r = document.querySelector(`[id="${t}-text"]`);
      r !== null && r.addEventListener("click", function() {
        e();
      });
    }
  );
}, "pushFun"), vCe = /* @__PURE__ */ x(function(t, e, r) {
  t.split(",").forEach(function(n) {
    mCe(n, e, r);
  }), _H(t, "clickable");
}, "setClickEvent"), yCe = /* @__PURE__ */ x(function(t) {
  QS.forEach(function(e) {
    e(t);
  });
}, "bindFunctions"), xCe = {
  getConfig: /* @__PURE__ */ x(() => we().gantt, "getConfig"),
  clear: F7e,
  setDateFormat: H7e,
  getDateFormat: Q7e,
  enableInclusiveEndDates: q7e,
  endDatesAreInclusive: Y7e,
  enableTopAxis: X7e,
  topAxisEnabled: j7e,
  setAxisFormat: $7e,
  getAxisFormat: z7e,
  setTickInterval: V7e,
  getTickInterval: G7e,
  setTodayMarker: U7e,
  getTodayMarker: W7e,
  setAccTitle: Cn,
  getAccTitle: Vn,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln,
  setDisplayMode: K7e,
  getDisplayMode: Z7e,
  setAccDescription: Gn,
  getAccDescription: Un,
  addSection: iCe,
  getSections: aCe,
  getTasks: sCe,
  addTask: fCe,
  findTaskById: Yu,
  addTaskOrg: pCe,
  setIncludes: J7e,
  getIncludes: eCe,
  setExcludes: tCe,
  getExcludes: rCe,
  setClickEvent: vCe,
  setLink: gCe,
  getLinks: nCe,
  bindFunctions: yCe,
  parseDuration: SH,
  isInvalidDate: EH,
  setWeekday: oCe,
  getWeekday: lCe,
  setWeekend: cCe
};
function t7(t, e, r) {
  let n = !0;
  for (; n; )
    n = !1, r.forEach(function(i) {
      const a = "^\\s*" + i + "\\s*$", s = new RegExp(a);
      t[0].match(s) && (e[i] = !0, t.shift(1), n = !0);
    });
}
x(t7, "getTaskTags");
var bCe = /* @__PURE__ */ x(function() {
  ae.debug("Something is calling, setConf, remove the call");
}, "setConf"), mN = {
  monday: $p,
  tuesday: vD,
  wednesday: yD,
  thursday: ou,
  friday: xD,
  saturday: bD,
  sunday: Mg
}, wCe = /* @__PURE__ */ x((t, e) => {
  let r = [...t].map(() => -1 / 0), n = [...t].sort((a, s) => a.startTime - s.startTime || a.order - s.order), i = 0;
  for (const a of n)
    for (let s = 0; s < r.length; s++)
      if (a.startTime >= r[s]) {
        r[s] = a.endTime, a.order = s + e, s > i && (i = s);
        break;
      }
  return i;
}, "getMaxIntersections"), xo, TCe = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = we().gantt, a = we().securityLevel;
  let s;
  a === "sandbox" && (s = Qe("#i" + e));
  const o = Qe(a === "sandbox" ? s.nodes()[0].contentDocument.body : "body"), l = a === "sandbox" ? s.nodes()[0].contentDocument : document, u = l.getElementById(e);
  xo = u.parentElement.offsetWidth, xo === void 0 && (xo = 1200), i.useWidth !== void 0 && (xo = i.useWidth);
  const h = n.db.getTasks();
  let d = [];
  for (const _ of h)
    d.push(_.type);
  d = k(d);
  const f = {};
  let p = 2 * i.topPadding;
  if (n.db.getDisplayMode() === "compact" || i.displayMode === "compact") {
    const _ = {};
    for (const N of h)
      _[N.section] === void 0 ? _[N.section] = [N] : _[N.section].push(N);
    let L = 0;
    for (const N of Object.keys(_)) {
      const A = wCe(_[N], L) + 1;
      L += A, p += A * (i.barHeight + i.barGap), f[N] = A;
    }
  } else {
    p += h.length * (i.barHeight + i.barGap);
    for (const _ of d)
      f[_] = h.filter((L) => L.type === _).length;
  }
  u.setAttribute("viewBox", "0 0 " + xo + " " + p);
  const g = o.select(`[id="${e}"]`), m = wte().domain([
    _j(h, function(_) {
      return _.startTime;
    }),
    Aj(h, function(_) {
      return _.endTime;
    })
  ]).rangeRound([0, xo - i.leftPadding - i.rightPadding]);
  function v(_, L) {
    const N = _.startTime, A = L.startTime;
    let O = 0;
    return N > A ? O = 1 : N < A && (O = -1), O;
  }
  x(v, "taskCompare"), h.sort(v), y(h, xo, p), Ki(g, p, xo, i.useMaxWidth), g.append("text").text(n.db.getDiagramTitle()).attr("x", xo / 2).attr("y", i.titleTopMargin).attr("class", "titleText");
  function y(_, L, N) {
    const A = i.barHeight, O = A + i.barGap, P = i.topPadding, S = i.leftPadding, R = qd().domain([0, d.length]).range(["#00B9FA", "#F95002"]).interpolate(ZZ);
    w(
      O,
      P,
      S,
      L,
      N,
      _,
      n.db.getExcludes(),
      n.db.getIncludes()
    ), T(S, P, L, N), b(_, O, P, S, A, R, L), E(O, P), C(S, P, L, N);
  }
  x(y, "makeGantt");
  function b(_, L, N, A, O, P, S) {
    _.sort(($, F) => $.vert === F.vert ? 0 : $.vert ? 1 : -1);
    const I = [...new Set(_.map(($) => $.order))].map(($) => _.find((F) => F.order === $));
    g.append("g").selectAll("rect").data(I).enter().append("rect").attr("x", 0).attr("y", function($, F) {
      return F = $.order, F * L + N - 2;
    }).attr("width", function() {
      return S - i.rightPadding / 2;
    }).attr("height", L).attr("class", function($) {
      for (const [F, G] of d.entries())
        if ($.type === G)
          return "section section" + F % i.numberSectionStyles;
      return "section section0";
    }).enter();
    const D = g.append("g").selectAll("rect").data(_).enter(), M = n.db.getLinks();
    if (D.append("rect").attr("id", function($) {
      return $.id;
    }).attr("rx", 3).attr("ry", 3).attr("x", function($) {
      return $.milestone ? m($.startTime) + A + 0.5 * (m($.endTime) - m($.startTime)) - 0.5 * O : m($.startTime) + A;
    }).attr("y", function($, F) {
      return F = $.order, $.vert ? i.gridLineStartPadding : F * L + N;
    }).attr("width", function($) {
      return $.milestone ? O : $.vert ? 0.08 * O : m($.renderEndTime || $.endTime) - m($.startTime);
    }).attr("height", function($) {
      return $.vert ? h.length * (i.barHeight + i.barGap) + i.barHeight * 2 : O;
    }).attr("transform-origin", function($, F) {
      return F = $.order, (m($.startTime) + A + 0.5 * (m($.endTime) - m($.startTime))).toString() + "px " + (F * L + N + 0.5 * O).toString() + "px";
    }).attr("class", function($) {
      const F = "task";
      let G = "";
      $.classes.length > 0 && (G = $.classes.join(" "));
      let H = 0;
      for (const [Y, re] of d.entries())
        $.type === re && (H = Y % i.numberSectionStyles);
      let ee = "";
      return $.active ? $.crit ? ee += " activeCrit" : ee = " active" : $.done ? $.crit ? ee = " doneCrit" : ee = " done" : $.crit && (ee += " crit"), ee.length === 0 && (ee = " task"), $.milestone && (ee = " milestone " + ee), $.vert && (ee = " vert " + ee), ee += H, ee += " " + G, F + ee;
    }), D.append("text").attr("id", function($) {
      return $.id + "-text";
    }).text(function($) {
      return $.task;
    }).attr("font-size", i.fontSize).attr("x", function($) {
      let F = m($.startTime), G = m($.renderEndTime || $.endTime);
      if ($.milestone && (F += 0.5 * (m($.endTime) - m($.startTime)) - 0.5 * O, G = F + O), $.vert)
        return m($.startTime) + A;
      const H = this.getBBox().width;
      return H > G - F ? G + H + 1.5 * i.leftPadding > S ? F + A - 5 : G + A + 5 : (G - F) / 2 + F + A;
    }).attr("y", function($, F) {
      return $.vert ? i.gridLineStartPadding + h.length * (i.barHeight + i.barGap) + 60 : (F = $.order, F * L + i.barHeight / 2 + (i.fontSize / 2 - 2) + N);
    }).attr("text-height", O).attr("class", function($) {
      const F = m($.startTime);
      let G = m($.endTime);
      $.milestone && (G = F + O);
      const H = this.getBBox().width;
      let ee = "";
      $.classes.length > 0 && (ee = $.classes.join(" "));
      let Y = 0;
      for (const [ne, he] of d.entries())
        $.type === he && (Y = ne % i.numberSectionStyles);
      let re = "";
      return $.active && ($.crit ? re = "activeCritText" + Y : re = "activeText" + Y), $.done ? $.crit ? re = re + " doneCritText" + Y : re = re + " doneText" + Y : $.crit && (re = re + " critText" + Y), $.milestone && (re += " milestoneText"), $.vert && (re += " vertText"), H > G - F ? G + H + 1.5 * i.leftPadding > S ? ee + " taskTextOutsideLeft taskTextOutside" + Y + " " + re : ee + " taskTextOutsideRight taskTextOutside" + Y + " " + re + " width-" + H : ee + " taskText taskText" + Y + " " + re + " width-" + H;
    }), we().securityLevel === "sandbox") {
      let $;
      $ = Qe("#i" + e);
      const F = $.nodes()[0].contentDocument;
      D.filter(function(G) {
        return M.has(G.id);
      }).each(function(G) {
        var H = F.querySelector("#" + G.id), ee = F.querySelector("#" + G.id + "-text");
        const Y = H.parentNode;
        var re = F.createElement("a");
        re.setAttribute("xlink:href", M.get(G.id)), re.setAttribute("target", "_top"), Y.appendChild(re), re.appendChild(H), re.appendChild(ee);
      });
    }
  }
  x(b, "drawRects");
  function w(_, L, N, A, O, P, S, R) {
    if (S.length === 0 && R.length === 0)
      return;
    let I, D;
    for (const { startTime: H, endTime: ee } of P)
      (I === void 0 || H < I) && (I = H), (D === void 0 || ee > D) && (D = ee);
    if (!I || !D)
      return;
    if (Ti(D).diff(Ti(I), "year") > 5) {
      ae.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 M = n.db.getDateFormat(), B = [];
    let $ = null, F = Ti(I);
    for (; F.valueOf() <= D; )
      n.db.isInvalidDate(F, M, S, R) ? $ ? $.end = F : $ = {
        start: F,
        end: F
      } : $ && (B.push($), $ = null), F = F.add(1, "d");
    g.append("g").selectAll("rect").data(B).enter().append("rect").attr("id", (H) => "exclude-" + H.start.format("YYYY-MM-DD")).attr("x", (H) => m(H.start.startOf("day")) + N).attr("y", i.gridLineStartPadding).attr("width", (H) => m(H.end.endOf("day")) - m(H.start.startOf("day"))).attr("height", O - L - i.gridLineStartPadding).attr("transform-origin", function(H, ee) {
      return (m(H.start) + N + 0.5 * (m(H.end) - m(H.start))).toString() + "px " + (ee * _ + 0.5 * O).toString() + "px";
    }).attr("class", "exclude-range");
  }
  x(w, "drawExcludeDays");
  function T(_, L, N, A) {
    const O = n.db.getDateFormat(), P = n.db.getAxisFormat();
    let S;
    P ? S = P : O === "D" ? S = "%d" : S = i.axisFormat ?? "%Y-%m-%d";
    let R = Bj(m).tickSize(-A + L + i.gridLineStartPadding).tickFormat(Qv(S));
    const D = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(
      n.db.getTickInterval() || i.tickInterval
    );
    if (D !== null) {
      const M = D[1], B = D[2], $ = n.db.getWeekday() || i.weekday;
      switch (B) {
        case "millisecond":
          R.ticks(Yd.every(M));
          break;
        case "second":
          R.ticks(bl.every(M));
          break;
        case "minute":
          R.ticks(Bp.every(M));
          break;
        case "hour":
          R.ticks(Fp.every(M));
          break;
        case "day":
          R.ticks(su.every(M));
          break;
        case "week":
          R.ticks(mN[$].every(M));
          break;
        case "month":
          R.ticks(zp.every(M));
          break;
      }
    }
    if (g.append("g").attr("class", "grid").attr("transform", "translate(" + _ + ", " + (A - 50) + ")").call(R).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"), n.db.topAxisEnabled() || i.topAxis) {
      let M = Pj(m).tickSize(-A + L + i.gridLineStartPadding).tickFormat(Qv(S));
      if (D !== null) {
        const B = D[1], $ = D[2], F = n.db.getWeekday() || i.weekday;
        switch ($) {
          case "millisecond":
            M.ticks(Yd.every(B));
            break;
          case "second":
            M.ticks(bl.every(B));
            break;
          case "minute":
            M.ticks(Bp.every(B));
            break;
          case "hour":
            M.ticks(Fp.every(B));
            break;
          case "day":
            M.ticks(su.every(B));
            break;
          case "week":
            M.ticks(mN[F].every(B));
            break;
          case "month":
            M.ticks(zp.every(B));
            break;
        }
      }
      g.append("g").attr("class", "grid").attr("transform", "translate(" + _ + ", " + L + ")").call(M).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
    }
  }
  x(T, "makeGrid");
  function E(_, L) {
    let N = 0;
    const A = Object.keys(f).map((O) => [O, f[O]]);
    g.append("g").selectAll("text").data(A).enter().append(function(O) {
      const P = O[0].split(at.lineBreakRegex), S = -(P.length - 1) / 2, R = l.createElementNS("http://www.w3.org/2000/svg", "text");
      R.setAttribute("dy", S + "em");
      for (const [I, D] of P.entries()) {
        const M = l.createElementNS("http://www.w3.org/2000/svg", "tspan");
        M.setAttribute("alignment-baseline", "central"), M.setAttribute("x", "10"), I > 0 && M.setAttribute("dy", "1em"), M.textContent = D, R.appendChild(M);
      }
      return R;
    }).attr("x", 10).attr("y", function(O, P) {
      if (P > 0)
        for (let S = 0; S < P; S++)
          return N += A[P - 1][1], O[1] * _ / 2 + N * _ + L;
      else
        return O[1] * _ / 2 + L;
    }).attr("font-size", i.sectionFontSize).attr("class", function(O) {
      for (const [P, S] of d.entries())
        if (O[0] === S)
          return "sectionTitle sectionTitle" + P % i.numberSectionStyles;
      return "sectionTitle";
    });
  }
  x(E, "vertLabels");
  function C(_, L, N, A) {
    const O = n.db.getTodayMarker();
    if (O === "off")
      return;
    const P = g.append("g").attr("class", "today"), S = /* @__PURE__ */ new Date(), R = P.append("line");
    R.attr("x1", m(S) + _).attr("x2", m(S) + _).attr("y1", i.titleTopMargin).attr("y2", A - i.titleTopMargin).attr("class", "today"), O !== "" && R.attr("style", O.replace(/,/g, ";"));
  }
  x(C, "drawToday");
  function k(_) {
    const L = {}, N = [];
    for (let A = 0, O = _.length; A < O; ++A)
      Object.prototype.hasOwnProperty.call(L, _[A]) || (L[_[A]] = !0, N.push(_[A]));
    return N;
  }
  x(k, "checkUnique");
}, "draw"), ECe = {
  setConf: bCe,
  draw: TCe
}, kCe = /* @__PURE__ */ x((t) => `
  .mermaid-main-font {
        font-family: ${t.fontFamily};
  }

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

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

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

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

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

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

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

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

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

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


  /* Grid and axis */

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

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

  .grid path {
    stroke-width: 0;
  }


  /* Today line */

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


  /* Task styling */

  /* Default task */

  .task {
    stroke-width: 2;
  }

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

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

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


  /* Special case clickable */

  .task.clickable {
    cursor: pointer;
  }

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

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

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


  /* Specific task settings for the sections*/

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

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

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

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


  /* Active task */

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

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


  /* Completed task */

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

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


  /* Tasks on the critical line */

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

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

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

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

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

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

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

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

  .titleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.titleColor || t.textColor};
    font-family: ${t.fontFamily};
  }
`, "getStyles"), SCe = kCe, CCe = {
  parser: B7e,
  db: xCe,
  renderer: ECe,
  styles: SCe
};
const ACe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: CCe
}, Symbol.toStringTag, { value: "Module" }));
var _Ce = {
  parse: /* @__PURE__ */ x(async (t) => {
    const e = await yc("info", t);
    ae.debug(e);
  }, "parse")
}, LCe = {
  version: G5.version + ""
}, RCe = /* @__PURE__ */ x(() => LCe.version, "getVersion"), NCe = {
  getVersion: RCe
}, MCe = /* @__PURE__ */ x((t, e, r) => {
  ae.debug(`rendering info diagram
` + t);
  const n = tl(e);
  Ki(n, 100, 400, !0), n.append("g").append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${r}`);
}, "draw"), DCe = { draw: MCe }, ICe = {
  parser: _Ce,
  db: NCe,
  renderer: DCe
};
const OCe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: ICe
}, Symbol.toStringTag, { value: "Module" }));
var PCe = hr.pie, r7 = {
  sections: /* @__PURE__ */ new Map(),
  showData: !1
}, C2 = r7.sections, n7 = r7.showData, BCe = structuredClone(PCe), FCe = /* @__PURE__ */ x(() => structuredClone(BCe), "getConfig"), $Ce = /* @__PURE__ */ x(() => {
  C2 = /* @__PURE__ */ new Map(), n7 = r7.showData, _n();
}, "clear"), zCe = /* @__PURE__ */ x(({ label: t, value: e }) => {
  if (e < 0)
    throw new Error(
      `"${t}" has invalid value: ${e}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
    );
  C2.has(t) || (C2.set(t, e), ae.debug(`added new section: ${t}, with value: ${e}`));
}, "addSection"), VCe = /* @__PURE__ */ x(() => C2, "getSections"), GCe = /* @__PURE__ */ x((t) => {
  n7 = t;
}, "setShowData"), UCe = /* @__PURE__ */ x(() => n7, "getShowData"), RH = {
  getConfig: FCe,
  clear: $Ce,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln,
  setAccTitle: Cn,
  getAccTitle: Vn,
  setAccDescription: Gn,
  getAccDescription: Un,
  addSection: zCe,
  getSections: VCe,
  setShowData: GCe,
  getShowData: UCe
}, WCe = /* @__PURE__ */ x((t, e) => {
  Vu(t, e), e.setShowData(t.showData), t.sections.map(e.addSection);
}, "populateDb"), HCe = {
  parse: /* @__PURE__ */ x(async (t) => {
    const e = await yc("pie", t);
    ae.debug(e), WCe(e, RH);
  }, "parse")
}, qCe = /* @__PURE__ */ x((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};
  }
`, "getStyles"), YCe = qCe, XCe = /* @__PURE__ */ x((t) => {
  const e = [...t.values()].reduce((i, a) => i + a, 0), r = [...t.entries()].map(([i, a]) => ({ label: i, value: a })).filter((i) => i.value / e * 100 >= 1).sort((i, a) => a.value - i.value);
  return Pte().value((i) => i.value)(r);
}, "createPieArcs"), jCe = /* @__PURE__ */ x((t, e, r, n) => {
  ae.debug(`rendering pie chart
` + t);
  const i = n.db, a = we(), s = qi(i.getConfig(), a.pie), o = 40, l = 18, u = 4, h = 450, d = h, f = tl(e), p = f.append("g");
  p.attr("transform", "translate(" + d / 2 + "," + h / 2 + ")");
  const { themeVariables: g } = a;
  let [m] = Du(g.pieOuterStrokeWidth);
  m ?? (m = 2);
  const v = s.textPosition, y = Math.min(d, h) / 2 - o, b = jd().innerRadius(0).outerRadius(y), w = jd().innerRadius(y * v).outerRadius(y * v);
  p.append("circle").attr("cx", 0).attr("cy", 0).attr("r", y + m / 2).attr("class", "pieOuterCircle");
  const T = i.getSections(), E = XCe(T), C = [
    g.pie1,
    g.pie2,
    g.pie3,
    g.pie4,
    g.pie5,
    g.pie6,
    g.pie7,
    g.pie8,
    g.pie9,
    g.pie10,
    g.pie11,
    g.pie12
  ];
  let k = 0;
  T.forEach((S) => {
    k += S;
  });
  const _ = E.filter((S) => (S.data.value / k * 100).toFixed(0) !== "0"), L = Qc(C);
  p.selectAll("mySlices").data(_).enter().append("path").attr("d", b).attr("fill", (S) => L(S.data.label)).attr("class", "pieCircle"), p.selectAll("mySlices").data(_).enter().append("text").text((S) => (S.data.value / k * 100).toFixed(0) + "%").attr("transform", (S) => "translate(" + w.centroid(S) + ")").style("text-anchor", "middle").attr("class", "slice"), p.append("text").text(i.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
  const N = [...T.entries()].map(([S, R]) => ({
    label: S,
    value: R
  })), A = p.selectAll(".legend").data(N).enter().append("g").attr("class", "legend").attr("transform", (S, R) => {
    const I = l + u, D = I * N.length / 2, M = 12 * l, B = R * I - D;
    return "translate(" + M + "," + B + ")";
  });
  A.append("rect").attr("width", l).attr("height", l).style("fill", (S) => L(S.label)).style("stroke", (S) => L(S.label)), A.append("text").attr("x", l + u).attr("y", l - u).text((S) => i.getShowData() ? `${S.label} [${S.value}]` : S.label);
  const O = Math.max(
    ...A.selectAll("text").nodes().map((S) => (S == null ? void 0 : S.getBoundingClientRect().width) ?? 0)
  ), P = d + o + l + u + O;
  f.attr("viewBox", `0 0 ${P} ${h}`), Ki(f, h, P, s.useMaxWidth);
}, "draw"), KCe = { draw: jCe }, ZCe = {
  parser: HCe,
  db: RH,
  renderer: KCe,
  styles: YCe
};
const QCe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: ZCe
}, Symbol.toStringTag, { value: "Module" }));
var w6 = function() {
  var t = /* @__PURE__ */ x(function(ce, z, oe, se) {
    for (oe = oe || {}, se = ce.length; se--; oe[ce[se]] = z) ;
    return oe;
  }, "o"), e = [1, 3], r = [1, 4], n = [1, 5], i = [1, 6], a = [1, 7], s = [1, 4, 5, 10, 12, 13, 14, 18, 25, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], o = [1, 4, 5, 10, 12, 13, 14, 18, 25, 28, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], l = [55, 56, 57], u = [2, 36], h = [1, 37], d = [1, 36], f = [1, 38], p = [1, 35], g = [1, 43], m = [1, 41], v = [1, 14], y = [1, 23], b = [1, 18], w = [1, 19], T = [1, 20], E = [1, 21], C = [1, 22], k = [1, 24], _ = [1, 25], L = [1, 26], N = [1, 27], A = [1, 28], O = [1, 29], P = [1, 32], S = [1, 33], R = [1, 34], I = [1, 39], D = [1, 40], M = [1, 42], B = [1, 44], $ = [1, 62], F = [1, 61], G = [4, 5, 8, 10, 12, 13, 14, 18, 44, 47, 49, 55, 56, 57, 63, 64, 65, 66, 67], H = [1, 65], ee = [1, 66], Y = [1, 67], re = [1, 68], ne = [1, 69], he = [1, 70], K = [1, 71], Z = [1, 72], X = [1, 73], q = [1, 74], J = [1, 75], j = [1, 76], pe = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18], te = [1, 90], Ae = [1, 91], W = [1, 92], Oe = [1, 99], ue = [1, 93], Ve = [1, 96], Ge = [1, 94], Ue = [1, 95], ke = [1, 97], Pe = [1, 98], Se = [1, 102], _e = [10, 55, 56, 57], ze = [4, 5, 6, 8, 10, 11, 13, 17, 18, 19, 20, 55, 56, 57], me = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    yy: {},
    symbols_: { error: 2, idStringToken: 3, ALPHA: 4, NUM: 5, NODE_STRING: 6, DOWN: 7, MINUS: 8, DEFAULT: 9, COMMA: 10, COLON: 11, AMP: 12, BRKT: 13, MULT: 14, UNICODE_TEXT: 15, styleComponent: 16, UNIT: 17, SPACE: 18, STYLE: 19, PCT: 20, idString: 21, style: 22, stylesOpt: 23, classDefStatement: 24, CLASSDEF: 25, start: 26, eol: 27, QUADRANT: 28, document: 29, line: 30, statement: 31, axisDetails: 32, quadrantDetails: 33, points: 34, title: 35, title_value: 36, acc_title: 37, acc_title_value: 38, acc_descr: 39, acc_descr_value: 40, acc_descr_multiline_value: 41, section: 42, text: 43, point_start: 44, point_x: 45, point_y: 46, class_name: 47, "X-AXIS": 48, "AXIS-TEXT-DELIMITER": 49, "Y-AXIS": 50, QUADRANT_1: 51, QUADRANT_2: 52, QUADRANT_3: 53, QUADRANT_4: 54, NEWLINE: 55, SEMI: 56, EOF: 57, alphaNumToken: 58, textNoTagsToken: 59, STR: 60, MD_STR: 61, alphaNum: 62, PUNCTUATION: 63, PLUS: 64, EQUALS: 65, DOT: 66, UNDERSCORE: 67, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "ALPHA", 5: "NUM", 6: "NODE_STRING", 7: "DOWN", 8: "MINUS", 9: "DEFAULT", 10: "COMMA", 11: "COLON", 12: "AMP", 13: "BRKT", 14: "MULT", 15: "UNICODE_TEXT", 17: "UNIT", 18: "SPACE", 19: "STYLE", 20: "PCT", 25: "CLASSDEF", 28: "QUADRANT", 35: "title", 36: "title_value", 37: "acc_title", 38: "acc_title_value", 39: "acc_descr", 40: "acc_descr_value", 41: "acc_descr_multiline_value", 42: "section", 44: "point_start", 45: "point_x", 46: "point_y", 47: "class_name", 48: "X-AXIS", 49: "AXIS-TEXT-DELIMITER", 50: "Y-AXIS", 51: "QUADRANT_1", 52: "QUADRANT_2", 53: "QUADRANT_3", 54: "QUADRANT_4", 55: "NEWLINE", 56: "SEMI", 57: "EOF", 60: "STR", 61: "MD_STR", 63: "PUNCTUATION", 64: "PLUS", 65: "EQUALS", 66: "DOT", 67: "UNDERSCORE" },
    productions_: [0, [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [21, 1], [21, 2], [22, 1], [22, 2], [23, 1], [23, 3], [24, 5], [26, 2], [26, 2], [26, 2], [29, 0], [29, 2], [30, 2], [31, 0], [31, 1], [31, 2], [31, 1], [31, 1], [31, 1], [31, 2], [31, 2], [31, 2], [31, 1], [31, 1], [34, 4], [34, 5], [34, 5], [34, 6], [32, 4], [32, 3], [32, 2], [32, 4], [32, 3], [32, 2], [33, 2], [33, 2], [33, 2], [33, 2], [27, 1], [27, 1], [27, 1], [43, 1], [43, 2], [43, 1], [43, 1], [62, 1], [62, 2], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [59, 1], [59, 1], [59, 1]],
    performAction: /* @__PURE__ */ x(function(z, oe, se, ge, de, be, Ce) {
      var Te = be.length - 1;
      switch (de) {
        case 23:
          this.$ = be[Te];
          break;
        case 24:
          this.$ = be[Te - 1] + "" + be[Te];
          break;
        case 26:
          this.$ = be[Te - 1] + be[Te];
          break;
        case 27:
          this.$ = [be[Te].trim()];
          break;
        case 28:
          be[Te - 2].push(be[Te].trim()), this.$ = be[Te - 2];
          break;
        case 29:
          this.$ = be[Te - 4], ge.addClass(be[Te - 2], be[Te]);
          break;
        case 37:
          this.$ = [];
          break;
        case 42:
          this.$ = be[Te].trim(), ge.setDiagramTitle(this.$);
          break;
        case 43:
          this.$ = be[Te].trim(), ge.setAccTitle(this.$);
          break;
        case 44:
        case 45:
          this.$ = be[Te].trim(), ge.setAccDescription(this.$);
          break;
        case 46:
          ge.addSection(be[Te].substr(8)), this.$ = be[Te].substr(8);
          break;
        case 47:
          ge.addPoint(be[Te - 3], "", be[Te - 1], be[Te], []);
          break;
        case 48:
          ge.addPoint(be[Te - 4], be[Te - 3], be[Te - 1], be[Te], []);
          break;
        case 49:
          ge.addPoint(be[Te - 4], "", be[Te - 2], be[Te - 1], be[Te]);
          break;
        case 50:
          ge.addPoint(be[Te - 5], be[Te - 4], be[Te - 2], be[Te - 1], be[Te]);
          break;
        case 51:
          ge.setXAxisLeftText(be[Te - 2]), ge.setXAxisRightText(be[Te]);
          break;
        case 52:
          be[Te - 1].text += " ⟶ ", ge.setXAxisLeftText(be[Te - 1]);
          break;
        case 53:
          ge.setXAxisLeftText(be[Te]);
          break;
        case 54:
          ge.setYAxisBottomText(be[Te - 2]), ge.setYAxisTopText(be[Te]);
          break;
        case 55:
          be[Te - 1].text += " ⟶ ", ge.setYAxisBottomText(be[Te - 1]);
          break;
        case 56:
          ge.setYAxisBottomText(be[Te]);
          break;
        case 57:
          ge.setQuadrant1Text(be[Te]);
          break;
        case 58:
          ge.setQuadrant2Text(be[Te]);
          break;
        case 59:
          ge.setQuadrant3Text(be[Te]);
          break;
        case 60:
          ge.setQuadrant4Text(be[Te]);
          break;
        case 64:
          this.$ = { text: be[Te], type: "text" };
          break;
        case 65:
          this.$ = { text: be[Te - 1].text + "" + be[Te], type: be[Te - 1].type };
          break;
        case 66:
          this.$ = { text: be[Te], type: "text" };
          break;
        case 67:
          this.$ = { text: be[Te], type: "markdown" };
          break;
        case 68:
          this.$ = be[Te];
          break;
        case 69:
          this.$ = be[Te - 1] + "" + be[Te];
          break;
      }
    }, "anonymous"),
    table: [{ 18: e, 26: 1, 27: 2, 28: r, 55: n, 56: i, 57: a }, { 1: [3] }, { 18: e, 26: 8, 27: 2, 28: r, 55: n, 56: i, 57: a }, { 18: e, 26: 9, 27: 2, 28: r, 55: n, 56: i, 57: a }, t(s, [2, 33], { 29: 10 }), t(o, [2, 61]), t(o, [2, 62]), t(o, [2, 63]), { 1: [2, 30] }, { 1: [2, 31] }, t(l, u, { 30: 11, 31: 12, 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 1: [2, 32], 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 18: v, 25: y, 35: b, 37: w, 39: T, 41: E, 42: C, 48: k, 50: _, 51: L, 52: N, 53: A, 54: O, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }), t(s, [2, 34]), { 27: 45, 55: n, 56: i, 57: a }, t(l, [2, 37]), t(l, u, { 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 31: 46, 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 18: v, 25: y, 35: b, 37: w, 39: T, 41: E, 42: C, 48: k, 50: _, 51: L, 52: N, 53: A, 54: O, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 39]), t(l, [2, 40]), t(l, [2, 41]), { 36: [1, 47] }, { 38: [1, 48] }, { 40: [1, 49] }, t(l, [2, 45]), t(l, [2, 46]), { 18: [1, 50] }, { 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 43: 51, 58: 31, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }, { 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 43: 52, 58: 31, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }, { 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 43: 53, 58: 31, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }, { 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 43: 54, 58: 31, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }, { 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 43: 55, 58: 31, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }, { 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 43: 56, 58: 31, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }, { 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 44: [1, 57], 47: [1, 58], 58: 60, 59: 59, 63: R, 64: I, 65: D, 66: M, 67: B }, t(G, [2, 64]), t(G, [2, 66]), t(G, [2, 67]), t(G, [2, 70]), t(G, [2, 71]), t(G, [2, 72]), t(G, [2, 73]), t(G, [2, 74]), t(G, [2, 75]), t(G, [2, 76]), t(G, [2, 77]), t(G, [2, 78]), t(G, [2, 79]), t(G, [2, 80]), t(s, [2, 35]), t(l, [2, 38]), t(l, [2, 42]), t(l, [2, 43]), t(l, [2, 44]), { 3: 64, 4: H, 5: ee, 6: Y, 7: re, 8: ne, 9: he, 10: K, 11: Z, 12: X, 13: q, 14: J, 15: j, 21: 63 }, t(l, [2, 53], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 49: [1, 77], 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 56], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 49: [1, 78], 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 57], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 58], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 59], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 60], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 63: R, 64: I, 65: D, 66: M, 67: B }), { 45: [1, 79] }, { 44: [1, 80] }, t(G, [2, 65]), t(G, [2, 81]), t(G, [2, 82]), t(G, [2, 83]), { 3: 82, 4: H, 5: ee, 6: Y, 7: re, 8: ne, 9: he, 10: K, 11: Z, 12: X, 13: q, 14: J, 15: j, 18: [1, 81] }, t(pe, [2, 23]), t(pe, [2, 1]), t(pe, [2, 2]), t(pe, [2, 3]), t(pe, [2, 4]), t(pe, [2, 5]), t(pe, [2, 6]), t(pe, [2, 7]), t(pe, [2, 8]), t(pe, [2, 9]), t(pe, [2, 10]), t(pe, [2, 11]), t(pe, [2, 12]), t(l, [2, 52], { 58: 31, 43: 83, 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 55], { 58: 31, 43: 84, 4: h, 5: d, 10: f, 12: p, 13: g, 14: m, 60: P, 61: S, 63: R, 64: I, 65: D, 66: M, 67: B }), { 46: [1, 85] }, { 45: [1, 86] }, { 4: te, 5: Ae, 6: W, 8: Oe, 11: ue, 13: Ve, 16: 89, 17: Ge, 18: Ue, 19: ke, 20: Pe, 22: 88, 23: 87 }, t(pe, [2, 24]), t(l, [2, 51], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 54], { 59: 59, 58: 60, 4: h, 5: d, 8: $, 10: f, 12: p, 13: g, 14: m, 18: F, 63: R, 64: I, 65: D, 66: M, 67: B }), t(l, [2, 47], { 22: 88, 16: 89, 23: 100, 4: te, 5: Ae, 6: W, 8: Oe, 11: ue, 13: Ve, 17: Ge, 18: Ue, 19: ke, 20: Pe }), { 46: [1, 101] }, t(l, [2, 29], { 10: Se }), t(_e, [2, 27], { 16: 103, 4: te, 5: Ae, 6: W, 8: Oe, 11: ue, 13: Ve, 17: Ge, 18: Ue, 19: ke, 20: Pe }), t(ze, [2, 25]), t(ze, [2, 13]), t(ze, [2, 14]), t(ze, [2, 15]), t(ze, [2, 16]), t(ze, [2, 17]), t(ze, [2, 18]), t(ze, [2, 19]), t(ze, [2, 20]), t(ze, [2, 21]), t(ze, [2, 22]), t(l, [2, 49], { 10: Se }), t(l, [2, 48], { 22: 88, 16: 89, 23: 104, 4: te, 5: Ae, 6: W, 8: Oe, 11: ue, 13: Ve, 17: Ge, 18: Ue, 19: ke, 20: Pe }), { 4: te, 5: Ae, 6: W, 8: Oe, 11: ue, 13: Ve, 16: 89, 17: Ge, 18: Ue, 19: ke, 20: Pe, 22: 105 }, t(ze, [2, 26]), t(l, [2, 50], { 10: Se }), t(_e, [2, 28], { 16: 103, 4: te, 5: Ae, 6: W, 8: Oe, 11: ue, 13: Ve, 17: Ge, 18: Ue, 19: ke, 20: Pe })],
    defaultActions: { 8: [2, 30], 9: [2, 31] },
    parseError: /* @__PURE__ */ x(function(z, oe) {
      if (oe.recoverable)
        this.trace(z);
      else {
        var se = new Error(z);
        throw se.hash = oe, se;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(z) {
      var oe = this, se = [0], ge = [], de = [null], be = [], Ce = this.table, Te = "", Ne = 0, Xe = 0, Ye = 2, Ke = 1, Ze = be.slice.call(arguments, 1), Be = Object.create(this.lexer), He = { yy: {} };
      for (var ht in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, ht) && (He.yy[ht] = this.yy[ht]);
      Be.setInput(z, He.yy), He.yy.lexer = Be, He.yy.parser = this, typeof Be.yylloc > "u" && (Be.yylloc = {});
      var st = Be.yylloc;
      be.push(st);
      var We = Be.options && Be.options.ranges;
      typeof He.yy.parseError == "function" ? this.parseError = He.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function kt(Wt) {
        se.length = se.length - 2 * Wt, de.length = de.length - Wt, be.length = be.length - Wt;
      }
      x(kt, "popStack");
      function qe() {
        var Wt;
        return Wt = ge.pop() || Be.lex() || Ke, typeof Wt != "number" && (Wt instanceof Array && (ge = Wt, Wt = ge.pop()), Wt = oe.symbols_[Wt] || Wt), Wt;
      }
      x(qe, "lex");
      for (var rt, ct, ut, nt, bt = {}, Zt, Ot, tr, xr; ; ) {
        if (ct = se[se.length - 1], this.defaultActions[ct] ? ut = this.defaultActions[ct] : ((rt === null || typeof rt > "u") && (rt = qe()), ut = Ce[ct] && Ce[ct][rt]), typeof ut > "u" || !ut.length || !ut[0]) {
          var rr = "";
          xr = [];
          for (Zt in Ce[ct])
            this.terminals_[Zt] && Zt > Ye && xr.push("'" + this.terminals_[Zt] + "'");
          Be.showPosition ? rr = "Parse error on line " + (Ne + 1) + `:
` + Be.showPosition() + `
Expecting ` + xr.join(", ") + ", got '" + (this.terminals_[rt] || rt) + "'" : rr = "Parse error on line " + (Ne + 1) + ": Unexpected " + (rt == Ke ? "end of input" : "'" + (this.terminals_[rt] || rt) + "'"), this.parseError(rr, {
            text: Be.match,
            token: this.terminals_[rt] || rt,
            line: Be.yylineno,
            loc: st,
            expected: xr
          });
        }
        if (ut[0] instanceof Array && ut.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + ct + ", token: " + rt);
        switch (ut[0]) {
          case 1:
            se.push(rt), de.push(Be.yytext), be.push(Be.yylloc), se.push(ut[1]), rt = null, Xe = Be.yyleng, Te = Be.yytext, Ne = Be.yylineno, st = Be.yylloc;
            break;
          case 2:
            if (Ot = this.productions_[ut[1]][1], bt.$ = de[de.length - Ot], bt._$ = {
              first_line: be[be.length - (Ot || 1)].first_line,
              last_line: be[be.length - 1].last_line,
              first_column: be[be.length - (Ot || 1)].first_column,
              last_column: be[be.length - 1].last_column
            }, We && (bt._$.range = [
              be[be.length - (Ot || 1)].range[0],
              be[be.length - 1].range[1]
            ]), nt = this.performAction.apply(bt, [
              Te,
              Xe,
              Ne,
              He.yy,
              ut[1],
              de,
              be
            ].concat(Ze)), typeof nt < "u")
              return nt;
            Ot && (se = se.slice(0, -1 * Ot * 2), de = de.slice(0, -1 * Ot), be = be.slice(0, -1 * Ot)), se.push(this.productions_[ut[1]][0]), de.push(bt.$), be.push(bt._$), tr = Ce[se[se.length - 2]][se[se.length - 1]], se.push(tr);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, Me = /* @__PURE__ */ function() {
    var ce = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(oe, se) {
        if (this.yy.parser)
          this.yy.parser.parseError(oe, se);
        else
          throw new Error(oe);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(z, oe) {
        return this.yy = oe || 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;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var z = this._input[0];
        this.yytext += z, this.yyleng++, this.offset++, this.match += z, this.matched += z;
        var oe = z.match(/(?:\r\n?|\n).*/g);
        return oe ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), z;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(z) {
        var oe = z.length, se = z.split(/(?:\r\n?|\n)/g);
        this._input = z + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - oe), this.offset -= oe;
        var ge = 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), se.length - 1 && (this.yylineno -= se.length - 1);
        var de = 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: se ? (se.length === ge.length ? this.yylloc.first_column : 0) + ge[ge.length - se.length].length - se[0].length : this.yylloc.first_column - oe
        }, this.options.ranges && (this.yylloc.range = [de[0], de[0] + this.yyleng - oe]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(z) {
        this.unput(this.match.slice(z));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var z = this.matched.substr(0, this.matched.length - this.match.length);
        return (z.length > 20 ? "..." : "") + z.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(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, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var z = this.pastInput(), oe = new Array(z.length + 1).join("-");
        return z + this.upcomingInput() + `
` + oe + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(z, oe) {
        var se, ge, de;
        if (this.options.backtrack_lexer && (de = {
          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 && (de.yylloc.range = this.yylloc.range.slice(0))), ge = z[0].match(/(?:\r\n?|\n).*/g), ge && (this.yylineno += ge.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: ge ? ge[ge.length - 1].length - ge[ge.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], se = this.performAction.call(this, this.yy, this, oe, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), se)
          return se;
        if (this._backtrack) {
          for (var be in de)
            this[be] = de[be];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var z, oe, se, ge;
        this._more || (this.yytext = "", this.match = "");
        for (var de = this._currentRules(), be = 0; be < de.length; be++)
          if (se = this._input.match(this.rules[de[be]]), se && (!oe || se[0].length > oe[0].length)) {
            if (oe = se, ge = be, this.options.backtrack_lexer) {
              if (z = this.test_match(se, de[be]), z !== !1)
                return z;
              if (this._backtrack) {
                oe = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return oe ? (z = this.test_match(oe, de[ge]), 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
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var oe = this.next();
        return oe || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(oe) {
        this.conditionStack.push(oe);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var oe = this.conditionStack.length - 1;
        return oe > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(oe) {
        return oe = this.conditionStack.length - 1 - Math.abs(oe || 0), oe >= 0 ? this.conditionStack[oe] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(oe) {
        this.begin(oe);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(oe, se, ge, de) {
        switch (ge) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 55;
          case 3:
            break;
          case 4:
            return this.begin("title"), 35;
          case 5:
            return this.popState(), "title_value";
          case 6:
            return this.begin("acc_title"), 37;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 39;
          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 48;
          case 14:
            return 50;
          case 15:
            return 49;
          case 16:
            return 51;
          case 17:
            return 52;
          case 18:
            return 53;
          case 19:
            return 54;
          case 20:
            return 25;
          case 21:
            this.begin("md_string");
            break;
          case 22:
            return "MD_STR";
          case 23:
            this.popState();
            break;
          case 24:
            this.begin("string");
            break;
          case 25:
            this.popState();
            break;
          case 26:
            return "STR";
          case 27:
            this.begin("class_name");
            break;
          case 28:
            return this.popState(), 47;
          case 29:
            return this.begin("point_start"), 44;
          case 30:
            return this.begin("point_x"), 45;
          case 31:
            this.popState();
            break;
          case 32:
            this.popState(), this.begin("point_y");
            break;
          case 33:
            return this.popState(), 46;
          case 34:
            return 28;
          case 35:
            return 4;
          case 36:
            return 11;
          case 37:
            return 64;
          case 38:
            return 10;
          case 39:
            return 65;
          case 40:
            return 65;
          case 41:
            return 14;
          case 42:
            return 13;
          case 43:
            return 67;
          case 44:
            return 66;
          case 45:
            return 12;
          case 46:
            return 8;
          case 47:
            return 5;
          case 48:
            return 18;
          case 49:
            return 56;
          case 50:
            return 63;
          case 51:
            return 57;
        }
      }, "anonymous"),
      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, /^(?:classDef\b)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?::::)/i, /^(?:^\w+)/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: { class_name: { rules: [28], inclusive: !1 }, point_y: { rules: [33], inclusive: !1 }, point_x: { rules: [32], inclusive: !1 }, point_start: { rules: [30, 31], 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: [22, 23], inclusive: !1 }, string: { rules: [25, 26], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 27, 29, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], inclusive: !0 } }
    };
    return ce;
  }();
  me.lexer = Me;
  function Q() {
    this.yy = {};
  }
  return x(Q, "Parser"), Q.prototype = me, me.Parser = Q, new Q();
}();
w6.parser = w6;
var JCe = w6, Ii = F2(), xd, e8e = (xd = class {
  constructor() {
    this.classes = /* @__PURE__ */ new Map(), 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, r, n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b;
    return {
      showXAxis: !0,
      showYAxis: !0,
      showTitle: !0,
      chartHeight: ((e = hr.quadrantChart) == null ? void 0 : e.chartWidth) || 500,
      chartWidth: ((r = hr.quadrantChart) == null ? void 0 : r.chartHeight) || 500,
      titlePadding: ((n = hr.quadrantChart) == null ? void 0 : n.titlePadding) || 10,
      titleFontSize: ((i = hr.quadrantChart) == null ? void 0 : i.titleFontSize) || 20,
      quadrantPadding: ((a = hr.quadrantChart) == null ? void 0 : a.quadrantPadding) || 5,
      xAxisLabelPadding: ((s = hr.quadrantChart) == null ? void 0 : s.xAxisLabelPadding) || 5,
      yAxisLabelPadding: ((o = hr.quadrantChart) == null ? void 0 : o.yAxisLabelPadding) || 5,
      xAxisLabelFontSize: ((l = hr.quadrantChart) == null ? void 0 : l.xAxisLabelFontSize) || 16,
      yAxisLabelFontSize: ((u = hr.quadrantChart) == null ? void 0 : u.yAxisLabelFontSize) || 16,
      quadrantLabelFontSize: ((h = hr.quadrantChart) == null ? void 0 : h.quadrantLabelFontSize) || 16,
      quadrantTextTopPadding: ((d = hr.quadrantChart) == null ? void 0 : d.quadrantTextTopPadding) || 5,
      pointTextPadding: ((f = hr.quadrantChart) == null ? void 0 : f.pointTextPadding) || 5,
      pointLabelFontSize: ((p = hr.quadrantChart) == null ? void 0 : p.pointLabelFontSize) || 12,
      pointRadius: ((g = hr.quadrantChart) == null ? void 0 : g.pointRadius) || 5,
      xAxisPosition: ((m = hr.quadrantChart) == null ? void 0 : m.xAxisPosition) || "top",
      yAxisPosition: ((v = hr.quadrantChart) == null ? void 0 : v.yAxisPosition) || "left",
      quadrantInternalBorderStrokeWidth: ((y = hr.quadrantChart) == null ? void 0 : y.quadrantInternalBorderStrokeWidth) || 1,
      quadrantExternalBorderStrokeWidth: ((b = hr.quadrantChart) == null ? void 0 : b.quadrantExternalBorderStrokeWidth) || 2
    };
  }
  getDefaultThemeConfig() {
    return {
      quadrant1Fill: Ii.quadrant1Fill,
      quadrant2Fill: Ii.quadrant2Fill,
      quadrant3Fill: Ii.quadrant3Fill,
      quadrant4Fill: Ii.quadrant4Fill,
      quadrant1TextFill: Ii.quadrant1TextFill,
      quadrant2TextFill: Ii.quadrant2TextFill,
      quadrant3TextFill: Ii.quadrant3TextFill,
      quadrant4TextFill: Ii.quadrant4TextFill,
      quadrantPointFill: Ii.quadrantPointFill,
      quadrantPointTextFill: Ii.quadrantPointTextFill,
      quadrantXAxisTextFill: Ii.quadrantXAxisTextFill,
      quadrantYAxisTextFill: Ii.quadrantYAxisTextFill,
      quadrantTitleFill: Ii.quadrantTitleFill,
      quadrantInternalBorderStrokeFill: Ii.quadrantInternalBorderStrokeFill,
      quadrantExternalBorderStrokeFill: Ii.quadrantExternalBorderStrokeFill
    };
  }
  clear() {
    this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(), this.classes = /* @__PURE__ */ new Map(), ae.info("clear called");
  }
  setData(e) {
    this.data = { ...this.data, ...e };
  }
  addPoints(e) {
    this.data.points = [...e, ...this.data.points];
  }
  addClass(e, r) {
    this.classes.set(e, r);
  }
  setConfig(e) {
    ae.trace("setConfig called with: ", e), this.config = { ...this.config, ...e };
  }
  setThemeConfig(e) {
    ae.trace("setThemeConfig called with: ", e), this.themeConfig = { ...this.themeConfig, ...e };
  }
  calculateSpace(e, r, n, i) {
    const a = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, s = {
      top: e === "top" && r ? a : 0,
      bottom: e === "bottom" && r ? a : 0
    }, o = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, l = {
      left: this.config.yAxisPosition === "left" && n ? o : 0,
      right: this.config.yAxisPosition === "right" && n ? o : 0
    }, u = this.config.titleFontSize + this.config.titlePadding * 2, h = {
      top: i ? u : 0
    }, d = this.config.quadrantPadding + l.left, f = this.config.quadrantPadding + s.top + h.top, p = this.config.chartWidth - this.config.quadrantPadding * 2 - l.left - l.right, g = this.config.chartHeight - this.config.quadrantPadding * 2 - s.top - s.bottom - h.top, m = p / 2, v = g / 2;
    return {
      xAxisSpace: s,
      yAxisSpace: l,
      titleSpace: h,
      quadrantSpace: {
        quadrantLeft: d,
        quadrantTop: f,
        quadrantWidth: p,
        quadrantHalfWidth: m,
        quadrantHeight: g,
        quadrantHalfHeight: v
      }
    };
  }
  getAxisLabels(e, r, n, i) {
    const { quadrantSpace: a, titleSpace: s } = i, {
      quadrantHalfHeight: o,
      quadrantHeight: l,
      quadrantLeft: u,
      quadrantHalfWidth: h,
      quadrantTop: d,
      quadrantWidth: f
    } = a, p = !!this.data.xAxisRightText, g = !!this.data.yAxisTopText, m = [];
    return this.data.xAxisLeftText && r && m.push({
      text: this.data.xAxisLeftText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: u + (p ? h / 2 : 0),
      y: e === "top" ? this.config.xAxisLabelPadding + s.top : this.config.xAxisLabelPadding + d + l + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: p ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.xAxisRightText && r && m.push({
      text: this.data.xAxisRightText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: u + h + (p ? h / 2 : 0),
      y: e === "top" ? this.config.xAxisLabelPadding + s.top : this.config.xAxisLabelPadding + d + l + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: p ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.yAxisBottomText && n && m.push({
      text: this.data.yAxisBottomText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + u + f + this.config.quadrantPadding,
      y: d + l - (g ? o / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: g ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), this.data.yAxisTopText && n && m.push({
      text: this.data.yAxisTopText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + u + f + this.config.quadrantPadding,
      y: d + o - (g ? o / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: g ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), m;
  }
  getQuadrants(e) {
    const { quadrantSpace: r } = e, { quadrantHalfHeight: n, quadrantLeft: i, quadrantHalfWidth: a, quadrantTop: s } = r, 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: i + a,
        y: s,
        width: a,
        height: n,
        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: i,
        y: s,
        width: a,
        height: n,
        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: i,
        y: s + n,
        width: a,
        height: n,
        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: i + a,
        y: s + n,
        width: a,
        height: n,
        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: r } = e, { quadrantHeight: n, quadrantLeft: i, quadrantTop: a, quadrantWidth: s } = r, o = qd().domain([0, 1]).range([i, s + i]), l = qd().domain([0, 1]).range([n + a, a]);
    return this.data.points.map((h) => {
      const d = this.classes.get(h.className);
      return d && (h = { ...d, ...h }), {
        x: o(h.x),
        y: l(h.y),
        fill: h.color ?? this.themeConfig.quadrantPointFill,
        radius: h.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
        },
        strokeColor: h.strokeColor ?? this.themeConfig.quadrantPointFill,
        strokeWidth: h.strokeWidth ?? "0px"
      };
    });
  }
  getBorders(e) {
    const r = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: n } = e, {
      quadrantHalfHeight: i,
      quadrantHeight: a,
      quadrantLeft: s,
      quadrantHalfWidth: o,
      quadrantTop: l,
      quadrantWidth: u
    } = n;
    return [
      // top border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: s - r,
        y1: l,
        x2: s + u + r,
        y2: l
      },
      // right border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: s + u,
        y1: l + r,
        x2: s + u,
        y2: l + a - r
      },
      // bottom border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: s - r,
        y1: l + a,
        x2: s + u + r,
        y2: l + a
      },
      // left border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: s,
        y1: l + r,
        x2: s,
        y2: l + a - r
      },
      // vertical inner border
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: s + o,
        y1: l + r,
        x2: s + o,
        y2: l + a - r
      },
      // horizontal inner border
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: s + r,
        y1: l + i,
        x2: s + u - r,
        y2: l + i
      }
    ];
  }
  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), r = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), n = this.config.showTitle && !!this.data.titleText, i = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, a = this.calculateSpace(i, e, r, n);
    return {
      points: this.getQuadrantPoints(a),
      quadrants: this.getQuadrants(a),
      axisLabels: this.getAxisLabels(i, e, r, a),
      borderLines: this.getBorders(a),
      title: this.getTitle(n)
    };
  }
}, x(xd, "QuadrantBuilder"), xd), bd, Lm = (bd = class extends Error {
  constructor(e, r, n) {
    super(`value for ${e} ${r} is invalid, please use a valid ${n}`), this.name = "InvalidStyleError";
  }
}, x(bd, "InvalidStyleError"), bd);
function T6(t) {
  return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t);
}
x(T6, "validateHexCode");
function NH(t) {
  return !/^\d+$/.test(t);
}
x(NH, "validateNumber");
function MH(t) {
  return !/^\d+px$/.test(t);
}
x(MH, "validateSizeInPixels");
var t8e = we();
function fo(t) {
  return fr(t.trim(), t8e);
}
x(fo, "textSanitizer");
var li = new e8e();
function DH(t) {
  li.setData({ quadrant1Text: fo(t.text) });
}
x(DH, "setQuadrant1Text");
function IH(t) {
  li.setData({ quadrant2Text: fo(t.text) });
}
x(IH, "setQuadrant2Text");
function OH(t) {
  li.setData({ quadrant3Text: fo(t.text) });
}
x(OH, "setQuadrant3Text");
function PH(t) {
  li.setData({ quadrant4Text: fo(t.text) });
}
x(PH, "setQuadrant4Text");
function BH(t) {
  li.setData({ xAxisLeftText: fo(t.text) });
}
x(BH, "setXAxisLeftText");
function FH(t) {
  li.setData({ xAxisRightText: fo(t.text) });
}
x(FH, "setXAxisRightText");
function $H(t) {
  li.setData({ yAxisTopText: fo(t.text) });
}
x($H, "setYAxisTopText");
function zH(t) {
  li.setData({ yAxisBottomText: fo(t.text) });
}
x(zH, "setYAxisBottomText");
function hb(t) {
  const e = {};
  for (const r of t) {
    const [n, i] = r.trim().split(/\s*:\s*/);
    if (n === "radius") {
      if (NH(i))
        throw new Lm(n, i, "number");
      e.radius = parseInt(i);
    } else if (n === "color") {
      if (T6(i))
        throw new Lm(n, i, "hex code");
      e.color = i;
    } else if (n === "stroke-color") {
      if (T6(i))
        throw new Lm(n, i, "hex code");
      e.strokeColor = i;
    } else if (n === "stroke-width") {
      if (MH(i))
        throw new Lm(n, i, "number of pixels (eg. 10px)");
      e.strokeWidth = i;
    } else
      throw new Error(`style named ${n} is not supported.`);
  }
  return e;
}
x(hb, "parseStyles");
function VH(t, e, r, n, i) {
  const a = hb(i);
  li.addPoints([
    {
      x: r,
      y: n,
      text: fo(t.text),
      className: e,
      ...a
    }
  ]);
}
x(VH, "addPoint");
function GH(t, e) {
  li.addClass(t, hb(e));
}
x(GH, "addClass");
function UH(t) {
  li.setConfig({ chartWidth: t });
}
x(UH, "setWidth");
function WH(t) {
  li.setConfig({ chartHeight: t });
}
x(WH, "setHeight");
function HH() {
  const t = we(), { themeVariables: e, quadrantChart: r } = t;
  return r && li.setConfig(r), li.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
  }), li.setData({ titleText: Ln() }), li.build();
}
x(HH, "getQuadrantData");
var r8e = /* @__PURE__ */ x(function() {
  li.clear(), _n();
}, "clear"), n8e = {
  setWidth: UH,
  setHeight: WH,
  setQuadrant1Text: DH,
  setQuadrant2Text: IH,
  setQuadrant3Text: OH,
  setQuadrant4Text: PH,
  setXAxisLeftText: BH,
  setXAxisRightText: FH,
  setYAxisTopText: $H,
  setYAxisBottomText: zH,
  parseStyles: hb,
  addPoint: VH,
  addClass: GH,
  getQuadrantData: HH,
  clear: r8e,
  setAccTitle: Cn,
  getAccTitle: Vn,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln,
  getAccDescription: Un,
  setAccDescription: Gn
}, i8e = /* @__PURE__ */ x((t, e, r, n) => {
  var _, L, N;
  function i(A) {
    return A === "top" ? "hanging" : "middle";
  }
  x(i, "getDominantBaseLine");
  function a(A) {
    return A === "left" ? "start" : "middle";
  }
  x(a, "getTextAnchor");
  function s(A) {
    return `translate(${A.x}, ${A.y}) rotate(${A.rotation || 0})`;
  }
  x(s, "getTransformation");
  const o = we();
  ae.debug(`Rendering quadrant chart
` + t);
  const l = o.securityLevel;
  let u;
  l === "sandbox" && (u = Qe("#i" + e));
  const d = Qe(l === "sandbox" ? u.nodes()[0].contentDocument.body : "body").select(`[id="${e}"]`), f = d.append("g").attr("class", "main"), p = ((_ = o.quadrantChart) == null ? void 0 : _.chartWidth) ?? 500, g = ((L = o.quadrantChart) == null ? void 0 : L.chartHeight) ?? 500;
  Ki(d, g, p, ((N = o.quadrantChart) == null ? void 0 : N.useMaxWidth) ?? !0), d.attr("viewBox", "0 0 " + p + " " + g), n.db.setHeight(g), n.db.setWidth(p);
  const m = n.db.getQuadrantData(), v = f.append("g").attr("class", "quadrants"), y = f.append("g").attr("class", "border"), b = f.append("g").attr("class", "data-points"), w = f.append("g").attr("class", "labels"), T = f.append("g").attr("class", "title");
  m.title && T.append("text").attr("x", 0).attr("y", 0).attr("fill", m.title.fill).attr("font-size", m.title.fontSize).attr("dominant-baseline", i(m.title.horizontalPos)).attr("text-anchor", a(m.title.verticalPos)).attr("transform", s(m.title)).text(m.title.text), m.borderLines && y.selectAll("line").data(m.borderLines).enter().append("line").attr("x1", (A) => A.x1).attr("y1", (A) => A.y1).attr("x2", (A) => A.x2).attr("y2", (A) => A.y2).style("stroke", (A) => A.strokeFill).style("stroke-width", (A) => A.strokeWidth);
  const E = v.selectAll("g.quadrant").data(m.quadrants).enter().append("g").attr("class", "quadrant");
  E.append("rect").attr("x", (A) => A.x).attr("y", (A) => A.y).attr("width", (A) => A.width).attr("height", (A) => A.height).attr("fill", (A) => A.fill), E.append("text").attr("x", 0).attr("y", 0).attr("fill", (A) => A.text.fill).attr("font-size", (A) => A.text.fontSize).attr(
    "dominant-baseline",
    (A) => i(A.text.horizontalPos)
  ).attr("text-anchor", (A) => a(A.text.verticalPos)).attr("transform", (A) => s(A.text)).text((A) => A.text.text), w.selectAll("g.label").data(m.axisLabels).enter().append("g").attr("class", "label").append("text").attr("x", 0).attr("y", 0).text((A) => A.text).attr("fill", (A) => A.fill).attr("font-size", (A) => A.fontSize).attr("dominant-baseline", (A) => i(A.horizontalPos)).attr("text-anchor", (A) => a(A.verticalPos)).attr("transform", (A) => s(A));
  const k = b.selectAll("g.data-point").data(m.points).enter().append("g").attr("class", "data-point");
  k.append("circle").attr("cx", (A) => A.x).attr("cy", (A) => A.y).attr("r", (A) => A.radius).attr("fill", (A) => A.fill).attr("stroke", (A) => A.strokeColor).attr("stroke-width", (A) => A.strokeWidth), k.append("text").attr("x", 0).attr("y", 0).text((A) => A.text.text).attr("fill", (A) => A.text.fill).attr("font-size", (A) => A.text.fontSize).attr(
    "dominant-baseline",
    (A) => i(A.text.horizontalPos)
  ).attr("text-anchor", (A) => a(A.text.verticalPos)).attr("transform", (A) => s(A.text));
}, "draw"), a8e = {
  draw: i8e
}, s8e = {
  parser: JCe,
  db: n8e,
  renderer: a8e,
  styles: /* @__PURE__ */ x(() => "", "styles")
};
const o8e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: s8e
}, Symbol.toStringTag, { value: "Module" }));
var E6 = function() {
  var t = /* @__PURE__ */ x(function(R, I, D, M) {
    for (D = D || {}, M = R.length; M--; D[R[M]] = I) ;
    return D;
  }, "o"), e = [1, 10, 12, 14, 16, 18, 19, 21, 23], r = [2, 6], n = [1, 3], i = [1, 5], a = [1, 6], s = [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], d = [1, 29], f = [1, 30], p = [1, 31], g = [1, 32], m = [1, 33], v = [1, 34], y = [1, 35], b = [1, 36], w = [1, 37], T = [1, 43], E = [1, 42], C = [1, 47], k = [1, 50], _ = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], L = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], N = [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], A = [1, 64], O = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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: /* @__PURE__ */ x(function(I, D, M, B, $, F, G) {
      var H = F.length - 1;
      switch ($) {
        case 5:
          B.setOrientation(F[H]);
          break;
        case 9:
          B.setDiagramTitle(F[H].text.trim());
          break;
        case 12:
          B.setLineData({ text: "", type: "text" }, F[H]);
          break;
        case 13:
          B.setLineData(F[H - 1], F[H]);
          break;
        case 14:
          B.setBarData({ text: "", type: "text" }, F[H]);
          break;
        case 15:
          B.setBarData(F[H - 1], F[H]);
          break;
        case 16:
          this.$ = F[H].trim(), B.setAccTitle(this.$);
          break;
        case 17:
        case 18:
          this.$ = F[H].trim(), B.setAccDescription(this.$);
          break;
        case 19:
          this.$ = F[H - 1];
          break;
        case 20:
          this.$ = [Number(F[H - 2]), ...F[H]];
          break;
        case 21:
          this.$ = [Number(F[H])];
          break;
        case 22:
          B.setXAxisTitle(F[H]);
          break;
        case 23:
          B.setXAxisTitle(F[H - 1]);
          break;
        case 24:
          B.setXAxisTitle({ type: "text", text: "" });
          break;
        case 25:
          B.setXAxisBand(F[H]);
          break;
        case 26:
          B.setXAxisRangeData(Number(F[H - 2]), Number(F[H]));
          break;
        case 27:
          this.$ = F[H - 1];
          break;
        case 28:
          this.$ = [F[H - 2], ...F[H]];
          break;
        case 29:
          this.$ = [F[H]];
          break;
        case 30:
          B.setYAxisTitle(F[H]);
          break;
        case 31:
          B.setYAxisTitle(F[H - 1]);
          break;
        case 32:
          B.setYAxisTitle({ type: "text", text: "" });
          break;
        case 33:
          B.setYAxisRangeData(Number(F[H - 2]), Number(F[H]));
          break;
        case 37:
          this.$ = { text: F[H], type: "text" };
          break;
        case 38:
          this.$ = { text: F[H], type: "text" };
          break;
        case 39:
          this.$ = { text: F[H], type: "markdown" };
          break;
        case 40:
          this.$ = F[H];
          break;
        case 41:
          this.$ = F[H - 1] + "" + F[H];
          break;
      }
    }, "anonymous"),
    table: [t(e, r, { 3: 1, 4: 2, 7: 4, 5: n, 34: i, 35: a, 36: s }), { 1: [3] }, t(e, r, { 4: 2, 7: 4, 3: 8, 5: n, 34: i, 35: a, 36: s }), t(e, r, { 4: 2, 7: 4, 6: 9, 3: 10, 5: n, 8: [1, 11], 34: i, 35: a, 36: s }), { 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, r, { 4: 2, 7: 4, 3: 21, 5: n, 34: i, 35: a, 36: s }), { 1: [2, 3] }, t(o, [2, 5]), t(e, [2, 7], { 4: 22, 34: i, 35: a, 36: s }), { 11: 23, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, { 11: 39, 13: 38, 24: T, 27: E, 29: 40, 30: 41, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, { 11: 45, 15: 44, 27: C, 33: 46, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, { 11: 49, 17: 48, 24: k, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, { 11: 52, 17: 51, 24: k, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, { 20: [1, 53] }, { 22: [1, 54] }, t(_, [2, 18]), { 1: [2, 2] }, t(_, [2, 8]), t(_, [2, 9]), t(L, [2, 37], { 40: 55, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }), t(L, [2, 38]), t(L, [2, 39]), t(N, [2, 40]), t(N, [2, 42]), t(N, [2, 43]), t(N, [2, 44]), t(N, [2, 45]), t(N, [2, 46]), t(N, [2, 47]), t(N, [2, 48]), t(N, [2, 49]), t(N, [2, 50]), t(N, [2, 51]), t(_, [2, 10]), t(_, [2, 22], { 30: 41, 29: 56, 24: T, 27: E }), t(_, [2, 24]), t(_, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, t(_, [2, 11]), t(_, [2, 30], { 33: 60, 27: C }), t(_, [2, 32]), { 31: [1, 61] }, t(_, [2, 12]), { 17: 62, 24: k }, { 25: 63, 27: A }, t(_, [2, 14]), { 17: 65, 24: k }, t(_, [2, 16]), t(_, [2, 17]), t(N, [2, 41]), t(_, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, t(_, [2, 31]), { 27: [1, 69] }, t(_, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, t(_, [2, 15]), t(_, [2, 26]), t(_, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: d, 43: f, 44: p, 45: g, 46: m, 47: v, 48: y, 49: b, 50: w }, t(_, [2, 33]), t(_, [2, 19]), { 25: 73, 27: A }, { 26: [2, 28] }, { 26: [2, 20] }],
    defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
    parseError: /* @__PURE__ */ x(function(I, D) {
      if (D.recoverable)
        this.trace(I);
      else {
        var M = new Error(I);
        throw M.hash = D, M;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(I) {
      var D = this, M = [0], B = [], $ = [null], F = [], G = this.table, H = "", ee = 0, Y = 0, re = 2, ne = 1, he = F.slice.call(arguments, 1), K = Object.create(this.lexer), Z = { yy: {} };
      for (var X in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, X) && (Z.yy[X] = this.yy[X]);
      K.setInput(I, Z.yy), Z.yy.lexer = K, Z.yy.parser = this, typeof K.yylloc > "u" && (K.yylloc = {});
      var q = K.yylloc;
      F.push(q);
      var J = K.options && K.options.ranges;
      typeof Z.yy.parseError == "function" ? this.parseError = Z.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function j(Se) {
        M.length = M.length - 2 * Se, $.length = $.length - Se, F.length = F.length - Se;
      }
      x(j, "popStack");
      function pe() {
        var Se;
        return Se = B.pop() || K.lex() || ne, typeof Se != "number" && (Se instanceof Array && (B = Se, Se = B.pop()), Se = D.symbols_[Se] || Se), Se;
      }
      x(pe, "lex");
      for (var te, Ae, W, Oe, ue = {}, Ve, Ge, Ue, ke; ; ) {
        if (Ae = M[M.length - 1], this.defaultActions[Ae] ? W = this.defaultActions[Ae] : ((te === null || typeof te > "u") && (te = pe()), W = G[Ae] && G[Ae][te]), typeof W > "u" || !W.length || !W[0]) {
          var Pe = "";
          ke = [];
          for (Ve in G[Ae])
            this.terminals_[Ve] && Ve > re && ke.push("'" + this.terminals_[Ve] + "'");
          K.showPosition ? Pe = "Parse error on line " + (ee + 1) + `:
` + K.showPosition() + `
Expecting ` + ke.join(", ") + ", got '" + (this.terminals_[te] || te) + "'" : Pe = "Parse error on line " + (ee + 1) + ": Unexpected " + (te == ne ? "end of input" : "'" + (this.terminals_[te] || te) + "'"), this.parseError(Pe, {
            text: K.match,
            token: this.terminals_[te] || te,
            line: K.yylineno,
            loc: q,
            expected: ke
          });
        }
        if (W[0] instanceof Array && W.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Ae + ", token: " + te);
        switch (W[0]) {
          case 1:
            M.push(te), $.push(K.yytext), F.push(K.yylloc), M.push(W[1]), te = null, Y = K.yyleng, H = K.yytext, ee = K.yylineno, q = K.yylloc;
            break;
          case 2:
            if (Ge = this.productions_[W[1]][1], ue.$ = $[$.length - Ge], ue._$ = {
              first_line: F[F.length - (Ge || 1)].first_line,
              last_line: F[F.length - 1].last_line,
              first_column: F[F.length - (Ge || 1)].first_column,
              last_column: F[F.length - 1].last_column
            }, J && (ue._$.range = [
              F[F.length - (Ge || 1)].range[0],
              F[F.length - 1].range[1]
            ]), Oe = this.performAction.apply(ue, [
              H,
              Y,
              ee,
              Z.yy,
              W[1],
              $,
              F
            ].concat(he)), typeof Oe < "u")
              return Oe;
            Ge && (M = M.slice(0, -1 * Ge * 2), $ = $.slice(0, -1 * Ge), F = F.slice(0, -1 * Ge)), M.push(this.productions_[W[1]][0]), $.push(ue.$), F.push(ue._$), Ue = G[M[M.length - 2]][M[M.length - 1]], M.push(Ue);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, P = /* @__PURE__ */ function() {
    var R = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(D, M) {
        if (this.yy.parser)
          this.yy.parser.parseError(D, M);
        else
          throw new Error(D);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(I, D) {
        return this.yy = D || 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;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var I = this._input[0];
        this.yytext += I, this.yyleng++, this.offset++, this.match += I, this.matched += I;
        var D = I.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), I;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(I) {
        var D = I.length, M = I.split(/(?:\r\n?|\n)/g);
        this._input = I + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - D), this.offset -= D;
        var B = 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 $ = 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 === B.length ? this.yylloc.first_column : 0) + B[B.length - M.length].length - M[0].length : this.yylloc.first_column - D
        }, this.options.ranges && (this.yylloc.range = [$[0], $[0] + this.yyleng - D]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(I) {
        this.unput(this.match.slice(I));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var I = this.matched.substr(0, this.matched.length - this.match.length);
        return (I.length > 20 ? "..." : "") + I.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(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, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var I = this.pastInput(), D = new Array(I.length + 1).join("-");
        return I + this.upcomingInput() + `
` + D + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(I, D) {
        var M, B, $;
        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))), B = I[0].match(/(?:\r\n?|\n).*/g), B && (this.yylineno += B.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: B ? B[B.length - 1].length - B[B.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], M = this.performAction.call(this, this.yy, this, D, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), M)
          return M;
        if (this._backtrack) {
          for (var F in $)
            this[F] = $[F];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var I, D, M, B;
        this._more || (this.yytext = "", this.match = "");
        for (var $ = this._currentRules(), F = 0; F < $.length; F++)
          if (M = this._input.match(this.rules[$[F]]), M && (!D || M[0].length > D[0].length)) {
            if (D = M, B = F, this.options.backtrack_lexer) {
              if (I = this.test_match(M, $[F]), I !== !1)
                return I;
              if (this._backtrack) {
                D = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return D ? (I = this.test_match(D, $[B]), 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
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var D = this.next();
        return D || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(D) {
        this.conditionStack.push(D);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var D = this.conditionStack.length - 1;
        return D > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(D) {
        return D = this.conditionStack.length - 1 - Math.abs(D || 0), D >= 0 ? this.conditionStack[D] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(D) {
        this.begin(D);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(D, M, B, $) {
        switch (B) {
          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 5;
          case 16:
            return 8;
          case 17:
            return this.pushState("axis_data"), "X_AXIS";
          case 18:
            return this.pushState("axis_data"), "Y_AXIS";
          case 19:
            return this.pushState("axis_band_data"), 24;
          case 20:
            return 31;
          case 21:
            return this.pushState("data"), 16;
          case 22:
            return this.pushState("data"), 18;
          case 23:
            return this.pushState("data_inner"), 24;
          case 24:
            return 27;
          case 25:
            return this.popState(), 26;
          case 26:
            this.popState();
            break;
          case 27:
            this.pushState("string");
            break;
          case 28:
            this.popState();
            break;
          case 29:
            return "STR";
          case 30:
            return 24;
          case 31:
            return 26;
          case 32:
            return 43;
          case 33:
            return "COLON";
          case 34:
            return 44;
          case 35:
            return 28;
          case 36:
            return 45;
          case 37:
            return 46;
          case 38:
            return 48;
          case 39:
            return 50;
          case 40:
            return 47;
          case 41:
            return 41;
          case 42:
            return 49;
          case 43:
            return 42;
          case 44:
            break;
          case 45:
            return 35;
          case 46:
            return 36;
        }
      }, "anonymous"),
      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, /^(?:xychart\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, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, data: { rules: [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 23, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, axis_band_data: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, axis_data: { rules: [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], 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: [28, 29], inclusive: !1 }, INITIAL: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 } }
    };
    return R;
  }();
  O.lexer = P;
  function S() {
    this.yy = {};
  }
  return x(S, "Parser"), S.prototype = O, O.Parser = S, new S();
}();
E6.parser = E6;
var l8e = E6;
function k6(t) {
  return t.type === "bar";
}
x(k6, "isBarPlot");
function i7(t) {
  return t.type === "band";
}
x(i7, "isBandAxisData");
function Gh(t) {
  return t.type === "linear";
}
x(Gh, "isLinearAxisData");
var wd, qH = (wd = class {
  constructor(e) {
    this.parentGroup = e;
  }
  getMaxDimension(e, r) {
    if (!this.parentGroup)
      return {
        width: e.reduce((a, s) => Math.max(s.length, a), 0) * r,
        height: r
      };
    const n = {
      width: 0,
      height: 0
    }, i = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", r);
    for (const a of e) {
      const s = MP(i, 1, a), o = s ? s.width : a.length * r, l = s ? s.height : r;
      n.width = Math.max(n.width, o), n.height = Math.max(n.height, l);
    }
    return i.remove(), n;
  }
}, x(wd, "TextDimensionCalculatorWithFont"), wd), vN = 0.7, yN = 0.2, Td, YH = (Td = class {
  constructor(e, r, n, i) {
    this.axisConfig = e, this.title = r, this.textDimensionCalculator = n, this.axisThemeConfig = i, 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() {
    vN * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(vN * this.getTickDistance() / 2)), this.recalculateScale();
  }
  calculateSpaceIfDrawnHorizontally(e) {
    let r = e.height;
    if (this.axisConfig.showAxisLine && r > this.axisConfig.axisLineWidth && (r -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
      const n = this.getLabelDimension(), i = yN * e.width;
      this.outerPadding = Math.min(n.width / 2, i);
      const a = n.height + this.axisConfig.labelPadding * 2;
      this.labelTextHeight = n.height, a <= r && (r -= a, this.showLabel = !0);
    }
    if (this.axisConfig.showTick && r >= this.axisConfig.tickLength && (this.showTick = !0, r -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
      const n = this.textDimensionCalculator.getMaxDimension(
        [this.title],
        this.axisConfig.titleFontSize
      ), i = n.height + this.axisConfig.titlePadding * 2;
      this.titleTextHeight = n.height, i <= r && (r -= i, this.showTitle = !0);
    }
    this.boundingRect.width = e.width, this.boundingRect.height = e.height - r;
  }
  calculateSpaceIfDrawnVertical(e) {
    let r = e.width;
    if (this.axisConfig.showAxisLine && r > this.axisConfig.axisLineWidth && (r -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
      const n = this.getLabelDimension(), i = yN * e.height;
      this.outerPadding = Math.min(n.height / 2, i);
      const a = n.width + this.axisConfig.labelPadding * 2;
      a <= r && (r -= a, this.showLabel = !0);
    }
    if (this.axisConfig.showTick && r >= this.axisConfig.tickLength && (this.showTick = !0, r -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
      const n = this.textDimensionCalculator.getMaxDimension(
        [this.title],
        this.axisConfig.titleFontSize
      ), i = n.height + this.axisConfig.titlePadding * 2;
      this.titleTextHeight = n.height, i <= r && (r -= i, this.showTitle = !0);
    }
    this.boundingRect.width = e.width - r, 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 r = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
      e.push({
        type: "path",
        groupTexts: ["left-axis", "axisl-line"],
        data: [
          {
            path: `M ${r},${this.boundingRect.y} L ${r},${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((r) => ({
        text: r.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(r),
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "middle",
        horizontalPos: "right"
      }))
    }), this.showTick) {
      const r = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
      e.push({
        type: "path",
        groupTexts: ["left-axis", "ticks"],
        data: this.getTickValues().map((n) => ({
          path: `M ${r},${this.getScaleValue(n)} L ${r - this.axisConfig.tickLength},${this.getScaleValue(n)}`,
          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 r = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
      e.push({
        type: "path",
        groupTexts: ["bottom-axis", "axis-line"],
        data: [
          {
            path: `M ${this.boundingRect.x},${r} L ${this.boundingRect.x + this.boundingRect.width},${r}`,
            strokeFill: this.axisThemeConfig.axisLineColor,
            strokeWidth: this.axisConfig.axisLineWidth
          }
        ]
      });
    }
    if (this.showLabel && e.push({
      type: "text",
      groupTexts: ["bottom-axis", "label"],
      data: this.getTickValues().map((r) => ({
        text: r.toString(),
        x: this.getScaleValue(r),
        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 r = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
      e.push({
        type: "path",
        groupTexts: ["bottom-axis", "ticks"],
        data: this.getTickValues().map((n) => ({
          path: `M ${this.getScaleValue(n)},${r} L ${this.getScaleValue(n)},${r + 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 r = 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},${r} L ${this.boundingRect.x + this.boundingRect.width},${r}`,
            strokeFill: this.axisThemeConfig.axisLineColor,
            strokeWidth: this.axisConfig.axisLineWidth
          }
        ]
      });
    }
    if (this.showLabel && e.push({
      type: "text",
      groupTexts: ["top-axis", "label"],
      data: this.getTickValues().map((r) => ({
        text: r.toString(),
        x: this.getScaleValue(r),
        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 r = this.boundingRect.y;
      e.push({
        type: "path",
        groupTexts: ["top-axis", "ticks"],
        data: this.getTickValues().map((n) => ({
          path: `M ${this.getScaleValue(n)},${r + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(n)},${r + 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() : [];
  }
}, x(Td, "BaseAxis"), Td), Ed, c8e = (Ed = class extends YH {
  constructor(e, r, n, i, a) {
    super(e, i, a, r), this.categories = n, this.scale = hw().domain(this.categories).range(this.getRange());
  }
  setRange(e) {
    super.setRange(e);
  }
  recalculateScale() {
    this.scale = hw().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), ae.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
  }
  getTickValues() {
    return this.categories;
  }
  getScaleValue(e) {
    return this.scale(e) ?? this.getRange()[0];
  }
}, x(Ed, "BandAxis"), Ed), kd, u8e = (kd = class extends YH {
  constructor(e, r, n, i, a) {
    super(e, i, a, r), this.domain = n, this.scale = qd().domain(this.domain).range(this.getRange());
  }
  getTickValues() {
    return this.scale.ticks();
  }
  recalculateScale() {
    const e = [...this.domain];
    this.axisPosition === "left" && e.reverse(), this.scale = qd().domain(e).range(this.getRange());
  }
  getScaleValue(e) {
    return this.scale(e);
  }
}, x(kd, "LinearAxis"), kd);
function S6(t, e, r, n) {
  const i = new qH(n);
  return i7(t) ? new c8e(
    e,
    r,
    t.categories,
    t.title,
    i
  ) : new u8e(
    e,
    r,
    [t.min, t.max],
    t.title,
    i
  );
}
x(S6, "getAxis");
var Sd, h8e = (Sd = class {
  constructor(e, r, n, i) {
    this.textDimensionCalculator = e, this.chartConfig = r, this.chartData = n, this.chartThemeConfig = i, 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 r = this.textDimensionCalculator.getMaxDimension(
      [this.chartData.title],
      this.chartConfig.titleFontSize
    ), n = Math.max(r.width, e.width), i = r.height + 2 * this.chartConfig.titlePadding;
    return r.width <= n && r.height <= i && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = n, this.boundingRect.height = i, 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;
  }
}, x(Sd, "ChartTitle"), Sd);
function XH(t, e, r, n) {
  const i = new qH(n);
  return new h8e(i, t, e, r);
}
x(XH, "getChartTitleComponent");
var Cd, d8e = (Cd = class {
  constructor(e, r, n, i, a) {
    this.plotData = e, this.xAxis = r, this.yAxis = n, this.orientation = i, this.plotIndex = a;
  }
  getDrawableElement() {
    const e = this.plotData.data.map((n) => [
      this.xAxis.getScaleValue(n[0]),
      this.yAxis.getScaleValue(n[1])
    ]);
    let r;
    return this.orientation === "horizontal" ? r = Gp().y((n) => n[0]).x((n) => n[1])(e) : r = Gp().x((n) => n[0]).y((n) => n[1])(e), r ? [
      {
        groupTexts: ["plot", `line-plot-${this.plotIndex}`],
        type: "path",
        data: [
          {
            path: r,
            strokeFill: this.plotData.strokeFill,
            strokeWidth: this.plotData.strokeWidth
          }
        ]
      }
    ] : [];
  }
}, x(Cd, "LinePlot"), Cd), Ad, f8e = (Ad = class {
  constructor(e, r, n, i, a, s) {
    this.barData = e, this.boundingRect = r, this.xAxis = n, this.yAxis = i, this.orientation = a, this.plotIndex = s;
  }
  getDrawableElement() {
    const e = this.barData.data.map((a) => [
      this.xAxis.getScaleValue(a[0]),
      this.yAxis.getScaleValue(a[1])
    ]), n = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), i = n / 2;
    return this.orientation === "horizontal" ? [
      {
        groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
        type: "rect",
        data: e.map((a) => ({
          x: this.boundingRect.x,
          y: a[0] - i,
          height: n,
          width: a[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((a) => ({
          x: a[0] - i,
          y: a[1],
          width: n,
          height: this.boundingRect.y + this.boundingRect.height - a[1],
          fill: this.barData.fill,
          strokeWidth: 0,
          strokeFill: this.barData.fill
        }))
      }
    ];
  }
}, x(Ad, "BarPlot"), Ad), _d, p8e = (_d = class {
  constructor(e, r, n) {
    this.chartConfig = e, this.chartData = r, this.chartThemeConfig = n, this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    };
  }
  setAxes(e, r) {
    this.xAxis = e, this.yAxis = r;
  }
  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 [r, n] of this.chartData.plots.entries())
      switch (n.type) {
        case "line":
          {
            const i = new d8e(
              n,
              this.xAxis,
              this.yAxis,
              this.chartConfig.chartOrientation,
              r
            );
            e.push(...i.getDrawableElement());
          }
          break;
        case "bar":
          {
            const i = new f8e(
              n,
              this.boundingRect,
              this.xAxis,
              this.yAxis,
              this.chartConfig.chartOrientation,
              r
            );
            e.push(...i.getDrawableElement());
          }
          break;
      }
    return e;
  }
}, x(_d, "BasePlot"), _d);
function jH(t, e, r) {
  return new p8e(t, e, r);
}
x(jH, "getPlotComponent");
var Ld, g8e = (Ld = class {
  constructor(e, r, n, i) {
    this.chartConfig = e, this.chartData = r, this.componentStore = {
      title: XH(e, r, n, i),
      plot: jH(e, r, n),
      xAxis: S6(
        r.xAxis,
        e.xAxis,
        {
          titleColor: n.xAxisTitleColor,
          labelColor: n.xAxisLabelColor,
          tickColor: n.xAxisTickColor,
          axisLineColor: n.xAxisLineColor
        },
        i
      ),
      yAxis: S6(
        r.yAxis,
        e.yAxis,
        {
          titleColor: n.yAxisTitleColor,
          labelColor: n.yAxisLabelColor,
          tickColor: n.yAxisTickColor,
          axisLineColor: n.yAxisLineColor
        },
        i
      )
    };
  }
  calculateVerticalSpace() {
    let e = this.chartConfig.width, r = this.chartConfig.height, n = 0, i = 0, a = Math.floor(e * this.chartConfig.plotReservedSpacePercent / 100), s = Math.floor(
      r * this.chartConfig.plotReservedSpacePercent / 100
    ), o = this.componentStore.plot.calculateSpace({
      width: a,
      height: s
    });
    e -= o.width, r -= o.height, o = this.componentStore.title.calculateSpace({
      width: this.chartConfig.width,
      height: r
    }), i = o.height, r -= o.height, this.componentStore.xAxis.setAxisPosition("bottom"), o = this.componentStore.xAxis.calculateSpace({
      width: e,
      height: r
    }), r -= o.height, this.componentStore.yAxis.setAxisPosition("left"), o = this.componentStore.yAxis.calculateSpace({
      width: e,
      height: r
    }), n = o.width, e -= o.width, e > 0 && (a += e, e = 0), r > 0 && (s += r, r = 0), this.componentStore.plot.calculateSpace({
      width: a,
      height: s
    }), this.componentStore.plot.setBoundingBoxXY({ x: n, y: i }), this.componentStore.xAxis.setRange([n, n + a]), this.componentStore.xAxis.setBoundingBoxXY({ x: n, y: i + s }), this.componentStore.yAxis.setRange([i, i + s]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: i }), this.chartData.plots.some((l) => k6(l)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
  }
  calculateHorizontalSpace() {
    let e = this.chartConfig.width, r = this.chartConfig.height, n = 0, i = 0, a = 0, s = Math.floor(e * this.chartConfig.plotReservedSpacePercent / 100), o = Math.floor(
      r * this.chartConfig.plotReservedSpacePercent / 100
    ), l = this.componentStore.plot.calculateSpace({
      width: s,
      height: o
    });
    e -= l.width, r -= l.height, l = this.componentStore.title.calculateSpace({
      width: this.chartConfig.width,
      height: r
    }), n = l.height, r -= l.height, this.componentStore.xAxis.setAxisPosition("left"), l = this.componentStore.xAxis.calculateSpace({
      width: e,
      height: r
    }), e -= l.width, i = l.width, this.componentStore.yAxis.setAxisPosition("top"), l = this.componentStore.yAxis.calculateSpace({
      width: e,
      height: r
    }), r -= l.height, a = n + l.height, e > 0 && (s += e, e = 0), r > 0 && (o += r, r = 0), this.componentStore.plot.calculateSpace({
      width: s,
      height: o
    }), this.componentStore.plot.setBoundingBoxXY({ x: i, y: a }), this.componentStore.yAxis.setRange([i, i + s]), this.componentStore.yAxis.setBoundingBoxXY({ x: i, y: n }), this.componentStore.xAxis.setRange([a, a + o]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: a }), this.chartData.plots.some((u) => k6(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 r of Object.values(this.componentStore))
      e.push(...r.getDrawableElements());
    return e;
  }
}, x(Ld, "Orchestrator"), Ld), Rd, m8e = (Rd = class {
  static build(e, r, n, i) {
    return new g8e(e, r, n, i).getDrawableElement();
  }
}, x(Rd, "XYChartBuilder"), Rd), xg = 0, KH, bg = o7(), wg = s7(), Ar = l7(), C6 = wg.plotColorPalette.split(",").map((t) => t.trim()), db = !1, a7 = !1;
function s7() {
  const t = F2(), e = gr();
  return qi(t.xyChart, e.themeVariables.xyChart);
}
x(s7, "getChartDefaultThemeConfig");
function o7() {
  const t = gr();
  return qi(
    hr.xyChart,
    t.xyChart
  );
}
x(o7, "getChartDefaultConfig");
function l7() {
  return {
    yAxis: {
      type: "linear",
      title: "",
      min: 1 / 0,
      max: -1 / 0
    },
    xAxis: {
      type: "band",
      title: "",
      categories: []
    },
    title: "",
    plots: []
  };
}
x(l7, "getChartDefaultData");
function fb(t) {
  const e = gr();
  return fr(t.trim(), e);
}
x(fb, "textSanitizer");
function ZH(t) {
  KH = t;
}
x(ZH, "setTmpSVGG");
function QH(t) {
  t === "horizontal" ? bg.chartOrientation = "horizontal" : bg.chartOrientation = "vertical";
}
x(QH, "setOrientation");
function JH(t) {
  Ar.xAxis.title = fb(t.text);
}
x(JH, "setXAxisTitle");
function c7(t, e) {
  Ar.xAxis = { type: "linear", title: Ar.xAxis.title, min: t, max: e }, db = !0;
}
x(c7, "setXAxisRangeData");
function eq(t) {
  Ar.xAxis = {
    type: "band",
    title: Ar.xAxis.title,
    categories: t.map((e) => fb(e.text))
  }, db = !0;
}
x(eq, "setXAxisBand");
function tq(t) {
  Ar.yAxis.title = fb(t.text);
}
x(tq, "setYAxisTitle");
function rq(t, e) {
  Ar.yAxis = { type: "linear", title: Ar.yAxis.title, min: t, max: e }, a7 = !0;
}
x(rq, "setYAxisRangeData");
function nq(t) {
  const e = Math.min(...t), r = Math.max(...t), n = Gh(Ar.yAxis) ? Ar.yAxis.min : 1 / 0, i = Gh(Ar.yAxis) ? Ar.yAxis.max : -1 / 0;
  Ar.yAxis = {
    type: "linear",
    title: Ar.yAxis.title,
    min: Math.min(n, e),
    max: Math.max(i, r)
  };
}
x(nq, "setYAxisRangeFromPlotData");
function u7(t) {
  let e = [];
  if (t.length === 0)
    return e;
  if (!db) {
    const r = Gh(Ar.xAxis) ? Ar.xAxis.min : 1 / 0, n = Gh(Ar.xAxis) ? Ar.xAxis.max : -1 / 0;
    c7(Math.min(r, 1), Math.max(n, t.length));
  }
  if (a7 || nq(t), i7(Ar.xAxis) && (e = Ar.xAxis.categories.map((r, n) => [r, t[n]])), Gh(Ar.xAxis)) {
    const r = Ar.xAxis.min, n = Ar.xAxis.max, i = (n - r) / (t.length - 1), a = [];
    for (let s = r; s <= n; s += i)
      a.push(`${s}`);
    e = a.map((s, o) => [s, t[o]]);
  }
  return e;
}
x(u7, "transformDataWithoutCategory");
function h7(t) {
  return C6[t === 0 ? 0 : t % C6.length];
}
x(h7, "getPlotColorFromPalette");
function iq(t, e) {
  const r = u7(e);
  Ar.plots.push({
    type: "line",
    strokeFill: h7(xg),
    strokeWidth: 2,
    data: r
  }), xg++;
}
x(iq, "setLineData");
function aq(t, e) {
  const r = u7(e);
  Ar.plots.push({
    type: "bar",
    fill: h7(xg),
    data: r
  }), xg++;
}
x(aq, "setBarData");
function sq() {
  if (Ar.plots.length === 0)
    throw Error("No Plot to render, please provide a plot with some data");
  return Ar.title = Ln(), m8e.build(bg, Ar, wg, KH);
}
x(sq, "getDrawableElem");
function oq() {
  return wg;
}
x(oq, "getChartThemeConfig");
function lq() {
  return bg;
}
x(lq, "getChartConfig");
function cq() {
  return Ar;
}
x(cq, "getXYChartData");
var v8e = /* @__PURE__ */ x(function() {
  _n(), xg = 0, bg = o7(), Ar = l7(), wg = s7(), C6 = wg.plotColorPalette.split(",").map((t) => t.trim()), db = !1, a7 = !1;
}, "clear"), y8e = {
  getDrawableElem: sq,
  clear: v8e,
  setAccTitle: Cn,
  getAccTitle: Vn,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln,
  getAccDescription: Un,
  setAccDescription: Gn,
  setOrientation: QH,
  setXAxisTitle: JH,
  setXAxisRangeData: c7,
  setXAxisBand: eq,
  setYAxisTitle: tq,
  setYAxisRangeData: rq,
  setLineData: iq,
  setBarData: aq,
  setTmpSVGG: ZH,
  getChartThemeConfig: oq,
  getChartConfig: lq,
  getXYChartData: cq
}, x8e = /* @__PURE__ */ x((t, e, r, n) => {
  const i = n.db, a = i.getChartThemeConfig(), s = i.getChartConfig(), o = i.getXYChartData().plots[0].data.map((y) => y[1]);
  function l(y) {
    return y === "top" ? "text-before-edge" : "middle";
  }
  x(l, "getDominantBaseLine");
  function u(y) {
    return y === "left" ? "start" : y === "right" ? "end" : "middle";
  }
  x(u, "getTextAnchor");
  function h(y) {
    return `translate(${y.x}, ${y.y}) rotate(${y.rotation || 0})`;
  }
  x(h, "getTextTransformation"), ae.debug(`Rendering xychart chart
` + t);
  const d = tl(e), f = d.append("g").attr("class", "main"), p = f.append("rect").attr("width", s.width).attr("height", s.height).attr("class", "background");
  Ki(d, s.height, s.width, !0), d.attr("viewBox", `0 0 ${s.width} ${s.height}`), p.attr("fill", a.backgroundColor), i.setTmpSVGG(d.append("g").attr("class", "mermaid-tmp-group"));
  const g = i.getDrawableElem(), m = {};
  function v(y) {
    let b = f, w = "";
    for (const [T] of y.entries()) {
      let E = f;
      T > 0 && m[w] && (E = m[w]), w += y[T], b = m[w], b || (b = m[w] = E.append("g").attr("class", y[T]));
    }
    return b;
  }
  x(v, "getGroup");
  for (const y of g) {
    if (y.data.length === 0)
      continue;
    const b = v(y.groupTexts);
    switch (y.type) {
      case "rect":
        if (b.selectAll("rect").data(y.data).enter().append("rect").attr("x", (w) => w.x).attr("y", (w) => w.y).attr("width", (w) => w.width).attr("height", (w) => w.height).attr("fill", (w) => w.fill).attr("stroke", (w) => w.strokeFill).attr("stroke-width", (w) => w.strokeWidth), s.showDataLabel)
          if (s.chartOrientation === "horizontal") {
            let w = function(_, L) {
              const { data: N, label: A } = _;
              return L * A.length * T <= N.width - 10;
            };
            x(w, "fitsHorizontally");
            const T = 0.7, E = y.data.map((_, L) => ({ data: _, label: o[L].toString() })).filter((_) => _.data.width > 0 && _.data.height > 0), C = E.map((_) => {
              const { data: L } = _;
              let N = L.height * 0.7;
              for (; !w(_, N) && N > 0; )
                N -= 1;
              return N;
            }), k = Math.floor(Math.min(...C));
            b.selectAll("text").data(E).enter().append("text").attr("x", (_) => _.data.x + _.data.width - 10).attr("y", (_) => _.data.y + _.data.height / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").attr("fill", "black").attr("font-size", `${k}px`).text((_) => _.label);
          } else {
            let w = function(_, L, N) {
              const { data: A, label: O } = _, S = L * O.length * 0.7, R = A.x + A.width / 2, I = R - S / 2, D = R + S / 2, M = I >= A.x && D <= A.x + A.width, B = A.y + N + L <= A.y + A.height;
              return M && B;
            };
            x(w, "fitsInBar");
            const T = 10, E = y.data.map((_, L) => ({ data: _, label: o[L].toString() })).filter((_) => _.data.width > 0 && _.data.height > 0), C = E.map((_) => {
              const { data: L, label: N } = _;
              let A = L.width / (N.length * 0.7);
              for (; !w(_, A, T) && A > 0; )
                A -= 1;
              return A;
            }), k = Math.floor(Math.min(...C));
            b.selectAll("text").data(E).enter().append("text").attr("x", (_) => _.data.x + _.data.width / 2).attr("y", (_) => _.data.y + T).attr("text-anchor", "middle").attr("dominant-baseline", "hanging").attr("fill", "black").attr("font-size", `${k}px`).text((_) => _.label);
          }
        break;
      case "text":
        b.selectAll("text").data(y.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (w) => w.fill).attr("font-size", (w) => w.fontSize).attr("dominant-baseline", (w) => l(w.verticalPos)).attr("text-anchor", (w) => u(w.horizontalPos)).attr("transform", (w) => h(w)).text((w) => w.text);
        break;
      case "path":
        b.selectAll("path").data(y.data).enter().append("path").attr("d", (w) => w.path).attr("fill", (w) => w.fill ? w.fill : "none").attr("stroke", (w) => w.strokeFill).attr("stroke-width", (w) => w.strokeWidth);
        break;
    }
  }
}, "draw"), b8e = {
  draw: x8e
}, w8e = {
  parser: l8e,
  db: y8e,
  renderer: b8e
};
const T8e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: w8e
}, Symbol.toStringTag, { value: "Module" }));
var A6 = function() {
  var t = /* @__PURE__ */ x(function(me, Me, Q, ce) {
    for (Q = Q || {}, ce = me.length; ce--; Q[me[ce]] = Me) ;
    return Q;
  }, "o"), e = [1, 3], r = [1, 4], n = [1, 5], i = [1, 6], a = [5, 6, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 77, 89, 90], s = [1, 22], o = [2, 7], l = [1, 26], u = [1, 27], h = [1, 28], d = [1, 29], f = [1, 33], p = [1, 34], g = [1, 35], m = [1, 36], v = [1, 37], y = [1, 38], b = [1, 24], w = [1, 31], T = [1, 32], E = [1, 30], C = [1, 39], k = [1, 40], _ = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 77, 89, 90], L = [1, 61], N = [89, 90], A = [5, 8, 9, 11, 13, 21, 22, 23, 24, 27, 29, 41, 42, 43, 44, 45, 46, 54, 61, 63, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], O = [27, 29], P = [1, 70], S = [1, 71], R = [1, 72], I = [1, 73], D = [1, 74], M = [1, 75], B = [1, 76], $ = [1, 83], F = [1, 80], G = [1, 84], H = [1, 85], ee = [1, 86], Y = [1, 87], re = [1, 88], ne = [1, 89], he = [1, 90], K = [1, 91], Z = [1, 92], X = [5, 8, 9, 11, 13, 21, 22, 23, 24, 27, 41, 42, 43, 44, 45, 46, 54, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], q = [63, 64], J = [1, 101], j = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 76, 77, 89, 90], pe = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], te = [1, 110], Ae = [1, 106], W = [1, 107], Oe = [1, 108], ue = [1, 109], Ve = [1, 111], Ge = [1, 116], Ue = [1, 117], ke = [1, 114], Pe = [1, 115], Se = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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, direction: 17, styleStatement: 18, classDefStatement: 19, classStatement: 20, direction_tb: 21, direction_bt: 22, direction_rl: 23, direction_lr: 24, requirementType: 25, requirementName: 26, STRUCT_START: 27, requirementBody: 28, STYLE_SEPARATOR: 29, idList: 30, ID: 31, COLONSEP: 32, id: 33, TEXT: 34, text: 35, RISK: 36, riskLevel: 37, VERIFYMTHD: 38, verifyType: 39, STRUCT_STOP: 40, REQUIREMENT: 41, FUNCTIONAL_REQUIREMENT: 42, INTERFACE_REQUIREMENT: 43, PERFORMANCE_REQUIREMENT: 44, PHYSICAL_REQUIREMENT: 45, DESIGN_CONSTRAINT: 46, LOW_RISK: 47, MED_RISK: 48, HIGH_RISK: 49, VERIFY_ANALYSIS: 50, VERIFY_DEMONSTRATION: 51, VERIFY_INSPECTION: 52, VERIFY_TEST: 53, ELEMENT: 54, elementName: 55, elementBody: 56, TYPE: 57, type: 58, DOCREF: 59, ref: 60, END_ARROW_L: 61, relationship: 62, LINE: 63, END_ARROW_R: 64, CONTAINS: 65, COPIES: 66, DERIVES: 67, SATISFIES: 68, VERIFIES: 69, REFINES: 70, TRACES: 71, CLASSDEF: 72, stylesOpt: 73, CLASS: 74, ALPHA: 75, COMMA: 76, STYLE: 77, style: 78, styleComponent: 79, NUM: 80, COLON: 81, UNIT: 82, SPACE: 83, BRKT: 84, PCT: 85, MINUS: 86, LABEL: 87, SEMICOLON: 88, unqString: 89, qString: 90, $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", 21: "direction_tb", 22: "direction_bt", 23: "direction_rl", 24: "direction_lr", 27: "STRUCT_START", 29: "STYLE_SEPARATOR", 31: "ID", 32: "COLONSEP", 34: "TEXT", 36: "RISK", 38: "VERIFYMTHD", 40: "STRUCT_STOP", 41: "REQUIREMENT", 42: "FUNCTIONAL_REQUIREMENT", 43: "INTERFACE_REQUIREMENT", 44: "PERFORMANCE_REQUIREMENT", 45: "PHYSICAL_REQUIREMENT", 46: "DESIGN_CONSTRAINT", 47: "LOW_RISK", 48: "MED_RISK", 49: "HIGH_RISK", 50: "VERIFY_ANALYSIS", 51: "VERIFY_DEMONSTRATION", 52: "VERIFY_INSPECTION", 53: "VERIFY_TEST", 54: "ELEMENT", 57: "TYPE", 59: "DOCREF", 61: "END_ARROW_L", 63: "LINE", 64: "END_ARROW_R", 65: "CONTAINS", 66: "COPIES", 67: "DERIVES", 68: "SATISFIES", 69: "VERIFIES", 70: "REFINES", 71: "TRACES", 72: "CLASSDEF", 74: "CLASS", 75: "ALPHA", 76: "COMMA", 77: "STYLE", 80: "NUM", 81: "COLON", 82: "UNIT", 83: "SPACE", 84: "BRKT", 85: "PCT", 86: "MINUS", 87: "LABEL", 88: "SEMICOLON", 89: "unqString", 90: "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], [7, 2], [7, 2], [7, 2], [7, 2], [17, 1], [17, 1], [17, 1], [17, 1], [14, 5], [14, 7], [28, 5], [28, 5], [28, 5], [28, 5], [28, 2], [28, 1], [25, 1], [25, 1], [25, 1], [25, 1], [25, 1], [25, 1], [37, 1], [37, 1], [37, 1], [39, 1], [39, 1], [39, 1], [39, 1], [15, 5], [15, 7], [56, 5], [56, 5], [56, 2], [56, 1], [16, 5], [16, 5], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [19, 3], [20, 3], [20, 3], [30, 1], [30, 3], [30, 1], [30, 3], [18, 3], [73, 1], [73, 3], [78, 1], [78, 2], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [26, 1], [26, 1], [33, 1], [33, 1], [35, 1], [35, 1], [55, 1], [55, 1], [58, 1], [58, 1], [60, 1], [60, 1]],
    performAction: /* @__PURE__ */ x(function(Me, Q, ce, z, oe, se, ge) {
      var de = se.length - 1;
      switch (oe) {
        case 4:
          this.$ = se[de].trim(), z.setAccTitle(this.$);
          break;
        case 5:
        case 6:
          this.$ = se[de].trim(), z.setAccDescription(this.$);
          break;
        case 7:
          this.$ = [];
          break;
        case 17:
          z.setDirection("TB");
          break;
        case 18:
          z.setDirection("BT");
          break;
        case 19:
          z.setDirection("RL");
          break;
        case 20:
          z.setDirection("LR");
          break;
        case 21:
          z.addRequirement(se[de - 3], se[de - 4]);
          break;
        case 22:
          z.addRequirement(se[de - 5], se[de - 6]), z.setClass([se[de - 5]], se[de - 3]);
          break;
        case 23:
          z.setNewReqId(se[de - 2]);
          break;
        case 24:
          z.setNewReqText(se[de - 2]);
          break;
        case 25:
          z.setNewReqRisk(se[de - 2]);
          break;
        case 26:
          z.setNewReqVerifyMethod(se[de - 2]);
          break;
        case 29:
          this.$ = z.RequirementType.REQUIREMENT;
          break;
        case 30:
          this.$ = z.RequirementType.FUNCTIONAL_REQUIREMENT;
          break;
        case 31:
          this.$ = z.RequirementType.INTERFACE_REQUIREMENT;
          break;
        case 32:
          this.$ = z.RequirementType.PERFORMANCE_REQUIREMENT;
          break;
        case 33:
          this.$ = z.RequirementType.PHYSICAL_REQUIREMENT;
          break;
        case 34:
          this.$ = z.RequirementType.DESIGN_CONSTRAINT;
          break;
        case 35:
          this.$ = z.RiskLevel.LOW_RISK;
          break;
        case 36:
          this.$ = z.RiskLevel.MED_RISK;
          break;
        case 37:
          this.$ = z.RiskLevel.HIGH_RISK;
          break;
        case 38:
          this.$ = z.VerifyType.VERIFY_ANALYSIS;
          break;
        case 39:
          this.$ = z.VerifyType.VERIFY_DEMONSTRATION;
          break;
        case 40:
          this.$ = z.VerifyType.VERIFY_INSPECTION;
          break;
        case 41:
          this.$ = z.VerifyType.VERIFY_TEST;
          break;
        case 42:
          z.addElement(se[de - 3]);
          break;
        case 43:
          z.addElement(se[de - 5]), z.setClass([se[de - 5]], se[de - 3]);
          break;
        case 44:
          z.setNewElementType(se[de - 2]);
          break;
        case 45:
          z.setNewElementDocRef(se[de - 2]);
          break;
        case 48:
          z.addRelationship(se[de - 2], se[de], se[de - 4]);
          break;
        case 49:
          z.addRelationship(se[de - 2], se[de - 4], se[de]);
          break;
        case 50:
          this.$ = z.Relationships.CONTAINS;
          break;
        case 51:
          this.$ = z.Relationships.COPIES;
          break;
        case 52:
          this.$ = z.Relationships.DERIVES;
          break;
        case 53:
          this.$ = z.Relationships.SATISFIES;
          break;
        case 54:
          this.$ = z.Relationships.VERIFIES;
          break;
        case 55:
          this.$ = z.Relationships.REFINES;
          break;
        case 56:
          this.$ = z.Relationships.TRACES;
          break;
        case 57:
          this.$ = se[de - 2], z.defineClass(se[de - 1], se[de]);
          break;
        case 58:
          z.setClass(se[de - 1], se[de]);
          break;
        case 59:
          z.setClass([se[de - 2]], se[de]);
          break;
        case 60:
        case 62:
          this.$ = [se[de]];
          break;
        case 61:
        case 63:
          this.$ = se[de - 2].concat([se[de]]);
          break;
        case 64:
          this.$ = se[de - 2], z.setCssStyle(se[de - 1], se[de]);
          break;
        case 65:
          this.$ = [se[de]];
          break;
        case 66:
          se[de - 2].push(se[de]), this.$ = se[de - 2];
          break;
        case 68:
          this.$ = se[de - 1] + se[de];
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: 2, 6: e, 9: r, 11: n, 13: i }, { 1: [3] }, { 3: 8, 4: 2, 5: [1, 7], 6: e, 9: r, 11: n, 13: i }, { 5: [1, 9] }, { 10: [1, 10] }, { 12: [1, 11] }, t(a, [2, 6]), { 3: 12, 4: 2, 6: e, 9: r, 11: n, 13: i }, { 1: [2, 2] }, { 4: 17, 5: s, 7: 13, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, t(a, [2, 4]), t(a, [2, 5]), { 1: [2, 1] }, { 8: [1, 41] }, { 4: 17, 5: s, 7: 42, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 43, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 44, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 45, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 46, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 47, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 48, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 49, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 4: 17, 5: s, 7: 50, 8: o, 9: r, 11: n, 13: i, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: l, 22: u, 23: h, 24: d, 25: 23, 33: 25, 41: f, 42: p, 43: g, 44: m, 45: v, 46: y, 54: b, 72: w, 74: T, 77: E, 89: C, 90: k }, { 26: 51, 89: [1, 52], 90: [1, 53] }, { 55: 54, 89: [1, 55], 90: [1, 56] }, { 29: [1, 59], 61: [1, 57], 63: [1, 58] }, t(_, [2, 17]), t(_, [2, 18]), t(_, [2, 19]), t(_, [2, 20]), { 30: 60, 33: 62, 75: L, 89: C, 90: k }, { 30: 63, 33: 62, 75: L, 89: C, 90: k }, { 30: 64, 33: 62, 75: L, 89: C, 90: k }, t(N, [2, 29]), t(N, [2, 30]), t(N, [2, 31]), t(N, [2, 32]), t(N, [2, 33]), t(N, [2, 34]), t(A, [2, 81]), t(A, [2, 82]), { 1: [2, 3] }, { 8: [2, 8] }, { 8: [2, 9] }, { 8: [2, 10] }, { 8: [2, 11] }, { 8: [2, 12] }, { 8: [2, 13] }, { 8: [2, 14] }, { 8: [2, 15] }, { 8: [2, 16] }, { 27: [1, 65], 29: [1, 66] }, t(O, [2, 79]), t(O, [2, 80]), { 27: [1, 67], 29: [1, 68] }, t(O, [2, 85]), t(O, [2, 86]), { 62: 69, 65: P, 66: S, 67: R, 68: I, 69: D, 70: M, 71: B }, { 62: 77, 65: P, 66: S, 67: R, 68: I, 69: D, 70: M, 71: B }, { 30: 78, 33: 62, 75: L, 89: C, 90: k }, { 73: 79, 75: $, 76: F, 78: 81, 79: 82, 80: G, 81: H, 82: ee, 83: Y, 84: re, 85: ne, 86: he, 87: K, 88: Z }, t(X, [2, 60]), t(X, [2, 62]), { 73: 93, 75: $, 76: F, 78: 81, 79: 82, 80: G, 81: H, 82: ee, 83: Y, 84: re, 85: ne, 86: he, 87: K, 88: Z }, { 30: 94, 33: 62, 75: L, 76: F, 89: C, 90: k }, { 5: [1, 95] }, { 30: 96, 33: 62, 75: L, 89: C, 90: k }, { 5: [1, 97] }, { 30: 98, 33: 62, 75: L, 89: C, 90: k }, { 63: [1, 99] }, t(q, [2, 50]), t(q, [2, 51]), t(q, [2, 52]), t(q, [2, 53]), t(q, [2, 54]), t(q, [2, 55]), t(q, [2, 56]), { 64: [1, 100] }, t(_, [2, 59], { 76: F }), t(_, [2, 64], { 76: J }), { 33: 103, 75: [1, 102], 89: C, 90: k }, t(j, [2, 65], { 79: 104, 75: $, 80: G, 81: H, 82: ee, 83: Y, 84: re, 85: ne, 86: he, 87: K, 88: Z }), t(pe, [2, 67]), t(pe, [2, 69]), t(pe, [2, 70]), t(pe, [2, 71]), t(pe, [2, 72]), t(pe, [2, 73]), t(pe, [2, 74]), t(pe, [2, 75]), t(pe, [2, 76]), t(pe, [2, 77]), t(pe, [2, 78]), t(_, [2, 57], { 76: J }), t(_, [2, 58], { 76: F }), { 5: te, 28: 105, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, { 27: [1, 112], 76: F }, { 5: Ge, 40: Ue, 56: 113, 57: ke, 59: Pe }, { 27: [1, 118], 76: F }, { 33: 119, 89: C, 90: k }, { 33: 120, 89: C, 90: k }, { 75: $, 78: 121, 79: 82, 80: G, 81: H, 82: ee, 83: Y, 84: re, 85: ne, 86: he, 87: K, 88: Z }, t(X, [2, 61]), t(X, [2, 63]), t(pe, [2, 68]), t(_, [2, 21]), { 32: [1, 122] }, { 32: [1, 123] }, { 32: [1, 124] }, { 32: [1, 125] }, { 5: te, 28: 126, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, t(_, [2, 28]), { 5: [1, 127] }, t(_, [2, 42]), { 32: [1, 128] }, { 32: [1, 129] }, { 5: Ge, 40: Ue, 56: 130, 57: ke, 59: Pe }, t(_, [2, 47]), { 5: [1, 131] }, t(_, [2, 48]), t(_, [2, 49]), t(j, [2, 66], { 79: 104, 75: $, 80: G, 81: H, 82: ee, 83: Y, 84: re, 85: ne, 86: he, 87: K, 88: Z }), { 33: 132, 89: C, 90: k }, { 35: 133, 89: [1, 134], 90: [1, 135] }, { 37: 136, 47: [1, 137], 48: [1, 138], 49: [1, 139] }, { 39: 140, 50: [1, 141], 51: [1, 142], 52: [1, 143], 53: [1, 144] }, t(_, [2, 27]), { 5: te, 28: 145, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, { 58: 146, 89: [1, 147], 90: [1, 148] }, { 60: 149, 89: [1, 150], 90: [1, 151] }, t(_, [2, 46]), { 5: Ge, 40: Ue, 56: 152, 57: ke, 59: Pe }, { 5: [1, 153] }, { 5: [1, 154] }, { 5: [2, 83] }, { 5: [2, 84] }, { 5: [1, 155] }, { 5: [2, 35] }, { 5: [2, 36] }, { 5: [2, 37] }, { 5: [1, 156] }, { 5: [2, 38] }, { 5: [2, 39] }, { 5: [2, 40] }, { 5: [2, 41] }, t(_, [2, 22]), { 5: [1, 157] }, { 5: [2, 87] }, { 5: [2, 88] }, { 5: [1, 158] }, { 5: [2, 89] }, { 5: [2, 90] }, t(_, [2, 43]), { 5: te, 28: 159, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, { 5: te, 28: 160, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, { 5: te, 28: 161, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, { 5: te, 28: 162, 31: Ae, 34: W, 36: Oe, 38: ue, 40: Ve }, { 5: Ge, 40: Ue, 56: 163, 57: ke, 59: Pe }, { 5: Ge, 40: Ue, 56: 164, 57: ke, 59: Pe }, t(_, [2, 23]), t(_, [2, 24]), t(_, [2, 25]), t(_, [2, 26]), t(_, [2, 44]), t(_, [2, 45])],
    defaultActions: { 8: [2, 2], 12: [2, 1], 41: [2, 3], 42: [2, 8], 43: [2, 9], 44: [2, 10], 45: [2, 11], 46: [2, 12], 47: [2, 13], 48: [2, 14], 49: [2, 15], 50: [2, 16], 134: [2, 83], 135: [2, 84], 137: [2, 35], 138: [2, 36], 139: [2, 37], 141: [2, 38], 142: [2, 39], 143: [2, 40], 144: [2, 41], 147: [2, 87], 148: [2, 88], 150: [2, 89], 151: [2, 90] },
    parseError: /* @__PURE__ */ x(function(Me, Q) {
      if (Q.recoverable)
        this.trace(Me);
      else {
        var ce = new Error(Me);
        throw ce.hash = Q, ce;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(Me) {
      var Q = this, ce = [0], z = [], oe = [null], se = [], ge = this.table, de = "", be = 0, Ce = 0, Te = 2, Ne = 1, Xe = se.slice.call(arguments, 1), Ye = Object.create(this.lexer), Ke = { yy: {} };
      for (var Ze in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Ze) && (Ke.yy[Ze] = this.yy[Ze]);
      Ye.setInput(Me, Ke.yy), Ke.yy.lexer = Ye, Ke.yy.parser = this, typeof Ye.yylloc > "u" && (Ye.yylloc = {});
      var Be = Ye.yylloc;
      se.push(Be);
      var He = Ye.options && Ye.options.ranges;
      typeof Ke.yy.parseError == "function" ? this.parseError = Ke.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function ht(tr) {
        ce.length = ce.length - 2 * tr, oe.length = oe.length - tr, se.length = se.length - tr;
      }
      x(ht, "popStack");
      function st() {
        var tr;
        return tr = z.pop() || Ye.lex() || Ne, typeof tr != "number" && (tr instanceof Array && (z = tr, tr = z.pop()), tr = Q.symbols_[tr] || tr), tr;
      }
      x(st, "lex");
      for (var We, kt, qe, rt, ct = {}, ut, nt, bt, Zt; ; ) {
        if (kt = ce[ce.length - 1], this.defaultActions[kt] ? qe = this.defaultActions[kt] : ((We === null || typeof We > "u") && (We = st()), qe = ge[kt] && ge[kt][We]), typeof qe > "u" || !qe.length || !qe[0]) {
          var Ot = "";
          Zt = [];
          for (ut in ge[kt])
            this.terminals_[ut] && ut > Te && Zt.push("'" + this.terminals_[ut] + "'");
          Ye.showPosition ? Ot = "Parse error on line " + (be + 1) + `:
` + Ye.showPosition() + `
Expecting ` + Zt.join(", ") + ", got '" + (this.terminals_[We] || We) + "'" : Ot = "Parse error on line " + (be + 1) + ": Unexpected " + (We == Ne ? "end of input" : "'" + (this.terminals_[We] || We) + "'"), this.parseError(Ot, {
            text: Ye.match,
            token: this.terminals_[We] || We,
            line: Ye.yylineno,
            loc: Be,
            expected: Zt
          });
        }
        if (qe[0] instanceof Array && qe.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + kt + ", token: " + We);
        switch (qe[0]) {
          case 1:
            ce.push(We), oe.push(Ye.yytext), se.push(Ye.yylloc), ce.push(qe[1]), We = null, Ce = Ye.yyleng, de = Ye.yytext, be = Ye.yylineno, Be = Ye.yylloc;
            break;
          case 2:
            if (nt = this.productions_[qe[1]][1], ct.$ = oe[oe.length - nt], ct._$ = {
              first_line: se[se.length - (nt || 1)].first_line,
              last_line: se[se.length - 1].last_line,
              first_column: se[se.length - (nt || 1)].first_column,
              last_column: se[se.length - 1].last_column
            }, He && (ct._$.range = [
              se[se.length - (nt || 1)].range[0],
              se[se.length - 1].range[1]
            ]), rt = this.performAction.apply(ct, [
              de,
              Ce,
              be,
              Ke.yy,
              qe[1],
              oe,
              se
            ].concat(Xe)), typeof rt < "u")
              return rt;
            nt && (ce = ce.slice(0, -1 * nt * 2), oe = oe.slice(0, -1 * nt), se = se.slice(0, -1 * nt)), ce.push(this.productions_[qe[1]][0]), oe.push(ct.$), se.push(ct._$), bt = ge[ce[ce.length - 2]][ce[ce.length - 1]], ce.push(bt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, _e = /* @__PURE__ */ function() {
    var me = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(Q, ce) {
        if (this.yy.parser)
          this.yy.parser.parseError(Q, ce);
        else
          throw new Error(Q);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(Me, Q) {
        return this.yy = Q || this.yy || {}, this._input = Me, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var Me = this._input[0];
        this.yytext += Me, this.yyleng++, this.offset++, this.match += Me, this.matched += Me;
        var Q = Me.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), Me;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(Me) {
        var Q = Me.length, ce = Me.split(/(?:\r\n?|\n)/g);
        this._input = Me + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - Q), this.offset -= Q;
        var z = 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), ce.length - 1 && (this.yylineno -= ce.length - 1);
        var oe = 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: ce ? (ce.length === z.length ? this.yylloc.first_column : 0) + z[z.length - ce.length].length - ce[0].length : this.yylloc.first_column - Q
        }, this.options.ranges && (this.yylloc.range = [oe[0], oe[0] + this.yyleng - Q]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(Me) {
        this.unput(this.match.slice(Me));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var Me = this.matched.substr(0, this.matched.length - this.match.length);
        return (Me.length > 20 ? "..." : "") + Me.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var Me = this.match;
        return Me.length < 20 && (Me += this._input.substr(0, 20 - Me.length)), (Me.substr(0, 20) + (Me.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var Me = this.pastInput(), Q = new Array(Me.length + 1).join("-");
        return Me + this.upcomingInput() + `
` + Q + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(Me, Q) {
        var ce, z, oe;
        if (this.options.backtrack_lexer && (oe = {
          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 && (oe.yylloc.range = this.yylloc.range.slice(0))), z = Me[0].match(/(?:\r\n?|\n).*/g), z && (this.yylineno += z.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: z ? z[z.length - 1].length - z[z.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + Me[0].length
        }, this.yytext += Me[0], this.match += Me[0], this.matches = Me, 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(Me[0].length), this.matched += Me[0], ce = this.performAction.call(this, this.yy, this, Q, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), ce)
          return ce;
        if (this._backtrack) {
          for (var se in oe)
            this[se] = oe[se];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var Me, Q, ce, z;
        this._more || (this.yytext = "", this.match = "");
        for (var oe = this._currentRules(), se = 0; se < oe.length; se++)
          if (ce = this._input.match(this.rules[oe[se]]), ce && (!Q || ce[0].length > Q[0].length)) {
            if (Q = ce, z = se, this.options.backtrack_lexer) {
              if (Me = this.test_match(ce, oe[se]), Me !== !1)
                return Me;
              if (this._backtrack) {
                Q = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return Q ? (Me = this.test_match(Q, oe[z]), Me !== !1 ? Me : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var Q = this.next();
        return Q || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(Q) {
        this.conditionStack.push(Q);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var Q = this.conditionStack.length - 1;
        return Q > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(Q) {
        return Q = this.conditionStack.length - 1 - Math.abs(Q || 0), Q >= 0 ? this.conditionStack[Q] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(Q) {
        this.begin(Q);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(Q, ce, z, oe) {
        switch (z) {
          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 21;
          case 9:
            return 22;
          case 10:
            return 23;
          case 11:
            return 24;
          case 12:
            return 5;
          case 13:
            break;
          case 14:
            break;
          case 15:
            break;
          case 16:
            return 8;
          case 17:
            return 6;
          case 18:
            return 27;
          case 19:
            return 40;
          case 20:
            return 29;
          case 21:
            return 32;
          case 22:
            return 31;
          case 23:
            return 34;
          case 24:
            return 36;
          case 25:
            return 38;
          case 26:
            return 41;
          case 27:
            return 42;
          case 28:
            return 43;
          case 29:
            return 44;
          case 30:
            return 45;
          case 31:
            return 46;
          case 32:
            return 47;
          case 33:
            return 48;
          case 34:
            return 49;
          case 35:
            return 50;
          case 36:
            return 51;
          case 37:
            return 52;
          case 38:
            return 53;
          case 39:
            return 54;
          case 40:
            return 65;
          case 41:
            return 66;
          case 42:
            return 67;
          case 43:
            return 68;
          case 44:
            return 69;
          case 45:
            return 70;
          case 46:
            return 71;
          case 47:
            return 57;
          case 48:
            return 59;
          case 49:
            return this.begin("style"), 77;
          case 50:
            return 75;
          case 51:
            return 81;
          case 52:
            return 88;
          case 53:
            return "PERCENT";
          case 54:
            return 86;
          case 55:
            return 84;
          case 56:
            break;
          case 57:
            this.begin("string");
            break;
          case 58:
            this.popState();
            break;
          case 59:
            return this.begin("style"), 72;
          case 60:
            return this.begin("style"), 74;
          case 61:
            return 61;
          case 62:
            return 64;
          case 63:
            return 63;
          case 64:
            this.begin("string");
            break;
          case 65:
            this.popState();
            break;
          case 66:
            return "qString";
          case 67:
            return ce.yytext = ce.yytext.trim(), 89;
          case 68:
            return 75;
          case 69:
            return 80;
          case 70:
            return 76;
        }
      }, "anonymous"),
      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, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::{3})/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, /^(?:style\b)/i, /^(?:\w+)/i, /^(?::)/i, /^(?:;)/i, /^(?:%)/i, /^(?:-)/i, /^(?:#)/i, /^(?: )/i, /^(?:["])/i, /^(?:\n)/i, /^(?:classDef\b)/i, /^(?:class\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i, /^(?:\w+)/i, /^(?:[0-9]+)/i, /^(?:,)/i],
      conditions: { acc_descr_multiline: { rules: [6, 7, 68, 69, 70], inclusive: !1 }, acc_descr: { rules: [4, 68, 69, 70], inclusive: !1 }, acc_title: { rules: [2, 68, 69, 70], inclusive: !1 }, style: { rules: [50, 51, 52, 53, 54, 55, 56, 57, 58, 68, 69, 70], inclusive: !1 }, unqString: { rules: [68, 69, 70], inclusive: !1 }, token: { rules: [68, 69, 70], inclusive: !1 }, string: { rules: [65, 66, 68, 69, 70], 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, 48, 49, 59, 60, 61, 62, 63, 64, 67, 68, 69, 70], inclusive: !0 } }
    };
    return me;
  }();
  Se.lexer = _e;
  function ze() {
    this.yy = {};
  }
  return x(ze, "Parser"), ze.prototype = Se, Se.Parser = ze, new ze();
}();
A6.parser = A6;
var E8e = A6, Nd, k8e = (Nd = class {
  constructor() {
    this.relations = [], this.latestRequirement = this.getInitialRequirement(), this.requirements = /* @__PURE__ */ new Map(), this.latestElement = this.getInitialElement(), this.elements = /* @__PURE__ */ new Map(), this.classes = /* @__PURE__ */ new Map(), this.direction = "TB", this.RequirementType = {
      REQUIREMENT: "Requirement",
      FUNCTIONAL_REQUIREMENT: "Functional Requirement",
      INTERFACE_REQUIREMENT: "Interface Requirement",
      PERFORMANCE_REQUIREMENT: "Performance Requirement",
      PHYSICAL_REQUIREMENT: "Physical Requirement",
      DESIGN_CONSTRAINT: "Design Constraint"
    }, this.RiskLevel = {
      LOW_RISK: "Low",
      MED_RISK: "Medium",
      HIGH_RISK: "High"
    }, this.VerifyType = {
      VERIFY_ANALYSIS: "Analysis",
      VERIFY_DEMONSTRATION: "Demonstration",
      VERIFY_INSPECTION: "Inspection",
      VERIFY_TEST: "Test"
    }, this.Relationships = {
      CONTAINS: "contains",
      COPIES: "copies",
      DERIVES: "derives",
      SATISFIES: "satisfies",
      VERIFIES: "verifies",
      REFINES: "refines",
      TRACES: "traces"
    }, this.setAccTitle = Cn, this.getAccTitle = Vn, this.setAccDescription = Gn, this.getAccDescription = Un, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.getConfig = /* @__PURE__ */ x(() => we().requirement, "getConfig"), this.clear(), this.setDirection = this.setDirection.bind(this), this.addRequirement = this.addRequirement.bind(this), this.setNewReqId = this.setNewReqId.bind(this), this.setNewReqRisk = this.setNewReqRisk.bind(this), this.setNewReqText = this.setNewReqText.bind(this), this.setNewReqVerifyMethod = this.setNewReqVerifyMethod.bind(this), this.addElement = this.addElement.bind(this), this.setNewElementType = this.setNewElementType.bind(this), this.setNewElementDocRef = this.setNewElementDocRef.bind(this), this.addRelationship = this.addRelationship.bind(this), this.setCssStyle = this.setCssStyle.bind(this), this.setClass = this.setClass.bind(this), this.defineClass = this.defineClass.bind(this), this.setAccTitle = this.setAccTitle.bind(this), this.setAccDescription = this.setAccDescription.bind(this);
  }
  getDirection() {
    return this.direction;
  }
  setDirection(e) {
    this.direction = e;
  }
  resetLatestRequirement() {
    this.latestRequirement = this.getInitialRequirement();
  }
  resetLatestElement() {
    this.latestElement = this.getInitialElement();
  }
  getInitialRequirement() {
    return {
      requirementId: "",
      text: "",
      risk: "",
      verifyMethod: "",
      name: "",
      type: "",
      cssStyles: [],
      classes: ["default"]
    };
  }
  getInitialElement() {
    return {
      name: "",
      type: "",
      docRef: "",
      cssStyles: [],
      classes: ["default"]
    };
  }
  addRequirement(e, r) {
    return this.requirements.has(e) || this.requirements.set(e, {
      name: e,
      type: r,
      requirementId: this.latestRequirement.requirementId,
      text: this.latestRequirement.text,
      risk: this.latestRequirement.risk,
      verifyMethod: this.latestRequirement.verifyMethod,
      cssStyles: [],
      classes: ["default"]
    }), this.resetLatestRequirement(), this.requirements.get(e);
  }
  getRequirements() {
    return this.requirements;
  }
  setNewReqId(e) {
    this.latestRequirement !== void 0 && (this.latestRequirement.requirementId = e);
  }
  setNewReqText(e) {
    this.latestRequirement !== void 0 && (this.latestRequirement.text = e);
  }
  setNewReqRisk(e) {
    this.latestRequirement !== void 0 && (this.latestRequirement.risk = e);
  }
  setNewReqVerifyMethod(e) {
    this.latestRequirement !== void 0 && (this.latestRequirement.verifyMethod = e);
  }
  addElement(e) {
    return this.elements.has(e) || (this.elements.set(e, {
      name: e,
      type: this.latestElement.type,
      docRef: this.latestElement.docRef,
      cssStyles: [],
      classes: ["default"]
    }), ae.info("Added new element: ", e)), this.resetLatestElement(), this.elements.get(e);
  }
  getElements() {
    return this.elements;
  }
  setNewElementType(e) {
    this.latestElement !== void 0 && (this.latestElement.type = e);
  }
  setNewElementDocRef(e) {
    this.latestElement !== void 0 && (this.latestElement.docRef = e);
  }
  addRelationship(e, r, n) {
    this.relations.push({
      type: e,
      src: r,
      dst: n
    });
  }
  getRelationships() {
    return this.relations;
  }
  clear() {
    this.relations = [], this.resetLatestRequirement(), this.requirements = /* @__PURE__ */ new Map(), this.resetLatestElement(), this.elements = /* @__PURE__ */ new Map(), this.classes = /* @__PURE__ */ new Map(), _n();
  }
  setCssStyle(e, r) {
    for (const n of e) {
      const i = this.requirements.get(n) ?? this.elements.get(n);
      if (!r || !i)
        return;
      for (const a of r)
        a.includes(",") ? i.cssStyles.push(...a.split(",")) : i.cssStyles.push(a);
    }
  }
  setClass(e, r) {
    var n;
    for (const i of e) {
      const a = this.requirements.get(i) ?? this.elements.get(i);
      if (a)
        for (const s of r) {
          a.classes.push(s);
          const o = (n = this.classes.get(s)) == null ? void 0 : n.styles;
          o && a.cssStyles.push(...o);
        }
    }
  }
  defineClass(e, r) {
    for (const n of e) {
      let i = this.classes.get(n);
      i === void 0 && (i = { id: n, styles: [], textStyles: [] }, this.classes.set(n, i)), r && r.forEach(function(a) {
        if (/color/.exec(a)) {
          const s = a.replace("fill", "bgFill");
          i.textStyles.push(s);
        }
        i.styles.push(a);
      }), this.requirements.forEach((a) => {
        a.classes.includes(n) && a.cssStyles.push(...r.flatMap((s) => s.split(",")));
      }), this.elements.forEach((a) => {
        a.classes.includes(n) && a.cssStyles.push(...r.flatMap((s) => s.split(",")));
      });
    }
  }
  getClasses() {
    return this.classes;
  }
  getData() {
    var i, a, s, o;
    const e = we(), r = [], n = [];
    for (const l of this.requirements.values()) {
      const u = l;
      u.id = l.name, u.cssStyles = l.cssStyles, u.cssClasses = l.classes.join(" "), u.shape = "requirementBox", u.look = e.look, r.push(u);
    }
    for (const l of this.elements.values()) {
      const u = l;
      u.shape = "requirementBox", u.look = e.look, u.id = l.name, u.cssStyles = l.cssStyles, u.cssClasses = l.classes.join(" "), r.push(u);
    }
    for (const l of this.relations) {
      let u = 0;
      const h = l.type === this.Relationships.CONTAINS, d = {
        id: `${l.src}-${l.dst}-${u}`,
        start: ((i = this.requirements.get(l.src)) == null ? void 0 : i.name) ?? ((a = this.elements.get(l.src)) == null ? void 0 : a.name),
        end: ((s = this.requirements.get(l.dst)) == null ? void 0 : s.name) ?? ((o = this.elements.get(l.dst)) == null ? void 0 : o.name),
        label: `&lt;&lt;${l.type}&gt;&gt;`,
        classes: "relationshipLine",
        style: ["fill:none", h ? "" : "stroke-dasharray: 10,7"],
        labelpos: "c",
        thickness: "normal",
        type: "normal",
        pattern: h ? "normal" : "dashed",
        arrowTypeStart: h ? "requirement_contains" : "",
        arrowTypeEnd: h ? "" : "requirement_arrow",
        look: e.look
      };
      n.push(d), u++;
    }
    return { nodes: r, edges: n, other: {}, config: e, direction: this.getDirection() };
  }
}, x(Nd, "RequirementDB"), Nd), S8e = /* @__PURE__ */ x((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};
  }
  .divider {
    stroke: ${t.nodeBorder};
    stroke-width: 1;
  }
  .label {
    font-family: ${t.fontFamily};
    color: ${t.nodeTextColor || t.textColor};
  }
  .label text,span {
    fill: ${t.nodeTextColor || t.textColor};
    color: ${t.nodeTextColor || t.textColor};
  }
  .labelBkg {
    background-color: ${t.edgeLabelBackground};
  }

`, "getStyles"), C8e = S8e, uq = {};
I2(uq, {
  draw: () => A8e
});
var A8e = /* @__PURE__ */ x(async function(t, e, r, n) {
  ae.info("REF0:"), ae.info("Drawing requirement diagram (unified)", e);
  const { securityLevel: i, state: a, layout: s } = we(), o = n.db.getData(), l = Ff(e, i);
  o.type = n.type, o.layoutAlgorithm = Gg(s), o.nodeSpacing = (a == null ? void 0 : a.nodeSpacing) ?? 50, o.rankSpacing = (a == null ? void 0 : a.rankSpacing) ?? 50, o.markers = ["requirement_contains", "requirement_arrow"], o.diagramId = e, await Af(o, l);
  const u = 8;
  Kt.insertTitle(
    l,
    "requirementDiagramTitleText",
    (a == null ? void 0 : a.titleTopMargin) ?? 25,
    n.db.getDiagramTitle()
  ), zu(l, u, "requirementDiagram", (a == null ? void 0 : a.useMaxWidth) ?? !0);
}, "draw"), _8e = {
  parser: E8e,
  get db() {
    return new k8e();
  },
  renderer: uq,
  styles: C8e
};
const L8e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: _8e
}, Symbol.toStringTag, { value: "Module" }));
var _6 = function() {
  var t = /* @__PURE__ */ x(function(Z, X, q, J) {
    for (q = q || {}, J = Z.length; J--; q[Z[J]] = X) ;
    return q;
  }, "o"), e = [1, 2], r = [1, 3], n = [1, 4], i = [2, 4], a = [1, 9], s = [1, 11], o = [1, 13], l = [1, 14], u = [1, 16], h = [1, 17], d = [1, 18], f = [1, 24], p = [1, 25], g = [1, 26], m = [1, 27], v = [1, 28], y = [1, 29], b = [1, 30], w = [1, 31], T = [1, 32], E = [1, 33], C = [1, 34], k = [1, 35], _ = [1, 36], L = [1, 37], N = [1, 38], A = [1, 39], O = [1, 41], P = [1, 42], S = [1, 43], R = [1, 44], I = [1, 45], D = [1, 46], M = [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, 55, 60, 61, 62, 63, 71], B = [2, 71], $ = [4, 5, 16, 50, 52, 53], F = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 55, 60, 61, 62, 63, 71], G = [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, 55, 60, 61, 62, 63, 71], H = [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, 55, 60, 61, 62, 63, 71], ee = [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, 55, 60, 61, 62, 63, 71], Y = [69, 70, 71], re = [1, 127], ne = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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, actor_with_config: 54, note: 55, placement: 56, text2: 57, over: 58, actor_pair: 59, links: 60, link: 61, properties: 62, details: 63, spaceList: 64, ",": 65, left_of: 66, right_of: 67, signaltype: 68, "+": 69, "-": 70, ACTOR: 71, config_object: 72, CONFIG_START: 73, CONFIG_CONTENT: 74, CONFIG_END: 75, SOLID_OPEN_ARROW: 76, DOTTED_OPEN_ARROW: 77, SOLID_ARROW: 78, BIDIRECTIONAL_SOLID_ARROW: 79, DOTTED_ARROW: 80, BIDIRECTIONAL_DOTTED_ARROW: 81, SOLID_CROSS: 82, DOTTED_CROSS: 83, SOLID_POINT: 84, DOTTED_POINT: 85, TXT: 86, $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", 55: "note", 58: "over", 60: "links", 61: "link", 62: "properties", 63: "details", 65: ",", 66: "left_of", 67: "right_of", 69: "+", 70: "-", 71: "ACTOR", 73: "CONFIG_START", 74: "CONFIG_CONTENT", 75: "CONFIG_END", 76: "SOLID_OPEN_ARROW", 77: "DOTTED_OPEN_ARROW", 78: "SOLID_ARROW", 79: "BIDIRECTIONAL_SOLID_ARROW", 80: "DOTTED_ARROW", 81: "BIDIRECTIONAL_DOTTED_ARROW", 82: "SOLID_CROSS", 83: "DOTTED_CROSS", 84: "SOLID_POINT", 85: "DOTTED_POINT", 86: "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], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [64, 2], [64, 1], [59, 3], [59, 1], [56, 1], [56, 1], [17, 5], [17, 5], [17, 4], [54, 2], [72, 3], [22, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [68, 1], [57, 1]],
    performAction: /* @__PURE__ */ x(function(X, q, J, j, pe, te, Ae) {
      var W = te.length - 1;
      switch (pe) {
        case 3:
          return j.apply(te[W]), te[W];
        case 4:
        case 9:
          this.$ = [];
          break;
        case 5:
        case 10:
          te[W - 1].push(te[W]), this.$ = te[W - 1];
          break;
        case 6:
        case 7:
        case 11:
        case 12:
          this.$ = te[W];
          break;
        case 8:
        case 13:
          this.$ = [];
          break;
        case 15:
          te[W].type = "createParticipant", this.$ = te[W];
          break;
        case 16:
          te[W - 1].unshift({ type: "boxStart", boxData: j.parseBoxData(te[W - 2]) }), te[W - 1].push({ type: "boxEnd", boxText: te[W - 2] }), this.$ = te[W - 1];
          break;
        case 18:
          this.$ = { type: "sequenceIndex", sequenceIndex: Number(te[W - 2]), sequenceIndexStep: Number(te[W - 1]), sequenceVisible: !0, signalType: j.LINETYPE.AUTONUMBER };
          break;
        case 19:
          this.$ = { type: "sequenceIndex", sequenceIndex: Number(te[W - 1]), sequenceIndexStep: 1, sequenceVisible: !0, signalType: j.LINETYPE.AUTONUMBER };
          break;
        case 20:
          this.$ = { type: "sequenceIndex", sequenceVisible: !1, signalType: j.LINETYPE.AUTONUMBER };
          break;
        case 21:
          this.$ = { type: "sequenceIndex", sequenceVisible: !0, signalType: j.LINETYPE.AUTONUMBER };
          break;
        case 22:
          this.$ = { type: "activeStart", signalType: j.LINETYPE.ACTIVE_START, actor: te[W - 1].actor };
          break;
        case 23:
          this.$ = { type: "activeEnd", signalType: j.LINETYPE.ACTIVE_END, actor: te[W - 1].actor };
          break;
        case 29:
          j.setDiagramTitle(te[W].substring(6)), this.$ = te[W].substring(6);
          break;
        case 30:
          j.setDiagramTitle(te[W].substring(7)), this.$ = te[W].substring(7);
          break;
        case 31:
          this.$ = te[W].trim(), j.setAccTitle(this.$);
          break;
        case 32:
        case 33:
          this.$ = te[W].trim(), j.setAccDescription(this.$);
          break;
        case 34:
          te[W - 1].unshift({ type: "loopStart", loopText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.LOOP_START }), te[W - 1].push({ type: "loopEnd", loopText: te[W - 2], signalType: j.LINETYPE.LOOP_END }), this.$ = te[W - 1];
          break;
        case 35:
          te[W - 1].unshift({ type: "rectStart", color: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.RECT_START }), te[W - 1].push({ type: "rectEnd", color: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.RECT_END }), this.$ = te[W - 1];
          break;
        case 36:
          te[W - 1].unshift({ type: "optStart", optText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.OPT_START }), te[W - 1].push({ type: "optEnd", optText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.OPT_END }), this.$ = te[W - 1];
          break;
        case 37:
          te[W - 1].unshift({ type: "altStart", altText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.ALT_START }), te[W - 1].push({ type: "altEnd", signalType: j.LINETYPE.ALT_END }), this.$ = te[W - 1];
          break;
        case 38:
          te[W - 1].unshift({ type: "parStart", parText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.PAR_START }), te[W - 1].push({ type: "parEnd", signalType: j.LINETYPE.PAR_END }), this.$ = te[W - 1];
          break;
        case 39:
          te[W - 1].unshift({ type: "parStart", parText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.PAR_OVER_START }), te[W - 1].push({ type: "parEnd", signalType: j.LINETYPE.PAR_END }), this.$ = te[W - 1];
          break;
        case 40:
          te[W - 1].unshift({ type: "criticalStart", criticalText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.CRITICAL_START }), te[W - 1].push({ type: "criticalEnd", signalType: j.LINETYPE.CRITICAL_END }), this.$ = te[W - 1];
          break;
        case 41:
          te[W - 1].unshift({ type: "breakStart", breakText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.BREAK_START }), te[W - 1].push({ type: "breakEnd", optText: j.parseMessage(te[W - 2]), signalType: j.LINETYPE.BREAK_END }), this.$ = te[W - 1];
          break;
        case 43:
          this.$ = te[W - 3].concat([{ type: "option", optionText: j.parseMessage(te[W - 1]), signalType: j.LINETYPE.CRITICAL_OPTION }, te[W]]);
          break;
        case 45:
          this.$ = te[W - 3].concat([{ type: "and", parText: j.parseMessage(te[W - 1]), signalType: j.LINETYPE.PAR_AND }, te[W]]);
          break;
        case 47:
          this.$ = te[W - 3].concat([{ type: "else", altText: j.parseMessage(te[W - 1]), signalType: j.LINETYPE.ALT_ELSE }, te[W]]);
          break;
        case 48:
          te[W - 3].draw = "participant", te[W - 3].type = "addParticipant", te[W - 3].description = j.parseMessage(te[W - 1]), this.$ = te[W - 3];
          break;
        case 49:
          te[W - 1].draw = "participant", te[W - 1].type = "addParticipant", this.$ = te[W - 1];
          break;
        case 50:
          te[W - 3].draw = "actor", te[W - 3].type = "addParticipant", te[W - 3].description = j.parseMessage(te[W - 1]), this.$ = te[W - 3];
          break;
        case 51:
          te[W - 1].draw = "actor", te[W - 1].type = "addParticipant", this.$ = te[W - 1];
          break;
        case 52:
          te[W - 1].type = "destroyParticipant", this.$ = te[W - 1];
          break;
        case 53:
          te[W - 1].draw = "participant", te[W - 1].type = "addParticipant", this.$ = te[W - 1];
          break;
        case 54:
          this.$ = [te[W - 1], { type: "addNote", placement: te[W - 2], actor: te[W - 1].actor, text: te[W] }];
          break;
        case 55:
          te[W - 2] = [].concat(te[W - 1], te[W - 1]).slice(0, 2), te[W - 2][0] = te[W - 2][0].actor, te[W - 2][1] = te[W - 2][1].actor, this.$ = [te[W - 1], { type: "addNote", placement: j.PLACEMENT.OVER, actor: te[W - 2].slice(0, 2), text: te[W] }];
          break;
        case 56:
          this.$ = [te[W - 1], { type: "addLinks", actor: te[W - 1].actor, text: te[W] }];
          break;
        case 57:
          this.$ = [te[W - 1], { type: "addALink", actor: te[W - 1].actor, text: te[W] }];
          break;
        case 58:
          this.$ = [te[W - 1], { type: "addProperties", actor: te[W - 1].actor, text: te[W] }];
          break;
        case 59:
          this.$ = [te[W - 1], { type: "addDetails", actor: te[W - 1].actor, text: te[W] }];
          break;
        case 62:
          this.$ = [te[W - 2], te[W]];
          break;
        case 63:
          this.$ = te[W];
          break;
        case 64:
          this.$ = j.PLACEMENT.LEFTOF;
          break;
        case 65:
          this.$ = j.PLACEMENT.RIGHTOF;
          break;
        case 66:
          this.$ = [
            te[W - 4],
            te[W - 1],
            { type: "addMessage", from: te[W - 4].actor, to: te[W - 1].actor, signalType: te[W - 3], msg: te[W], activate: !0 },
            { type: "activeStart", signalType: j.LINETYPE.ACTIVE_START, actor: te[W - 1].actor }
          ];
          break;
        case 67:
          this.$ = [
            te[W - 4],
            te[W - 1],
            { type: "addMessage", from: te[W - 4].actor, to: te[W - 1].actor, signalType: te[W - 3], msg: te[W] },
            { type: "activeEnd", signalType: j.LINETYPE.ACTIVE_END, actor: te[W - 4].actor }
          ];
          break;
        case 68:
          this.$ = [te[W - 3], te[W - 1], { type: "addMessage", from: te[W - 3].actor, to: te[W - 1].actor, signalType: te[W - 2], msg: te[W] }];
          break;
        case 69:
          this.$ = {
            type: "addParticipant",
            actor: te[W - 1],
            config: te[W]
          };
          break;
        case 70:
          this.$ = te[W - 1].trim();
          break;
        case 71:
          this.$ = { type: "addParticipant", actor: te[W] };
          break;
        case 72:
          this.$ = j.LINETYPE.SOLID_OPEN;
          break;
        case 73:
          this.$ = j.LINETYPE.DOTTED_OPEN;
          break;
        case 74:
          this.$ = j.LINETYPE.SOLID;
          break;
        case 75:
          this.$ = j.LINETYPE.BIDIRECTIONAL_SOLID;
          break;
        case 76:
          this.$ = j.LINETYPE.DOTTED;
          break;
        case 77:
          this.$ = j.LINETYPE.BIDIRECTIONAL_DOTTED;
          break;
        case 78:
          this.$ = j.LINETYPE.SOLID_CROSS;
          break;
        case 79:
          this.$ = j.LINETYPE.DOTTED_CROSS;
          break;
        case 80:
          this.$ = j.LINETYPE.SOLID_POINT;
          break;
        case 81:
          this.$ = j.LINETYPE.DOTTED_POINT;
          break;
        case 82:
          this.$ = j.parseMessage(te[W].trim().substring(1));
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: e, 5: r, 6: n }, { 1: [3] }, { 3: 5, 4: e, 5: r, 6: n }, { 3: 6, 4: e, 5: r, 6: n }, 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, 55, 60, 61, 62, 63, 71], i, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, t(M, [2, 5]), { 9: 47, 12: 12, 13: o, 14: l, 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, t(M, [2, 7]), t(M, [2, 8]), t(M, [2, 14]), { 12: 48, 50: L, 52: N, 53: A }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 71: D }, { 22: 55, 71: D }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, t(M, [2, 29]), t(M, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, t(M, [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, 54: 72, 71: [1, 73] }, { 22: 74, 71: D }, { 22: 75, 71: D }, { 68: 76, 76: [1, 77], 77: [1, 78], 78: [1, 79], 79: [1, 80], 80: [1, 81], 81: [1, 82], 82: [1, 83], 83: [1, 84], 84: [1, 85], 85: [1, 86] }, { 56: 87, 58: [1, 88], 66: [1, 89], 67: [1, 90] }, { 22: 91, 71: D }, { 22: 92, 71: D }, { 22: 93, 71: D }, { 22: 94, 71: D }, t([5, 51, 65, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86], B), t(M, [2, 6]), t(M, [2, 15]), t($, [2, 9], { 10: 95 }), t(M, [2, 17]), { 5: [1, 97], 19: [1, 96] }, { 5: [1, 98] }, t(M, [2, 21]), { 5: [1, 99] }, { 5: [1, 100] }, t(M, [2, 24]), t(M, [2, 25]), t(M, [2, 26]), t(M, [2, 27]), t(M, [2, 28]), t(M, [2, 31]), t(M, [2, 32]), t(F, i, { 7: 101 }), t(F, i, { 7: 102 }), t(F, i, { 7: 103 }), t(G, i, { 40: 104, 7: 105 }), t(H, i, { 42: 106, 7: 107 }), t(H, i, { 7: 107, 42: 108 }), t(ee, i, { 45: 109, 7: 110 }), t(F, i, { 7: 111 }), { 5: [1, 113], 51: [1, 112] }, { 5: [1, 114] }, t([5, 51], B, { 72: 115, 73: [1, 116] }), { 5: [1, 118], 51: [1, 117] }, { 5: [1, 119] }, { 22: 122, 69: [1, 120], 70: [1, 121], 71: D }, t(Y, [2, 72]), t(Y, [2, 73]), t(Y, [2, 74]), t(Y, [2, 75]), t(Y, [2, 76]), t(Y, [2, 77]), t(Y, [2, 78]), t(Y, [2, 79]), t(Y, [2, 80]), t(Y, [2, 81]), { 22: 123, 71: D }, { 22: 125, 59: 124, 71: D }, { 71: [2, 64] }, { 71: [2, 65] }, { 57: 126, 86: re }, { 57: 128, 86: re }, { 57: 129, 86: re }, { 57: 130, 86: re }, { 4: [1, 133], 5: [1, 135], 11: 132, 12: 134, 16: [1, 131], 50: L, 52: N, 53: A }, { 5: [1, 136] }, t(M, [2, 19]), t(M, [2, 20]), t(M, [2, 22]), t(M, [2, 23]), { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 137], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 138], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 139], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 16: [1, 140] }, { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [2, 46], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 49: [1, 141], 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 16: [1, 142] }, { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [2, 44], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 48: [1, 143], 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 16: [1, 144] }, { 16: [1, 145] }, { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [2, 42], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 47: [1, 146], 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 4: a, 5: s, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 147], 17: 15, 18: u, 21: h, 22: 40, 23: d, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: f, 30: p, 31: g, 33: m, 35: v, 36: y, 37: b, 38: w, 39: T, 41: E, 43: C, 44: k, 46: _, 50: L, 52: N, 53: A, 55: O, 60: P, 61: S, 62: R, 63: I, 71: D }, { 15: [1, 148] }, t(M, [2, 49]), t(M, [2, 53]), { 5: [2, 69] }, { 74: [1, 149] }, { 15: [1, 150] }, t(M, [2, 51]), t(M, [2, 52]), { 22: 151, 71: D }, { 22: 152, 71: D }, { 57: 153, 86: re }, { 57: 154, 86: re }, { 57: 155, 86: re }, { 65: [1, 156], 86: [2, 63] }, { 5: [2, 56] }, { 5: [2, 82] }, { 5: [2, 57] }, { 5: [2, 58] }, { 5: [2, 59] }, t(M, [2, 16]), t($, [2, 10]), { 12: 157, 50: L, 52: N, 53: A }, t($, [2, 12]), t($, [2, 13]), t(M, [2, 18]), t(M, [2, 34]), t(M, [2, 35]), t(M, [2, 36]), t(M, [2, 37]), { 15: [1, 158] }, t(M, [2, 38]), { 15: [1, 159] }, t(M, [2, 39]), t(M, [2, 40]), { 15: [1, 160] }, t(M, [2, 41]), { 5: [1, 161] }, { 75: [1, 162] }, { 5: [1, 163] }, { 57: 164, 86: re }, { 57: 165, 86: re }, { 5: [2, 68] }, { 5: [2, 54] }, { 5: [2, 55] }, { 22: 166, 71: D }, t($, [2, 11]), t(G, i, { 7: 105, 40: 167 }), t(H, i, { 7: 107, 42: 168 }), t(ee, i, { 7: 110, 45: 169 }), t(M, [2, 48]), { 5: [2, 70] }, t(M, [2, 50]), { 5: [2, 66] }, { 5: [2, 67] }, { 86: [2, 62] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
    defaultActions: { 5: [2, 1], 6: [2, 2], 89: [2, 64], 90: [2, 65], 115: [2, 69], 126: [2, 56], 127: [2, 82], 128: [2, 57], 129: [2, 58], 130: [2, 59], 153: [2, 68], 154: [2, 54], 155: [2, 55], 162: [2, 70], 164: [2, 66], 165: [2, 67], 166: [2, 62], 167: [2, 47], 168: [2, 45], 169: [2, 43] },
    parseError: /* @__PURE__ */ x(function(X, q) {
      if (q.recoverable)
        this.trace(X);
      else {
        var J = new Error(X);
        throw J.hash = q, J;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(X) {
      var q = this, J = [0], j = [], pe = [null], te = [], Ae = this.table, W = "", Oe = 0, ue = 0, Ve = 2, Ge = 1, Ue = te.slice.call(arguments, 1), ke = Object.create(this.lexer), Pe = { yy: {} };
      for (var Se in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Se) && (Pe.yy[Se] = this.yy[Se]);
      ke.setInput(X, Pe.yy), Pe.yy.lexer = ke, Pe.yy.parser = this, typeof ke.yylloc > "u" && (ke.yylloc = {});
      var _e = ke.yylloc;
      te.push(_e);
      var ze = ke.options && ke.options.ranges;
      typeof Pe.yy.parseError == "function" ? this.parseError = Pe.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function me(Ne) {
        J.length = J.length - 2 * Ne, pe.length = pe.length - Ne, te.length = te.length - Ne;
      }
      x(me, "popStack");
      function Me() {
        var Ne;
        return Ne = j.pop() || ke.lex() || Ge, typeof Ne != "number" && (Ne instanceof Array && (j = Ne, Ne = j.pop()), Ne = q.symbols_[Ne] || Ne), Ne;
      }
      x(Me, "lex");
      for (var Q, ce, z, oe, se = {}, ge, de, be, Ce; ; ) {
        if (ce = J[J.length - 1], this.defaultActions[ce] ? z = this.defaultActions[ce] : ((Q === null || typeof Q > "u") && (Q = Me()), z = Ae[ce] && Ae[ce][Q]), typeof z > "u" || !z.length || !z[0]) {
          var Te = "";
          Ce = [];
          for (ge in Ae[ce])
            this.terminals_[ge] && ge > Ve && Ce.push("'" + this.terminals_[ge] + "'");
          ke.showPosition ? Te = "Parse error on line " + (Oe + 1) + `:
` + ke.showPosition() + `
Expecting ` + Ce.join(", ") + ", got '" + (this.terminals_[Q] || Q) + "'" : Te = "Parse error on line " + (Oe + 1) + ": Unexpected " + (Q == Ge ? "end of input" : "'" + (this.terminals_[Q] || Q) + "'"), this.parseError(Te, {
            text: ke.match,
            token: this.terminals_[Q] || Q,
            line: ke.yylineno,
            loc: _e,
            expected: Ce
          });
        }
        if (z[0] instanceof Array && z.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + ce + ", token: " + Q);
        switch (z[0]) {
          case 1:
            J.push(Q), pe.push(ke.yytext), te.push(ke.yylloc), J.push(z[1]), Q = null, ue = ke.yyleng, W = ke.yytext, Oe = ke.yylineno, _e = ke.yylloc;
            break;
          case 2:
            if (de = this.productions_[z[1]][1], se.$ = pe[pe.length - de], se._$ = {
              first_line: te[te.length - (de || 1)].first_line,
              last_line: te[te.length - 1].last_line,
              first_column: te[te.length - (de || 1)].first_column,
              last_column: te[te.length - 1].last_column
            }, ze && (se._$.range = [
              te[te.length - (de || 1)].range[0],
              te[te.length - 1].range[1]
            ]), oe = this.performAction.apply(se, [
              W,
              ue,
              Oe,
              Pe.yy,
              z[1],
              pe,
              te
            ].concat(Ue)), typeof oe < "u")
              return oe;
            de && (J = J.slice(0, -1 * de * 2), pe = pe.slice(0, -1 * de), te = te.slice(0, -1 * de)), J.push(this.productions_[z[1]][0]), pe.push(se.$), te.push(se._$), be = Ae[J[J.length - 2]][J[J.length - 1]], J.push(be);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, he = /* @__PURE__ */ function() {
    var Z = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(q, J) {
        if (this.yy.parser)
          this.yy.parser.parseError(q, J);
        else
          throw new Error(q);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(X, q) {
        return this.yy = q || 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;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var X = this._input[0];
        this.yytext += X, this.yyleng++, this.offset++, this.match += X, this.matched += X;
        var q = X.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), X;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(X) {
        var q = X.length, J = X.split(/(?:\r\n?|\n)/g);
        this._input = X + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - q), this.offset -= q;
        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), J.length - 1 && (this.yylineno -= J.length - 1);
        var pe = 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: J ? (J.length === j.length ? this.yylloc.first_column : 0) + j[j.length - J.length].length - J[0].length : this.yylloc.first_column - q
        }, this.options.ranges && (this.yylloc.range = [pe[0], pe[0] + this.yyleng - q]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(X) {
        this.unput(this.match.slice(X));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var X = this.matched.substr(0, this.matched.length - this.match.length);
        return (X.length > 20 ? "..." : "") + X.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(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, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var X = this.pastInput(), q = new Array(X.length + 1).join("-");
        return X + this.upcomingInput() + `
` + q + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(X, q) {
        var J, j, pe;
        if (this.options.backtrack_lexer && (pe = {
          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 && (pe.yylloc.range = this.yylloc.range.slice(0))), j = X[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 + 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], J = this.performAction.call(this, this.yy, this, q, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), J)
          return J;
        if (this._backtrack) {
          for (var te in pe)
            this[te] = pe[te];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var X, q, J, j;
        this._more || (this.yytext = "", this.match = "");
        for (var pe = this._currentRules(), te = 0; te < pe.length; te++)
          if (J = this._input.match(this.rules[pe[te]]), J && (!q || J[0].length > q[0].length)) {
            if (q = J, j = te, this.options.backtrack_lexer) {
              if (X = this.test_match(J, pe[te]), X !== !1)
                return X;
              if (this._backtrack) {
                q = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return q ? (X = this.test_match(q, pe[j]), 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
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var q = this.next();
        return q || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(q) {
        this.conditionStack.push(q);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var q = this.conditionStack.length - 1;
        return q > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(q) {
        return q = this.conditionStack.length - 1 - Math.abs(q || 0), q >= 0 ? this.conditionStack[q] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(q) {
        this.begin(q);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(q, J, j, pe) {
        switch (j) {
          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("CONFIG"), 73;
          case 8:
            return 74;
          case 9:
            return this.popState(), this.popState(), 75;
          case 10:
            return J.yytext = J.yytext.trim(), 71;
          case 11:
            return J.yytext = J.yytext.trim(), this.begin("ALIAS"), 71;
          case 12:
            return this.begin("LINE"), 14;
          case 13:
            return this.begin("ID"), 50;
          case 14:
            return this.begin("ID"), 52;
          case 15:
            return 13;
          case 16:
            return this.begin("ID"), 53;
          case 17:
            return J.yytext = J.yytext.trim(), this.begin("ALIAS"), 71;
          case 18:
            return this.popState(), this.popState(), this.begin("LINE"), 51;
          case 19:
            return this.popState(), this.popState(), 5;
          case 20:
            return this.begin("LINE"), 36;
          case 21:
            return this.begin("LINE"), 37;
          case 22:
            return this.begin("LINE"), 38;
          case 23:
            return this.begin("LINE"), 39;
          case 24:
            return this.begin("LINE"), 49;
          case 25:
            return this.begin("LINE"), 41;
          case 26:
            return this.begin("LINE"), 43;
          case 27:
            return this.begin("LINE"), 48;
          case 28:
            return this.begin("LINE"), 44;
          case 29:
            return this.begin("LINE"), 47;
          case 30:
            return this.begin("LINE"), 46;
          case 31:
            return this.popState(), 15;
          case 32:
            return 16;
          case 33:
            return 66;
          case 34:
            return 67;
          case 35:
            return 60;
          case 36:
            return 61;
          case 37:
            return 62;
          case 38:
            return 63;
          case 39:
            return 58;
          case 40:
            return 55;
          case 41:
            return this.begin("ID"), 21;
          case 42:
            return this.begin("ID"), 23;
          case 43:
            return 29;
          case 44:
            return 30;
          case 45:
            return this.begin("acc_title"), 31;
          case 46:
            return this.popState(), "acc_title_value";
          case 47:
            return this.begin("acc_descr"), 33;
          case 48:
            return this.popState(), "acc_descr_value";
          case 49:
            this.begin("acc_descr_multiline");
            break;
          case 50:
            this.popState();
            break;
          case 51:
            return "acc_descr_multiline_value";
          case 52:
            return 6;
          case 53:
            return 18;
          case 54:
            return 20;
          case 55:
            return 65;
          case 56:
            return 5;
          case 57:
            return J.yytext = J.yytext.trim(), 71;
          case 58:
            return 78;
          case 59:
            return 79;
          case 60:
            return 80;
          case 61:
            return 81;
          case 62:
            return 76;
          case 63:
            return 77;
          case 64:
            return 82;
          case 65:
            return 83;
          case 66:
            return 84;
          case 67:
            return 85;
          case 68:
            return 86;
          case 69:
            return 86;
          case 70:
            return 69;
          case 71:
            return 70;
          case 72:
            return 5;
          case 73:
            return "INVALID";
        }
      }, "anonymous"),
      rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^\<->\->:\n,;@]+?([\-]*[^\<->\->:\n,;@]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\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, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { acc_descr_multiline: { rules: [50, 51], inclusive: !1 }, acc_descr: { rules: [48], inclusive: !1 }, acc_title: { rules: [46], inclusive: !1 }, ID: { rules: [2, 3, 7, 10, 11, 17], inclusive: !1 }, ALIAS: { rules: [2, 3, 18, 19], inclusive: !1 }, LINE: { rules: [2, 3, 31], inclusive: !1 }, CONFIG: { rules: [8, 9], inclusive: !1 }, CONFIG_DATA: { rules: [], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 4, 5, 6, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 49, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73], inclusive: !0 } }
    };
    return Z;
  }();
  ne.lexer = he;
  function K() {
    this.yy = {};
  }
  return x(K, "Parser"), K.prototype = ne, ne.Parser = K, new K();
}();
_6.parser = _6;
var R8e = _6, N8e = {
  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,
  BIDIRECTIONAL_SOLID: 33,
  BIDIRECTIONAL_DOTTED: 34
}, M8e = {
  FILLED: 0,
  OPEN: 1
}, D8e = {
  LEFTOF: 0,
  RIGHTOF: 1,
  OVER: 2
}, Rm = {
  ACTOR: "actor",
  CONTROL: "control",
  DATABASE: "database",
  ENTITY: "entity"
}, Md, I8e = (Md = class {
  constructor() {
    this.state = new gU(() => ({
      prevActor: void 0,
      actors: /* @__PURE__ */ new Map(),
      createdActors: /* @__PURE__ */ new Map(),
      destroyedActors: /* @__PURE__ */ new Map(),
      boxes: [],
      messages: [],
      notes: [],
      sequenceNumbersEnabled: !1,
      wrapEnabled: void 0,
      currentBox: void 0,
      lastCreated: void 0,
      lastDestroyed: void 0
    })), this.setAccTitle = Cn, this.setAccDescription = Gn, this.setDiagramTitle = Qn, this.getAccTitle = Vn, this.getAccDescription = Un, this.getDiagramTitle = Ln, this.apply = this.apply.bind(this), this.parseBoxData = this.parseBoxData.bind(this), this.parseMessage = this.parseMessage.bind(this), this.clear(), this.setWrap(we().wrap), this.LINETYPE = N8e, this.ARROWTYPE = M8e, this.PLACEMENT = D8e;
  }
  addBox(e) {
    this.state.records.boxes.push({
      name: e.text,
      wrap: e.wrap ?? this.autoWrap(),
      fill: e.color,
      actorKeys: []
    }), this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
  }
  addActor(e, r, n, i, a) {
    let s = this.state.records.currentBox, o;
    if (a !== void 0) {
      let u;
      a.includes(`
`) ? u = a + `
` : u = `{
` + a + `
}`, o = Q2(u, { schema: Z2 });
    }
    i = (o == null ? void 0 : o.type) ?? i;
    const l = this.state.records.actors.get(e);
    if (l) {
      if (this.state.records.currentBox && l.box && this.state.records.currentBox !== l.box)
        throw new Error(
          `A same participant should only be defined in one Box: ${l.name} can't be in '${l.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`
        );
      if (s = l.box ? l.box : this.state.records.currentBox, l.box = s, l && r === l.name && n == null)
        return;
    }
    if ((n == null ? void 0 : n.text) == null && (n = { text: r, type: i }), (i == null || n.text == null) && (n = { text: r, type: i }), this.state.records.actors.set(e, {
      box: s,
      name: r,
      description: n.text,
      wrap: n.wrap ?? this.autoWrap(),
      prevActor: this.state.records.prevActor,
      links: {},
      properties: {},
      actorCnt: null,
      rectData: null,
      type: i ?? "participant"
    }), this.state.records.prevActor) {
      const u = this.state.records.actors.get(this.state.records.prevActor);
      u && (u.nextActor = e);
    }
    this.state.records.currentBox && this.state.records.currentBox.actorKeys.push(e), this.state.records.prevActor = e;
  }
  activationCount(e) {
    let r, n = 0;
    if (!e)
      return 0;
    for (r = 0; r < this.state.records.messages.length; r++)
      this.state.records.messages[r].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[r].from === e && n++, this.state.records.messages[r].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[r].from === e && n--;
    return n;
  }
  addMessage(e, r, n, i) {
    this.state.records.messages.push({
      id: this.state.records.messages.length.toString(),
      from: e,
      to: r,
      message: n.text,
      wrap: n.wrap ?? this.autoWrap(),
      answer: i
    });
  }
  addSignal(e, r, n, i, a = !1) {
    if (i === this.LINETYPE.ACTIVE_END && this.activationCount(e ?? "") < 1) {
      const o = new Error("Trying to inactivate an inactive participant (" + e + ")");
      throw o.hash = {
        text: "->>-",
        token: "->>-",
        line: "1",
        loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
        expected: ["'ACTIVE_PARTICIPANT'"]
      }, o;
    }
    return this.state.records.messages.push({
      id: this.state.records.messages.length.toString(),
      from: e,
      to: r,
      message: (n == null ? void 0 : n.text) ?? "",
      wrap: (n == null ? void 0 : n.wrap) ?? this.autoWrap(),
      type: i,
      activate: a
    }), !0;
  }
  hasAtLeastOneBox() {
    return this.state.records.boxes.length > 0;
  }
  hasAtLeastOneBoxWithTitle() {
    return this.state.records.boxes.some((e) => e.name);
  }
  getMessages() {
    return this.state.records.messages;
  }
  getBoxes() {
    return this.state.records.boxes;
  }
  getActors() {
    return this.state.records.actors;
  }
  getCreatedActors() {
    return this.state.records.createdActors;
  }
  getDestroyedActors() {
    return this.state.records.destroyedActors;
  }
  getActor(e) {
    return this.state.records.actors.get(e);
  }
  getActorKeys() {
    return [...this.state.records.actors.keys()];
  }
  enableSequenceNumbers() {
    this.state.records.sequenceNumbersEnabled = !0;
  }
  disableSequenceNumbers() {
    this.state.records.sequenceNumbersEnabled = !1;
  }
  showSequenceNumbers() {
    return this.state.records.sequenceNumbersEnabled;
  }
  setWrap(e) {
    this.state.records.wrapEnabled = e;
  }
  extractWrap(e) {
    if (e === void 0)
      return {};
    e = e.trim();
    const r = /^:?wrap:/.exec(e) !== null ? !0 : /^:?nowrap:/.exec(e) !== null ? !1 : void 0;
    return { cleanedText: (r === void 0 ? e : e.replace(/^:?(?:no)?wrap:/, "")).trim(), wrap: r };
  }
  autoWrap() {
    var e;
    return this.state.records.wrapEnabled !== void 0 ? this.state.records.wrapEnabled : ((e = we().sequence) == null ? void 0 : e.wrap) ?? !1;
  }
  clear() {
    this.state.reset(), _n();
  }
  parseMessage(e) {
    const r = e.trim(), { wrap: n, cleanedText: i } = this.extractWrap(r), a = {
      text: i,
      wrap: n
    };
    return ae.debug(`parseMessage: ${JSON.stringify(a)}`), a;
  }
  // We expect the box statement to be color first then description
  // The color can be rgb,rgba,hsl,hsla, or css code names  #hex codes are not supported for now because of the way the char # is handled
  // We extract first segment as color, the rest of the line is considered as text
  parseBoxData(e) {
    const r = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(e);
    let n = r != null && r[1] ? r[1].trim() : "transparent", i = r != null && r[2] ? r[2].trim() : void 0;
    if (window != null && window.CSS)
      window.CSS.supports("color", n) || (n = "transparent", i = e.trim());
    else {
      const o = new Option().style;
      o.color = n, o.color !== n && (n = "transparent", i = e.trim());
    }
    const { wrap: a, cleanedText: s } = this.extractWrap(i);
    return {
      text: s ? fr(s, we()) : void 0,
      color: n,
      wrap: a
    };
  }
  addNote(e, r, n) {
    const i = {
      actor: e,
      placement: r,
      message: n.text,
      wrap: n.wrap ?? this.autoWrap()
    }, a = [].concat(e, e);
    this.state.records.notes.push(i), this.state.records.messages.push({
      id: this.state.records.messages.length.toString(),
      from: a[0],
      to: a[1],
      message: n.text,
      wrap: n.wrap ?? this.autoWrap(),
      type: this.LINETYPE.NOTE,
      placement: r
    });
  }
  addLinks(e, r) {
    const n = this.getActor(e);
    try {
      let i = fr(r.text, we());
      i = i.replace(/&equals;/g, "="), i = i.replace(/&amp;/g, "&");
      const a = JSON.parse(i);
      this.insertLinks(n, a);
    } catch (i) {
      ae.error("error while parsing actor link text", i);
    }
  }
  addALink(e, r) {
    const n = this.getActor(e);
    try {
      const i = {};
      let a = fr(r.text, we());
      const s = a.indexOf("@");
      a = a.replace(/&equals;/g, "="), a = a.replace(/&amp;/g, "&");
      const o = a.slice(0, s - 1).trim(), l = a.slice(s + 1).trim();
      i[o] = l, this.insertLinks(n, i);
    } catch (i) {
      ae.error("error while parsing actor link text", i);
    }
  }
  insertLinks(e, r) {
    if (e.links == null)
      e.links = r;
    else
      for (const n in r)
        e.links[n] = r[n];
  }
  addProperties(e, r) {
    const n = this.getActor(e);
    try {
      const i = fr(r.text, we()), a = JSON.parse(i);
      this.insertProperties(n, a);
    } catch (i) {
      ae.error("error while parsing actor properties text", i);
    }
  }
  insertProperties(e, r) {
    if (e.properties == null)
      e.properties = r;
    else
      for (const n in r)
        e.properties[n] = r[n];
  }
  boxEnd() {
    this.state.records.currentBox = void 0;
  }
  addDetails(e, r) {
    const n = this.getActor(e), i = document.getElementById(r.text);
    try {
      const a = i.innerHTML, s = JSON.parse(a);
      s.properties && this.insertProperties(n, s.properties), s.links && this.insertLinks(n, s.links);
    } catch (a) {
      ae.error("error while parsing actor details text", a);
    }
  }
  getActorProperty(e, r) {
    if ((e == null ? void 0 : e.properties) !== void 0)
      return e.properties[r];
  }
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
  apply(e) {
    if (Array.isArray(e))
      e.forEach((r) => {
        this.apply(r);
      });
    else
      switch (e.type) {
        case "sequenceIndex":
          this.state.records.messages.push({
            id: this.state.records.messages.length.toString(),
            from: void 0,
            to: void 0,
            message: {
              start: e.sequenceIndex,
              step: e.sequenceIndexStep,
              visible: e.sequenceVisible
            },
            wrap: !1,
            type: e.signalType
          });
          break;
        case "addParticipant":
          this.addActor(e.actor, e.actor, e.description, e.draw, e.config);
          break;
        case "createParticipant":
          if (this.state.records.actors.has(e.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"
            );
          this.state.records.lastCreated = e.actor, this.addActor(e.actor, e.actor, e.description, e.draw, e.config), this.state.records.createdActors.set(e.actor, this.state.records.messages.length);
          break;
        case "destroyParticipant":
          this.state.records.lastDestroyed = e.actor, this.state.records.destroyedActors.set(e.actor, this.state.records.messages.length);
          break;
        case "activeStart":
          this.addSignal(e.actor, void 0, void 0, e.signalType);
          break;
        case "activeEnd":
          this.addSignal(e.actor, void 0, void 0, e.signalType);
          break;
        case "addNote":
          this.addNote(e.actor, e.placement, e.text);
          break;
        case "addLinks":
          this.addLinks(e.actor, e.text);
          break;
        case "addALink":
          this.addALink(e.actor, e.text);
          break;
        case "addProperties":
          this.addProperties(e.actor, e.text);
          break;
        case "addDetails":
          this.addDetails(e.actor, e.text);
          break;
        case "addMessage":
          if (this.state.records.lastCreated) {
            if (e.to !== this.state.records.lastCreated)
              throw new Error(
                "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
              );
            this.state.records.lastCreated = void 0;
          } else if (this.state.records.lastDestroyed) {
            if (e.to !== this.state.records.lastDestroyed && e.from !== this.state.records.lastDestroyed)
              throw new Error(
                "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
              );
            this.state.records.lastDestroyed = void 0;
          }
          this.addSignal(e.from, e.to, e.msg, e.signalType, e.activate);
          break;
        case "boxStart":
          this.addBox(e.boxData);
          break;
        case "boxEnd":
          this.boxEnd();
          break;
        case "loopStart":
          this.addSignal(void 0, void 0, e.loopText, e.signalType);
          break;
        case "loopEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
        case "rectStart":
          this.addSignal(void 0, void 0, e.color, e.signalType);
          break;
        case "rectEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
        case "optStart":
          this.addSignal(void 0, void 0, e.optText, e.signalType);
          break;
        case "optEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
        case "altStart":
          this.addSignal(void 0, void 0, e.altText, e.signalType);
          break;
        case "else":
          this.addSignal(void 0, void 0, e.altText, e.signalType);
          break;
        case "altEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
        case "setAccTitle":
          Cn(e.text);
          break;
        case "parStart":
          this.addSignal(void 0, void 0, e.parText, e.signalType);
          break;
        case "and":
          this.addSignal(void 0, void 0, e.parText, e.signalType);
          break;
        case "parEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
        case "criticalStart":
          this.addSignal(void 0, void 0, e.criticalText, e.signalType);
          break;
        case "option":
          this.addSignal(void 0, void 0, e.optionText, e.signalType);
          break;
        case "criticalEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
        case "breakStart":
          this.addSignal(void 0, void 0, e.breakText, e.signalType);
          break;
        case "breakEnd":
          this.addSignal(void 0, void 0, void 0, e.signalType);
          break;
      }
  }
  getConfig() {
    return we().sequence;
  }
}, x(Md, "SequenceDB"), Md), O8e = /* @__PURE__ */ x((t) => `.actor {
    stroke: ${t.actorBorder};
    fill: ${t.actorBkg};
  }

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

  .actor-line {
    stroke: ${t.actorLineColor};
  }
  
  .innerArc {
    stroke-width: 1.5;
    stroke-dasharray: none;
  }

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

`, "getStyles"), P8e = O8e, Kc = 18 * 2, xc = "actor-top", bc = "actor-bottom", pb = "actor-box", Jl = "actor-man", Tg = /* @__PURE__ */ x(function(t, e) {
  return Yx(t, e);
}, "drawRect"), B8e = /* @__PURE__ */ x(function(t, e, r, n, i) {
  if (e.links === void 0 || e.links === null || Object.keys(e.links).length === 0)
    return { height: 0, width: 0 };
  const a = e.links, s = e.actorCnt, o = e.rectData;
  var l = "none";
  i && (l = "block !important");
  const u = t.append("g");
  u.attr("id", "actor" + s + "_popup"), u.attr("class", "actorPopupMenu"), u.attr("display", l);
  var h = "";
  o.class !== void 0 && (h = " " + o.class);
  let d = o.width > r ? o.width : r;
  const f = u.append("rect");
  if (f.attr("class", "actorPopupMenuPanel" + h), f.attr("x", o.x), f.attr("y", o.height), f.attr("fill", o.fill), f.attr("stroke", o.stroke), f.attr("width", d), f.attr("height", o.height), f.attr("rx", o.rx), f.attr("ry", o.ry), a != null) {
    var p = 20;
    for (let v in a) {
      var g = u.append("a"), m = rc(a[v]);
      g.attr("xlink:href", m), g.attr("target", "_blank"), aAe(n)(
        v,
        g,
        o.x + 10,
        o.height + p,
        d,
        20,
        { class: "actor" },
        n
      ), p += 30;
    }
  }
  return f.attr("height", p), { height: o.height + p, width: d };
}, "drawPopup"), gb = /* @__PURE__ */ x(function(t) {
  return "var pu = document.getElementById('" + t + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
}, "popupMenuToggle"), A2 = /* @__PURE__ */ x(async function(t, e, r = null) {
  let n = t.append("foreignObject");
  const i = await _g(e.text, gr()), s = n.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(i).node().getBoundingClientRect();
  if (n.attr("height", Math.round(s.height)).attr("width", Math.round(s.width)), e.class === "noteText") {
    const o = t.node().firstChild;
    o.setAttribute("height", s.height + 2 * e.textMargin);
    const l = o.getBBox();
    n.attr("x", Math.round(l.x + l.width / 2 - s.width / 2)).attr("y", Math.round(l.y + l.height / 2 - s.height / 2));
  } else if (r) {
    let { startx: o, stopx: l, starty: u } = r;
    if (o > l) {
      const h = o;
      o = l, l = h;
    }
    n.attr("x", Math.round(o + Math.abs(o - l) / 2 - s.width / 2)), e.class === "loopText" ? n.attr("y", Math.round(u)) : n.attr("y", Math.round(u - s.height));
  }
  return [n];
}, "drawKatex"), mf = /* @__PURE__ */ x(function(t, e) {
  let r = 0, n = 0;
  const i = e.text.split(at.lineBreakRegex), [a, s] = Du(e.fontSize);
  let o = [], l = 0, u = /* @__PURE__ */ x(() => e.y, "yfunc");
  if (e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0)
    switch (e.valign) {
      case "top":
      case "start":
        u = /* @__PURE__ */ x(() => Math.round(e.y + e.textMargin), "yfunc");
        break;
      case "middle":
      case "center":
        u = /* @__PURE__ */ x(() => Math.round(e.y + (r + n + e.textMargin) / 2), "yfunc");
        break;
      case "bottom":
      case "end":
        u = /* @__PURE__ */ x(() => Math.round(
          e.y + (r + n + 2 * e.textMargin) - e.textMargin
        ), "yfunc");
        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, d] of i.entries()) {
    e.textMargin !== void 0 && e.textMargin === 0 && a !== void 0 && (l = h * a);
    const f = t.append("text");
    f.attr("x", e.x), f.attr("y", u()), e.anchor !== void 0 && f.attr("text-anchor", e.anchor).attr("dominant-baseline", e.dominantBaseline).attr("alignment-baseline", e.alignmentBaseline), e.fontFamily !== void 0 && f.style("font-family", e.fontFamily), s !== void 0 && f.style("font-size", s), e.fontWeight !== void 0 && f.style("font-weight", e.fontWeight), e.fill !== void 0 && f.attr("fill", e.fill), e.class !== void 0 && f.attr("class", e.class), e.dy !== void 0 ? f.attr("dy", e.dy) : l !== 0 && f.attr("dy", l);
    const p = d || KO;
    if (e.tspan) {
      const g = f.append("tspan");
      g.attr("x", e.x), e.fill !== void 0 && g.attr("fill", e.fill), g.text(p);
    } else
      f.text(p);
    e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0 && (n += (f._groups || f)[0][0].getBBox().height, r = n), o.push(f);
  }
  return o;
}, "drawText"), hq = /* @__PURE__ */ x(function(t, e) {
  function r(i, a, s, o, l) {
    return i + "," + a + " " + (i + s) + "," + a + " " + (i + s) + "," + (a + o - l) + " " + (i + s - l * 1.2) + "," + (a + o) + " " + i + "," + (a + o);
  }
  x(r, "genPoints");
  const n = t.append("polygon");
  return n.attr("points", r(e.x, e.y, e.width, e.height, 7)), n.attr("class", "labelBox"), e.y = e.y + e.height / 2, mf(t, e), n;
}, "drawLabel"), or = -1, dq = /* @__PURE__ */ x((t, e, r, n) => {
  t.select && r.forEach((i) => {
    const a = e.get(i), s = t.select("#actor" + a.actorCnt);
    !n.mirrorActors && a.stopy ? s.attr("y2", a.stopy + a.height / 2) : n.mirrorActors && s.attr("y2", a.stopy);
  });
}, "fixLifeLineHeights"), F8e = /* @__PURE__ */ x(function(t, e, r, n) {
  var p, g;
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + e.height, o = t.append("g").lower();
  var l = o;
  n || (or++, Object.keys(e.links || {}).length && !r.forceMenus && l.attr("onclick", gb(`actor${or}_popup`)).attr("cursor", "pointer"), l.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), l = o.append("g"), e.actorCnt = or, e.links != null && l.attr("id", "root-" + or));
  const u = Ia();
  var h = "actor";
  (p = e.properties) != null && p.class ? h = e.properties.class : u.fill = "#eaeaea", n ? h += ` ${bc}` : h += ` ${xc}`, u.x = e.x, u.y = i, u.width = e.width, u.height = e.height, u.class = h, u.rx = 3, u.ry = 3, u.name = e.name;
  const d = Tg(l, u);
  if (e.rectData = u, (g = e.properties) != null && g.icon) {
    const m = e.properties.icon.trim();
    m.charAt(0) === "@" ? pS(l, u.x + u.width - 20, u.y + 10, m.substr(1)) : fS(l, u.x + u.width - 20, u.y + 10, m);
  }
  ll(r, un(e.description))(
    e.description,
    l,
    u.x,
    u.y,
    u.width,
    u.height,
    { class: `actor ${pb}` },
    r
  );
  let f = e.height;
  if (d.node) {
    const m = d.node().getBBox();
    e.height = m.height, f = m.height;
  }
  return f;
}, "drawActorTypeParticipant"), $8e = /* @__PURE__ */ x(function(t, e, r, n) {
  var m, v;
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + e.height, o = t.append("g").lower();
  var l = o;
  n || (or++, Object.keys(e.links || {}).length && !r.forceMenus && l.attr("onclick", gb(`actor${or}_popup`)).attr("cursor", "pointer"), l.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), l = o.append("g"), e.actorCnt = or, e.links != null && l.attr("id", "root-" + or));
  const u = Ia();
  var h = "actor";
  (m = e.properties) != null && m.class ? h = e.properties.class : u.fill = "#eaeaea", n ? h += ` ${bc}` : h += ` ${xc}`, u.x = e.x, u.y = i, u.width = e.width, u.height = e.height, u.class = h, u.name = e.name;
  const d = 6, f = {
    ...u,
    x: u.x + -d,
    y: u.y + +d,
    class: "actor"
  }, p = Tg(l, u);
  if (Tg(l, f), e.rectData = u, (v = e.properties) != null && v.icon) {
    const y = e.properties.icon.trim();
    y.charAt(0) === "@" ? pS(l, u.x + u.width - 20, u.y + 10, y.substr(1)) : fS(l, u.x + u.width - 20, u.y + 10, y);
  }
  ll(r, un(e.description))(
    e.description,
    l,
    u.x - d,
    u.y + d,
    u.width,
    u.height,
    { class: `actor ${pb}` },
    r
  );
  let g = e.height;
  if (p.node) {
    const y = p.node().getBBox();
    e.height = y.height, g = y.height;
  }
  return g;
}, "drawActorTypeCollections"), z8e = /* @__PURE__ */ x(function(t, e, r, n) {
  var y, b;
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + e.height, o = t.append("g").lower();
  let l = o;
  n || (or++, Object.keys(e.links || {}).length && !r.forceMenus && l.attr("onclick", gb(`actor${or}_popup`)).attr("cursor", "pointer"), l.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), l = o.append("g"), e.actorCnt = or, e.links != null && l.attr("id", "root-" + or));
  const u = Ia();
  let h = "actor";
  (y = e.properties) != null && y.class ? h = e.properties.class : u.fill = "#eaeaea", n ? h += ` ${bc}` : h += ` ${xc}`, u.x = e.x, u.y = i, u.width = e.width, u.height = e.height, u.class = h, u.name = e.name;
  const d = u.height / 2, f = d / (2.5 + u.height / 50), p = l.append("g"), g = l.append("g");
  if (p.append("path").attr(
    "d",
    `M ${u.x},${u.y + d}
    a ${f},${d} 0 0 0 0,${u.height}
    h ${u.width - 2 * f}
    a ${f},${d} 0 0 0 0,-${u.height}
    Z
  `
  ).attr("class", h), g.append("path").attr(
    "d",
    `M ${u.x},${u.y + d}
      a ${f},${d} 0 0 0 0,${u.height}`
  ).attr("stroke", "#666").attr("stroke-width", "1px").attr("class", h), p.attr("transform", `translate(${f}, ${-(u.height / 2)})`), g.attr("transform", `translate(${u.width - f}, ${-u.height / 2})`), e.rectData = u, (b = e.properties) != null && b.icon) {
    const w = e.properties.icon.trim(), T = u.x + u.width - 20, E = u.y + 10;
    w.charAt(0) === "@" ? pS(l, T, E, w.substr(1)) : fS(l, T, E, w);
  }
  ll(r, un(e.description))(
    e.description,
    l,
    u.x,
    u.y,
    u.width,
    u.height,
    { class: `actor ${pb}` },
    r
  );
  let m = e.height;
  const v = p.select("path:last-child");
  if (v.node()) {
    const w = v.node().getBBox();
    e.height = w.height, m = w.height;
  }
  return m;
}, "drawActorTypeQueue"), V8e = /* @__PURE__ */ x(function(t, e, r, n) {
  var m;
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + 75, o = t.append("g").lower();
  n || (or++, o.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), e.actorCnt = or);
  const l = t.append("g");
  let u = Jl;
  n ? u += ` ${bc}` : u += ` ${xc}`, l.attr("class", u), l.attr("name", e.name);
  const h = Ia();
  h.x = e.x, h.y = i, h.fill = "#eaeaea", h.width = e.width, h.height = e.height, h.class = "actor";
  const d = e.x + e.width / 2, f = i + 30, p = 18;
  l.append("defs").append("marker").attr("id", "filled-head-control").attr("refX", 11).attr("refY", 5.8).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "172.5").append("path").attr("d", "M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"), l.append("circle").attr("cx", d).attr("cy", f).attr("r", p).attr("fill", "#eaeaf7").attr("stroke", "#666").attr("stroke-width", 1.2), l.append("line").attr("marker-end", "url(#filled-head-control)").attr("transform", `translate(${d}, ${f - p})`);
  const g = l.node().getBBox();
  return e.height = g.height + 2 * (((m = r == null ? void 0 : r.sequence) == null ? void 0 : m.labelBoxHeight) ?? 0), ll(r, un(e.description))(
    e.description,
    l,
    h.x,
    h.y + p + (n ? 5 : 10),
    h.width,
    h.height,
    { class: `actor ${Jl}` },
    r
  ), e.height;
}, "drawActorTypeControl"), G8e = /* @__PURE__ */ x(function(t, e, r, n) {
  var m;
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + 75, o = t.append("g").lower(), l = t.append("g");
  let u = Jl;
  n ? u += ` ${bc}` : u += ` ${xc}`, l.attr("class", u), l.attr("name", e.name);
  const h = Ia();
  h.x = e.x, h.y = i, h.fill = "#eaeaea", h.width = e.width, h.height = e.height, h.class = "actor";
  const d = e.x + e.width / 2, f = i + (n ? 10 : 25), p = 18;
  l.append("circle").attr("cx", d).attr("cy", f).attr("r", p).attr("width", e.width).attr("height", e.height), l.append("line").attr("x1", d - p).attr("x2", d + p).attr("y1", f + p).attr("y2", f + p).attr("stroke", "#333").attr("stroke-width", 2);
  const g = l.node().getBBox();
  return e.height = g.height + (((m = r == null ? void 0 : r.sequence) == null ? void 0 : m.labelBoxHeight) ?? 0), n || (or++, o.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), e.actorCnt = or), ll(r, un(e.description))(
    e.description,
    l,
    h.x,
    h.y + (n ? (f - i + p - 5) / 2 : (f + p - i) / 2),
    h.width,
    h.height,
    { class: `actor ${Jl}` },
    r
  ), n ? l.attr("transform", `translate(0, ${p / 2})`) : l.attr("transform", `translate(0, ${p / 2})`), e.height;
}, "drawActorTypeEntity"), U8e = /* @__PURE__ */ x(function(t, e, r, n) {
  var b;
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + e.height + 2 * r.boxTextMargin, o = t.append("g").lower();
  let l = o;
  n || (or++, Object.keys(e.links || {}).length && !r.forceMenus && l.attr("onclick", gb(`actor${or}_popup`)).attr("cursor", "pointer"), l.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), l = o.append("g"), e.actorCnt = or, e.links != null && l.attr("id", "root-" + or));
  const u = Ia();
  let h = "actor";
  (b = e.properties) != null && b.class ? h = e.properties.class : u.fill = "#eaeaea", n ? h += ` ${bc}` : h += ` ${xc}`, u.x = e.x, u.y = i, u.width = e.width, u.height = e.height, u.class = h, u.name = e.name, u.x = e.x, u.y = i;
  const d = u.width / 4, f = u.width / 4, p = d / 2, g = p / (2.5 + d / 50), m = l.append("g"), v = `
  M ${u.x},${u.y + g}
  a ${p},${g} 0 0 0 ${d},0
  a ${p},${g} 0 0 0 -${d},0
  l 0,${f - 2 * g}
  a ${p},${g} 0 0 0 ${d},0
  l 0,-${f - 2 * g}
`;
  m.append("path").attr("d", v).attr("fill", "#eaeaea").attr("stroke", "#000").attr("stroke-width", 1).attr("class", h), n ? m.attr("transform", `translate(${d * 1.5}, ${u.height / 4 - 2 * g})`) : m.attr("transform", `translate(${d * 1.5}, ${(u.height + g) / 4})`), e.rectData = u, ll(r, un(e.description))(
    e.description,
    l,
    u.x,
    u.y + (n ? (u.height + f) / 4 : (u.height + g) / 2),
    u.width,
    u.height,
    { class: `actor ${pb}` },
    r
  );
  const y = m.select("path:last-child");
  if (y.node()) {
    const w = y.node().getBBox();
    e.height = w.height + (r.sequence.labelBoxHeight ?? 0);
  }
  return e.height;
}, "drawActorTypeDatabase"), W8e = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + 80, o = 30, l = t.append("g").lower();
  n || (or++, l.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), e.actorCnt = or);
  const u = t.append("g");
  let h = Jl;
  n ? h += ` ${bc}` : h += ` ${xc}`, u.attr("class", h), u.attr("name", e.name);
  const d = Ia();
  d.x = e.x, d.y = i, d.fill = "#eaeaea", d.width = e.width, d.height = e.height, d.class = "actor", u.append("line").attr("id", "actor-man-torso" + or).attr("x1", e.x + e.width / 2 - o * 2.5).attr("y1", i + 10).attr("x2", e.x + e.width / 2 - 15).attr("y2", i + 10), u.append("line").attr("id", "actor-man-arms" + or).attr("x1", e.x + e.width / 2 - o * 2.5).attr("y1", i + 0).attr("x2", e.x + e.width / 2 - o * 2.5).attr("y2", i + 20), u.append("circle").attr("cx", e.x + e.width / 2).attr("cy", i + 10).attr("r", o);
  const f = u.node().getBBox();
  return e.height = f.height + (r.sequence.labelBoxHeight ?? 0), ll(r, un(e.description))(
    e.description,
    u,
    d.x,
    d.y + (n ? o / 2 - 4 : o / 2 + 3),
    d.width,
    d.height,
    { class: `actor ${Jl}` },
    r
  ), n ? u.attr("transform", `translate(0,${o / 2 + 7})`) : u.attr("transform", `translate(0,${o / 2 + 7})`), e.height;
}, "drawActorTypeBoundary"), H8e = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = n ? e.stopy : e.starty, a = e.x + e.width / 2, s = i + 80, o = t.append("g").lower();
  n || (or++, o.append("line").attr("id", "actor" + or).attr("x1", a).attr("y1", s).attr("x2", a).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", e.name), e.actorCnt = or);
  const l = t.append("g");
  let u = Jl;
  n ? u += ` ${bc}` : u += ` ${xc}`, l.attr("class", u), l.attr("name", e.name);
  const h = Ia();
  h.x = e.x, h.y = i, h.fill = "#eaeaea", h.width = e.width, h.height = e.height, h.class = "actor", h.rx = 3, h.ry = 3, l.append("line").attr("id", "actor-man-torso" + or).attr("x1", a).attr("y1", i + 25).attr("x2", a).attr("y2", i + 45), l.append("line").attr("id", "actor-man-arms" + or).attr("x1", a - Kc / 2).attr("y1", i + 33).attr("x2", a + Kc / 2).attr("y2", i + 33), l.append("line").attr("x1", a - Kc / 2).attr("y1", i + 60).attr("x2", a).attr("y2", i + 45), l.append("line").attr("x1", a).attr("y1", i + 45).attr("x2", a + Kc / 2 - 2).attr("y2", i + 60);
  const d = l.append("circle");
  d.attr("cx", e.x + e.width / 2), d.attr("cy", i + 10), d.attr("r", 15), d.attr("width", e.width), d.attr("height", e.height);
  const f = l.node().getBBox();
  return e.height = f.height, ll(r, un(e.description))(
    e.description,
    l,
    h.x,
    h.y + 35,
    h.width,
    h.height,
    { class: `actor ${Jl}` },
    r
  ), e.height;
}, "drawActorTypeActor"), q8e = /* @__PURE__ */ x(async function(t, e, r, n) {
  switch (e.type) {
    case "actor":
      return await H8e(t, e, r, n);
    case "participant":
      return await F8e(t, e, r, n);
    case "boundary":
      return await W8e(t, e, r, n);
    case "control":
      return await V8e(t, e, r, n);
    case "entity":
      return await G8e(t, e, r, n);
    case "database":
      return await U8e(t, e, r, n);
    case "collections":
      return await $8e(t, e, r, n);
    case "queue":
      return await z8e(t, e, r, n);
  }
}, "drawActor"), Y8e = /* @__PURE__ */ x(function(t, e, r) {
  const i = t.append("g");
  fq(i, e), e.name && ll(r)(
    e.name,
    i,
    e.x,
    e.y + r.boxTextMargin + (e.textMaxHeight || 0) / 2,
    e.width,
    0,
    { class: "text" },
    r
  ), i.lower();
}, "drawBox"), X8e = /* @__PURE__ */ x(function(t) {
  return t.append("g");
}, "anchorElement"), j8e = /* @__PURE__ */ x(function(t, e, r, n, i) {
  const a = Ia(), s = e.anchored;
  a.x = e.startx, a.y = e.starty, a.class = "activation" + i % 3, a.width = e.stopx - e.startx, a.height = r - e.starty, Tg(s, a);
}, "drawActivation"), K8e = /* @__PURE__ */ x(async function(t, e, r, n) {
  const {
    boxMargin: i,
    boxTextMargin: a,
    labelBoxHeight: s,
    labelBoxWidth: o,
    messageFontFamily: l,
    messageFontSize: u,
    messageFontWeight: h
  } = n, d = t.append("g"), f = /* @__PURE__ */ x(function(m, v, y, b) {
    return d.append("line").attr("x1", m).attr("y1", v).attr("x2", y).attr("y2", b).attr("class", "loopLine");
  }, "drawLoopLine");
  f(e.startx, e.starty, e.stopx, e.starty), f(e.stopx, e.starty, e.stopx, e.stopy), f(e.startx, e.stopy, e.stopx, e.stopy), f(e.startx, e.starty, e.startx, e.stopy), e.sections !== void 0 && e.sections.forEach(function(m) {
    f(e.startx, m.y, e.stopx, m.y).style(
      "stroke-dasharray",
      "3, 3"
    );
  });
  let p = gS();
  p.text = r, 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 = s || 20, p.textMargin = a, p.class = "labelText", hq(d, p), p = pq(), p.text = e.title, p.x = e.startx + o / 2 + (e.stopx - e.startx) / 2, p.y = e.starty + i + a, p.anchor = "middle", p.valign = "middle", p.textMargin = a, p.class = "loopText", p.fontFamily = l, p.fontSize = u, p.fontWeight = h, p.wrap = !0;
  let g = un(p.text) ? await A2(d, p, e) : mf(d, p);
  if (e.sectionTitles !== void 0) {
    for (const [m, v] of Object.entries(e.sectionTitles))
      if (v.message) {
        p.text = v.message, p.x = e.startx + (e.stopx - e.startx) / 2, p.y = e.sections[m].y + i + a, 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, un(p.text) ? (e.starty = e.sections[m].y, await A2(d, p, e)) : mf(d, p);
        let y = Math.round(
          g.map((b) => (b._groups || b)[0][0].getBBox().height).reduce((b, w) => b + w)
        );
        e.sections[m].height += y - (i + a);
      }
  }
  return e.height = Math.round(e.stopy - e.starty), d;
}, "drawLoop"), fq = /* @__PURE__ */ x(function(t, e) {
  nU(t, e);
}, "drawBackgroundRect"), Z8e = /* @__PURE__ */ x(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"
  );
}, "insertDatabaseIcon"), Q8e = /* @__PURE__ */ x(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"
  );
}, "insertComputerIcon"), J8e = /* @__PURE__ */ x(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"
  );
}, "insertClockIcon"), eAe = /* @__PURE__ */ x(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-start-reverse").append("path").attr("d", "M -1 0 L 10 5 L 0 10 z");
}, "insertArrowHead"), tAe = /* @__PURE__ */ x(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");
}, "insertArrowFilledHead"), rAe = /* @__PURE__ */ x(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);
}, "insertSequenceNumber"), nAe = /* @__PURE__ */ x(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");
}, "insertArrowCrossHead"), pq = /* @__PURE__ */ x(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
  };
}, "getTextObj"), iAe = /* @__PURE__ */ x(function() {
  return {
    x: 0,
    y: 0,
    fill: "#EDF2AE",
    stroke: "#666",
    width: 100,
    anchor: "start",
    height: 100,
    rx: 0,
    ry: 0
  };
}, "getNoteRect"), ll = /* @__PURE__ */ function() {
  function t(a, s, o, l, u, h, d) {
    const f = s.append("text").attr("x", o + u / 2).attr("y", l + h / 2 + 5).style("text-anchor", "middle").text(a);
    i(f, d);
  }
  x(t, "byText");
  function e(a, s, o, l, u, h, d, f) {
    const { actorFontSize: p, actorFontFamily: g, actorFontWeight: m } = f, [v, y] = Du(p), b = a.split(at.lineBreakRegex);
    for (let w = 0; w < b.length; w++) {
      const T = w * v - v * (b.length - 1) / 2, E = s.append("text").attr("x", o + u / 2).attr("y", l).style("text-anchor", "middle").style("font-size", y).style("font-weight", m).style("font-family", g);
      E.append("tspan").attr("x", o + u / 2).attr("dy", T).text(b[w]), E.attr("y", l + h / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), i(E, d);
    }
  }
  x(e, "byTspan");
  function r(a, s, o, l, u, h, d, f) {
    const p = s.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(a), e(a, p, o, l, u, h, d, f), i(m, d);
  }
  x(r, "byFo");
  async function n(a, s, o, l, u, h, d, f) {
    const p = await Ag(a, gr()), g = s.append("switch"), v = g.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%");
    v.append("div").style("text-align", "center").style("vertical-align", "middle").html(await _g(a, gr())), e(a, g, o, l, u, h, d, f), i(v, d);
  }
  x(n, "byKatex");
  function i(a, s) {
    for (const o in s)
      s.hasOwnProperty(o) && a.attr(o, s[o]);
  }
  return x(i, "_setTextAttrs"), function(a, s = !1) {
    return s ? n : a.textPlacement === "fo" ? r : a.textPlacement === "old" ? t : e;
  };
}(), aAe = /* @__PURE__ */ function() {
  function t(i, a, s, o, l, u, h) {
    const d = a.append("text").attr("x", s).attr("y", o).style("text-anchor", "start").text(i);
    n(d, h);
  }
  x(t, "byText");
  function e(i, a, s, o, l, u, h, d) {
    const { actorFontSize: f, actorFontFamily: p, actorFontWeight: g } = d, m = i.split(at.lineBreakRegex);
    for (let v = 0; v < m.length; v++) {
      const y = v * f - f * (m.length - 1) / 2, b = a.append("text").attr("x", s).attr("y", o).style("text-anchor", "start").style("font-size", f).style("font-weight", g).style("font-family", p);
      b.append("tspan").attr("x", s).attr("dy", y).text(m[v]), b.attr("y", o + u / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), n(b, h);
    }
  }
  x(e, "byTspan");
  function r(i, a, s, o, l, u, h, d) {
    const f = a.append("switch"), g = f.append("foreignObject").attr("x", s).attr("y", o).attr("width", l).attr("height", u).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    g.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, f, s, o, l, u, h, d), n(g, h);
  }
  x(r, "byFo");
  function n(i, a) {
    for (const s in a)
      a.hasOwnProperty(s) && i.attr(s, a[s]);
  }
  return x(n, "_setTextAttrs"), function(i) {
    return i.textPlacement === "fo" ? r : i.textPlacement === "old" ? t : e;
  };
}(), fn = {
  drawRect: Tg,
  drawText: mf,
  drawLabel: hq,
  drawActor: q8e,
  drawBox: Y8e,
  drawPopup: B8e,
  anchorElement: X8e,
  drawActivation: j8e,
  drawLoop: K8e,
  drawBackgroundRect: fq,
  insertArrowHead: eAe,
  insertArrowFilledHead: tAe,
  insertSequenceNumber: rAe,
  insertArrowCrossHead: nAe,
  insertDatabaseIcon: Z8e,
  insertComputerIcon: Q8e,
  insertClockIcon: J8e,
  getTextObj: pq,
  getNoteRect: iAe,
  fixLifeLineHeights: dq,
  sanitizeUrl: rc
}, Re = {}, et = {
  data: {
    startx: void 0,
    stopx: void 0,
    starty: void 0,
    stopy: void 0
  },
  verticalPos: 0,
  sequenceItems: [],
  activations: [],
  models: {
    getHeight: /* @__PURE__ */ x(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));
    }, "getHeight"),
    clear: /* @__PURE__ */ x(function() {
      this.actors = [], this.boxes = [], this.loops = [], this.messages = [], this.notes = [];
    }, "clear"),
    addBox: /* @__PURE__ */ x(function(t) {
      this.boxes.push(t);
    }, "addBox"),
    addActor: /* @__PURE__ */ x(function(t) {
      this.actors.push(t);
    }, "addActor"),
    addLoop: /* @__PURE__ */ x(function(t) {
      this.loops.push(t);
    }, "addLoop"),
    addMessage: /* @__PURE__ */ x(function(t) {
      this.messages.push(t);
    }, "addMessage"),
    addNote: /* @__PURE__ */ x(function(t) {
      this.notes.push(t);
    }, "addNote"),
    lastActor: /* @__PURE__ */ x(function() {
      return this.actors[this.actors.length - 1];
    }, "lastActor"),
    lastLoop: /* @__PURE__ */ x(function() {
      return this.loops[this.loops.length - 1];
    }, "lastLoop"),
    lastMessage: /* @__PURE__ */ x(function() {
      return this.messages[this.messages.length - 1];
    }, "lastMessage"),
    lastNote: /* @__PURE__ */ x(function() {
      return this.notes[this.notes.length - 1];
    }, "lastNote"),
    actors: [],
    boxes: [],
    loops: [],
    messages: [],
    notes: []
  },
  init: /* @__PURE__ */ x(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, vq(we());
  }, "init"),
  updateVal: /* @__PURE__ */ x(function(t, e, r, n) {
    t[e] === void 0 ? t[e] = r : t[e] = n(r, t[e]);
  }, "updateVal"),
  updateBounds: /* @__PURE__ */ x(function(t, e, r, n) {
    const i = this;
    let a = 0;
    function s(o) {
      return /* @__PURE__ */ x(function(u) {
        a++;
        const h = i.sequenceItems.length - a + 1;
        i.updateVal(u, "starty", e - h * Re.boxMargin, Math.min), i.updateVal(u, "stopy", n + h * Re.boxMargin, Math.max), i.updateVal(et.data, "startx", t - h * Re.boxMargin, Math.min), i.updateVal(et.data, "stopx", r + h * Re.boxMargin, Math.max), o !== "activation" && (i.updateVal(u, "startx", t - h * Re.boxMargin, Math.min), i.updateVal(u, "stopx", r + h * Re.boxMargin, Math.max), i.updateVal(et.data, "starty", e - h * Re.boxMargin, Math.min), i.updateVal(et.data, "stopy", n + h * Re.boxMargin, Math.max));
      }, "updateItemBounds");
    }
    x(s, "updateFn"), this.sequenceItems.forEach(s()), this.activations.forEach(s("activation"));
  }, "updateBounds"),
  insert: /* @__PURE__ */ x(function(t, e, r, n) {
    const i = at.getMin(t, r), a = at.getMax(t, r), s = at.getMin(e, n), o = at.getMax(e, n);
    this.updateVal(et.data, "startx", i, Math.min), this.updateVal(et.data, "starty", s, Math.min), this.updateVal(et.data, "stopx", a, Math.max), this.updateVal(et.data, "stopy", o, Math.max), this.updateBounds(i, s, a, o);
  }, "insert"),
  newActivation: /* @__PURE__ */ x(function(t, e, r) {
    const n = r.get(t.from), i = mb(t.from).length || 0, a = n.x + n.width / 2 + (i - 1) * Re.activationWidth / 2;
    this.activations.push({
      startx: a,
      starty: this.verticalPos + 2,
      stopx: a + Re.activationWidth,
      stopy: void 0,
      actor: t.from,
      anchored: fn.anchorElement(e)
    });
  }, "newActivation"),
  endActivation: /* @__PURE__ */ x(function(t) {
    const e = this.activations.map(function(r) {
      return r.actor;
    }).lastIndexOf(t.from);
    return this.activations.splice(e, 1)[0];
  }, "endActivation"),
  createLoop: /* @__PURE__ */ x(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
    };
  }, "createLoop"),
  newLoop: /* @__PURE__ */ x(function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
    this.sequenceItems.push(this.createLoop(t, e));
  }, "newLoop"),
  endLoop: /* @__PURE__ */ x(function() {
    return this.sequenceItems.pop();
  }, "endLoop"),
  isLoopOverlap: /* @__PURE__ */ x(function() {
    return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : !1;
  }, "isLoopOverlap"),
  addSectionToLoop: /* @__PURE__ */ x(function(t) {
    const e = this.sequenceItems.pop();
    e.sections = e.sections || [], e.sectionTitles = e.sectionTitles || [], e.sections.push({ y: et.getVerticalPos(), height: 0 }), e.sectionTitles.push(t), this.sequenceItems.push(e);
  }, "addSectionToLoop"),
  saveVerticalPos: /* @__PURE__ */ x(function() {
    this.isLoopOverlap() && (this.savedVerticalPos = this.verticalPos);
  }, "saveVerticalPos"),
  resetVerticalPos: /* @__PURE__ */ x(function() {
    this.isLoopOverlap() && (this.verticalPos = this.savedVerticalPos);
  }, "resetVerticalPos"),
  bumpVerticalPos: /* @__PURE__ */ x(function(t) {
    this.verticalPos = this.verticalPos + t, this.data.stopy = at.getMax(this.data.stopy, this.verticalPos);
  }, "bumpVerticalPos"),
  getVerticalPos: /* @__PURE__ */ x(function() {
    return this.verticalPos;
  }, "getVerticalPos"),
  getBounds: /* @__PURE__ */ x(function() {
    return { bounds: this.data, models: this.models };
  }, "getBounds")
}, sAe = /* @__PURE__ */ x(async function(t, e) {
  et.bumpVerticalPos(Re.boxMargin), e.height = Re.boxMargin, e.starty = et.getVerticalPos();
  const r = Ia();
  r.x = e.startx, r.y = e.starty, r.width = e.width || Re.width, r.class = "note";
  const n = t.append("g"), i = fn.drawRect(n, r), a = gS();
  a.x = e.startx, a.y = e.starty, a.width = r.width, a.dy = "1em", a.text = e.message, a.class = "noteText", a.fontFamily = Re.noteFontFamily, a.fontSize = Re.noteFontSize, a.fontWeight = Re.noteFontWeight, a.anchor = Re.noteAlign, a.textMargin = Re.noteMargin, a.valign = "center";
  const s = un(a.text) ? await A2(n, a) : mf(n, a), o = Math.round(
    s.map((l) => (l._groups || l)[0][0].getBBox().height).reduce((l, u) => l + u)
  );
  i.attr("height", o + 2 * Re.noteMargin), e.height += o + 2 * Re.noteMargin, et.bumpVerticalPos(o + 2 * Re.noteMargin), e.stopy = e.starty + o + 2 * Re.noteMargin, e.stopx = e.startx + r.width, et.insert(e.startx, e.starty, e.stopx, e.stopy), et.models.addNote(e);
}, "drawNote"), Cu = /* @__PURE__ */ x((t) => ({
  fontFamily: t.messageFontFamily,
  fontSize: t.messageFontSize,
  fontWeight: t.messageFontWeight
}), "messageFont"), gh = /* @__PURE__ */ x((t) => ({
  fontFamily: t.noteFontFamily,
  fontSize: t.noteFontSize,
  fontWeight: t.noteFontWeight
}), "noteFont"), L6 = /* @__PURE__ */ x((t) => ({
  fontFamily: t.actorFontFamily,
  fontSize: t.actorFontSize,
  fontWeight: t.actorFontWeight
}), "actorFont");
async function gq(t, e) {
  et.bumpVerticalPos(10);
  const { startx: r, stopx: n, message: i } = e, a = at.splitBreaks(i).length, s = un(i), o = s ? await Ag(i, we()) : Kt.calculateTextDimensions(i, Cu(Re));
  if (!s) {
    const d = o.height / a;
    e.height += d, et.bumpVerticalPos(d);
  }
  let l, u = o.height - 10;
  const h = o.width;
  if (r === n) {
    l = et.getVerticalPos() + u, Re.rightAngles || (u += Re.boxMargin, l = et.getVerticalPos() + u), u += 30;
    const d = at.getMax(h / 2, Re.width / 2);
    et.insert(
      r - d,
      et.getVerticalPos() - 10 + u,
      n + d,
      et.getVerticalPos() + 30 + u
    );
  } else
    u += Re.boxMargin, l = et.getVerticalPos() + u, et.insert(r, l - 10, n, l);
  return et.bumpVerticalPos(u), e.height += u, e.stopy = e.starty + e.height, et.insert(e.fromBounds, e.starty, e.toBounds, e.stopy), l;
}
x(gq, "boundMessage");
var oAe = /* @__PURE__ */ x(async function(t, e, r, n) {
  const { startx: i, stopx: a, starty: s, message: o, type: l, sequenceIndex: u, sequenceVisible: h } = e, d = Kt.calculateTextDimensions(o, Cu(Re)), f = gS();
  f.x = i, f.y = s + 10, f.width = a - i, f.class = "messageText", f.dy = "1em", f.text = o, f.fontFamily = Re.messageFontFamily, f.fontSize = Re.messageFontSize, f.fontWeight = Re.messageFontWeight, f.anchor = Re.messageAlign, f.valign = "center", f.textMargin = Re.wrapPadding, f.tspan = !1, un(f.text) ? await A2(t, f, { startx: i, stopx: a, starty: r }) : mf(t, f);
  const p = d.width;
  let g;
  i === a ? Re.rightAngles ? g = t.append("path").attr(
    "d",
    `M  ${i},${r} H ${i + at.getMax(Re.width / 2, p / 2)} V ${r + 25} H ${i}`
  ) : g = t.append("path").attr(
    "d",
    "M " + i + "," + r + " C " + (i + 60) + "," + (r - 10) + " " + (i + 60) + "," + (r + 30) + " " + i + "," + (r + 20)
  ) : (g = t.append("line"), g.attr("x1", i), g.attr("y1", r), g.attr("x2", a), g.attr("y2", r)), l === n.db.LINETYPE.DOTTED || l === n.db.LINETYPE.DOTTED_CROSS || l === n.db.LINETYPE.DOTTED_POINT || l === n.db.LINETYPE.DOTTED_OPEN || l === n.db.LINETYPE.BIDIRECTIONAL_DOTTED ? (g.style("stroke-dasharray", "3, 3"), g.attr("class", "messageLine1")) : g.attr("class", "messageLine0");
  let m = "";
  Re.arrowMarkerAbsolute && (m = z2(!0)), g.attr("stroke-width", 2), g.attr("stroke", "none"), g.style("fill", "none"), (l === n.db.LINETYPE.SOLID || l === n.db.LINETYPE.DOTTED) && g.attr("marker-end", "url(" + m + "#arrowhead)"), (l === n.db.LINETYPE.BIDIRECTIONAL_SOLID || l === n.db.LINETYPE.BIDIRECTIONAL_DOTTED) && (g.attr("marker-start", "url(" + m + "#arrowhead)"), g.attr("marker-end", "url(" + m + "#arrowhead)")), (l === n.db.LINETYPE.SOLID_POINT || l === n.db.LINETYPE.DOTTED_POINT) && g.attr("marker-end", "url(" + m + "#filled-head)"), (l === n.db.LINETYPE.SOLID_CROSS || l === n.db.LINETYPE.DOTTED_CROSS) && g.attr("marker-end", "url(" + m + "#crosshead)"), (h || Re.showSequenceNumbers) && ((l === n.db.LINETYPE.BIDIRECTIONAL_SOLID || l === n.db.LINETYPE.BIDIRECTIONAL_DOTTED) && (i < a ? g.attr("x1", i + 2 * 6) : g.attr("x1", i + 6)), t.append("line").attr("x1", i).attr("y1", r).attr("x2", i).attr("y2", r).attr("stroke-width", 0).attr("marker-start", "url(" + m + "#sequencenumber)"), t.append("text").attr("x", i).attr("y", r + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(u));
}, "drawMessage"), lAe = /* @__PURE__ */ x(function(t, e, r, n, i, a, s) {
  let o = 0, l = 0, u, h = 0;
  for (const d of n) {
    const f = e.get(d), p = f.box;
    u && u != p && (s || et.models.addBox(u), l += Re.boxMargin + u.margin), p && p != u && (s || (p.x = o + l, p.y = i), l += p.margin), f.width = f.width || Re.width, f.height = at.getMax(f.height || Re.height, Re.height), f.margin = f.margin || Re.actorMargin, h = at.getMax(h, f.height), r.get(f.name) && (l += f.width / 2), f.x = o + l, f.starty = et.getVerticalPos(), et.insert(f.x, i, f.x + f.width, f.height), o += f.width + l, f.box && (f.box.width = o + p.margin - f.box.x), l = f.margin, u = f.box, et.models.addActor(f);
  }
  u && !s && et.models.addBox(u), et.bumpVerticalPos(h);
}, "addActorRenderingData"), R6 = /* @__PURE__ */ x(async function(t, e, r, n) {
  if (n) {
    let i = 0;
    et.bumpVerticalPos(Re.boxMargin * 2);
    for (const a of r) {
      const s = e.get(a);
      s.stopy || (s.stopy = et.getVerticalPos());
      const o = await fn.drawActor(t, s, Re, !0);
      i = at.getMax(i, o);
    }
    et.bumpVerticalPos(i + Re.boxMargin);
  } else
    for (const i of r) {
      const a = e.get(i);
      await fn.drawActor(t, a, Re, !1);
    }
}, "drawActors"), mq = /* @__PURE__ */ x(function(t, e, r, n) {
  let i = 0, a = 0;
  for (const s of r) {
    const o = e.get(s), l = uAe(o), u = fn.drawPopup(
      t,
      o,
      l,
      Re,
      Re.forceMenus,
      n
    );
    u.height > i && (i = u.height), u.width + o.x > a && (a = u.width + o.x);
  }
  return { maxHeight: i, maxWidth: a };
}, "drawActorsPopup"), vq = /* @__PURE__ */ x(function(t) {
  mn(Re, t), t.fontFamily && (Re.actorFontFamily = Re.noteFontFamily = Re.messageFontFamily = t.fontFamily), t.fontSize && (Re.actorFontSize = Re.noteFontSize = Re.messageFontSize = t.fontSize), t.fontWeight && (Re.actorFontWeight = Re.noteFontWeight = Re.messageFontWeight = t.fontWeight);
}, "setConf"), mb = /* @__PURE__ */ x(function(t) {
  return et.activations.filter(function(e) {
    return e.actor === t;
  });
}, "actorActivations"), xN = /* @__PURE__ */ x(function(t, e) {
  const r = e.get(t), n = mb(t), i = n.reduce(
    function(s, o) {
      return at.getMin(s, o.startx);
    },
    r.x + r.width / 2 - 1
  ), a = n.reduce(
    function(s, o) {
      return at.getMax(s, o.stopx);
    },
    r.x + r.width / 2 + 1
  );
  return [i, a];
}, "activationBounds");
function as(t, e, r, n, i) {
  et.bumpVerticalPos(r);
  let a = n;
  if (e.id && e.message && t[e.id]) {
    const s = t[e.id].width, o = Cu(Re);
    e.message = Kt.wrapLabel(`[${e.message}]`, s - 2 * Re.wrapPadding, o), e.width = s, e.wrap = !0;
    const l = Kt.calculateTextDimensions(e.message, o), u = at.getMax(l.height, Re.labelBoxHeight);
    a = n + u, ae.debug(`${u} - ${e.message}`);
  }
  i(e), et.bumpVerticalPos(a);
}
x(as, "adjustLoopHeightForWrap");
function yq(t, e, r, n, i, a, s) {
  function o(h, d) {
    h.x < i.get(t.from).x ? (et.insert(
      e.stopx - d,
      e.starty,
      e.startx,
      e.stopy + h.height / 2 + Re.noteMargin
    ), e.stopx = e.stopx + d) : (et.insert(
      e.startx,
      e.starty,
      e.stopx + d,
      e.stopy + h.height / 2 + Re.noteMargin
    ), e.stopx = e.stopx - d);
  }
  x(o, "receiverAdjustment");
  function l(h, d) {
    h.x < i.get(t.to).x ? (et.insert(
      e.startx - d,
      e.starty,
      e.stopx,
      e.stopy + h.height / 2 + Re.noteMargin
    ), e.startx = e.startx + d) : (et.insert(
      e.stopx,
      e.starty,
      e.startx + d,
      e.stopy + h.height / 2 + Re.noteMargin
    ), e.startx = e.startx - d);
  }
  x(l, "senderAdjustment");
  const u = [
    Rm.ACTOR,
    Rm.CONTROL,
    Rm.ENTITY,
    Rm.DATABASE
  ];
  if (a.get(t.to) == n) {
    const h = i.get(t.to), d = u.includes(h.type) ? Kc / 2 + 3 : h.width / 2 + 3;
    o(h, d), h.starty = r - h.height / 2, et.bumpVerticalPos(h.height / 2);
  } else if (s.get(t.from) == n) {
    const h = i.get(t.from);
    if (Re.mirrorActors) {
      const d = u.includes(h.type) ? Kc / 2 : h.width / 2;
      l(h, d);
    }
    h.stopy = r - h.height / 2, et.bumpVerticalPos(h.height / 2);
  } else if (s.get(t.to) == n) {
    const h = i.get(t.to);
    if (Re.mirrorActors) {
      const d = u.includes(h.type) ? Kc / 2 + 3 : h.width / 2 + 3;
      o(h, d);
    }
    h.stopy = r - h.height / 2, et.bumpVerticalPos(h.height / 2);
  }
}
x(yq, "adjustCreatedDestroyedData");
var cAe = /* @__PURE__ */ x(async function(t, e, r, n) {
  const { securityLevel: i, sequence: a } = we();
  Re = a;
  let s;
  i === "sandbox" && (s = Qe("#i" + e));
  const o = Qe(i === "sandbox" ? s.nodes()[0].contentDocument.body : "body"), l = i === "sandbox" ? s.nodes()[0].contentDocument : document;
  et.init(), ae.debug(n.db);
  const u = i === "sandbox" ? o.select(`[id="${e}"]`) : Qe(`[id="${e}"]`), h = n.db.getActors(), d = n.db.getCreatedActors(), f = n.db.getDestroyedActors(), p = n.db.getBoxes();
  let g = n.db.getActorKeys();
  const m = n.db.getMessages(), v = n.db.getDiagramTitle(), y = n.db.hasAtLeastOneBox(), b = n.db.hasAtLeastOneBoxWithTitle(), w = await xq(h, m, n);
  if (Re.height = await bq(h, w, p), fn.insertComputerIcon(u), fn.insertDatabaseIcon(u), fn.insertClockIcon(u), y && (et.bumpVerticalPos(Re.boxMargin), b && et.bumpVerticalPos(p[0].textMaxHeight)), Re.hideUnusedParticipants === !0) {
    const M = /* @__PURE__ */ new Set();
    m.forEach((B) => {
      M.add(B.from), M.add(B.to);
    }), g = g.filter((B) => M.has(B));
  }
  lAe(u, h, d, g, 0, m, !1);
  const T = await fAe(m, h, w, n);
  fn.insertArrowHead(u), fn.insertArrowCrossHead(u), fn.insertArrowFilledHead(u), fn.insertSequenceNumber(u);
  function E(M, B) {
    const $ = et.endActivation(M);
    $.starty + 18 > B && ($.starty = B - 6, B += 12), fn.drawActivation(
      u,
      $,
      B,
      Re,
      mb(M.from).length
    ), et.insert($.startx, B - 10, $.stopx, B);
  }
  x(E, "activeEnd");
  let C = 1, k = 1;
  const _ = [], L = [];
  let N = 0;
  for (const M of m) {
    let B, $, F;
    switch (M.type) {
      case n.db.LINETYPE.NOTE:
        et.resetVerticalPos(), $ = M.noteModel, await sAe(u, $);
        break;
      case n.db.LINETYPE.ACTIVE_START:
        et.newActivation(M, u, h);
        break;
      case n.db.LINETYPE.ACTIVE_END:
        E(M, et.getVerticalPos());
        break;
      case n.db.LINETYPE.LOOP_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin + Re.boxTextMargin,
          (G) => et.newLoop(G)
        );
        break;
      case n.db.LINETYPE.LOOP_END:
        B = et.endLoop(), await fn.drawLoop(u, B, "loop", Re), et.bumpVerticalPos(B.stopy - et.getVerticalPos()), et.models.addLoop(B);
        break;
      case n.db.LINETYPE.RECT_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin,
          (G) => et.newLoop(void 0, G.message)
        );
        break;
      case n.db.LINETYPE.RECT_END:
        B = et.endLoop(), L.push(B), et.models.addLoop(B), et.bumpVerticalPos(B.stopy - et.getVerticalPos());
        break;
      case n.db.LINETYPE.OPT_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin + Re.boxTextMargin,
          (G) => et.newLoop(G)
        );
        break;
      case n.db.LINETYPE.OPT_END:
        B = et.endLoop(), await fn.drawLoop(u, B, "opt", Re), et.bumpVerticalPos(B.stopy - et.getVerticalPos()), et.models.addLoop(B);
        break;
      case n.db.LINETYPE.ALT_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin + Re.boxTextMargin,
          (G) => et.newLoop(G)
        );
        break;
      case n.db.LINETYPE.ALT_ELSE:
        as(
          T,
          M,
          Re.boxMargin + Re.boxTextMargin,
          Re.boxMargin,
          (G) => et.addSectionToLoop(G)
        );
        break;
      case n.db.LINETYPE.ALT_END:
        B = et.endLoop(), await fn.drawLoop(u, B, "alt", Re), et.bumpVerticalPos(B.stopy - et.getVerticalPos()), et.models.addLoop(B);
        break;
      case n.db.LINETYPE.PAR_START:
      case n.db.LINETYPE.PAR_OVER_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin + Re.boxTextMargin,
          (G) => et.newLoop(G)
        ), et.saveVerticalPos();
        break;
      case n.db.LINETYPE.PAR_AND:
        as(
          T,
          M,
          Re.boxMargin + Re.boxTextMargin,
          Re.boxMargin,
          (G) => et.addSectionToLoop(G)
        );
        break;
      case n.db.LINETYPE.PAR_END:
        B = et.endLoop(), await fn.drawLoop(u, B, "par", Re), et.bumpVerticalPos(B.stopy - et.getVerticalPos()), et.models.addLoop(B);
        break;
      case n.db.LINETYPE.AUTONUMBER:
        C = M.message.start || C, k = M.message.step || k, M.message.visible ? n.db.enableSequenceNumbers() : n.db.disableSequenceNumbers();
        break;
      case n.db.LINETYPE.CRITICAL_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin + Re.boxTextMargin,
          (G) => et.newLoop(G)
        );
        break;
      case n.db.LINETYPE.CRITICAL_OPTION:
        as(
          T,
          M,
          Re.boxMargin + Re.boxTextMargin,
          Re.boxMargin,
          (G) => et.addSectionToLoop(G)
        );
        break;
      case n.db.LINETYPE.CRITICAL_END:
        B = et.endLoop(), await fn.drawLoop(u, B, "critical", Re), et.bumpVerticalPos(B.stopy - et.getVerticalPos()), et.models.addLoop(B);
        break;
      case n.db.LINETYPE.BREAK_START:
        as(
          T,
          M,
          Re.boxMargin,
          Re.boxMargin + Re.boxTextMargin,
          (G) => et.newLoop(G)
        );
        break;
      case n.db.LINETYPE.BREAK_END:
        B = et.endLoop(), await fn.drawLoop(u, B, "break", Re), et.bumpVerticalPos(B.stopy - et.getVerticalPos()), et.models.addLoop(B);
        break;
      default:
        try {
          F = M.msgModel, F.starty = et.getVerticalPos(), F.sequenceIndex = C, F.sequenceVisible = n.db.showSequenceNumbers();
          const G = await gq(u, F);
          yq(
            M,
            F,
            G,
            N,
            h,
            d,
            f
          ), _.push({ messageModel: F, lineStartY: G }), et.models.addMessage(F);
        } catch (G) {
          ae.error("error while drawing message", G);
        }
    }
    [
      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,
      n.db.LINETYPE.BIDIRECTIONAL_SOLID,
      n.db.LINETYPE.BIDIRECTIONAL_DOTTED
    ].includes(M.type) && (C = C + k), N++;
  }
  ae.debug("createdActors", d), ae.debug("destroyedActors", f), await R6(u, h, g, !1);
  for (const M of _)
    await oAe(u, M.messageModel, M.lineStartY, n);
  Re.mirrorActors && await R6(u, h, g, !0), L.forEach((M) => fn.drawBackgroundRect(u, M)), dq(u, h, g, Re);
  for (const M of et.models.boxes) {
    M.height = et.getVerticalPos() - M.y, et.insert(M.x, M.y, M.x + M.width, M.height);
    const B = Re.boxMargin * 2;
    M.startx = M.x - B, M.starty = M.y - B * 0.25, M.stopx = M.startx + M.width + 2 * B, M.stopy = M.starty + M.height + B * 0.75, M.stroke = "rgb(0,0,0, 0.5)", fn.drawBox(u, M, Re);
  }
  y && et.bumpVerticalPos(Re.boxMargin);
  const A = mq(u, h, g, l), { bounds: O } = et.getBounds();
  O.startx === void 0 && (O.startx = 0), O.starty === void 0 && (O.starty = 0), O.stopx === void 0 && (O.stopx = 0), O.stopy === void 0 && (O.stopy = 0);
  let P = O.stopy - O.starty;
  P < A.maxHeight && (P = A.maxHeight);
  let S = P + 2 * Re.diagramMarginY;
  Re.mirrorActors && (S = S - Re.boxMargin + Re.bottomMarginAdj);
  let R = O.stopx - O.startx;
  R < A.maxWidth && (R = A.maxWidth);
  const I = R + 2 * Re.diagramMarginX;
  v && u.append("text").text(v).attr("x", (O.stopx - O.startx) / 2 - 2 * Re.diagramMarginX).attr("y", -25), Ki(u, S, I, Re.useMaxWidth);
  const D = v ? 40 : 0;
  u.attr(
    "viewBox",
    O.startx - Re.diagramMarginX + " -" + (Re.diagramMarginY + D) + " " + I + " " + (S + D)
  ), ae.debug("models:", et.models);
}, "draw");
async function xq(t, e, r) {
  const n = {};
  for (const i of e)
    if (t.get(i.to) && t.get(i.from)) {
      const a = t.get(i.to);
      if (i.placement === r.db.PLACEMENT.LEFTOF && !a.prevActor || i.placement === r.db.PLACEMENT.RIGHTOF && !a.nextActor)
        continue;
      const s = i.placement !== void 0, o = !s, l = s ? gh(Re) : Cu(Re), u = i.wrap ? Kt.wrapLabel(i.message, Re.width - 2 * Re.wrapPadding, l) : i.message, d = (un(u) ? await Ag(i.message, we()) : Kt.calculateTextDimensions(u, l)).width + 2 * Re.wrapPadding;
      o && i.from === a.nextActor ? n[i.to] = at.getMax(
        n[i.to] || 0,
        d
      ) : o && i.from === a.prevActor ? n[i.from] = at.getMax(
        n[i.from] || 0,
        d
      ) : o && i.from === i.to ? (n[i.from] = at.getMax(
        n[i.from] || 0,
        d / 2
      ), n[i.to] = at.getMax(
        n[i.to] || 0,
        d / 2
      )) : i.placement === r.db.PLACEMENT.RIGHTOF ? n[i.from] = at.getMax(
        n[i.from] || 0,
        d
      ) : i.placement === r.db.PLACEMENT.LEFTOF ? n[a.prevActor] = at.getMax(
        n[a.prevActor] || 0,
        d
      ) : i.placement === r.db.PLACEMENT.OVER && (a.prevActor && (n[a.prevActor] = at.getMax(
        n[a.prevActor] || 0,
        d / 2
      )), a.nextActor && (n[i.from] = at.getMax(
        n[i.from] || 0,
        d / 2
      )));
    }
  return ae.debug("maxMessageWidthPerActor:", n), n;
}
x(xq, "getMaxMessageWidthPerActor");
var uAe = /* @__PURE__ */ x(function(t) {
  let e = 0;
  const r = L6(Re);
  for (const n in t.links) {
    const a = Kt.calculateTextDimensions(n, r).width + 2 * Re.wrapPadding + 2 * Re.boxMargin;
    e < a && (e = a);
  }
  return e;
}, "getRequiredPopupWidth");
async function bq(t, e, r) {
  let n = 0;
  for (const a of t.keys()) {
    const s = t.get(a);
    s.wrap && (s.description = Kt.wrapLabel(
      s.description,
      Re.width - 2 * Re.wrapPadding,
      L6(Re)
    ));
    const o = un(s.description) ? await Ag(s.description, we()) : Kt.calculateTextDimensions(s.description, L6(Re));
    s.width = s.wrap ? Re.width : at.getMax(Re.width, o.width + 2 * Re.wrapPadding), s.height = s.wrap ? at.getMax(o.height, Re.height) : Re.height, n = at.getMax(n, s.height);
  }
  for (const a in e) {
    const s = t.get(a);
    if (!s)
      continue;
    const o = t.get(s.nextActor);
    if (!o) {
      const d = e[a] + Re.actorMargin - s.width / 2;
      s.margin = at.getMax(d, Re.actorMargin);
      continue;
    }
    const u = e[a] + Re.actorMargin - s.width / 2 - o.width / 2;
    s.margin = at.getMax(u, Re.actorMargin);
  }
  let i = 0;
  return r.forEach((a) => {
    const s = Cu(Re);
    let o = a.actorKeys.reduce((d, f) => d += t.get(f).width + (t.get(f).margin || 0), 0);
    const l = Re.boxMargin * 8;
    o += l, o -= 2 * Re.boxTextMargin, a.wrap && (a.name = Kt.wrapLabel(a.name, o - 2 * Re.wrapPadding, s));
    const u = Kt.calculateTextDimensions(a.name, s);
    i = at.getMax(u.height, i);
    const h = at.getMax(o, u.width + 2 * Re.wrapPadding);
    if (a.margin = Re.boxTextMargin, o < h) {
      const d = (h - o) / 2;
      a.margin += d;
    }
  }), r.forEach((a) => a.textMaxHeight = i), at.getMax(n, Re.height);
}
x(bq, "calculateActorMargins");
var hAe = /* @__PURE__ */ x(async function(t, e, r) {
  const n = e.get(t.from), i = e.get(t.to), a = n.x, s = i.x, o = t.wrap && t.message;
  let l = un(t.message) ? await Ag(t.message, we()) : Kt.calculateTextDimensions(
    o ? Kt.wrapLabel(t.message, Re.width, gh(Re)) : t.message,
    gh(Re)
  );
  const u = {
    width: o ? Re.width : at.getMax(Re.width, l.width + 2 * Re.noteMargin),
    height: 0,
    startx: n.x,
    stopx: 0,
    starty: 0,
    stopy: 0,
    message: t.message
  };
  return t.placement === r.db.PLACEMENT.RIGHTOF ? (u.width = o ? at.getMax(Re.width, l.width) : at.getMax(
    n.width / 2 + i.width / 2,
    l.width + 2 * Re.noteMargin
  ), u.startx = a + (n.width + Re.actorMargin) / 2) : t.placement === r.db.PLACEMENT.LEFTOF ? (u.width = o ? at.getMax(Re.width, l.width + 2 * Re.noteMargin) : at.getMax(
    n.width / 2 + i.width / 2,
    l.width + 2 * Re.noteMargin
  ), u.startx = a - u.width + (n.width - Re.actorMargin) / 2) : t.to === t.from ? (l = Kt.calculateTextDimensions(
    o ? Kt.wrapLabel(t.message, at.getMax(Re.width, n.width), gh(Re)) : t.message,
    gh(Re)
  ), u.width = o ? at.getMax(Re.width, n.width) : at.getMax(n.width, Re.width, l.width + 2 * Re.noteMargin), u.startx = a + (n.width - u.width) / 2) : (u.width = Math.abs(a + n.width / 2 - (s + i.width / 2)) + Re.actorMargin, u.startx = a < s ? a + n.width / 2 - Re.actorMargin / 2 : s + i.width / 2 - Re.actorMargin / 2), o && (u.message = Kt.wrapLabel(
    t.message,
    u.width - 2 * Re.wrapPadding,
    gh(Re)
  )), ae.debug(
    `NM:[${u.startx},${u.stopx},${u.starty},${u.stopy}:${u.width},${u.height}=${t.message}]`
  ), u;
}, "buildNoteModel"), dAe = /* @__PURE__ */ x(function(t, e, r) {
  if (![
    r.db.LINETYPE.SOLID_OPEN,
    r.db.LINETYPE.DOTTED_OPEN,
    r.db.LINETYPE.SOLID,
    r.db.LINETYPE.DOTTED,
    r.db.LINETYPE.SOLID_CROSS,
    r.db.LINETYPE.DOTTED_CROSS,
    r.db.LINETYPE.SOLID_POINT,
    r.db.LINETYPE.DOTTED_POINT,
    r.db.LINETYPE.BIDIRECTIONAL_SOLID,
    r.db.LINETYPE.BIDIRECTIONAL_DOTTED
  ].includes(t.type))
    return {};
  const [n, i] = xN(t.from, e), [a, s] = xN(t.to, e), o = n <= a;
  let l = o ? i : n, u = o ? a : s;
  const h = Math.abs(a - s) > 2, d = /* @__PURE__ */ x((m) => o ? -m : m, "adjustValue");
  t.from === t.to ? u = l : (t.activate && !h && (u += d(Re.activationWidth / 2 - 1)), [r.db.LINETYPE.SOLID_OPEN, r.db.LINETYPE.DOTTED_OPEN].includes(t.type) || (u += d(3)), [r.db.LINETYPE.BIDIRECTIONAL_SOLID, r.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(
    t.type
  ) && (l -= d(3)));
  const f = [n, i, a, s], p = Math.abs(l - u);
  t.wrap && t.message && (t.message = Kt.wrapLabel(
    t.message,
    at.getMax(p + 2 * Re.wrapPadding, Re.width),
    Cu(Re)
  ));
  const g = Kt.calculateTextDimensions(t.message, Cu(Re));
  return {
    width: at.getMax(
      t.wrap ? 0 : g.width + 2 * Re.wrapPadding,
      p + 2 * Re.wrapPadding,
      Re.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, f),
    toBounds: Math.max.apply(null, f)
  };
}, "buildMessageModel"), fAe = /* @__PURE__ */ x(async function(t, e, r, n) {
  const i = {}, a = [];
  let s, o, l;
  for (const u of t) {
    switch (u.type) {
      case n.db.LINETYPE.LOOP_START:
      case n.db.LINETYPE.ALT_START:
      case n.db.LINETYPE.OPT_START:
      case n.db.LINETYPE.PAR_START:
      case n.db.LINETYPE.PAR_OVER_START:
      case n.db.LINETYPE.CRITICAL_START:
      case n.db.LINETYPE.BREAK_START:
        a.push({
          id: u.id,
          msg: u.message,
          from: Number.MAX_SAFE_INTEGER,
          to: Number.MIN_SAFE_INTEGER,
          width: 0
        });
        break;
      case n.db.LINETYPE.ALT_ELSE:
      case n.db.LINETYPE.PAR_AND:
      case n.db.LINETYPE.CRITICAL_OPTION:
        u.message && (s = a.pop(), i[s.id] = s, i[u.id] = s, a.push(s));
        break;
      case n.db.LINETYPE.LOOP_END:
      case n.db.LINETYPE.ALT_END:
      case n.db.LINETYPE.OPT_END:
      case n.db.LINETYPE.PAR_END:
      case n.db.LINETYPE.CRITICAL_END:
      case n.db.LINETYPE.BREAK_END:
        s = a.pop(), i[s.id] = s;
        break;
      case n.db.LINETYPE.ACTIVE_START:
        {
          const d = e.get(u.from ? u.from : u.to.actor), f = mb(u.from ? u.from : u.to.actor).length, p = d.x + d.width / 2 + (f - 1) * Re.activationWidth / 2, g = {
            startx: p,
            stopx: p + Re.activationWidth,
            actor: u.from,
            enabled: !0
          };
          et.activations.push(g);
        }
        break;
      case n.db.LINETYPE.ACTIVE_END:
        {
          const d = et.activations.map((f) => f.actor).lastIndexOf(u.from);
          et.activations.splice(d, 1).splice(0, 1);
        }
        break;
    }
    u.placement !== void 0 ? (o = await hAe(u, e, n), u.noteModel = o, a.forEach((d) => {
      s = d, s.from = at.getMin(s.from, o.startx), s.to = at.getMax(s.to, o.startx + o.width), s.width = at.getMax(s.width, Math.abs(s.from - s.to)) - Re.labelBoxWidth;
    })) : (l = dAe(u, e, n), u.msgModel = l, l.startx && l.stopx && a.length > 0 && a.forEach((d) => {
      if (s = d, l.startx === l.stopx) {
        const f = e.get(u.from), p = e.get(u.to);
        s.from = at.getMin(
          f.x - l.width / 2,
          f.x - f.width / 2,
          s.from
        ), s.to = at.getMax(
          p.x + l.width / 2,
          p.x + f.width / 2,
          s.to
        ), s.width = at.getMax(s.width, Math.abs(s.to - s.from)) - Re.labelBoxWidth;
      } else
        s.from = at.getMin(l.startx, s.from), s.to = at.getMax(l.stopx, s.to), s.width = at.getMax(s.width, l.width) - Re.labelBoxWidth;
    }));
  }
  return et.activations = [], ae.debug("Loop type widths:", i), i;
}, "calculateLoopBounds"), pAe = {
  bounds: et,
  drawActors: R6,
  drawActorsPopup: mq,
  setConf: vq,
  draw: cAe
}, gAe = {
  parser: R8e,
  get db() {
    return new I8e();
  },
  renderer: pAe,
  styles: P8e,
  init: /* @__PURE__ */ x((t) => {
    t.sequence || (t.sequence = {}), t.wrap && (t.sequence.wrap = t.wrap, K5({ sequence: { wrap: t.wrap } }));
  }, "init")
};
const mAe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: gAe
}, Symbol.toStringTag, { value: "Module" }));
var N6 = function() {
  var t = /* @__PURE__ */ x(function(Pe, Se, _e, ze) {
    for (_e = _e || {}, ze = Pe.length; ze--; _e[Pe[ze]] = Se) ;
    return _e;
  }, "o"), e = [1, 18], r = [1, 19], n = [1, 20], i = [1, 41], a = [1, 42], s = [1, 26], o = [1, 24], l = [1, 25], u = [1, 32], h = [1, 33], d = [1, 34], f = [1, 45], p = [1, 35], g = [1, 36], m = [1, 37], v = [1, 38], y = [1, 27], b = [1, 28], w = [1, 29], T = [1, 30], E = [1, 31], C = [1, 44], k = [1, 46], _ = [1, 43], L = [1, 47], N = [1, 9], A = [1, 8, 9], O = [1, 58], P = [1, 59], S = [1, 60], R = [1, 61], I = [1, 62], D = [1, 63], M = [1, 64], B = [1, 8, 9, 41], $ = [1, 76], F = [1, 8, 9, 12, 13, 22, 39, 41, 44, 68, 69, 70, 71, 72, 73, 74, 79, 81], G = [1, 8, 9, 12, 13, 18, 20, 22, 39, 41, 44, 50, 60, 68, 69, 70, 71, 72, 73, 74, 79, 81, 86, 100, 102, 103], H = [13, 60, 86, 100, 102, 103], ee = [13, 60, 73, 74, 86, 100, 102, 103], Y = [13, 60, 68, 69, 70, 71, 72, 86, 100, 102, 103], re = [1, 100], ne = [1, 117], he = [1, 113], K = [1, 109], Z = [1, 115], X = [1, 110], q = [1, 111], J = [1, 112], j = [1, 114], pe = [1, 116], te = [22, 48, 60, 61, 82, 86, 87, 88, 89, 90], Ae = [1, 8, 9, 39, 41, 44], W = [1, 8, 9, 22], Oe = [1, 145], ue = [1, 8, 9, 61], Ve = [1, 8, 9, 22, 48, 60, 61, 82, 86, 87, 88, 89, 90], Ge = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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, classLiteralName: 17, DOT: 18, className: 19, GENERICTYPE: 20, relationStatement: 21, LABEL: 22, namespaceStatement: 23, classStatement: 24, memberStatement: 25, annotationStatement: 26, clickStatement: 27, styleStatement: 28, cssClassStatement: 29, noteStatement: 30, classDefStatement: 31, direction: 32, acc_title: 33, acc_title_value: 34, acc_descr: 35, acc_descr_value: 36, acc_descr_multiline_value: 37, namespaceIdentifier: 38, STRUCT_START: 39, classStatements: 40, STRUCT_STOP: 41, NAMESPACE: 42, classIdentifier: 43, STYLE_SEPARATOR: 44, members: 45, CLASS: 46, emptyBody: 47, SPACE: 48, ANNOTATION_START: 49, ANNOTATION_END: 50, MEMBER: 51, SEPARATOR: 52, relation: 53, NOTE_FOR: 54, noteText: 55, NOTE: 56, CLASSDEF: 57, classList: 58, stylesOpt: 59, ALPHA: 60, COMMA: 61, direction_tb: 62, direction_bt: 63, direction_rl: 64, direction_lr: 65, relationType: 66, lineType: 67, AGGREGATION: 68, EXTENSION: 69, COMPOSITION: 70, DEPENDENCY: 71, LOLLIPOP: 72, LINE: 73, DOTTED_LINE: 74, CALLBACK: 75, LINK: 76, LINK_TARGET: 77, CLICK: 78, CALLBACK_NAME: 79, CALLBACK_ARGS: 80, HREF: 81, STYLE: 82, CSSCLASS: 83, style: 84, styleComponent: 85, NUM: 86, COLON: 87, UNIT: 88, BRKT: 89, PCT: 90, commentToken: 91, textToken: 92, graphCodeTokens: 93, textNoTagsToken: 94, TAGSTART: 95, TAGEND: 96, "==": 97, "--": 98, DEFAULT: 99, MINUS: 100, keywords: 101, UNICODE_TEXT: 102, BQUOTE_STR: 103, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 7: "CLASS_DIAGRAM", 8: "NEWLINE", 9: "EOF", 12: "SQS", 13: "STR", 14: "SQE", 18: "DOT", 20: "GENERICTYPE", 22: "LABEL", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 39: "STRUCT_START", 41: "STRUCT_STOP", 42: "NAMESPACE", 44: "STYLE_SEPARATOR", 46: "CLASS", 48: "SPACE", 49: "ANNOTATION_START", 50: "ANNOTATION_END", 51: "MEMBER", 52: "SEPARATOR", 54: "NOTE_FOR", 56: "NOTE", 57: "CLASSDEF", 60: "ALPHA", 61: "COMMA", 62: "direction_tb", 63: "direction_bt", 64: "direction_rl", 65: "direction_lr", 68: "AGGREGATION", 69: "EXTENSION", 70: "COMPOSITION", 71: "DEPENDENCY", 72: "LOLLIPOP", 73: "LINE", 74: "DOTTED_LINE", 75: "CALLBACK", 76: "LINK", 77: "LINK_TARGET", 78: "CLICK", 79: "CALLBACK_NAME", 80: "CALLBACK_ARGS", 81: "HREF", 82: "STYLE", 83: "CSSCLASS", 86: "NUM", 87: "COLON", 88: "UNIT", 89: "BRKT", 90: "PCT", 93: "graphCodeTokens", 95: "TAGSTART", 96: "TAGEND", 97: "==", 98: "--", 99: "DEFAULT", 100: "MINUS", 101: "keywords", 102: "UNICODE_TEXT", 103: "BQUOTE_STR" },
    productions_: [0, [3, 1], [3, 1], [4, 1], [6, 4], [5, 1], [5, 2], [5, 3], [11, 3], [15, 1], [15, 1], [15, 3], [15, 2], [19, 1], [19, 3], [19, 1], [19, 2], [19, 2], [19, 2], [10, 1], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [10, 1], [23, 4], [23, 5], [38, 2], [40, 1], [40, 2], [40, 3], [24, 1], [24, 3], [24, 4], [24, 3], [24, 6], [43, 2], [43, 3], [47, 0], [47, 2], [47, 2], [26, 4], [45, 1], [45, 2], [25, 1], [25, 2], [25, 1], [25, 1], [21, 3], [21, 4], [21, 4], [21, 5], [30, 3], [30, 2], [31, 3], [58, 1], [58, 3], [32, 1], [32, 1], [32, 1], [32, 1], [53, 3], [53, 2], [53, 2], [53, 1], [66, 1], [66, 1], [66, 1], [66, 1], [66, 1], [67, 1], [67, 1], [27, 3], [27, 4], [27, 3], [27, 4], [27, 4], [27, 5], [27, 3], [27, 4], [27, 4], [27, 5], [27, 4], [27, 5], [27, 5], [27, 6], [28, 3], [29, 3], [59, 1], [59, 3], [84, 1], [84, 2], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [91, 1], [91, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [94, 1], [94, 1], [94, 1], [94, 1], [16, 1], [16, 1], [16, 1], [16, 1], [17, 1], [55, 1]],
    performAction: /* @__PURE__ */ x(function(Se, _e, ze, me, Me, Q, ce) {
      var z = Q.length - 1;
      switch (Me) {
        case 8:
          this.$ = Q[z - 1];
          break;
        case 9:
        case 10:
        case 13:
        case 15:
          this.$ = Q[z];
          break;
        case 11:
        case 14:
          this.$ = Q[z - 2] + "." + Q[z];
          break;
        case 12:
        case 16:
          this.$ = Q[z - 1] + Q[z];
          break;
        case 17:
        case 18:
          this.$ = Q[z - 1] + "~" + Q[z] + "~";
          break;
        case 19:
          me.addRelation(Q[z]);
          break;
        case 20:
          Q[z - 1].title = me.cleanupLabel(Q[z]), me.addRelation(Q[z - 1]);
          break;
        case 31:
          this.$ = Q[z].trim(), me.setAccTitle(this.$);
          break;
        case 32:
        case 33:
          this.$ = Q[z].trim(), me.setAccDescription(this.$);
          break;
        case 34:
          me.addClassesToNamespace(Q[z - 3], Q[z - 1]);
          break;
        case 35:
          me.addClassesToNamespace(Q[z - 4], Q[z - 1]);
          break;
        case 36:
          this.$ = Q[z], me.addNamespace(Q[z]);
          break;
        case 37:
          this.$ = [Q[z]];
          break;
        case 38:
          this.$ = [Q[z - 1]];
          break;
        case 39:
          Q[z].unshift(Q[z - 2]), this.$ = Q[z];
          break;
        case 41:
          me.setCssClass(Q[z - 2], Q[z]);
          break;
        case 42:
          me.addMembers(Q[z - 3], Q[z - 1]);
          break;
        case 44:
          me.setCssClass(Q[z - 5], Q[z - 3]), me.addMembers(Q[z - 5], Q[z - 1]);
          break;
        case 45:
          this.$ = Q[z], me.addClass(Q[z]);
          break;
        case 46:
          this.$ = Q[z - 1], me.addClass(Q[z - 1]), me.setClassLabel(Q[z - 1], Q[z]);
          break;
        case 50:
          me.addAnnotation(Q[z], Q[z - 2]);
          break;
        case 51:
        case 64:
          this.$ = [Q[z]];
          break;
        case 52:
          Q[z].push(Q[z - 1]), this.$ = Q[z];
          break;
        case 53:
          break;
        case 54:
          me.addMember(Q[z - 1], me.cleanupLabel(Q[z]));
          break;
        case 55:
          break;
        case 56:
          break;
        case 57:
          this.$ = { id1: Q[z - 2], id2: Q[z], relation: Q[z - 1], relationTitle1: "none", relationTitle2: "none" };
          break;
        case 58:
          this.$ = { id1: Q[z - 3], id2: Q[z], relation: Q[z - 1], relationTitle1: Q[z - 2], relationTitle2: "none" };
          break;
        case 59:
          this.$ = { id1: Q[z - 3], id2: Q[z], relation: Q[z - 2], relationTitle1: "none", relationTitle2: Q[z - 1] };
          break;
        case 60:
          this.$ = { id1: Q[z - 4], id2: Q[z], relation: Q[z - 2], relationTitle1: Q[z - 3], relationTitle2: Q[z - 1] };
          break;
        case 61:
          me.addNote(Q[z], Q[z - 1]);
          break;
        case 62:
          me.addNote(Q[z]);
          break;
        case 63:
          this.$ = Q[z - 2], me.defineClass(Q[z - 1], Q[z]);
          break;
        case 65:
          this.$ = Q[z - 2].concat([Q[z]]);
          break;
        case 66:
          me.setDirection("TB");
          break;
        case 67:
          me.setDirection("BT");
          break;
        case 68:
          me.setDirection("RL");
          break;
        case 69:
          me.setDirection("LR");
          break;
        case 70:
          this.$ = { type1: Q[z - 2], type2: Q[z], lineType: Q[z - 1] };
          break;
        case 71:
          this.$ = { type1: "none", type2: Q[z], lineType: Q[z - 1] };
          break;
        case 72:
          this.$ = { type1: Q[z - 1], type2: "none", lineType: Q[z] };
          break;
        case 73:
          this.$ = { type1: "none", type2: "none", lineType: Q[z] };
          break;
        case 74:
          this.$ = me.relationType.AGGREGATION;
          break;
        case 75:
          this.$ = me.relationType.EXTENSION;
          break;
        case 76:
          this.$ = me.relationType.COMPOSITION;
          break;
        case 77:
          this.$ = me.relationType.DEPENDENCY;
          break;
        case 78:
          this.$ = me.relationType.LOLLIPOP;
          break;
        case 79:
          this.$ = me.lineType.LINE;
          break;
        case 80:
          this.$ = me.lineType.DOTTED_LINE;
          break;
        case 81:
        case 87:
          this.$ = Q[z - 2], me.setClickEvent(Q[z - 1], Q[z]);
          break;
        case 82:
        case 88:
          this.$ = Q[z - 3], me.setClickEvent(Q[z - 2], Q[z - 1]), me.setTooltip(Q[z - 2], Q[z]);
          break;
        case 83:
          this.$ = Q[z - 2], me.setLink(Q[z - 1], Q[z]);
          break;
        case 84:
          this.$ = Q[z - 3], me.setLink(Q[z - 2], Q[z - 1], Q[z]);
          break;
        case 85:
          this.$ = Q[z - 3], me.setLink(Q[z - 2], Q[z - 1]), me.setTooltip(Q[z - 2], Q[z]);
          break;
        case 86:
          this.$ = Q[z - 4], me.setLink(Q[z - 3], Q[z - 2], Q[z]), me.setTooltip(Q[z - 3], Q[z - 1]);
          break;
        case 89:
          this.$ = Q[z - 3], me.setClickEvent(Q[z - 2], Q[z - 1], Q[z]);
          break;
        case 90:
          this.$ = Q[z - 4], me.setClickEvent(Q[z - 3], Q[z - 2], Q[z - 1]), me.setTooltip(Q[z - 3], Q[z]);
          break;
        case 91:
          this.$ = Q[z - 3], me.setLink(Q[z - 2], Q[z]);
          break;
        case 92:
          this.$ = Q[z - 4], me.setLink(Q[z - 3], Q[z - 1], Q[z]);
          break;
        case 93:
          this.$ = Q[z - 4], me.setLink(Q[z - 3], Q[z - 1]), me.setTooltip(Q[z - 3], Q[z]);
          break;
        case 94:
          this.$ = Q[z - 5], me.setLink(Q[z - 4], Q[z - 2], Q[z]), me.setTooltip(Q[z - 4], Q[z - 1]);
          break;
        case 95:
          this.$ = Q[z - 2], me.setCssStyle(Q[z - 1], Q[z]);
          break;
        case 96:
          me.setCssClass(Q[z - 1], Q[z]);
          break;
        case 97:
          this.$ = [Q[z]];
          break;
        case 98:
          Q[z - 2].push(Q[z]), this.$ = Q[z - 2];
          break;
        case 100:
          this.$ = Q[z - 1] + Q[z];
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: [1, 6], 10: 5, 16: 39, 17: 40, 19: 21, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: e, 35: r, 37: n, 38: 22, 42: i, 43: 23, 46: a, 49: s, 51: o, 52: l, 54: u, 56: h, 57: d, 60: f, 62: p, 63: g, 64: m, 65: v, 75: y, 76: b, 78: w, 82: T, 83: E, 86: C, 100: k, 102: _, 103: L }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, t(N, [2, 5], { 8: [1, 48] }), { 8: [1, 49] }, t(A, [2, 19], { 22: [1, 50] }), t(A, [2, 21]), t(A, [2, 22]), t(A, [2, 23]), t(A, [2, 24]), t(A, [2, 25]), t(A, [2, 26]), t(A, [2, 27]), t(A, [2, 28]), t(A, [2, 29]), t(A, [2, 30]), { 34: [1, 51] }, { 36: [1, 52] }, t(A, [2, 33]), t(A, [2, 53], { 53: 53, 66: 56, 67: 57, 13: [1, 54], 22: [1, 55], 68: O, 69: P, 70: S, 71: R, 72: I, 73: D, 74: M }), { 39: [1, 65] }, t(B, [2, 40], { 39: [1, 67], 44: [1, 66] }), t(A, [2, 55]), t(A, [2, 56]), { 16: 68, 60: f, 86: C, 100: k, 102: _ }, { 16: 39, 17: 40, 19: 69, 60: f, 86: C, 100: k, 102: _, 103: L }, { 16: 39, 17: 40, 19: 70, 60: f, 86: C, 100: k, 102: _, 103: L }, { 16: 39, 17: 40, 19: 71, 60: f, 86: C, 100: k, 102: _, 103: L }, { 60: [1, 72] }, { 13: [1, 73] }, { 16: 39, 17: 40, 19: 74, 60: f, 86: C, 100: k, 102: _, 103: L }, { 13: $, 55: 75 }, { 58: 77, 60: [1, 78] }, t(A, [2, 66]), t(A, [2, 67]), t(A, [2, 68]), t(A, [2, 69]), t(F, [2, 13], { 16: 39, 17: 40, 19: 80, 18: [1, 79], 20: [1, 81], 60: f, 86: C, 100: k, 102: _, 103: L }), t(F, [2, 15], { 20: [1, 82] }), { 15: 83, 16: 84, 17: 85, 60: f, 86: C, 100: k, 102: _, 103: L }, { 16: 39, 17: 40, 19: 86, 60: f, 86: C, 100: k, 102: _, 103: L }, t(G, [2, 123]), t(G, [2, 124]), t(G, [2, 125]), t(G, [2, 126]), t([1, 8, 9, 12, 13, 20, 22, 39, 41, 44, 68, 69, 70, 71, 72, 73, 74, 79, 81], [2, 127]), t(N, [2, 6], { 10: 5, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 19: 21, 38: 22, 43: 23, 16: 39, 17: 40, 5: 87, 33: e, 35: r, 37: n, 42: i, 46: a, 49: s, 51: o, 52: l, 54: u, 56: h, 57: d, 60: f, 62: p, 63: g, 64: m, 65: v, 75: y, 76: b, 78: w, 82: T, 83: E, 86: C, 100: k, 102: _, 103: L }), { 5: 88, 10: 5, 16: 39, 17: 40, 19: 21, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: e, 35: r, 37: n, 38: 22, 42: i, 43: 23, 46: a, 49: s, 51: o, 52: l, 54: u, 56: h, 57: d, 60: f, 62: p, 63: g, 64: m, 65: v, 75: y, 76: b, 78: w, 82: T, 83: E, 86: C, 100: k, 102: _, 103: L }, t(A, [2, 20]), t(A, [2, 31]), t(A, [2, 32]), { 13: [1, 90], 16: 39, 17: 40, 19: 89, 60: f, 86: C, 100: k, 102: _, 103: L }, { 53: 91, 66: 56, 67: 57, 68: O, 69: P, 70: S, 71: R, 72: I, 73: D, 74: M }, t(A, [2, 54]), { 67: 92, 73: D, 74: M }, t(H, [2, 73], { 66: 93, 68: O, 69: P, 70: S, 71: R, 72: I }), t(ee, [2, 74]), t(ee, [2, 75]), t(ee, [2, 76]), t(ee, [2, 77]), t(ee, [2, 78]), t(Y, [2, 79]), t(Y, [2, 80]), { 8: [1, 95], 24: 96, 40: 94, 43: 23, 46: a }, { 16: 97, 60: f, 86: C, 100: k, 102: _ }, { 41: [1, 99], 45: 98, 51: re }, { 50: [1, 101] }, { 13: [1, 102] }, { 13: [1, 103] }, { 79: [1, 104], 81: [1, 105] }, { 22: ne, 48: he, 59: 106, 60: K, 82: Z, 84: 107, 85: 108, 86: X, 87: q, 88: J, 89: j, 90: pe }, { 60: [1, 118] }, { 13: $, 55: 119 }, t(A, [2, 62]), t(A, [2, 128]), { 22: ne, 48: he, 59: 120, 60: K, 61: [1, 121], 82: Z, 84: 107, 85: 108, 86: X, 87: q, 88: J, 89: j, 90: pe }, t(te, [2, 64]), { 16: 39, 17: 40, 19: 122, 60: f, 86: C, 100: k, 102: _, 103: L }, t(F, [2, 16]), t(F, [2, 17]), t(F, [2, 18]), { 39: [2, 36] }, { 15: 124, 16: 84, 17: 85, 18: [1, 123], 39: [2, 9], 60: f, 86: C, 100: k, 102: _, 103: L }, { 39: [2, 10] }, t(Ae, [2, 45], { 11: 125, 12: [1, 126] }), t(N, [2, 7]), { 9: [1, 127] }, t(W, [2, 57]), { 16: 39, 17: 40, 19: 128, 60: f, 86: C, 100: k, 102: _, 103: L }, { 13: [1, 130], 16: 39, 17: 40, 19: 129, 60: f, 86: C, 100: k, 102: _, 103: L }, t(H, [2, 72], { 66: 131, 68: O, 69: P, 70: S, 71: R, 72: I }), t(H, [2, 71]), { 41: [1, 132] }, { 24: 96, 40: 133, 43: 23, 46: a }, { 8: [1, 134], 41: [2, 37] }, t(B, [2, 41], { 39: [1, 135] }), { 41: [1, 136] }, t(B, [2, 43]), { 41: [2, 51], 45: 137, 51: re }, { 16: 39, 17: 40, 19: 138, 60: f, 86: C, 100: k, 102: _, 103: L }, t(A, [2, 81], { 13: [1, 139] }), t(A, [2, 83], { 13: [1, 141], 77: [1, 140] }), t(A, [2, 87], { 13: [1, 142], 80: [1, 143] }), { 13: [1, 144] }, t(A, [2, 95], { 61: Oe }), t(ue, [2, 97], { 85: 146, 22: ne, 48: he, 60: K, 82: Z, 86: X, 87: q, 88: J, 89: j, 90: pe }), t(Ve, [2, 99]), t(Ve, [2, 101]), t(Ve, [2, 102]), t(Ve, [2, 103]), t(Ve, [2, 104]), t(Ve, [2, 105]), t(Ve, [2, 106]), t(Ve, [2, 107]), t(Ve, [2, 108]), t(Ve, [2, 109]), t(A, [2, 96]), t(A, [2, 61]), t(A, [2, 63], { 61: Oe }), { 60: [1, 147] }, t(F, [2, 14]), { 15: 148, 16: 84, 17: 85, 60: f, 86: C, 100: k, 102: _, 103: L }, { 39: [2, 12] }, t(Ae, [2, 46]), { 13: [1, 149] }, { 1: [2, 4] }, t(W, [2, 59]), t(W, [2, 58]), { 16: 39, 17: 40, 19: 150, 60: f, 86: C, 100: k, 102: _, 103: L }, t(H, [2, 70]), t(A, [2, 34]), { 41: [1, 151] }, { 24: 96, 40: 152, 41: [2, 38], 43: 23, 46: a }, { 45: 153, 51: re }, t(B, [2, 42]), { 41: [2, 52] }, t(A, [2, 50]), t(A, [2, 82]), t(A, [2, 84]), t(A, [2, 85], { 77: [1, 154] }), t(A, [2, 88]), t(A, [2, 89], { 13: [1, 155] }), t(A, [2, 91], { 13: [1, 157], 77: [1, 156] }), { 22: ne, 48: he, 60: K, 82: Z, 84: 158, 85: 108, 86: X, 87: q, 88: J, 89: j, 90: pe }, t(Ve, [2, 100]), t(te, [2, 65]), { 39: [2, 11] }, { 14: [1, 159] }, t(W, [2, 60]), t(A, [2, 35]), { 41: [2, 39] }, { 41: [1, 160] }, t(A, [2, 86]), t(A, [2, 90]), t(A, [2, 92]), t(A, [2, 93], { 77: [1, 161] }), t(ue, [2, 98], { 85: 146, 22: ne, 48: he, 60: K, 82: Z, 86: X, 87: q, 88: J, 89: j, 90: pe }), t(Ae, [2, 8]), t(B, [2, 44]), t(A, [2, 94])],
    defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 3], 83: [2, 36], 85: [2, 10], 124: [2, 12], 127: [2, 4], 137: [2, 52], 148: [2, 11], 152: [2, 39] },
    parseError: /* @__PURE__ */ x(function(Se, _e) {
      if (_e.recoverable)
        this.trace(Se);
      else {
        var ze = new Error(Se);
        throw ze.hash = _e, ze;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(Se) {
      var _e = this, ze = [0], me = [], Me = [null], Q = [], ce = this.table, z = "", oe = 0, se = 0, ge = 2, de = 1, be = Q.slice.call(arguments, 1), Ce = Object.create(this.lexer), Te = { yy: {} };
      for (var Ne in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Ne) && (Te.yy[Ne] = this.yy[Ne]);
      Ce.setInput(Se, Te.yy), Te.yy.lexer = Ce, Te.yy.parser = this, typeof Ce.yylloc > "u" && (Ce.yylloc = {});
      var Xe = Ce.yylloc;
      Q.push(Xe);
      var Ye = Ce.options && Ce.options.ranges;
      typeof Te.yy.parseError == "function" ? this.parseError = Te.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Ke(nt) {
        ze.length = ze.length - 2 * nt, Me.length = Me.length - nt, Q.length = Q.length - nt;
      }
      x(Ke, "popStack");
      function Ze() {
        var nt;
        return nt = me.pop() || Ce.lex() || de, typeof nt != "number" && (nt instanceof Array && (me = nt, nt = me.pop()), nt = _e.symbols_[nt] || nt), nt;
      }
      x(Ze, "lex");
      for (var Be, He, ht, st, We = {}, kt, qe, rt, ct; ; ) {
        if (He = ze[ze.length - 1], this.defaultActions[He] ? ht = this.defaultActions[He] : ((Be === null || typeof Be > "u") && (Be = Ze()), ht = ce[He] && ce[He][Be]), typeof ht > "u" || !ht.length || !ht[0]) {
          var ut = "";
          ct = [];
          for (kt in ce[He])
            this.terminals_[kt] && kt > ge && ct.push("'" + this.terminals_[kt] + "'");
          Ce.showPosition ? ut = "Parse error on line " + (oe + 1) + `:
` + Ce.showPosition() + `
Expecting ` + ct.join(", ") + ", got '" + (this.terminals_[Be] || Be) + "'" : ut = "Parse error on line " + (oe + 1) + ": Unexpected " + (Be == de ? "end of input" : "'" + (this.terminals_[Be] || Be) + "'"), this.parseError(ut, {
            text: Ce.match,
            token: this.terminals_[Be] || Be,
            line: Ce.yylineno,
            loc: Xe,
            expected: ct
          });
        }
        if (ht[0] instanceof Array && ht.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + He + ", token: " + Be);
        switch (ht[0]) {
          case 1:
            ze.push(Be), Me.push(Ce.yytext), Q.push(Ce.yylloc), ze.push(ht[1]), Be = null, se = Ce.yyleng, z = Ce.yytext, oe = Ce.yylineno, Xe = Ce.yylloc;
            break;
          case 2:
            if (qe = this.productions_[ht[1]][1], We.$ = Me[Me.length - qe], We._$ = {
              first_line: Q[Q.length - (qe || 1)].first_line,
              last_line: Q[Q.length - 1].last_line,
              first_column: Q[Q.length - (qe || 1)].first_column,
              last_column: Q[Q.length - 1].last_column
            }, Ye && (We._$.range = [
              Q[Q.length - (qe || 1)].range[0],
              Q[Q.length - 1].range[1]
            ]), st = this.performAction.apply(We, [
              z,
              se,
              oe,
              Te.yy,
              ht[1],
              Me,
              Q
            ].concat(be)), typeof st < "u")
              return st;
            qe && (ze = ze.slice(0, -1 * qe * 2), Me = Me.slice(0, -1 * qe), Q = Q.slice(0, -1 * qe)), ze.push(this.productions_[ht[1]][0]), Me.push(We.$), Q.push(We._$), rt = ce[ze[ze.length - 2]][ze[ze.length - 1]], ze.push(rt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, Ue = /* @__PURE__ */ function() {
    var Pe = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(_e, ze) {
        if (this.yy.parser)
          this.yy.parser.parseError(_e, ze);
        else
          throw new Error(_e);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(Se, _e) {
        return this.yy = _e || this.yy || {}, this._input = Se, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var Se = this._input[0];
        this.yytext += Se, this.yyleng++, this.offset++, this.match += Se, this.matched += Se;
        var _e = Se.match(/(?:\r\n?|\n).*/g);
        return _e ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), Se;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(Se) {
        var _e = Se.length, ze = Se.split(/(?:\r\n?|\n)/g);
        this._input = Se + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - _e), this.offset -= _e;
        var me = 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), ze.length - 1 && (this.yylineno -= ze.length - 1);
        var Me = 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: ze ? (ze.length === me.length ? this.yylloc.first_column : 0) + me[me.length - ze.length].length - ze[0].length : this.yylloc.first_column - _e
        }, this.options.ranges && (this.yylloc.range = [Me[0], Me[0] + this.yyleng - _e]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(Se) {
        this.unput(this.match.slice(Se));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var Se = this.matched.substr(0, this.matched.length - this.match.length);
        return (Se.length > 20 ? "..." : "") + Se.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var Se = this.match;
        return Se.length < 20 && (Se += this._input.substr(0, 20 - Se.length)), (Se.substr(0, 20) + (Se.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var Se = this.pastInput(), _e = new Array(Se.length + 1).join("-");
        return Se + this.upcomingInput() + `
` + _e + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(Se, _e) {
        var ze, me, Me;
        if (this.options.backtrack_lexer && (Me = {
          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 && (Me.yylloc.range = this.yylloc.range.slice(0))), me = Se[0].match(/(?:\r\n?|\n).*/g), me && (this.yylineno += me.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: me ? me[me.length - 1].length - me[me.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + Se[0].length
        }, this.yytext += Se[0], this.match += Se[0], this.matches = Se, 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(Se[0].length), this.matched += Se[0], ze = this.performAction.call(this, this.yy, this, _e, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), ze)
          return ze;
        if (this._backtrack) {
          for (var Q in Me)
            this[Q] = Me[Q];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var Se, _e, ze, me;
        this._more || (this.yytext = "", this.match = "");
        for (var Me = this._currentRules(), Q = 0; Q < Me.length; Q++)
          if (ze = this._input.match(this.rules[Me[Q]]), ze && (!_e || ze[0].length > _e[0].length)) {
            if (_e = ze, me = Q, this.options.backtrack_lexer) {
              if (Se = this.test_match(ze, Me[Q]), Se !== !1)
                return Se;
              if (this._backtrack) {
                _e = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return _e ? (Se = this.test_match(_e, Me[me]), Se !== !1 ? Se : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var _e = this.next();
        return _e || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(_e) {
        this.conditionStack.push(_e);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var _e = this.conditionStack.length - 1;
        return _e > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(_e) {
        return _e = this.conditionStack.length - 1 - Math.abs(_e || 0), _e >= 0 ? this.conditionStack[_e] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(_e) {
        this.begin(_e);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: {},
      performAction: /* @__PURE__ */ x(function(_e, ze, me, Me) {
        switch (me) {
          case 0:
            return 62;
          case 1:
            return 63;
          case 2:
            return 64;
          case 3:
            return 65;
          case 4:
            break;
          case 5:
            break;
          case 6:
            return this.begin("acc_title"), 33;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 35;
          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 79;
          case 22:
            this.popState();
            break;
          case 23:
            return 80;
          case 24:
            this.popState();
            break;
          case 25:
            return "STR";
          case 26:
            this.begin("string");
            break;
          case 27:
            return 82;
          case 28:
            return 57;
          case 29:
            return this.begin("namespace"), 42;
          case 30:
            return this.popState(), 8;
          case 31:
            break;
          case 32:
            return this.begin("namespace-body"), 39;
          case 33:
            return this.popState(), 41;
          case 34:
            return "EOF_IN_STRUCT";
          case 35:
            return 8;
          case 36:
            break;
          case 37:
            return "EDGE_STATE";
          case 38:
            return this.begin("class"), 46;
          case 39:
            return this.popState(), 8;
          case 40:
            break;
          case 41:
            return this.popState(), this.popState(), 41;
          case 42:
            return this.begin("class-body"), 39;
          case 43:
            return this.popState(), 41;
          case 44:
            return "EOF_IN_STRUCT";
          case 45:
            return "EDGE_STATE";
          case 46:
            return "OPEN_IN_STRUCT";
          case 47:
            break;
          case 48:
            return "MEMBER";
          case 49:
            return 83;
          case 50:
            return 75;
          case 51:
            return 76;
          case 52:
            return 78;
          case 53:
            return 54;
          case 54:
            return 56;
          case 55:
            return 49;
          case 56:
            return 50;
          case 57:
            return 81;
          case 58:
            this.popState();
            break;
          case 59:
            return "GENERICTYPE";
          case 60:
            this.begin("generic");
            break;
          case 61:
            this.popState();
            break;
          case 62:
            return "BQUOTE_STR";
          case 63:
            this.begin("bqstring");
            break;
          case 64:
            return 77;
          case 65:
            return 77;
          case 66:
            return 77;
          case 67:
            return 77;
          case 68:
            return 69;
          case 69:
            return 69;
          case 70:
            return 71;
          case 71:
            return 71;
          case 72:
            return 70;
          case 73:
            return 68;
          case 74:
            return 72;
          case 75:
            return 73;
          case 76:
            return 74;
          case 77:
            return 22;
          case 78:
            return 44;
          case 79:
            return 100;
          case 80:
            return 18;
          case 81:
            return "PLUS";
          case 82:
            return 87;
          case 83:
            return 61;
          case 84:
            return 89;
          case 85:
            return 89;
          case 86:
            return 90;
          case 87:
            return "EQUALS";
          case 88:
            return "EQUALS";
          case 89:
            return 60;
          case 90:
            return 12;
          case 91:
            return 14;
          case 92:
            return "PUNCTUATION";
          case 93:
            return 86;
          case 94:
            return 102;
          case 95:
            return 48;
          case 96:
            return 48;
          case 97:
            return 9;
        }
      }, "anonymous"),
      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)/, /^(?:classDef\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, 33, 34, 35, 36, 37, 38, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, namespace: { rules: [26, 29, 30, 31, 32, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, "class-body": { rules: [26, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, class: { rules: [26, 39, 40, 41, 42, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, acc_descr_multiline: { rules: [11, 12, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, acc_descr: { rules: [9, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, acc_title: { rules: [7, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, callback_args: { rules: [22, 23, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, callback_name: { rules: [19, 20, 21, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, href: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, struct: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, generic: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, bqstring: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, string: { rules: [24, 25, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 26, 27, 28, 29, 38, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 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, 97], inclusive: !0 } }
    };
    return Pe;
  }();
  Ge.lexer = Ue;
  function ke() {
    this.yy = {};
  }
  return x(ke, "Parser"), ke.prototype = Ge, Ge.Parser = ke, new ke();
}();
N6.parser = N6;
var wq = N6, bN = ["#", "+", "~", "-", ""], Dd, wN = (Dd = class {
  constructor(e, r) {
    this.memberType = r, this.visibility = "", this.classifier = "", this.text = "";
    const n = fr(e, we());
    this.parseMember(n);
  }
  getDisplayDetails() {
    let e = this.visibility + gl(this.id);
    this.memberType === "method" && (e += `(${gl(this.parameters.trim())})`, this.returnType && (e += " : " + gl(this.returnType))), e = e.trim();
    const r = this.parseClassifier();
    return {
      displayText: e,
      cssStyle: r
    };
  }
  parseMember(e) {
    let r = "";
    if (this.memberType === "method") {
      const a = /([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(e);
      if (a) {
        const s = a[1] ? a[1].trim() : "";
        if (bN.includes(s) && (this.visibility = s), this.id = a[2], this.parameters = a[3] ? a[3].trim() : "", r = a[4] ? a[4].trim() : "", this.returnType = a[5] ? a[5].trim() : "", r === "") {
          const o = this.returnType.substring(this.returnType.length - 1);
          /[$*]/.exec(o) && (r = o, this.returnType = this.returnType.substring(0, this.returnType.length - 1));
        }
      }
    } else {
      const i = e.length, a = e.substring(0, 1), s = e.substring(i - 1);
      bN.includes(a) && (this.visibility = a), /[$*]/.exec(s) && (r = s), this.id = e.substring(
        this.visibility === "" ? 0 : 1,
        r === "" ? i : i - 1
      );
    }
    this.classifier = r, this.id = this.id.startsWith(" ") ? " " + this.id.trim() : this.id.trim();
    const n = `${this.visibility ? "\\" + this.visibility : ""}${gl(this.id)}${this.memberType === "method" ? `(${gl(this.parameters)})${this.returnType ? " : " + gl(this.returnType) : ""}` : ""}`;
    this.text = n.replaceAll("<", "&lt;").replaceAll(">", "&gt;"), this.text.startsWith("\\&lt;") && (this.text = this.text.replace("\\&lt;", "~"));
  }
  parseClassifier() {
    switch (this.classifier) {
      case "*":
        return "font-style:italic;";
      case "$":
        return "text-decoration:underline;";
      default:
        return "";
    }
  }
}, x(Dd, "ClassMember"), Dd), Nm = "classId-", TN = 0, Rc = /* @__PURE__ */ x((t) => at.sanitizeText(t, we()), "sanitizeText"), Id, Tq = (Id = class {
  constructor() {
    this.relations = [], this.classes = /* @__PURE__ */ new Map(), this.styleClasses = /* @__PURE__ */ new Map(), this.notes = [], this.interfaces = [], this.namespaces = /* @__PURE__ */ new Map(), this.namespaceCounter = 0, this.functions = [], this.lineType = {
      LINE: 0,
      DOTTED_LINE: 1
    }, this.relationType = {
      AGGREGATION: 0,
      EXTENSION: 1,
      COMPOSITION: 2,
      DEPENDENCY: 3,
      LOLLIPOP: 4
    }, this.setupToolTips = /* @__PURE__ */ x((e) => {
      let r = Qe(".mermaidTooltip");
      (r._groups || r)[0][0] === null && (r = Qe("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0)), Qe(e).select("svg").selectAll("g.node").on("mouseover", (a) => {
        const s = Qe(a.currentTarget);
        if (s.attr("title") === null)
          return;
        const l = this.getBoundingClientRect();
        r.transition().duration(200).style("opacity", ".9"), r.text(s.attr("title")).style("left", window.scrollX + l.left + (l.right - l.left) / 2 + "px").style("top", window.scrollY + l.top - 14 + document.body.scrollTop + "px"), r.html(r.html().replace(/&lt;br\/&gt;/g, "<br/>")), s.classed("hover", !0);
      }).on("mouseout", (a) => {
        r.transition().duration(500).style("opacity", 0), Qe(a.currentTarget).classed("hover", !1);
      });
    }, "setupToolTips"), this.direction = "TB", this.setAccTitle = Cn, this.getAccTitle = Vn, this.setAccDescription = Gn, this.getAccDescription = Un, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.getConfig = /* @__PURE__ */ x(() => we().class, "getConfig"), this.functions.push(this.setupToolTips.bind(this)), this.clear(), this.addRelation = this.addRelation.bind(this), this.addClassesToNamespace = this.addClassesToNamespace.bind(this), this.addNamespace = this.addNamespace.bind(this), this.setCssClass = this.setCssClass.bind(this), this.addMembers = this.addMembers.bind(this), this.addClass = this.addClass.bind(this), this.setClassLabel = this.setClassLabel.bind(this), this.addAnnotation = this.addAnnotation.bind(this), this.addMember = this.addMember.bind(this), this.cleanupLabel = this.cleanupLabel.bind(this), this.addNote = this.addNote.bind(this), this.defineClass = this.defineClass.bind(this), this.setDirection = this.setDirection.bind(this), this.setLink = this.setLink.bind(this), this.bindFunctions = this.bindFunctions.bind(this), this.clear = this.clear.bind(this), this.setTooltip = this.setTooltip.bind(this), this.setClickEvent = this.setClickEvent.bind(this), this.setCssStyle = this.setCssStyle.bind(this);
  }
  splitClassNameAndType(e) {
    const r = at.sanitizeText(e, we());
    let n = "", i = r;
    if (r.indexOf("~") > 0) {
      const a = r.split("~");
      i = Rc(a[0]), n = Rc(a[1]);
    }
    return { className: i, type: n };
  }
  setClassLabel(e, r) {
    const n = at.sanitizeText(e, we());
    r && (r = Rc(r));
    const { className: i } = this.splitClassNameAndType(n);
    this.classes.get(i).label = r, this.classes.get(i).text = `${r}${this.classes.get(i).type ? `<${this.classes.get(i).type}>` : ""}`;
  }
  /**
   * Function called by parser when a node definition has been found.
   *
   * @param id - ID of the class to add
   * @public
   */
  addClass(e) {
    const r = at.sanitizeText(e, we()), { className: n, type: i } = this.splitClassNameAndType(r);
    if (this.classes.has(n))
      return;
    const a = at.sanitizeText(n, we());
    this.classes.set(a, {
      id: a,
      type: i,
      label: a,
      text: `${a}${i ? `&lt;${i}&gt;` : ""}`,
      shape: "classBox",
      cssClasses: "default",
      methods: [],
      members: [],
      annotations: [],
      styles: [],
      domId: Nm + a + "-" + TN
    }), TN++;
  }
  addInterface(e, r) {
    const n = {
      id: `interface${this.interfaces.length}`,
      label: e,
      classId: r
    };
    this.interfaces.push(n);
  }
  /**
   * Function to lookup domId from id in the graph definition.
   *
   * @param id - class ID to lookup
   * @public
   */
  lookUpDomId(e) {
    const r = at.sanitizeText(e, we());
    if (this.classes.has(r))
      return this.classes.get(r).domId;
    throw new Error("Class not found: " + r);
  }
  clear() {
    this.relations = [], this.classes = /* @__PURE__ */ new Map(), this.notes = [], this.interfaces = [], this.functions = [], this.functions.push(this.setupToolTips.bind(this)), this.namespaces = /* @__PURE__ */ new Map(), this.namespaceCounter = 0, this.direction = "TB", _n();
  }
  getClass(e) {
    return this.classes.get(e);
  }
  getClasses() {
    return this.classes;
  }
  getRelations() {
    return this.relations;
  }
  getNotes() {
    return this.notes;
  }
  addRelation(e) {
    ae.debug("Adding relation: " + JSON.stringify(e));
    const r = [
      this.relationType.LOLLIPOP,
      this.relationType.AGGREGATION,
      this.relationType.COMPOSITION,
      this.relationType.DEPENDENCY,
      this.relationType.EXTENSION
    ];
    e.relation.type1 === this.relationType.LOLLIPOP && !r.includes(e.relation.type2) ? (this.addClass(e.id2), this.addInterface(e.id1, e.id2), e.id1 = `interface${this.interfaces.length - 1}`) : e.relation.type2 === this.relationType.LOLLIPOP && !r.includes(e.relation.type1) ? (this.addClass(e.id1), this.addInterface(e.id2, e.id1), e.id2 = `interface${this.interfaces.length - 1}`) : (this.addClass(e.id1), this.addClass(e.id2)), e.id1 = this.splitClassNameAndType(e.id1).className, e.id2 = this.splitClassNameAndType(e.id2).className, e.relationTitle1 = at.sanitizeText(
      e.relationTitle1.trim(),
      we()
    ), e.relationTitle2 = at.sanitizeText(
      e.relationTitle2.trim(),
      we()
    ), this.relations.push(e);
  }
  /**
   * Adds an annotation to the specified class Annotations mark special properties of the given type
   * (like 'interface' or 'service')
   *
   * @param className - The class name
   * @param annotation - The name of the annotation without any brackets
   * @public
   */
  addAnnotation(e, r) {
    const n = this.splitClassNameAndType(e).className;
    this.classes.get(n).annotations.push(r);
  }
  /**
   * Adds a member to the specified class
   *
   * @param className - The class name
   * @param member - The full name of the member. If the member is enclosed in `<<brackets>>` it is
   *   treated as an annotation If the member is ending with a closing bracket ) it is treated as a
   *   method Otherwise the member will be treated as a normal property
   * @public
   */
  addMember(e, r) {
    this.addClass(e);
    const n = this.splitClassNameAndType(e).className, i = this.classes.get(n);
    if (typeof r == "string") {
      const a = r.trim();
      a.startsWith("<<") && a.endsWith(">>") ? i.annotations.push(Rc(a.substring(2, a.length - 2))) : a.indexOf(")") > 0 ? i.methods.push(new wN(a, "method")) : a && i.members.push(new wN(a, "attribute"));
    }
  }
  addMembers(e, r) {
    Array.isArray(r) && (r.reverse(), r.forEach((n) => this.addMember(e, n)));
  }
  addNote(e, r) {
    const n = {
      id: `note${this.notes.length}`,
      class: r,
      text: e
    };
    this.notes.push(n);
  }
  cleanupLabel(e) {
    return e.startsWith(":") && (e = e.substring(1)), Rc(e.trim());
  }
  /**
   * Called by parser when assigning cssClass to a class
   *
   * @param ids - Comma separated list of ids
   * @param className - Class to add
   */
  setCssClass(e, r) {
    e.split(",").forEach((n) => {
      let i = n;
      /\d/.exec(n[0]) && (i = Nm + i);
      const a = this.classes.get(i);
      a && (a.cssClasses += " " + r);
    });
  }
  defineClass(e, r) {
    for (const n of e) {
      let i = this.styleClasses.get(n);
      i === void 0 && (i = { id: n, styles: [], textStyles: [] }, this.styleClasses.set(n, i)), r && r.forEach((a) => {
        if (/color/.exec(a)) {
          const s = a.replace("fill", "bgFill");
          i.textStyles.push(s);
        }
        i.styles.push(a);
      }), this.classes.forEach((a) => {
        a.cssClasses.includes(n) && a.styles.push(...r.flatMap((s) => s.split(",")));
      });
    }
  }
  /**
   * Called by parser when a tooltip is found, e.g. a clickable element.
   *
   * @param ids - Comma separated list of ids
   * @param tooltip - Tooltip to add
   */
  setTooltip(e, r) {
    e.split(",").forEach((n) => {
      r !== void 0 && (this.classes.get(n).tooltip = Rc(r));
    });
  }
  getTooltip(e, r) {
    return r && this.namespaces.has(r) ? this.namespaces.get(r).classes.get(e).tooltip : this.classes.get(e).tooltip;
  }
  /**
   * Called by parser when a link is found. Adds the URL to the vertex data.
   *
   * @param ids - Comma separated list of ids
   * @param linkStr - URL to create a link for
   * @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file
   */
  setLink(e, r, n) {
    const i = we();
    e.split(",").forEach((a) => {
      let s = a;
      /\d/.exec(a[0]) && (s = Nm + s);
      const o = this.classes.get(s);
      o && (o.link = Kt.formatUrl(r, i), i.securityLevel === "sandbox" ? o.linkTarget = "_top" : typeof n == "string" ? o.linkTarget = Rc(n) : o.linkTarget = "_blank");
    }), this.setCssClass(e, "clickable");
  }
  /**
   * Called by parser when a click definition is found. Registers an event handler.
   *
   * @param ids - Comma separated list of ids
   * @param functionName - Function to be called on click
   * @param functionArgs - Function args the function should be called with
   */
  setClickEvent(e, r, n) {
    e.split(",").forEach((i) => {
      this.setClickFunc(i, r, n), this.classes.get(i).haveCallback = !0;
    }), this.setCssClass(e, "clickable");
  }
  setClickFunc(e, r, n) {
    const i = at.sanitizeText(e, we());
    if (we().securityLevel !== "loose" || r === void 0)
      return;
    const s = i;
    if (this.classes.has(s)) {
      const o = this.lookUpDomId(s);
      let l = [];
      if (typeof n == "string") {
        l = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
        for (let u = 0; u < l.length; u++) {
          let h = l[u].trim();
          h.startsWith('"') && h.endsWith('"') && (h = h.substr(1, h.length - 2)), l[u] = h;
        }
      }
      l.length === 0 && l.push(o), this.functions.push(() => {
        const u = document.querySelector(`[id="${o}"]`);
        u !== null && u.addEventListener(
          "click",
          () => {
            Kt.runFunc(r, ...l);
          },
          !1
        );
      });
    }
  }
  bindFunctions(e) {
    this.functions.forEach((r) => {
      r(e);
    });
  }
  getDirection() {
    return this.direction;
  }
  setDirection(e) {
    this.direction = e;
  }
  /**
   * Function called by parser when a namespace definition has been found.
   *
   * @param id - ID of the namespace to add
   * @public
   */
  addNamespace(e) {
    this.namespaces.has(e) || (this.namespaces.set(e, {
      id: e,
      classes: /* @__PURE__ */ new Map(),
      children: {},
      domId: Nm + e + "-" + this.namespaceCounter
    }), this.namespaceCounter++);
  }
  getNamespace(e) {
    return this.namespaces.get(e);
  }
  getNamespaces() {
    return this.namespaces;
  }
  /**
   * Function called by parser when a namespace definition has been found.
   *
   * @param id - ID of the namespace to add
   * @param classNames - IDs of the class to add
   * @public
   */
  addClassesToNamespace(e, r) {
    if (this.namespaces.has(e))
      for (const n of r) {
        const { className: i } = this.splitClassNameAndType(n);
        this.classes.get(i).parent = e, this.namespaces.get(e).classes.set(i, this.classes.get(i));
      }
  }
  setCssStyle(e, r) {
    const n = this.classes.get(e);
    if (!(!r || !n))
      for (const i of r)
        i.includes(",") ? n.styles.push(...i.split(",")) : n.styles.push(i);
  }
  /**
   * Gets the arrow marker for a type index
   *
   * @param type - The type to look for
   * @returns The arrow marker
   */
  getArrowMarker(e) {
    let r;
    switch (e) {
      case 0:
        r = "aggregation";
        break;
      case 1:
        r = "extension";
        break;
      case 2:
        r = "composition";
        break;
      case 3:
        r = "dependency";
        break;
      case 4:
        r = "lollipop";
        break;
      default:
        r = "none";
    }
    return r;
  }
  getData() {
    var a;
    const e = [], r = [], n = we();
    for (const s of this.namespaces.keys()) {
      const o = this.namespaces.get(s);
      if (o) {
        const l = {
          id: o.id,
          label: o.id,
          isGroup: !0,
          padding: n.class.padding ?? 16,
          // parent node must be one of [rect, roundedWithTitle, noteGroup, divider]
          shape: "rect",
          cssStyles: ["fill: none", "stroke: black"],
          look: n.look
        };
        e.push(l);
      }
    }
    for (const s of this.classes.keys()) {
      const o = this.classes.get(s);
      if (o) {
        const l = o;
        l.parentId = o.parent, l.look = n.look, e.push(l);
      }
    }
    let i = 0;
    for (const s of this.notes) {
      i++;
      const o = {
        id: s.id,
        label: s.text,
        isGroup: !1,
        shape: "note",
        padding: n.class.padding ?? 6,
        cssStyles: [
          "text-align: left",
          "white-space: nowrap",
          `fill: ${n.themeVariables.noteBkgColor}`,
          `stroke: ${n.themeVariables.noteBorderColor}`
        ],
        look: n.look
      };
      e.push(o);
      const l = ((a = this.classes.get(s.class)) == null ? void 0 : a.id) ?? "";
      if (l) {
        const u = {
          id: `edgeNote${i}`,
          start: s.id,
          end: l,
          type: "normal",
          thickness: "normal",
          classes: "relation",
          arrowTypeStart: "none",
          arrowTypeEnd: "none",
          arrowheadStyle: "",
          labelStyle: [""],
          style: ["fill: none"],
          pattern: "dotted",
          look: n.look
        };
        r.push(u);
      }
    }
    for (const s of this.interfaces) {
      const o = {
        id: s.id,
        label: s.label,
        isGroup: !1,
        shape: "rect",
        cssStyles: ["opacity: 0;"],
        look: n.look
      };
      e.push(o);
    }
    i = 0;
    for (const s of this.relations) {
      i++;
      const o = {
        id: Nh(s.id1, s.id2, {
          prefix: "id",
          counter: i
        }),
        start: s.id1,
        end: s.id2,
        type: "normal",
        label: s.title,
        labelpos: "c",
        thickness: "normal",
        classes: "relation",
        arrowTypeStart: this.getArrowMarker(s.relation.type1),
        arrowTypeEnd: this.getArrowMarker(s.relation.type2),
        startLabelRight: s.relationTitle1 === "none" ? "" : s.relationTitle1,
        endLabelLeft: s.relationTitle2 === "none" ? "" : s.relationTitle2,
        arrowheadStyle: "",
        labelStyle: ["display: inline-block"],
        style: s.style || "",
        pattern: s.relation.lineType == 1 ? "dashed" : "solid",
        look: n.look
      };
      r.push(o);
    }
    return { nodes: e, edges: r, other: {}, config: n, direction: this.getDirection() };
  }
}, x(Id, "ClassDB"), Id), vAe = /* @__PURE__ */ x((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};
}

.labelBkg {
  background: ${t.mainBkg};
}
.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};
}
  ${l1()}
`, "getStyles"), Eq = vAe, yAe = /* @__PURE__ */ x((t, e = "TB") => {
  if (!t.doc)
    return e;
  let r = e;
  for (const n of t.doc)
    n.stmt === "dir" && (r = n.value);
  return r;
}, "getDir"), xAe = /* @__PURE__ */ x(function(t, e) {
  return e.db.getClasses();
}, "getClasses"), bAe = /* @__PURE__ */ x(async function(t, e, r, n) {
  ae.info("REF0:"), ae.info("Drawing class diagram (v3)", e);
  const { securityLevel: i, state: a, layout: s } = we(), o = n.db.getData(), l = Ff(e, i);
  o.type = n.type, o.layoutAlgorithm = Gg(s), o.nodeSpacing = (a == null ? void 0 : a.nodeSpacing) || 50, o.rankSpacing = (a == null ? void 0 : a.rankSpacing) || 50, o.markers = ["aggregation", "extension", "composition", "dependency", "lollipop"], o.diagramId = e, await Af(o, l);
  const u = 8;
  Kt.insertTitle(
    l,
    "classDiagramTitleText",
    (a == null ? void 0 : a.titleTopMargin) ?? 25,
    n.db.getDiagramTitle()
  ), zu(l, u, "classDiagram", (a == null ? void 0 : a.useMaxWidth) ?? !0);
}, "draw"), kq = {
  getClasses: xAe,
  draw: bAe,
  getDir: yAe
}, wAe = {
  parser: wq,
  get db() {
    return new Tq();
  },
  renderer: kq,
  styles: Eq,
  init: /* @__PURE__ */ x((t) => {
    t.class || (t.class = {}), t.class.arrowMarkerAbsolute = t.arrowMarkerAbsolute;
  }, "init")
};
const TAe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: wAe
}, Symbol.toStringTag, { value: "Module" }));
var EAe = {
  parser: wq,
  get db() {
    return new Tq();
  },
  renderer: kq,
  styles: Eq,
  init: /* @__PURE__ */ x((t) => {
    t.class || (t.class = {}), t.class.arrowMarkerAbsolute = t.arrowMarkerAbsolute;
  }, "init")
};
const kAe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: EAe
}, Symbol.toStringTag, { value: "Module" }));
var M6 = function() {
  var t = /* @__PURE__ */ x(function(B, $, F, G) {
    for (F = F || {}, G = B.length; G--; F[B[G]] = $) ;
    return F;
  }, "o"), e = [1, 2], r = [1, 3], n = [1, 4], i = [2, 4], a = [1, 9], s = [1, 11], o = [1, 16], l = [1, 17], u = [1, 18], h = [1, 19], d = [1, 33], f = [1, 20], p = [1, 21], g = [1, 22], m = [1, 23], v = [1, 24], y = [1, 26], b = [1, 27], w = [1, 28], T = [1, 29], E = [1, 30], C = [1, 31], k = [1, 32], _ = [1, 35], L = [1, 36], N = [1, 37], A = [1, 38], O = [1, 34], P = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], S = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 39, 40, 41, 45, 48, 51, 52, 53, 54, 57], R = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], I = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    yy: {},
    symbols_: { error: 2, start: 3, SPACE: 4, NL: 5, SD: 6, document: 7, line: 8, statement: 9, classDefStatement: 10, styleStatement: 11, cssClassStatement: 12, idStatement: 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: 29, notePosition: 30, NOTE_TEXT: 31, direction: 32, acc_title: 33, acc_title_value: 34, acc_descr: 35, acc_descr_value: 36, acc_descr_multiline_value: 37, CLICK: 38, STRING: 39, HREF: 40, classDef: 41, CLASSDEF_ID: 42, CLASSDEF_STYLEOPTS: 43, DEFAULT: 44, style: 45, STYLE_IDS: 46, STYLEDEF_STYLEOPTS: 47, class: 48, CLASSENTITY_IDS: 49, STYLECLASS: 50, direction_tb: 51, direction_bt: 52, direction_rl: 53, direction_lr: 54, eol: 55, ";": 56, EDGE_STATE: 57, STYLE_SEPARATOR: 58, left_of: 59, right_of: 60, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "CLICK", 39: "STRING", 40: "HREF", 41: "classDef", 42: "CLASSDEF_ID", 43: "CLASSDEF_STYLEOPTS", 44: "DEFAULT", 45: "style", 46: "STYLE_IDS", 47: "STYLEDEF_STYLEOPTS", 48: "class", 49: "CLASSENTITY_IDS", 50: "STYLECLASS", 51: "direction_tb", 52: "direction_bt", 53: "direction_rl", 54: "direction_lr", 56: ";", 57: "EDGE_STATE", 58: "STYLE_SEPARATOR", 59: "left_of", 60: "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, 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], [9, 5], [9, 5], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [55, 1], [55, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
    performAction: /* @__PURE__ */ x(function($, F, G, H, ee, Y, re) {
      var ne = Y.length - 1;
      switch (ee) {
        case 3:
          return H.setRootDoc(Y[ne]), Y[ne];
        case 4:
          this.$ = [];
          break;
        case 5:
          Y[ne] != "nl" && (Y[ne - 1].push(Y[ne]), this.$ = Y[ne - 1]);
          break;
        case 6:
        case 7:
          this.$ = Y[ne];
          break;
        case 8:
          this.$ = "nl";
          break;
        case 12:
          this.$ = Y[ne];
          break;
        case 13:
          const X = Y[ne - 1];
          X.description = H.trimColon(Y[ne]), this.$ = X;
          break;
        case 14:
          this.$ = { stmt: "relation", state1: Y[ne - 2], state2: Y[ne] };
          break;
        case 15:
          const q = H.trimColon(Y[ne]);
          this.$ = { stmt: "relation", state1: Y[ne - 3], state2: Y[ne - 1], description: q };
          break;
        case 19:
          this.$ = { stmt: "state", id: Y[ne - 3], type: "default", description: "", doc: Y[ne - 1] };
          break;
        case 20:
          var he = Y[ne], K = Y[ne - 2].trim();
          if (Y[ne].match(":")) {
            var Z = Y[ne].split(":");
            he = Z[0], K = [K, Z[1]];
          }
          this.$ = { stmt: "state", id: he, type: "default", description: K };
          break;
        case 21:
          this.$ = { stmt: "state", id: Y[ne - 3], type: "default", description: Y[ne - 5], doc: Y[ne - 1] };
          break;
        case 22:
          this.$ = { stmt: "state", id: Y[ne], type: "fork" };
          break;
        case 23:
          this.$ = { stmt: "state", id: Y[ne], type: "join" };
          break;
        case 24:
          this.$ = { stmt: "state", id: Y[ne], type: "choice" };
          break;
        case 25:
          this.$ = { stmt: "state", id: H.getDividerId(), type: "divider" };
          break;
        case 26:
          this.$ = { stmt: "state", id: Y[ne - 1].trim(), note: { position: Y[ne - 2].trim(), text: Y[ne].trim() } };
          break;
        case 29:
          this.$ = Y[ne].trim(), H.setAccTitle(this.$);
          break;
        case 30:
        case 31:
          this.$ = Y[ne].trim(), H.setAccDescription(this.$);
          break;
        case 32:
          this.$ = {
            stmt: "click",
            id: Y[ne - 3],
            url: Y[ne - 2],
            tooltip: Y[ne - 1]
          };
          break;
        case 33:
          this.$ = {
            stmt: "click",
            id: Y[ne - 3],
            url: Y[ne - 1],
            tooltip: ""
          };
          break;
        case 34:
        case 35:
          this.$ = { stmt: "classDef", id: Y[ne - 1].trim(), classes: Y[ne].trim() };
          break;
        case 36:
          this.$ = { stmt: "style", id: Y[ne - 1].trim(), styleClass: Y[ne].trim() };
          break;
        case 37:
          this.$ = { stmt: "applyClass", id: Y[ne - 1].trim(), styleClass: Y[ne].trim() };
          break;
        case 38:
          H.setDirection("TB"), this.$ = { stmt: "dir", value: "TB" };
          break;
        case 39:
          H.setDirection("BT"), this.$ = { stmt: "dir", value: "BT" };
          break;
        case 40:
          H.setDirection("RL"), this.$ = { stmt: "dir", value: "RL" };
          break;
        case 41:
          H.setDirection("LR"), this.$ = { stmt: "dir", value: "LR" };
          break;
        case 44:
        case 45:
          this.$ = { stmt: "state", id: Y[ne].trim(), type: "default", description: "" };
          break;
        case 46:
          this.$ = { stmt: "state", id: Y[ne - 2].trim(), classes: [Y[ne].trim()], type: "default", description: "" };
          break;
        case 47:
          this.$ = { stmt: "state", id: Y[ne - 2].trim(), classes: [Y[ne].trim()], type: "default", description: "" };
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: e, 5: r, 6: n }, { 1: [3] }, { 3: 5, 4: e, 5: r, 6: n }, { 3: 6, 4: e, 5: r, 6: n }, t([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], i, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: a, 5: s, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: o, 17: l, 19: u, 22: h, 24: d, 25: f, 26: p, 27: g, 28: m, 29: v, 32: 25, 33: y, 35: b, 37: w, 38: T, 41: E, 45: C, 48: k, 51: _, 52: L, 53: N, 54: A, 57: O }, t(P, [2, 5]), { 9: 39, 10: 12, 11: 13, 12: 14, 13: 15, 16: o, 17: l, 19: u, 22: h, 24: d, 25: f, 26: p, 27: g, 28: m, 29: v, 32: 25, 33: y, 35: b, 37: w, 38: T, 41: E, 45: C, 48: k, 51: _, 52: L, 53: N, 54: A, 57: O }, t(P, [2, 7]), t(P, [2, 8]), t(P, [2, 9]), t(P, [2, 10]), t(P, [2, 11]), t(P, [2, 12], { 14: [1, 40], 15: [1, 41] }), t(P, [2, 16]), { 18: [1, 42] }, t(P, [2, 18], { 20: [1, 43] }), { 23: [1, 44] }, t(P, [2, 22]), t(P, [2, 23]), t(P, [2, 24]), t(P, [2, 25]), { 30: 45, 31: [1, 46], 59: [1, 47], 60: [1, 48] }, t(P, [2, 28]), { 34: [1, 49] }, { 36: [1, 50] }, t(P, [2, 31]), { 13: 51, 24: d, 57: O }, { 42: [1, 52], 44: [1, 53] }, { 46: [1, 54] }, { 49: [1, 55] }, t(S, [2, 44], { 58: [1, 56] }), t(S, [2, 45], { 58: [1, 57] }), t(P, [2, 38]), t(P, [2, 39]), t(P, [2, 40]), t(P, [2, 41]), t(P, [2, 6]), t(P, [2, 13]), { 13: 58, 24: d, 57: O }, t(P, [2, 17]), t(R, i, { 7: 59 }), { 24: [1, 60] }, { 24: [1, 61] }, { 23: [1, 62] }, { 24: [2, 48] }, { 24: [2, 49] }, t(P, [2, 29]), t(P, [2, 30]), { 39: [1, 63], 40: [1, 64] }, { 43: [1, 65] }, { 43: [1, 66] }, { 47: [1, 67] }, { 50: [1, 68] }, { 24: [1, 69] }, { 24: [1, 70] }, t(P, [2, 14], { 14: [1, 71] }), { 4: a, 5: s, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: o, 17: l, 19: u, 21: [1, 72], 22: h, 24: d, 25: f, 26: p, 27: g, 28: m, 29: v, 32: 25, 33: y, 35: b, 37: w, 38: T, 41: E, 45: C, 48: k, 51: _, 52: L, 53: N, 54: A, 57: O }, t(P, [2, 20], { 20: [1, 73] }), { 31: [1, 74] }, { 24: [1, 75] }, { 39: [1, 76] }, { 39: [1, 77] }, t(P, [2, 34]), t(P, [2, 35]), t(P, [2, 36]), t(P, [2, 37]), t(S, [2, 46]), t(S, [2, 47]), t(P, [2, 15]), t(P, [2, 19]), t(R, i, { 7: 78 }), t(P, [2, 26]), t(P, [2, 27]), { 5: [1, 79] }, { 5: [1, 80] }, { 4: a, 5: s, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: o, 17: l, 19: u, 21: [1, 81], 22: h, 24: d, 25: f, 26: p, 27: g, 28: m, 29: v, 32: 25, 33: y, 35: b, 37: w, 38: T, 41: E, 45: C, 48: k, 51: _, 52: L, 53: N, 54: A, 57: O }, t(P, [2, 32]), t(P, [2, 33]), t(P, [2, 21])],
    defaultActions: { 5: [2, 1], 6: [2, 2], 47: [2, 48], 48: [2, 49] },
    parseError: /* @__PURE__ */ x(function($, F) {
      if (F.recoverable)
        this.trace($);
      else {
        var G = new Error($);
        throw G.hash = F, G;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function($) {
      var F = this, G = [0], H = [], ee = [null], Y = [], re = this.table, ne = "", he = 0, K = 0, Z = 2, X = 1, q = Y.slice.call(arguments, 1), J = Object.create(this.lexer), j = { yy: {} };
      for (var pe in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, pe) && (j.yy[pe] = this.yy[pe]);
      J.setInput($, j.yy), j.yy.lexer = J, j.yy.parser = this, typeof J.yylloc > "u" && (J.yylloc = {});
      var te = J.yylloc;
      Y.push(te);
      var Ae = J.options && J.options.ranges;
      typeof j.yy.parseError == "function" ? this.parseError = j.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function W(Me) {
        G.length = G.length - 2 * Me, ee.length = ee.length - Me, Y.length = Y.length - Me;
      }
      x(W, "popStack");
      function Oe() {
        var Me;
        return Me = H.pop() || J.lex() || X, typeof Me != "number" && (Me instanceof Array && (H = Me, Me = H.pop()), Me = F.symbols_[Me] || Me), Me;
      }
      x(Oe, "lex");
      for (var ue, Ve, Ge, Ue, ke = {}, Pe, Se, _e, ze; ; ) {
        if (Ve = G[G.length - 1], this.defaultActions[Ve] ? Ge = this.defaultActions[Ve] : ((ue === null || typeof ue > "u") && (ue = Oe()), Ge = re[Ve] && re[Ve][ue]), typeof Ge > "u" || !Ge.length || !Ge[0]) {
          var me = "";
          ze = [];
          for (Pe in re[Ve])
            this.terminals_[Pe] && Pe > Z && ze.push("'" + this.terminals_[Pe] + "'");
          J.showPosition ? me = "Parse error on line " + (he + 1) + `:
` + J.showPosition() + `
Expecting ` + ze.join(", ") + ", got '" + (this.terminals_[ue] || ue) + "'" : me = "Parse error on line " + (he + 1) + ": Unexpected " + (ue == X ? "end of input" : "'" + (this.terminals_[ue] || ue) + "'"), this.parseError(me, {
            text: J.match,
            token: this.terminals_[ue] || ue,
            line: J.yylineno,
            loc: te,
            expected: ze
          });
        }
        if (Ge[0] instanceof Array && Ge.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Ve + ", token: " + ue);
        switch (Ge[0]) {
          case 1:
            G.push(ue), ee.push(J.yytext), Y.push(J.yylloc), G.push(Ge[1]), ue = null, K = J.yyleng, ne = J.yytext, he = J.yylineno, te = J.yylloc;
            break;
          case 2:
            if (Se = this.productions_[Ge[1]][1], ke.$ = ee[ee.length - Se], ke._$ = {
              first_line: Y[Y.length - (Se || 1)].first_line,
              last_line: Y[Y.length - 1].last_line,
              first_column: Y[Y.length - (Se || 1)].first_column,
              last_column: Y[Y.length - 1].last_column
            }, Ae && (ke._$.range = [
              Y[Y.length - (Se || 1)].range[0],
              Y[Y.length - 1].range[1]
            ]), Ue = this.performAction.apply(ke, [
              ne,
              K,
              he,
              j.yy,
              Ge[1],
              ee,
              Y
            ].concat(q)), typeof Ue < "u")
              return Ue;
            Se && (G = G.slice(0, -1 * Se * 2), ee = ee.slice(0, -1 * Se), Y = Y.slice(0, -1 * Se)), G.push(this.productions_[Ge[1]][0]), ee.push(ke.$), Y.push(ke._$), _e = re[G[G.length - 2]][G[G.length - 1]], G.push(_e);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, D = /* @__PURE__ */ function() {
    var B = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(F, G) {
        if (this.yy.parser)
          this.yy.parser.parseError(F, G);
        else
          throw new Error(F);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function($, F) {
        return this.yy = F || this.yy || {}, this._input = $, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var $ = this._input[0];
        this.yytext += $, this.yyleng++, this.offset++, this.match += $, this.matched += $;
        var F = $.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), $;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function($) {
        var F = $.length, G = $.split(/(?:\r\n?|\n)/g);
        this._input = $ + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - F), this.offset -= F;
        var H = 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 ee = 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 === H.length ? this.yylloc.first_column : 0) + H[H.length - G.length].length - G[0].length : this.yylloc.first_column - F
        }, this.options.ranges && (this.yylloc.range = [ee[0], ee[0] + this.yyleng - F]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function($) {
        this.unput(this.match.slice($));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var $ = this.matched.substr(0, this.matched.length - this.match.length);
        return ($.length > 20 ? "..." : "") + $.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var $ = this.match;
        return $.length < 20 && ($ += this._input.substr(0, 20 - $.length)), ($.substr(0, 20) + ($.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var $ = this.pastInput(), F = new Array($.length + 1).join("-");
        return $ + this.upcomingInput() + `
` + F + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function($, F) {
        var G, H, ee;
        if (this.options.backtrack_lexer && (ee = {
          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 && (ee.yylloc.range = this.yylloc.range.slice(0))), H = $[0].match(/(?:\r\n?|\n).*/g), H && (this.yylineno += H.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: H ? H[H.length - 1].length - H[H.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + $[0].length
        }, this.yytext += $[0], this.match += $[0], this.matches = $, 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($[0].length), this.matched += $[0], G = this.performAction.call(this, this.yy, this, F, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), G)
          return G;
        if (this._backtrack) {
          for (var Y in ee)
            this[Y] = ee[Y];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var $, F, G, H;
        this._more || (this.yytext = "", this.match = "");
        for (var ee = this._currentRules(), Y = 0; Y < ee.length; Y++)
          if (G = this._input.match(this.rules[ee[Y]]), G && (!F || G[0].length > F[0].length)) {
            if (F = G, H = Y, this.options.backtrack_lexer) {
              if ($ = this.test_match(G, ee[Y]), $ !== !1)
                return $;
              if (this._backtrack) {
                F = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return F ? ($ = this.test_match(F, ee[H]), $ !== !1 ? $ : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var F = this.next();
        return F || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(F) {
        this.conditionStack.push(F);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var F = this.conditionStack.length - 1;
        return F > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(F) {
        return F = this.conditionStack.length - 1 - Math.abs(F || 0), F >= 0 ? this.conditionStack[F] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(F) {
        this.begin(F);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(F, G, H, ee) {
        switch (H) {
          case 0:
            return 38;
          case 1:
            return 40;
          case 2:
            return 39;
          case 3:
            return 44;
          case 4:
            return 51;
          case 5:
            return 52;
          case 6:
            return 53;
          case 7:
            return 54;
          case 8:
            break;
          case 9:
            break;
          case 10:
            return 5;
          case 11:
            break;
          case 12:
            break;
          case 13:
            break;
          case 14:
            break;
          case 15:
            return this.pushState("SCALE"), 17;
          case 16:
            return 18;
          case 17:
            this.popState();
            break;
          case 18:
            return this.begin("acc_title"), 33;
          case 19:
            return this.popState(), "acc_title_value";
          case 20:
            return this.begin("acc_descr"), 35;
          case 21:
            return this.popState(), "acc_descr_value";
          case 22:
            this.begin("acc_descr_multiline");
            break;
          case 23:
            this.popState();
            break;
          case 24:
            return "acc_descr_multiline_value";
          case 25:
            return this.pushState("CLASSDEF"), 41;
          case 26:
            return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
          case 27:
            return this.popState(), this.pushState("CLASSDEFID"), 42;
          case 28:
            return this.popState(), 43;
          case 29:
            return this.pushState("CLASS"), 48;
          case 30:
            return this.popState(), this.pushState("CLASS_STYLE"), 49;
          case 31:
            return this.popState(), 50;
          case 32:
            return this.pushState("STYLE"), 45;
          case 33:
            return this.popState(), this.pushState("STYLEDEF_STYLES"), 46;
          case 34:
            return this.popState(), 47;
          case 35:
            return this.pushState("SCALE"), 17;
          case 36:
            return 18;
          case 37:
            this.popState();
            break;
          case 38:
            this.pushState("STATE");
            break;
          case 39:
            return this.popState(), G.yytext = G.yytext.slice(0, -8).trim(), 25;
          case 40:
            return this.popState(), G.yytext = G.yytext.slice(0, -8).trim(), 26;
          case 41:
            return this.popState(), G.yytext = G.yytext.slice(0, -10).trim(), 27;
          case 42:
            return this.popState(), G.yytext = G.yytext.slice(0, -8).trim(), 25;
          case 43:
            return this.popState(), G.yytext = G.yytext.slice(0, -8).trim(), 26;
          case 44:
            return this.popState(), G.yytext = G.yytext.slice(0, -10).trim(), 27;
          case 45:
            return 51;
          case 46:
            return 52;
          case 47:
            return 53;
          case 48:
            return 54;
          case 49:
            this.pushState("STATE_STRING");
            break;
          case 50:
            return this.pushState("STATE_ID"), "AS";
          case 51:
            return this.popState(), "ID";
          case 52:
            this.popState();
            break;
          case 53:
            return "STATE_DESCR";
          case 54:
            return 19;
          case 55:
            this.popState();
            break;
          case 56:
            return this.popState(), this.pushState("struct"), 20;
          case 57:
            break;
          case 58:
            return this.popState(), 21;
          case 59:
            break;
          case 60:
            return this.begin("NOTE"), 29;
          case 61:
            return this.popState(), this.pushState("NOTE_ID"), 59;
          case 62:
            return this.popState(), this.pushState("NOTE_ID"), 60;
          case 63:
            this.popState(), this.pushState("FLOATING_NOTE");
            break;
          case 64:
            return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS";
          case 65:
            break;
          case 66:
            return "NOTE_TEXT";
          case 67:
            return this.popState(), "ID";
          case 68:
            return this.popState(), this.pushState("NOTE_TEXT"), 24;
          case 69:
            return this.popState(), G.yytext = G.yytext.substr(2).trim(), 31;
          case 70:
            return this.popState(), G.yytext = G.yytext.slice(0, -8).trim(), 31;
          case 71:
            return 6;
          case 72:
            return 6;
          case 73:
            return 16;
          case 74:
            return 57;
          case 75:
            return 24;
          case 76:
            return G.yytext = G.yytext.trim(), 14;
          case 77:
            return 15;
          case 78:
            return 28;
          case 79:
            return 58;
          case 80:
            return 5;
          case 81:
            return "INVALID";
        }
      }, "anonymous"),
      rules: [/^(?:click\b)/i, /^(?:href\b)/i, /^(?:"[^"]*")/i, /^(?: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, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/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: [12, 13], inclusive: !1 }, struct: { rules: [12, 13, 25, 29, 32, 38, 45, 46, 47, 48, 57, 58, 59, 60, 74, 75, 76, 77, 78], inclusive: !1 }, FLOATING_NOTE_ID: { rules: [67], inclusive: !1 }, FLOATING_NOTE: { rules: [64, 65, 66], inclusive: !1 }, NOTE_TEXT: { rules: [69, 70], inclusive: !1 }, NOTE_ID: { rules: [68], inclusive: !1 }, NOTE: { rules: [61, 62, 63], inclusive: !1 }, STYLEDEF_STYLEOPTS: { rules: [], inclusive: !1 }, STYLEDEF_STYLES: { rules: [34], inclusive: !1 }, STYLE_IDS: { rules: [], inclusive: !1 }, STYLE: { rules: [33], inclusive: !1 }, CLASS_STYLE: { rules: [31], inclusive: !1 }, CLASS: { rules: [30], inclusive: !1 }, CLASSDEFID: { rules: [28], inclusive: !1 }, CLASSDEF: { rules: [26, 27], inclusive: !1 }, acc_descr_multiline: { rules: [23, 24], inclusive: !1 }, acc_descr: { rules: [21], inclusive: !1 }, acc_title: { rules: [19], inclusive: !1 }, SCALE: { rules: [16, 17, 36, 37], inclusive: !1 }, ALIAS: { rules: [], inclusive: !1 }, STATE_ID: { rules: [51], inclusive: !1 }, STATE_STRING: { rules: [52, 53], inclusive: !1 }, FORK_STATE: { rules: [], inclusive: !1 }, STATE: { rules: [12, 13, 39, 40, 41, 42, 43, 44, 49, 50, 54, 55, 56], inclusive: !1 }, ID: { rules: [12, 13], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 18, 20, 22, 25, 29, 32, 35, 38, 56, 60, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81], inclusive: !0 } }
    };
    return B;
  }();
  I.lexer = D;
  function M() {
    this.yy = {};
  }
  return x(M, "Parser"), M.prototype = I, I.Parser = M, new M();
}();
M6.parser = M6;
var Sq = M6, SAe = "TB", Cq = "TB", EN = "dir", mh = "state", lh = "root", D6 = "relation", CAe = "classDef", AAe = "style", _Ae = "applyClass", Mp = "default", Aq = "divider", _q = "fill:none", Lq = "fill: #333", Rq = "c", Nq = "text", Mq = "normal", D5 = "rect", I5 = "rectWithTitle", LAe = "stateStart", RAe = "stateEnd", kN = "divider", SN = "roundedWithTitle", NAe = "note", MAe = "noteGroup", x1 = "statediagram", DAe = "state", IAe = `${x1}-${DAe}`, Dq = "transition", OAe = "note", PAe = "note-edge", BAe = `${Dq} ${PAe}`, FAe = `${x1}-${OAe}`, $Ae = "cluster", zAe = `${x1}-${$Ae}`, VAe = "cluster-alt", GAe = `${x1}-${VAe}`, Iq = "parent", Oq = "note", UAe = "state", d7 = "----", WAe = `${d7}${Oq}`, CN = `${d7}${Iq}`, Pq = /* @__PURE__ */ x((t, e = Cq) => {
  if (!t.doc)
    return e;
  let r = e;
  for (const n of t.doc)
    n.stmt === "dir" && (r = n.value);
  return r;
}, "getDir"), HAe = /* @__PURE__ */ x(function(t, e) {
  return e.db.getClasses();
}, "getClasses"), qAe = /* @__PURE__ */ x(async function(t, e, r, n) {
  ae.info("REF0:"), ae.info("Drawing state diagram (v2)", e);
  const { securityLevel: i, state: a, layout: s } = we();
  n.db.extract(n.db.getRootDocV2());
  const o = n.db.getData(), l = Ff(e, i);
  o.type = n.type, o.layoutAlgorithm = s, o.nodeSpacing = (a == null ? void 0 : a.nodeSpacing) || 50, o.rankSpacing = (a == null ? void 0 : a.rankSpacing) || 50, o.markers = ["barb"], o.diagramId = e, await Af(o, l);
  const u = 8;
  try {
    (typeof n.db.getLinks == "function" ? n.db.getLinks() : /* @__PURE__ */ new Map()).forEach((d, f) => {
      var w;
      const p = typeof f == "string" ? f : typeof (f == null ? void 0 : f.id) == "string" ? f.id : "";
      if (!p) {
        ae.warn("⚠️ Invalid or missing stateId from key:", JSON.stringify(f));
        return;
      }
      const g = (w = l.node()) == null ? void 0 : w.querySelectorAll("g");
      let m;
      if (g == null || g.forEach((T) => {
        var C;
        ((C = T.textContent) == null ? void 0 : C.trim()) === p && (m = T);
      }), !m) {
        ae.warn("⚠️ Could not find node matching text:", p);
        return;
      }
      const v = m.parentNode;
      if (!v) {
        ae.warn("⚠️ Node has no parent, cannot wrap:", p);
        return;
      }
      const y = document.createElementNS("http://www.w3.org/2000/svg", "a"), b = d.url.replace(/^"+|"+$/g, "");
      if (y.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", b), y.setAttribute("target", "_blank"), d.tooltip) {
        const T = d.tooltip.replace(/^"+|"+$/g, "");
        y.setAttribute("title", T);
      }
      v.replaceChild(y, m), y.appendChild(m), ae.info("🔗 Wrapped node in <a> tag for:", p, d.url);
    });
  } catch (h) {
    ae.error("❌ Error injecting clickable links:", h);
  }
  Kt.insertTitle(
    l,
    "statediagramTitleText",
    (a == null ? void 0 : a.titleTopMargin) ?? 25,
    n.db.getDiagramTitle()
  ), zu(l, u, x1, (a == null ? void 0 : a.useMaxWidth) ?? !0);
}, "draw"), YAe = {
  getClasses: HAe,
  draw: qAe,
  getDir: Pq
}, Rv = /* @__PURE__ */ new Map(), xl = 0;
function Nv(t = "", e = 0, r = "", n = d7) {
  const i = r !== null && r.length > 0 ? `${n}${r}` : "";
  return `${UAe}-${t}${i}-${e}`;
}
x(Nv, "stateDomId");
var XAe = /* @__PURE__ */ x((t, e, r, n, i, a, s, o) => {
  ae.trace("items", e), e.forEach((l) => {
    switch (l.stmt) {
      case mh:
        mp(t, l, r, n, i, a, s, o);
        break;
      case Mp:
        mp(t, l, r, n, i, a, s, o);
        break;
      case D6:
        {
          mp(
            t,
            l.state1,
            r,
            n,
            i,
            a,
            s,
            o
          ), mp(
            t,
            l.state2,
            r,
            n,
            i,
            a,
            s,
            o
          );
          const u = {
            id: "edge" + xl,
            start: l.state1.id,
            end: l.state2.id,
            arrowhead: "normal",
            arrowTypeEnd: "arrow_barb",
            style: _q,
            labelStyle: "",
            label: at.sanitizeText(l.description ?? "", we()),
            arrowheadStyle: Lq,
            labelpos: Rq,
            labelType: Nq,
            thickness: Mq,
            classes: Dq,
            look: s
          };
          i.push(u), xl++;
        }
        break;
    }
  });
}, "setupDoc"), AN = /* @__PURE__ */ x((t, e = Cq) => {
  let r = e;
  if (t.doc)
    for (const n of t.doc)
      n.stmt === "dir" && (r = n.value);
  return r;
}, "getDir");
function gp(t, e, r) {
  if (!e.id || e.id === "</join></fork>" || e.id === "</choice>")
    return;
  e.cssClasses && (Array.isArray(e.cssCompiledStyles) || (e.cssCompiledStyles = []), e.cssClasses.split(" ").forEach((i) => {
    const a = r.get(i);
    a && (e.cssCompiledStyles = [...e.cssCompiledStyles ?? [], ...a.styles]);
  }));
  const n = t.find((i) => i.id === e.id);
  n ? Object.assign(n, e) : t.push(e);
}
x(gp, "insertOrUpdateNode");
function Bq(t) {
  var e;
  return ((e = t == null ? void 0 : t.classes) == null ? void 0 : e.join(" ")) ?? "";
}
x(Bq, "getClassesFromDbInfo");
function Fq(t) {
  return (t == null ? void 0 : t.styles) ?? [];
}
x(Fq, "getStylesFromDbInfo");
var mp = /* @__PURE__ */ x((t, e, r, n, i, a, s, o) => {
  var p, g, m;
  const l = e.id, u = r.get(l), h = Bq(u), d = Fq(u), f = we();
  if (ae.info("dataFetcher parsedItem", e, u, d), l !== "root") {
    let v = D5;
    e.start === !0 ? v = LAe : e.start === !1 && (v = RAe), e.type !== Mp && (v = e.type), Rv.get(l) || Rv.set(l, {
      id: l,
      shape: v,
      description: at.sanitizeText(l, f),
      cssClasses: `${h} ${IAe}`,
      cssStyles: d
    });
    const y = Rv.get(l);
    e.description && (Array.isArray(y.description) ? (y.shape = I5, y.description.push(e.description)) : (p = y.description) != null && p.length && y.description.length > 0 ? (y.shape = I5, y.description === l ? y.description = [e.description] : y.description = [y.description, e.description]) : (y.shape = D5, y.description = e.description), y.description = at.sanitizeTextOrArray(y.description, f)), ((g = y.description) == null ? void 0 : g.length) === 1 && y.shape === I5 && (y.type === "group" ? y.shape = SN : y.shape = D5), !y.type && e.doc && (ae.info("Setting cluster for XCX", l, AN(e)), y.type = "group", y.isGroup = !0, y.dir = AN(e), y.shape = e.type === Aq ? kN : SN, y.cssClasses = `${y.cssClasses} ${zAe} ${a ? GAe : ""}`);
    const b = {
      labelStyle: "",
      shape: y.shape,
      label: y.description,
      cssClasses: y.cssClasses,
      cssCompiledStyles: [],
      cssStyles: y.cssStyles,
      id: l,
      dir: y.dir,
      domId: Nv(l, xl),
      type: y.type,
      isGroup: y.type === "group",
      padding: 8,
      rx: 10,
      ry: 10,
      look: s
    };
    if (b.shape === kN && (b.label = ""), t && t.id !== "root" && (ae.trace("Setting node ", l, " to be child of its parent ", t.id), b.parentId = t.id), b.centerLabel = !0, e.note) {
      const w = {
        labelStyle: "",
        shape: NAe,
        label: e.note.text,
        cssClasses: FAe,
        // useHtmlLabels: false,
        cssStyles: [],
        cssCompiledStyles: [],
        id: l + WAe + "-" + xl,
        domId: Nv(l, xl, Oq),
        type: y.type,
        isGroup: y.type === "group",
        padding: (m = f.flowchart) == null ? void 0 : m.padding,
        look: s,
        position: e.note.position
      }, T = l + CN, E = {
        labelStyle: "",
        shape: MAe,
        label: e.note.text,
        cssClasses: y.cssClasses,
        cssStyles: [],
        id: l + CN,
        domId: Nv(l, xl, Iq),
        type: "group",
        isGroup: !0,
        padding: 16,
        //getConfig().flowchart.padding
        look: s,
        position: e.note.position
      };
      xl++, E.id = T, w.parentId = T, gp(n, E, o), gp(n, w, o), gp(n, b, o);
      let C = l, k = w.id;
      e.note.position === "left of" && (C = w.id, k = l), i.push({
        id: C + "-" + k,
        start: C,
        end: k,
        arrowhead: "none",
        arrowTypeEnd: "",
        style: _q,
        labelStyle: "",
        classes: BAe,
        arrowheadStyle: Lq,
        labelpos: Rq,
        labelType: Nq,
        thickness: Mq,
        look: s
      });
    } else
      gp(n, b, o);
  }
  e.doc && (ae.trace("Adding nodes children "), XAe(e, e.doc, r, n, i, !a, s, o));
}, "dataFetcher"), jAe = /* @__PURE__ */ x(() => {
  Rv.clear(), xl = 0;
}, "reset"), Oi = {
  START_NODE: "[*]",
  START_TYPE: "start",
  END_NODE: "[*]",
  END_TYPE: "end",
  COLOR_KEYWORD: "color",
  FILL_KEYWORD: "fill",
  BG_FILL: "bgFill",
  STYLECLASS_SEP: ","
}, _N = /* @__PURE__ */ x(() => /* @__PURE__ */ new Map(), "newClassesList"), LN = /* @__PURE__ */ x(() => ({
  relations: [],
  states: /* @__PURE__ */ new Map(),
  documents: {}
}), "newDoc"), Mm = /* @__PURE__ */ x((t) => JSON.parse(JSON.stringify(t)), "clone"), tu, zc = (tu = class {
  constructor(e) {
    this.version = e, this.nodes = [], this.edges = [], this.rootDoc = [], this.classes = _N(), this.documents = { root: LN() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.dividerCnt = 0, this.links = /* @__PURE__ */ new Map(), this.getAccTitle = Vn, this.setAccTitle = Cn, this.getAccDescription = Un, this.setAccDescription = Gn, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.clear(), this.setRootDoc = this.setRootDoc.bind(this), this.getDividerId = this.getDividerId.bind(this), this.setDirection = this.setDirection.bind(this), this.trimColon = this.trimColon.bind(this);
  }
  /**
   * Convert all of the statements (stmts) that were parsed into states and relationships.
   * This is done because a state diagram may have nested sections,
   * where each section is a 'document' and has its own set of statements.
   * Ex: the section within a fork has its own statements, and incoming and outgoing statements
   * refer to the fork as a whole (document).
   * See the parser grammar:  the definition of a document is a document then a 'line', where a line can be a statement.
   * This will push the statement into the list of statements for the current document.
   */
  extract(e) {
    this.clear(!0);
    for (const i of Array.isArray(e) ? e : e.doc)
      switch (i.stmt) {
        case mh:
          this.addState(i.id.trim(), i.type, i.doc, i.description, i.note);
          break;
        case D6:
          this.addRelation(i.state1, i.state2, i.description);
          break;
        case CAe:
          this.addStyleClass(i.id.trim(), i.classes);
          break;
        case AAe:
          this.handleStyleDef(i);
          break;
        case _Ae:
          this.setCssClass(i.id.trim(), i.styleClass);
          break;
        case "click":
          this.addLink(i.id, i.url, i.tooltip);
          break;
      }
    const r = this.getStates(), n = we();
    jAe(), mp(
      void 0,
      this.getRootDocV2(),
      r,
      this.nodes,
      this.edges,
      !0,
      n.look,
      this.classes
    );
    for (const i of this.nodes)
      if (Array.isArray(i.label)) {
        if (i.description = i.label.slice(1), i.isGroup && i.description.length > 0)
          throw new Error(
            `Group nodes can only have label. Remove the additional description for node [${i.id}]`
          );
        i.label = i.label[0];
      }
  }
  handleStyleDef(e) {
    const r = e.id.trim().split(","), n = e.styleClass.split(",");
    for (const i of r) {
      let a = this.getState(i);
      if (!a) {
        const s = i.trim();
        this.addState(s), a = this.getState(s);
      }
      a && (a.styles = n.map((s) => {
        var o;
        return (o = s.replace(/;/g, "")) == null ? void 0 : o.trim();
      }));
    }
  }
  setRootDoc(e) {
    ae.info("Setting root doc", e), this.rootDoc = e, this.version === 1 ? this.extract(e) : this.extract(this.getRootDocV2());
  }
  docTranslator(e, r, n) {
    if (r.stmt === D6) {
      this.docTranslator(e, r.state1, !0), this.docTranslator(e, r.state2, !1);
      return;
    }
    if (r.stmt === mh && (r.id === Oi.START_NODE ? (r.id = e.id + (n ? "_start" : "_end"), r.start = n) : r.id = r.id.trim()), r.stmt !== lh && r.stmt !== mh || !r.doc)
      return;
    const i = [];
    let a = [];
    for (const s of r.doc)
      if (s.type === Aq) {
        const o = Mm(s);
        o.doc = Mm(a), i.push(o), a = [];
      } else
        a.push(s);
    if (i.length > 0 && a.length > 0) {
      const s = {
        stmt: mh,
        id: rP(),
        type: "divider",
        doc: Mm(a)
      };
      i.push(Mm(s)), r.doc = i;
    }
    r.doc.forEach((s) => this.docTranslator(r, s, !0));
  }
  getRootDocV2() {
    return this.docTranslator(
      { id: lh, stmt: lh },
      { id: lh, stmt: lh, doc: this.rootDoc },
      !0
    ), { id: lh, doc: this.rootDoc };
  }
  /**
   * Function called by parser when a node definition has been found.
   *
   * @param descr - description for the state. Can be a string or a list or strings
   * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
   * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
   * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
   */
  addState(e, r = Mp, n = void 0, i = void 0, a = void 0, s = void 0, o = void 0, l = void 0) {
    const u = e == null ? void 0 : e.trim();
    if (!this.currentDocument.states.has(u))
      ae.info("Adding state ", u, i), this.currentDocument.states.set(u, {
        stmt: mh,
        id: u,
        descriptions: [],
        type: r,
        doc: n,
        note: a,
        classes: [],
        styles: [],
        textStyles: []
      });
    else {
      const h = this.currentDocument.states.get(u);
      if (!h)
        throw new Error(`State not found: ${u}`);
      h.doc || (h.doc = n), h.type || (h.type = r);
    }
    if (i && (ae.info("Setting state description", u, i), (Array.isArray(i) ? i : [i]).forEach((d) => this.addDescription(u, d.trim()))), a) {
      const h = this.currentDocument.states.get(u);
      if (!h)
        throw new Error(`State not found: ${u}`);
      h.note = a, h.note.text = at.sanitizeText(h.note.text, we());
    }
    s && (ae.info("Setting state classes", u, s), (Array.isArray(s) ? s : [s]).forEach((d) => this.setCssClass(u, d.trim()))), o && (ae.info("Setting state styles", u, o), (Array.isArray(o) ? o : [o]).forEach((d) => this.setStyle(u, d.trim()))), l && (ae.info("Setting state styles", u, o), (Array.isArray(l) ? l : [l]).forEach((d) => this.setTextStyle(u, d.trim())));
  }
  clear(e) {
    this.nodes = [], this.edges = [], this.documents = { root: LN() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.classes = _N(), e || (this.links = /* @__PURE__ */ new Map(), _n());
  }
  getState(e) {
    return this.currentDocument.states.get(e);
  }
  getStates() {
    return this.currentDocument.states;
  }
  logDocuments() {
    ae.info("Documents = ", this.documents);
  }
  getRelations() {
    return this.currentDocument.relations;
  }
  /**
   * Adds a clickable link to a state.
   */
  addLink(e, r, n) {
    this.links.set(e, { url: r, tooltip: n }), ae.warn("Adding link", e, r, n);
  }
  /**
   * Get all registered links.
   */
  getLinks() {
    return this.links;
  }
  /**
   * If the id is a start node ( [*] ), then return a new id constructed from
   * the start node name and the current start node count.
   * else return the given id
   */
  startIdIfNeeded(e = "") {
    return e === Oi.START_NODE ? (this.startEndCount++, `${Oi.START_TYPE}${this.startEndCount}`) : e;
  }
  /**
   * If the id is a start node ( [*] ), then return the start type ('start')
   * else return the given type
   */
  startTypeIfNeeded(e = "", r = Mp) {
    return e === Oi.START_NODE ? Oi.START_TYPE : r;
  }
  /**
   * If the id is an end node ( [*] ), then return a new id constructed from
   * the end node name and the current start_end node count.
   * else return the given id
   */
  endIdIfNeeded(e = "") {
    return e === Oi.END_NODE ? (this.startEndCount++, `${Oi.END_TYPE}${this.startEndCount}`) : e;
  }
  /**
   * If the id is an end node ( [*] ), then return the end type
   * else return the given type
   *
   */
  endTypeIfNeeded(e = "", r = Mp) {
    return e === Oi.END_NODE ? Oi.END_TYPE : r;
  }
  addRelationObjs(e, r, n = "") {
    const i = this.startIdIfNeeded(e.id.trim()), a = this.startTypeIfNeeded(e.id.trim(), e.type), s = this.startIdIfNeeded(r.id.trim()), o = this.startTypeIfNeeded(r.id.trim(), r.type);
    this.addState(
      i,
      a,
      e.doc,
      e.description,
      e.note,
      e.classes,
      e.styles,
      e.textStyles
    ), this.addState(
      s,
      o,
      r.doc,
      r.description,
      r.note,
      r.classes,
      r.styles,
      r.textStyles
    ), this.currentDocument.relations.push({
      id1: i,
      id2: s,
      relationTitle: at.sanitizeText(n, we())
    });
  }
  /**
   * Add a relation between two items.  The items may be full objects or just the string id of a state.
   */
  addRelation(e, r, n) {
    if (typeof e == "object" && typeof r == "object")
      this.addRelationObjs(e, r, n);
    else if (typeof e == "string" && typeof r == "string") {
      const i = this.startIdIfNeeded(e.trim()), a = this.startTypeIfNeeded(e), s = this.endIdIfNeeded(r.trim()), o = this.endTypeIfNeeded(r);
      this.addState(i, a), this.addState(s, o), this.currentDocument.relations.push({
        id1: i,
        id2: s,
        relationTitle: n ? at.sanitizeText(n, we()) : void 0
      });
    }
  }
  addDescription(e, r) {
    var a;
    const n = this.currentDocument.states.get(e), i = r.startsWith(":") ? r.replace(":", "").trim() : r;
    (a = n == null ? void 0 : n.descriptions) == null || a.push(at.sanitizeText(i, we()));
  }
  cleanupLabel(e) {
    return e.startsWith(":") ? e.slice(2).trim() : e.trim();
  }
  getDividerId() {
    return this.dividerCnt++, `divider-id-${this.dividerCnt}`;
  }
  /**
   * Called when the parser comes across a (style) class definition
   * @example classDef my-style fill:#f96;
   *
   * @param id - the id of this (style) class
   * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
   */
  addStyleClass(e, r = "") {
    this.classes.has(e) || this.classes.set(e, { id: e, styles: [], textStyles: [] });
    const n = this.classes.get(e);
    r && n && r.split(Oi.STYLECLASS_SEP).forEach((i) => {
      const a = i.replace(/([^;]*);/, "$1").trim();
      if (RegExp(Oi.COLOR_KEYWORD).exec(i)) {
        const o = a.replace(Oi.FILL_KEYWORD, Oi.BG_FILL).replace(Oi.COLOR_KEYWORD, Oi.FILL_KEYWORD);
        n.textStyles.push(o);
      }
      n.styles.push(a);
    });
  }
  getClasses() {
    return this.classes;
  }
  /**
   * Add a (style) class or css class to a state with the given id.
   * If the state isn't already in the list of known states, add it.
   * Might be called by parser when a style class or CSS class should be applied to a state
   *
   * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
   * @param cssClassName - CSS class name
   */
  setCssClass(e, r) {
    e.split(",").forEach((n) => {
      var a;
      let i = this.getState(n);
      if (!i) {
        const s = n.trim();
        this.addState(s), i = this.getState(s);
      }
      (a = i == null ? void 0 : i.classes) == null || a.push(r);
    });
  }
  /**
   * Add a style to a state with the given id.
   * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
   *   where 'style' is the keyword
   *   stateId is the id of a state
   *   the rest of the string is the styleText (all of the attributes to be applied to the state)
   *
   * @param itemId - The id of item to apply the style to
   * @param styleText - the text of the attributes for the style
   */
  setStyle(e, r) {
    var n, i;
    (i = (n = this.getState(e)) == null ? void 0 : n.styles) == null || i.push(r);
  }
  /**
   * Add a text style to a state with the given id
   *
   * @param itemId - The id of item to apply the css class to
   * @param cssClassName - CSS class name
   */
  setTextStyle(e, r) {
    var n, i;
    (i = (n = this.getState(e)) == null ? void 0 : n.textStyles) == null || i.push(r);
  }
  /**
   * Finds the direction statement in the root document.
   * @returns the direction statement if present
   */
  getDirectionStatement() {
    return this.rootDoc.find((e) => e.stmt === EN);
  }
  getDirection() {
    var e;
    return ((e = this.getDirectionStatement()) == null ? void 0 : e.value) ?? SAe;
  }
  setDirection(e) {
    const r = this.getDirectionStatement();
    r ? r.value = e : this.rootDoc.unshift({ stmt: EN, value: e });
  }
  trimColon(e) {
    return e.startsWith(":") ? e.slice(1).trim() : e.trim();
  }
  getData() {
    const e = we();
    return {
      nodes: this.nodes,
      edges: this.edges,
      other: {},
      config: e,
      direction: Pq(this.getRootDocV2())
    };
  }
  getConfig() {
    return we().state;
  }
}, x(tu, "StateDB"), tu.relationType = {
  AGGREGATION: 0,
  EXTENSION: 1,
  COMPOSITION: 2,
  DEPENDENCY: 3
}, tu), KAe = /* @__PURE__ */ x((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 {
  background-color: ${t.edgeLabelBackground};
  p {
    background-color: ${t.edgeLabelBackground};
  }
  rect {
    opacity: 0.5;
    background-color: ${t.edgeLabelBackground};
    fill: ${t.edgeLabelBackground};
  }
  text-align: center;
}
.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};
  // line-height: 1;
}

.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};
}
`, "getStyles"), $q = KAe, ZAe = /* @__PURE__ */ x((t) => t.append("circle").attr("class", "start-state").attr("r", we().state.sizeUnit).attr("cx", we().state.padding + we().state.sizeUnit).attr("cy", we().state.padding + we().state.sizeUnit), "drawStartState"), QAe = /* @__PURE__ */ x((t) => t.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", we().state.textHeight).attr("class", "divider").attr("x2", we().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider"), JAe = /* @__PURE__ */ x((t, e) => {
  const r = t.append("text").attr("x", 2 * we().state.padding).attr("y", we().state.textHeight + 2 * we().state.padding).attr("font-size", we().state.fontSize).attr("class", "state-title").text(e.id), n = r.node().getBBox();
  return t.insert("rect", ":first-child").attr("x", we().state.padding).attr("y", we().state.padding).attr("width", n.width + 2 * we().state.padding).attr("height", n.height + 2 * we().state.padding).attr("rx", we().state.radius), r;
}, "drawSimpleState"), e_e = /* @__PURE__ */ x((t, e) => {
  const r = /* @__PURE__ */ x(function(f, p, g) {
    const m = f.append("tspan").attr("x", 2 * we().state.padding).text(p);
    g || m.attr("dy", we().state.textHeight);
  }, "addTspan"), i = t.append("text").attr("x", 2 * we().state.padding).attr("y", we().state.textHeight + 1.3 * we().state.padding).attr("font-size", we().state.fontSize).attr("class", "state-title").text(e.descriptions[0]).node().getBBox(), a = i.height, s = t.append("text").attr("x", we().state.padding).attr(
    "y",
    a + we().state.padding * 0.4 + we().state.dividerMargin + we().state.textHeight
  ).attr("class", "state-description");
  let o = !0, l = !0;
  e.descriptions.forEach(function(f) {
    o || (r(s, f, l), l = !1), o = !1;
  });
  const u = t.append("line").attr("x1", we().state.padding).attr("y1", we().state.padding + a + we().state.dividerMargin / 2).attr("y2", we().state.padding + a + we().state.dividerMargin / 2).attr("class", "descr-divider"), h = s.node().getBBox(), d = Math.max(h.width, i.width);
  return u.attr("x2", d + 3 * we().state.padding), t.insert("rect", ":first-child").attr("x", we().state.padding).attr("y", we().state.padding).attr("width", d + 2 * we().state.padding).attr("height", h.height + a + 2 * we().state.padding).attr("rx", we().state.radius), t;
}, "drawDescrState"), t_e = /* @__PURE__ */ x((t, e, r) => {
  const n = we().state.padding, i = 2 * we().state.padding, a = t.node().getBBox(), s = a.width, o = a.x, l = t.append("text").attr("x", 0).attr("y", we().state.titleShift).attr("font-size", we().state.fontSize).attr("class", "state-title").text(e.id), h = l.node().getBBox().width + i;
  let d = Math.max(h, s);
  d === s && (d = d + i);
  let f;
  const p = t.node().getBBox();
  e.doc, f = o - n, h > s && (f = (s - d) / 2 + n), Math.abs(o - p.x) < n && h > s && (f = o - (h - s) / 2);
  const g = 1 - we().state.textHeight;
  return t.insert("rect", ":first-child").attr("x", f).attr("y", g).attr("class", r ? "alt-composit" : "composit").attr("width", d).attr(
    "height",
    p.height + we().state.textHeight + we().state.titleShift + 1
  ).attr("rx", "0"), l.attr("x", f + n), h <= s && l.attr("x", o + (d - i) / 2 - h / 2 + n), t.insert("rect", ":first-child").attr("x", f).attr(
    "y",
    we().state.titleShift - we().state.textHeight - we().state.padding
  ).attr("width", d).attr("height", we().state.textHeight * 3).attr("rx", we().state.radius), t.insert("rect", ":first-child").attr("x", f).attr(
    "y",
    we().state.titleShift - we().state.textHeight - we().state.padding
  ).attr("width", d).attr("height", p.height + 3 + 2 * we().state.textHeight).attr("rx", we().state.radius), t;
}, "addTitleAndBox"), r_e = /* @__PURE__ */ x((t) => (t.append("circle").attr("class", "end-state-outer").attr("r", we().state.sizeUnit + we().state.miniPadding).attr(
  "cx",
  we().state.padding + we().state.sizeUnit + we().state.miniPadding
).attr(
  "cy",
  we().state.padding + we().state.sizeUnit + we().state.miniPadding
), t.append("circle").attr("class", "end-state-inner").attr("r", we().state.sizeUnit).attr("cx", we().state.padding + we().state.sizeUnit + 2).attr("cy", we().state.padding + we().state.sizeUnit + 2)), "drawEndState"), n_e = /* @__PURE__ */ x((t, e) => {
  let r = we().state.forkWidth, n = we().state.forkHeight;
  if (e.parentId) {
    let i = r;
    r = n, n = i;
  }
  return t.append("rect").style("stroke", "black").style("fill", "black").attr("width", r).attr("height", n).attr("x", we().state.padding).attr("y", we().state.padding);
}, "drawForkJoinState"), i_e = /* @__PURE__ */ x((t, e, r, n) => {
  let i = 0;
  const a = n.append("text");
  a.style("text-anchor", "start"), a.attr("class", "noteText");
  let s = t.replace(/\r\n/g, "<br/>");
  s = s.replace(/\n/g, "<br/>");
  const o = s.split(at.lineBreakRegex);
  let l = 1.25 * we().state.noteMargin;
  for (const u of o) {
    const h = u.trim();
    if (h.length > 0) {
      const d = a.append("tspan");
      if (d.text(h), l === 0) {
        const f = d.node().getBBox();
        l += f.height;
      }
      i += l, d.attr("x", e + we().state.noteMargin), d.attr("y", r + i + 1.25 * we().state.noteMargin);
    }
  }
  return { textWidth: a.node().getBBox().width, textHeight: i };
}, "_drawLongText"), a_e = /* @__PURE__ */ x((t, e) => {
  e.attr("class", "state-note");
  const r = e.append("rect").attr("x", 0).attr("y", we().state.padding), n = e.append("g"), { textWidth: i, textHeight: a } = i_e(t, 0, 0, n);
  return r.attr("height", a + 2 * we().state.noteMargin), r.attr("width", i + we().state.noteMargin * 2), r;
}, "drawNote"), RN = /* @__PURE__ */ x(function(t, e) {
  const r = e.id, n = {
    id: r,
    label: e.id,
    width: 0,
    height: 0
  }, i = t.append("g").attr("id", r).attr("class", "stateGroup");
  e.type === "start" && ZAe(i), e.type === "end" && r_e(i), (e.type === "fork" || e.type === "join") && n_e(i, e), e.type === "note" && a_e(e.note.text, i), e.type === "divider" && QAe(i), e.type === "default" && e.descriptions.length === 0 && JAe(i, e), e.type === "default" && e.descriptions.length > 0 && e_e(i, e);
  const a = i.node().getBBox();
  return n.width = a.width + 2 * we().state.padding, n.height = a.height + 2 * we().state.padding, n;
}, "drawState"), NN = 0, s_e = /* @__PURE__ */ x(function(t, e, r) {
  const n = /* @__PURE__ */ x(function(l) {
    switch (l) {
      case zc.relationType.AGGREGATION:
        return "aggregation";
      case zc.relationType.EXTENSION:
        return "extension";
      case zc.relationType.COMPOSITION:
        return "composition";
      case zc.relationType.DEPENDENCY:
        return "dependency";
    }
  }, "getRelationType");
  e.points = e.points.filter((l) => !Number.isNaN(l.y));
  const i = e.points, a = Gp().x(function(l) {
    return l.x;
  }).y(function(l) {
    return l.y;
  }).curve(Rh), s = t.append("path").attr("d", a(i)).attr("id", "edge" + NN).attr("class", "transition");
  let o = "";
  if (we().state.arrowMarkerAbsolute && (o = z2(!0)), s.attr(
    "marker-end",
    "url(" + o + "#" + n(zc.relationType.DEPENDENCY) + "End)"
  ), r.title !== void 0) {
    const l = t.append("g").attr("class", "stateLabel"), { x: u, y: h } = Kt.calcLabelPosition(e.points), d = at.getRows(r.title);
    let f = 0;
    const p = [];
    let g = 0, m = 0;
    for (let b = 0; b <= d.length; b++) {
      const w = l.append("text").attr("text-anchor", "middle").text(d[b]).attr("x", u).attr("y", h + f), T = w.node().getBBox();
      g = Math.max(g, T.width), m = Math.min(m, T.x), ae.info(T.x, u, h + f), f === 0 && (f = w.node().getBBox().height, ae.info("Title height", f, h)), p.push(w);
    }
    let v = f * d.length;
    if (d.length > 1) {
      const b = (d.length - 1) * f * 0.5;
      p.forEach((w, T) => w.attr("y", h + T * f - b)), v = f * d.length;
    }
    const y = l.node().getBBox();
    l.insert("rect", ":first-child").attr("class", "box").attr("x", u - g / 2 - we().state.padding / 2).attr("y", h - v / 2 - we().state.padding / 2 - 3.5).attr("width", g + we().state.padding).attr("height", v + we().state.padding), ae.info(y);
  }
  NN++;
}, "drawEdge"), Ea, O5 = {}, o_e = /* @__PURE__ */ x(function() {
}, "setConf"), l_e = /* @__PURE__ */ x(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");
}, "insertMarkers"), c_e = /* @__PURE__ */ x(function(t, e, r, n) {
  Ea = we().state;
  const i = we().securityLevel;
  let a;
  i === "sandbox" && (a = Qe("#i" + e));
  const s = Qe(i === "sandbox" ? a.nodes()[0].contentDocument.body : "body"), o = i === "sandbox" ? a.nodes()[0].contentDocument : document;
  ae.debug("Rendering diagram " + t);
  const l = s.select(`[id='${e}']`);
  l_e(l);
  const u = n.db.getRootDoc();
  zq(u, l, void 0, !1, s, o, n);
  const h = Ea.padding, d = l.node().getBBox(), f = d.width + h * 2, p = d.height + h * 2, g = f * 1.75;
  Ki(l, p, g, Ea.useMaxWidth), l.attr(
    "viewBox",
    `${d.x - Ea.padding}  ${d.y - Ea.padding} ` + f + " " + p
  );
}, "draw"), u_e = /* @__PURE__ */ x((t) => t ? t.length * Ea.fontSizeFactor : 1, "getLabelWidth"), zq = /* @__PURE__ */ x((t, e, r, n, i, a, s) => {
  const o = new va({
    compound: !0,
    multigraph: !0
  });
  let l, u = !0;
  for (l = 0; l < t.length; l++)
    if (t[l].stmt === "relation") {
      u = !1;
      break;
    }
  r ? o.setGraph({
    rankdir: "LR",
    multigraph: !0,
    compound: !0,
    // acyclicer: 'greedy',
    ranker: "tight-tree",
    ranksep: u ? 1 : Ea.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 : Ea.edgeLengthFactor,
    nodeSep: u ? 1 : 50,
    ranker: "tight-tree",
    // ranker: 'network-simplex'
    isMultiGraph: !0
  }), o.setDefaultEdgeLabel(function() {
    return {};
  });
  const h = s.db.getStates(), d = s.db.getRelations(), f = Object.keys(h);
  for (const y of f) {
    const b = h[y];
    r && (b.parentId = r);
    let w;
    if (b.doc) {
      let T = e.append("g").attr("id", b.id).attr("class", "stateGroup");
      w = zq(b.doc, T, b.id, !n, i, a, s);
      {
        T = t_e(T, b, n);
        let E = T.node().getBBox();
        w.width = E.width, w.height = E.height + Ea.padding / 2, O5[b.id] = { y: Ea.compositTitleSize };
      }
    } else
      w = RN(e, b, o);
    if (b.note) {
      const T = {
        descriptions: [],
        id: b.id + "-note",
        note: b.note,
        type: "note"
      }, E = RN(e, T, o);
      b.note.position === "left of" ? (o.setNode(w.id + "-note", E), o.setNode(w.id, w)) : (o.setNode(w.id, w), o.setNode(w.id + "-note", E)), o.setParent(w.id, w.id + "-group"), o.setParent(w.id + "-note", w.id + "-group");
    } else
      o.setNode(w.id, w);
  }
  ae.debug("Count=", o.nodeCount(), o);
  let p = 0;
  d.forEach(function(y) {
    p++, ae.debug("Setting edge", y), o.setEdge(
      y.id1,
      y.id2,
      {
        relation: y,
        width: u_e(y.title),
        height: Ea.labelHeight * at.getRows(y.title).length,
        labelpos: "c"
      },
      "id" + p
    );
  }), Zz(o), ae.debug("Graph after layout", o.nodes());
  const g = e.node();
  o.nodes().forEach(function(y) {
    y !== void 0 && o.node(y) !== void 0 ? (ae.warn("Node " + y + ": " + JSON.stringify(o.node(y))), i.select("#" + g.id + " #" + y).attr(
      "transform",
      "translate(" + (o.node(y).x - o.node(y).width / 2) + "," + (o.node(y).y + (O5[y] ? O5[y].y : 0) - o.node(y).height / 2) + " )"
    ), i.select("#" + g.id + " #" + y).attr("data-x-shift", o.node(y).x - o.node(y).width / 2), a.querySelectorAll("#" + g.id + " #" + y + " .divider").forEach((w) => {
      const T = w.parentElement;
      let E = 0, C = 0;
      T && (T.parentElement && (E = T.parentElement.getBBox().width), C = parseInt(T.getAttribute("data-x-shift"), 10), Number.isNaN(C) && (C = 0)), w.setAttribute("x1", 0 - C + 8), w.setAttribute("x2", E - C - 8);
    })) : ae.debug("No Node " + y + ": " + JSON.stringify(o.node(y)));
  });
  let m = g.getBBox();
  o.edges().forEach(function(y) {
    y !== void 0 && o.edge(y) !== void 0 && (ae.debug("Edge " + y.v + " -> " + y.w + ": " + JSON.stringify(o.edge(y))), s_e(e, o.edge(y), o.edge(y).relation));
  }), m = g.getBBox();
  const v = {
    id: r || "root",
    label: r || "root",
    width: 0,
    height: 0
  };
  return v.width = m.width + 2 * Ea.padding, v.height = m.height + 2 * Ea.padding, ae.debug("Doc rendered", v, o), v;
}, "renderDoc"), h_e = {
  setConf: o_e,
  draw: c_e
}, d_e = {
  parser: Sq,
  get db() {
    return new zc(1);
  },
  renderer: h_e,
  styles: $q,
  init: /* @__PURE__ */ x((t) => {
    t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute;
  }, "init")
};
const f_e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: d_e
}, Symbol.toStringTag, { value: "Module" }));
var p_e = {
  parser: Sq,
  get db() {
    return new zc(2);
  },
  renderer: YAe,
  styles: $q,
  init: /* @__PURE__ */ x((t) => {
    t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute;
  }, "init")
};
const g_e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: p_e
}, Symbol.toStringTag, { value: "Module" }));
var I6 = function() {
  var t = /* @__PURE__ */ x(function(d, f, p, g) {
    for (p = p || {}, g = d.length; g--; p[d[g]] = f) ;
    return p;
  }, "o"), e = [6, 8, 10, 11, 12, 14, 16, 17, 18], r = [1, 9], n = [1, 10], i = [1, 11], a = [1, 12], s = [1, 13], o = [1, 14], l = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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: /* @__PURE__ */ x(function(f, p, g, m, v, y, b) {
      var w = y.length - 1;
      switch (v) {
        case 1:
          return y[w - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          y[w - 1].push(y[w]), this.$ = y[w - 1];
          break;
        case 4:
        case 5:
          this.$ = y[w];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          m.setDiagramTitle(y[w].substr(6)), this.$ = y[w].substr(6);
          break;
        case 9:
          this.$ = y[w].trim(), m.setAccTitle(this.$);
          break;
        case 10:
        case 11:
          this.$ = y[w].trim(), m.setAccDescription(this.$);
          break;
        case 12:
          m.addSection(y[w].substr(8)), this.$ = y[w].substr(8);
          break;
        case 13:
          m.addTask(y[w - 1], y[w]), this.$ = "task";
          break;
      }
    }, "anonymous"),
    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: r, 12: n, 14: i, 16: a, 17: s, 18: o }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 15, 11: r, 12: n, 14: i, 16: a, 17: s, 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: /* @__PURE__ */ x(function(f, p) {
      if (p.recoverable)
        this.trace(f);
      else {
        var g = new Error(f);
        throw g.hash = p, g;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(f) {
      var p = this, g = [0], m = [], v = [null], y = [], b = this.table, w = "", T = 0, E = 0, C = 2, k = 1, _ = y.slice.call(arguments, 1), L = Object.create(this.lexer), N = { yy: {} };
      for (var A in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, A) && (N.yy[A] = this.yy[A]);
      L.setInput(f, N.yy), N.yy.lexer = L, N.yy.parser = this, typeof L.yylloc > "u" && (L.yylloc = {});
      var O = L.yylloc;
      y.push(O);
      var P = L.options && L.options.ranges;
      typeof N.yy.parseError == "function" ? this.parseError = N.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function S(re) {
        g.length = g.length - 2 * re, v.length = v.length - re, y.length = y.length - re;
      }
      x(S, "popStack");
      function R() {
        var re;
        return re = m.pop() || L.lex() || k, typeof re != "number" && (re instanceof Array && (m = re, re = m.pop()), re = p.symbols_[re] || re), re;
      }
      x(R, "lex");
      for (var I, D, M, B, $ = {}, F, G, H, ee; ; ) {
        if (D = g[g.length - 1], this.defaultActions[D] ? M = this.defaultActions[D] : ((I === null || typeof I > "u") && (I = R()), M = b[D] && b[D][I]), typeof M > "u" || !M.length || !M[0]) {
          var Y = "";
          ee = [];
          for (F in b[D])
            this.terminals_[F] && F > C && ee.push("'" + this.terminals_[F] + "'");
          L.showPosition ? Y = "Parse error on line " + (T + 1) + `:
` + L.showPosition() + `
Expecting ` + ee.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : Y = "Parse error on line " + (T + 1) + ": Unexpected " + (I == k ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(Y, {
            text: L.match,
            token: this.terminals_[I] || I,
            line: L.yylineno,
            loc: O,
            expected: ee
          });
        }
        if (M[0] instanceof Array && M.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + D + ", token: " + I);
        switch (M[0]) {
          case 1:
            g.push(I), v.push(L.yytext), y.push(L.yylloc), g.push(M[1]), I = null, E = L.yyleng, w = L.yytext, T = L.yylineno, O = L.yylloc;
            break;
          case 2:
            if (G = this.productions_[M[1]][1], $.$ = v[v.length - G], $._$ = {
              first_line: y[y.length - (G || 1)].first_line,
              last_line: y[y.length - 1].last_line,
              first_column: y[y.length - (G || 1)].first_column,
              last_column: y[y.length - 1].last_column
            }, P && ($._$.range = [
              y[y.length - (G || 1)].range[0],
              y[y.length - 1].range[1]
            ]), B = this.performAction.apply($, [
              w,
              E,
              T,
              N.yy,
              M[1],
              v,
              y
            ].concat(_)), typeof B < "u")
              return B;
            G && (g = g.slice(0, -1 * G * 2), v = v.slice(0, -1 * G), y = y.slice(0, -1 * G)), g.push(this.productions_[M[1]][0]), v.push($.$), y.push($._$), H = b[g[g.length - 2]][g[g.length - 1]], g.push(H);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, u = /* @__PURE__ */ function() {
    var d = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(p, g) {
        if (this.yy.parser)
          this.yy.parser.parseError(p, g);
        else
          throw new Error(p);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(f, p) {
        return this.yy = p || this.yy || {}, this._input = f, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var f = this._input[0];
        this.yytext += f, this.yyleng++, this.offset++, this.match += f, this.matched += f;
        var p = f.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), f;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(f) {
        var p = f.length, g = f.split(/(?:\r\n?|\n)/g);
        this._input = f + 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), g.length - 1 && (this.yylineno -= g.length - 1);
        var v = 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 === m.length ? this.yylloc.first_column : 0) + m[m.length - g.length].length - g[0].length : this.yylloc.first_column - p
        }, this.options.ranges && (this.yylloc.range = [v[0], v[0] + this.yyleng - p]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(f) {
        this.unput(this.match.slice(f));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var f = this.matched.substr(0, this.matched.length - this.match.length);
        return (f.length > 20 ? "..." : "") + f.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var f = this.match;
        return f.length < 20 && (f += this._input.substr(0, 20 - f.length)), (f.substr(0, 20) + (f.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var f = this.pastInput(), p = new Array(f.length + 1).join("-");
        return f + this.upcomingInput() + `
` + p + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(f, p) {
        var g, m, v;
        if (this.options.backtrack_lexer && (v = {
          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 && (v.yylloc.range = this.yylloc.range.slice(0))), m = f[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 + f[0].length
        }, this.yytext += f[0], this.match += f[0], this.matches = f, 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(f[0].length), this.matched += f[0], g = this.performAction.call(this, this.yy, this, p, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), g)
          return g;
        if (this._backtrack) {
          for (var y in v)
            this[y] = v[y];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var f, p, g, m;
        this._more || (this.yytext = "", this.match = "");
        for (var v = this._currentRules(), y = 0; y < v.length; y++)
          if (g = this._input.match(this.rules[v[y]]), g && (!p || g[0].length > p[0].length)) {
            if (p = g, m = y, this.options.backtrack_lexer) {
              if (f = this.test_match(g, v[y]), f !== !1)
                return f;
              if (this._backtrack) {
                p = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return p ? (f = this.test_match(p, v[m]), f !== !1 ? f : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var p = this.next();
        return p || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(p) {
        this.conditionStack.push(p);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var p = this.conditionStack.length - 1;
        return p > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(p) {
        return p = this.conditionStack.length - 1 - Math.abs(p || 0), p >= 0 ? this.conditionStack[p] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(p) {
        this.begin(p);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(p, g, m, v) {
        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";
        }
      }, "anonymous"),
      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 d;
  }();
  l.lexer = u;
  function h() {
    this.yy = {};
  }
  return x(h, "Parser"), h.prototype = l, l.Parser = h, new h();
}();
I6.parser = I6;
var m_e = I6, vf = "", f7 = [], Eg = [], kg = [], v_e = /* @__PURE__ */ x(function() {
  f7.length = 0, Eg.length = 0, vf = "", kg.length = 0, _n();
}, "clear"), y_e = /* @__PURE__ */ x(function(t) {
  vf = t, f7.push(t);
}, "addSection"), x_e = /* @__PURE__ */ x(function() {
  return f7;
}, "getSections"), b_e = /* @__PURE__ */ x(function() {
  let t = MN();
  const e = 100;
  let r = 0;
  for (; !t && r < e; )
    t = MN(), r++;
  return Eg.push(...kg), Eg;
}, "getTasks"), w_e = /* @__PURE__ */ x(function() {
  const t = [];
  return Eg.forEach((r) => {
    r.people && t.push(...r.people);
  }), [...new Set(t)].sort();
}, "updateActors"), T_e = /* @__PURE__ */ x(function(t, e) {
  const r = e.substr(1).split(":");
  let n = 0, i = [];
  r.length === 1 ? (n = Number(r[0]), i = []) : (n = Number(r[0]), i = r[1].split(","));
  const a = i.map((o) => o.trim()), s = {
    section: vf,
    type: vf,
    people: a,
    task: t,
    score: n
  };
  kg.push(s);
}, "addTask"), E_e = /* @__PURE__ */ x(function(t) {
  const e = {
    section: vf,
    type: vf,
    description: t,
    task: t,
    classes: []
  };
  Eg.push(e);
}, "addTaskOrg"), MN = /* @__PURE__ */ x(function() {
  const t = /* @__PURE__ */ x(function(r) {
    return kg[r].processed;
  }, "compileTask");
  let e = !0;
  for (const [r, n] of kg.entries())
    t(r), e = e && n.processed;
  return e;
}, "compileTasks"), k_e = /* @__PURE__ */ x(function() {
  return w_e();
}, "getActors"), DN = {
  getConfig: /* @__PURE__ */ x(() => we().journey, "getConfig"),
  clear: v_e,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln,
  setAccTitle: Cn,
  getAccTitle: Vn,
  setAccDescription: Gn,
  getAccDescription: Un,
  addSection: y_e,
  getSections: x_e,
  getTasks: b_e,
  addTask: T_e,
  addTaskOrg: E_e,
  getActors: k_e
}, S_e = /* @__PURE__ */ x((t) => `.label {
    font-family: ${t.fontFamily};
    color: ${t.textColor};
  }
  .mouth {
    stroke: #666;
  }

  line {
    stroke: ${t.textColor}
  }

  .legend {
    fill: ${t.textColor};
    font-family: ${t.fontFamily};
  }

  .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: ${t.fontFamily};
    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}` : ""};
  }
  ${l1()}
`, "getStyles"), C_e = S_e, p7 = /* @__PURE__ */ x(function(t, e) {
  return Yx(t, e);
}, "drawRect"), A_e = /* @__PURE__ */ x(function(t, e) {
  const n = t.append("circle").attr("cx", e.cx).attr("cy", e.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), i = t.append("g");
  i.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"), i.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 a(l) {
    const u = jd().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) + ")");
  }
  x(a, "smile");
  function s(l) {
    const u = jd().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) + ")");
  }
  x(s, "sad");
  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 x(o, "ambivalent"), e.score > 3 ? a(i) : e.score < 3 ? s(i) : o(i), n;
}, "drawFace"), Vq = /* @__PURE__ */ x(function(t, e) {
  const r = t.append("circle");
  return r.attr("cx", e.cx), r.attr("cy", e.cy), r.attr("class", "actor-" + e.pos), r.attr("fill", e.fill), r.attr("stroke", e.stroke), r.attr("r", e.r), r.class !== void 0 && r.attr("class", r.class), e.title !== void 0 && r.append("title").text(e.title), r;
}, "drawCircle"), Gq = /* @__PURE__ */ x(function(t, e) {
  return e3e(t, e);
}, "drawText"), __e = /* @__PURE__ */ x(function(t, e) {
  function r(i, a, s, o, l) {
    return i + "," + a + " " + (i + s) + "," + a + " " + (i + s) + "," + (a + o - l) + " " + (i + s - l * 1.2) + "," + (a + o) + " " + i + "," + (a + o);
  }
  x(r, "genPoints");
  const n = t.append("polygon");
  n.attr("points", r(e.x, e.y, 50, 20, 7)), n.attr("class", "labelBox"), e.y = e.y + e.labelMargin, e.x = e.x + 0.5 * e.labelMargin, Gq(t, e);
}, "drawLabel"), L_e = /* @__PURE__ */ x(function(t, e, r) {
  const n = t.append("g"), i = Ia();
  i.x = e.x, i.y = e.y, i.fill = e.fill, i.width = r.width * e.taskCount + // width of the tasks
  r.diagramMarginX * (e.taskCount - 1), i.height = r.height, i.class = "journey-section section-type-" + e.num, i.rx = 3, i.ry = 3, p7(n, i), Uq(r)(
    e.text,
    n,
    i.x,
    i.y,
    i.width,
    i.height,
    { class: "journey-section section-type-" + e.num },
    r,
    e.colour
  );
}, "drawSection"), IN = -1, R_e = /* @__PURE__ */ x(function(t, e, r) {
  const n = e.x + r.width / 2, i = t.append("g");
  IN++;
  const a = 300 + 5 * 30;
  i.append("line").attr("id", "task" + IN).attr("x1", n).attr("y1", e.y).attr("x2", n).attr("y2", a).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), A_e(i, {
    cx: n,
    cy: 300 + (5 - e.score) * 30,
    score: e.score
  });
  const s = Ia();
  s.x = e.x, s.y = e.y, s.fill = e.fill, s.width = r.width, s.height = r.height, s.class = "task task-type-" + e.num, s.rx = 3, s.ry = 3, p7(i, s);
  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
    };
    Vq(i, h), o += 10;
  }), Uq(r)(
    e.task,
    i,
    s.x,
    s.y,
    s.width,
    s.height,
    { class: "task" },
    r,
    e.colour
  );
}, "drawTask"), N_e = /* @__PURE__ */ x(function(t, e) {
  nU(t, e);
}, "drawBackgroundRect"), Uq = /* @__PURE__ */ function() {
  function t(i, a, s, o, l, u, h, d) {
    const f = a.append("text").attr("x", s + l / 2).attr("y", o + u / 2 + 5).style("font-color", d).style("text-anchor", "middle").text(i);
    n(f, h);
  }
  x(t, "byText");
  function e(i, a, s, o, l, u, h, d, f) {
    const { taskFontSize: p, taskFontFamily: g } = d, m = i.split(/<br\s*\/?>/gi);
    for (let v = 0; v < m.length; v++) {
      const y = v * p - p * (m.length - 1) / 2, b = a.append("text").attr("x", s + l / 2).attr("y", o).attr("fill", f).style("text-anchor", "middle").style("font-size", p).style("font-family", g);
      b.append("tspan").attr("x", s + l / 2).attr("dy", y).text(m[v]), b.attr("y", o + u / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), n(b, h);
    }
  }
  x(e, "byTspan");
  function r(i, a, s, o, l, u, h, d) {
    const f = a.append("switch"), g = f.append("foreignObject").attr("x", s).attr("y", o).attr("width", l).attr("height", u).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    g.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, f, s, o, l, u, h, d), n(g, h);
  }
  x(r, "byFo");
  function n(i, a) {
    for (const s in a)
      s in a && i.attr(s, a[s]);
  }
  return x(n, "_setTextAttrs"), function(i) {
    return i.textPlacement === "fo" ? r : i.textPlacement === "old" ? t : e;
  };
}(), M_e = /* @__PURE__ */ x(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");
}, "initGraphics"), Sg = {
  drawRect: p7,
  drawCircle: Vq,
  drawSection: L_e,
  drawText: Gq,
  drawLabel: __e,
  drawTask: R_e,
  drawBackgroundRect: N_e,
  initGraphics: M_e
}, D_e = /* @__PURE__ */ x(function(t) {
  Object.keys(t).forEach(function(r) {
    os[r] = t[r];
  });
}, "setConf"), Po = {}, Mv = 0;
function Wq(t) {
  const e = we().journey, r = e.maxLabelWidth;
  Mv = 0;
  let n = 60;
  Object.keys(Po).forEach((i) => {
    const a = Po[i].color, s = {
      cx: 20,
      cy: n,
      r: 7,
      fill: a,
      stroke: "#000",
      pos: Po[i].position
    };
    Sg.drawCircle(t, s);
    let o = t.append("text").attr("visibility", "hidden").text(i);
    const l = o.node().getBoundingClientRect().width;
    o.remove();
    let u = [];
    if (l <= r)
      u = [i];
    else {
      const h = i.split(" ");
      let d = "";
      o = t.append("text").attr("visibility", "hidden"), h.forEach((f) => {
        const p = d ? `${d} ${f}` : f;
        if (o.text(p), o.node().getBoundingClientRect().width > r) {
          if (d && u.push(d), d = f, o.text(f), o.node().getBoundingClientRect().width > r) {
            let m = "";
            for (const v of f)
              m += v, o.text(m + "-"), o.node().getBoundingClientRect().width > r && (u.push(m.slice(0, -1) + "-"), m = v);
            d = m;
          }
        } else
          d = p;
      }), d && u.push(d), o.remove();
    }
    u.forEach((h, d) => {
      const f = {
        x: 40,
        y: n + 7 + d * 20,
        fill: "#666",
        text: h,
        textMargin: e.boxTextMargin ?? 5
      }, g = Sg.drawText(t, f).node().getBoundingClientRect().width;
      g > Mv && g > e.leftMargin - g && (Mv = g);
    }), n += Math.max(20, u.length * 20);
  });
}
x(Wq, "drawActorLegend");
var os = we().journey, vl = 0, I_e = /* @__PURE__ */ x(function(t, e, r, n) {
  const i = we(), a = i.journey.titleColor, s = i.journey.titleFontSize, o = i.journey.titleFontFamily, l = i.securityLevel;
  let u;
  l === "sandbox" && (u = Qe("#i" + e));
  const h = Qe(l === "sandbox" ? u.nodes()[0].contentDocument.body : "body");
  Ga.init();
  const d = h.select("#" + e);
  Sg.initGraphics(d);
  const f = n.db.getTasks(), p = n.db.getDiagramTitle(), g = n.db.getActors();
  for (const T in Po)
    delete Po[T];
  let m = 0;
  g.forEach((T) => {
    Po[T] = {
      color: os.actorColours[m % os.actorColours.length],
      position: m
    }, m++;
  }), Wq(d), vl = os.leftMargin + Mv, Ga.insert(0, 0, vl, Object.keys(Po).length * 50), O_e(d, f, 0);
  const v = Ga.getBounds();
  p && d.append("text").text(p).attr("x", vl).attr("font-size", s).attr("font-weight", "bold").attr("y", 25).attr("fill", a).attr("font-family", o);
  const y = v.stopy - v.starty + 2 * os.diagramMarginY, b = vl + v.stopx + 2 * os.diagramMarginX;
  Ki(d, y, b, os.useMaxWidth), d.append("line").attr("x1", vl).attr("y1", os.height * 4).attr("x2", b - vl - 4).attr("y2", os.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
  const w = p ? 70 : 0;
  d.attr("viewBox", `${v.startx} -25 ${b} ${y + w}`), d.attr("preserveAspectRatio", "xMinYMin meet"), d.attr("height", y + w + 25);
}, "draw"), Ga = {
  data: {
    startx: void 0,
    stopx: void 0,
    starty: void 0,
    stopy: void 0
  },
  verticalPos: 0,
  sequenceItems: [],
  init: /* @__PURE__ */ x(function() {
    this.sequenceItems = [], this.data = {
      startx: void 0,
      stopx: void 0,
      starty: void 0,
      stopy: void 0
    }, this.verticalPos = 0;
  }, "init"),
  updateVal: /* @__PURE__ */ x(function(t, e, r, n) {
    t[e] === void 0 ? t[e] = r : t[e] = n(r, t[e]);
  }, "updateVal"),
  updateBounds: /* @__PURE__ */ x(function(t, e, r, n) {
    const i = we().journey, a = this;
    let s = 0;
    function o(l) {
      return /* @__PURE__ */ x(function(h) {
        s++;
        const d = a.sequenceItems.length - s + 1;
        a.updateVal(h, "starty", e - d * i.boxMargin, Math.min), a.updateVal(h, "stopy", n + d * i.boxMargin, Math.max), a.updateVal(Ga.data, "startx", t - d * i.boxMargin, Math.min), a.updateVal(Ga.data, "stopx", r + d * i.boxMargin, Math.max), l !== "activation" && (a.updateVal(h, "startx", t - d * i.boxMargin, Math.min), a.updateVal(h, "stopx", r + d * i.boxMargin, Math.max), a.updateVal(Ga.data, "starty", e - d * i.boxMargin, Math.min), a.updateVal(Ga.data, "stopy", n + d * i.boxMargin, Math.max));
      }, "updateItemBounds");
    }
    x(o, "updateFn"), this.sequenceItems.forEach(o());
  }, "updateBounds"),
  insert: /* @__PURE__ */ x(function(t, e, r, n) {
    const i = Math.min(t, r), a = Math.max(t, r), s = Math.min(e, n), o = Math.max(e, n);
    this.updateVal(Ga.data, "startx", i, Math.min), this.updateVal(Ga.data, "starty", s, Math.min), this.updateVal(Ga.data, "stopx", a, Math.max), this.updateVal(Ga.data, "stopy", o, Math.max), this.updateBounds(i, s, a, o);
  }, "insert"),
  bumpVerticalPos: /* @__PURE__ */ x(function(t) {
    this.verticalPos = this.verticalPos + t, this.data.stopy = this.verticalPos;
  }, "bumpVerticalPos"),
  getVerticalPos: /* @__PURE__ */ x(function() {
    return this.verticalPos;
  }, "getVerticalPos"),
  getBounds: /* @__PURE__ */ x(function() {
    return this.data;
  }, "getBounds")
}, P5 = os.sectionFills, ON = os.sectionColours, O_e = /* @__PURE__ */ x(function(t, e, r) {
  const n = we().journey;
  let i = "";
  const a = n.height * 2 + n.diagramMarginY, s = r + a;
  let o = 0, l = "#CCC", u = "black", h = 0;
  for (const [d, f] of e.entries()) {
    if (i !== f.section) {
      l = P5[o % P5.length], h = o % P5.length, u = ON[o % ON.length];
      let g = 0;
      const m = f.section;
      for (let y = d; y < e.length && e[y].section == m; y++)
        g = g + 1;
      const v = {
        x: d * n.taskMargin + d * n.width + vl,
        y: 50,
        text: f.section,
        fill: l,
        num: h,
        colour: u,
        taskCount: g
      };
      Sg.drawSection(t, v, n), i = f.section, o++;
    }
    const p = f.people.reduce((g, m) => (Po[m] && (g[m] = Po[m]), g), {});
    f.x = d * n.taskMargin + d * n.width + vl, f.y = s, f.width = n.diagramMarginX, f.height = n.diagramMarginY, f.colour = u, f.fill = l, f.num = h, f.actors = p, Sg.drawTask(t, f, n), Ga.insert(f.x, f.y, f.x + f.width + n.taskMargin, 300 + 5 * 30);
  }
}, "drawTasks"), PN = {
  setConf: D_e,
  draw: I_e
}, P_e = {
  parser: m_e,
  db: DN,
  renderer: PN,
  styles: C_e,
  init: /* @__PURE__ */ x((t) => {
    PN.setConf(t.journey), DN.clear();
  }, "init")
};
const B_e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: P_e
}, Symbol.toStringTag, { value: "Module" }));
var O6 = function() {
  var t = /* @__PURE__ */ x(function(f, p, g, m) {
    for (g = g || {}, m = f.length; m--; g[f[m]] = p) ;
    return g;
  }, "o"), e = [6, 8, 10, 11, 12, 14, 16, 17, 20, 21], r = [1, 9], n = [1, 10], i = [1, 11], a = [1, 12], s = [1, 13], o = [1, 16], l = [1, 17], u = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    yy: {},
    symbols_: { error: 2, start: 3, timeline: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, title: 11, acc_title: 12, acc_title_value: 13, acc_descr: 14, acc_descr_value: 15, acc_descr_multiline_value: 16, section: 17, period_statement: 18, event_statement: 19, period: 20, event: 21, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "timeline", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 20: "period", 21: "event" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [18, 1], [19, 1]],
    performAction: /* @__PURE__ */ x(function(p, g, m, v, y, b, w) {
      var T = b.length - 1;
      switch (y) {
        case 1:
          return b[T - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          b[T - 1].push(b[T]), this.$ = b[T - 1];
          break;
        case 4:
        case 5:
          this.$ = b[T];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          v.getCommonDb().setDiagramTitle(b[T].substr(6)), this.$ = b[T].substr(6);
          break;
        case 9:
          this.$ = b[T].trim(), v.getCommonDb().setAccTitle(this.$);
          break;
        case 10:
        case 11:
          this.$ = b[T].trim(), v.getCommonDb().setAccDescription(this.$);
          break;
        case 12:
          v.addSection(b[T].substr(8)), this.$ = b[T].substr(8);
          break;
        case 15:
          v.addTask(b[T], 0, ""), this.$ = b[T];
          break;
        case 16:
          v.addEvent(b[T].substr(2)), this.$ = b[T];
          break;
      }
    }, "anonymous"),
    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: r, 12: n, 14: i, 16: a, 17: s, 18: 14, 19: 15, 20: o, 21: l }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 18, 11: r, 12: n, 14: i, 16: a, 17: s, 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: /* @__PURE__ */ x(function(p, g) {
      if (g.recoverable)
        this.trace(p);
      else {
        var m = new Error(p);
        throw m.hash = g, m;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(p) {
      var g = this, m = [0], v = [], y = [null], b = [], w = this.table, T = "", E = 0, C = 0, k = 2, _ = 1, L = b.slice.call(arguments, 1), N = Object.create(this.lexer), A = { yy: {} };
      for (var O in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, O) && (A.yy[O] = this.yy[O]);
      N.setInput(p, A.yy), A.yy.lexer = N, A.yy.parser = this, typeof N.yylloc > "u" && (N.yylloc = {});
      var P = N.yylloc;
      b.push(P);
      var S = N.options && N.options.ranges;
      typeof A.yy.parseError == "function" ? this.parseError = A.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function R(ne) {
        m.length = m.length - 2 * ne, y.length = y.length - ne, b.length = b.length - ne;
      }
      x(R, "popStack");
      function I() {
        var ne;
        return ne = v.pop() || N.lex() || _, typeof ne != "number" && (ne instanceof Array && (v = ne, ne = v.pop()), ne = g.symbols_[ne] || ne), ne;
      }
      x(I, "lex");
      for (var D, M, B, $, F = {}, G, H, ee, Y; ; ) {
        if (M = m[m.length - 1], this.defaultActions[M] ? B = this.defaultActions[M] : ((D === null || typeof D > "u") && (D = I()), B = w[M] && w[M][D]), typeof B > "u" || !B.length || !B[0]) {
          var re = "";
          Y = [];
          for (G in w[M])
            this.terminals_[G] && G > k && Y.push("'" + this.terminals_[G] + "'");
          N.showPosition ? re = "Parse error on line " + (E + 1) + `:
` + N.showPosition() + `
Expecting ` + Y.join(", ") + ", got '" + (this.terminals_[D] || D) + "'" : re = "Parse error on line " + (E + 1) + ": Unexpected " + (D == _ ? "end of input" : "'" + (this.terminals_[D] || D) + "'"), this.parseError(re, {
            text: N.match,
            token: this.terminals_[D] || D,
            line: N.yylineno,
            loc: P,
            expected: Y
          });
        }
        if (B[0] instanceof Array && B.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + M + ", token: " + D);
        switch (B[0]) {
          case 1:
            m.push(D), y.push(N.yytext), b.push(N.yylloc), m.push(B[1]), D = null, C = N.yyleng, T = N.yytext, E = N.yylineno, P = N.yylloc;
            break;
          case 2:
            if (H = this.productions_[B[1]][1], F.$ = y[y.length - H], F._$ = {
              first_line: b[b.length - (H || 1)].first_line,
              last_line: b[b.length - 1].last_line,
              first_column: b[b.length - (H || 1)].first_column,
              last_column: b[b.length - 1].last_column
            }, S && (F._$.range = [
              b[b.length - (H || 1)].range[0],
              b[b.length - 1].range[1]
            ]), $ = this.performAction.apply(F, [
              T,
              C,
              E,
              A.yy,
              B[1],
              y,
              b
            ].concat(L)), typeof $ < "u")
              return $;
            H && (m = m.slice(0, -1 * H * 2), y = y.slice(0, -1 * H), b = b.slice(0, -1 * H)), m.push(this.productions_[B[1]][0]), y.push(F.$), b.push(F._$), ee = w[m[m.length - 2]][m[m.length - 1]], m.push(ee);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, h = /* @__PURE__ */ function() {
    var f = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(g, m) {
        if (this.yy.parser)
          this.yy.parser.parseError(g, m);
        else
          throw new Error(g);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(p, g) {
        return this.yy = g || 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;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var p = this._input[0];
        this.yytext += p, this.yyleng++, this.offset++, this.match += p, this.matched += p;
        var g = p.match(/(?:\r\n?|\n).*/g);
        return g ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), p;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(p) {
        var g = p.length, m = p.split(/(?:\r\n?|\n)/g);
        this._input = p + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - g), this.offset -= g;
        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), m.length - 1 && (this.yylineno -= m.length - 1);
        var y = this.yylloc.range;
        return this.yylloc = {
          first_line: this.yylloc.first_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.first_column,
          last_column: m ? (m.length === v.length ? this.yylloc.first_column : 0) + v[v.length - m.length].length - m[0].length : this.yylloc.first_column - g
        }, this.options.ranges && (this.yylloc.range = [y[0], y[0] + this.yyleng - g]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(p) {
        this.unput(this.match.slice(p));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var p = this.matched.substr(0, this.matched.length - this.match.length);
        return (p.length > 20 ? "..." : "") + p.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(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, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var p = this.pastInput(), g = new Array(p.length + 1).join("-");
        return p + this.upcomingInput() + `
` + g + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(p, g) {
        var m, v, y;
        if (this.options.backtrack_lexer && (y = {
          yylineno: this.yylineno,
          yylloc: {
            first_line: this.yylloc.first_line,
            last_line: this.last_line,
            first_column: this.yylloc.first_column,
            last_column: this.yylloc.last_column
          },
          yytext: this.yytext,
          match: this.match,
          matches: this.matches,
          matched: this.matched,
          yyleng: this.yyleng,
          offset: this.offset,
          _more: this._more,
          _input: this._input,
          yy: this.yy,
          conditionStack: this.conditionStack.slice(0),
          done: this.done
        }, this.options.ranges && (y.yylloc.range = this.yylloc.range.slice(0))), v = p[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 + 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, g, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), m)
          return m;
        if (this._backtrack) {
          for (var b in y)
            this[b] = y[b];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var p, g, m, v;
        this._more || (this.yytext = "", this.match = "");
        for (var y = this._currentRules(), b = 0; b < y.length; b++)
          if (m = this._input.match(this.rules[y[b]]), m && (!g || m[0].length > g[0].length)) {
            if (g = m, v = b, this.options.backtrack_lexer) {
              if (p = this.test_match(m, y[b]), p !== !1)
                return p;
              if (this._backtrack) {
                g = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return g ? (p = this.test_match(g, y[v]), 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
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var g = this.next();
        return g || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(g) {
        this.conditionStack.push(g);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var g = this.conditionStack.length - 1;
        return g > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(g) {
        return g = this.conditionStack.length - 1 - Math.abs(g || 0), g >= 0 ? this.conditionStack[g] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(g) {
        this.begin(g);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(g, m, v, y) {
        switch (v) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 10;
          case 3:
            break;
          case 4:
            break;
          case 5:
            return 4;
          case 6:
            return 11;
          case 7:
            return this.begin("acc_title"), 12;
          case 8:
            return this.popState(), "acc_title_value";
          case 9:
            return this.begin("acc_descr"), 14;
          case 10:
            return this.popState(), "acc_descr_value";
          case 11:
            this.begin("acc_descr_multiline");
            break;
          case 12:
            this.popState();
            break;
          case 13:
            return "acc_descr_multiline_value";
          case 14:
            return 17;
          case 15:
            return 21;
          case 16:
            return 20;
          case 17:
            return 6;
          case 18:
            return "INVALID";
        }
      }, "anonymous"),
      rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^:\n]+)/i, /^(?::\s(?:[^:\n]|:(?!\s))+)/i, /^(?:[^#:\n]+)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18], inclusive: !0 } }
    };
    return f;
  }();
  u.lexer = h;
  function d() {
    this.yy = {};
  }
  return x(d, "Parser"), d.prototype = u, u.Parser = d, new d();
}();
O6.parser = O6;
var F_e = O6, Hq = {};
I2(Hq, {
  addEvent: () => Jq,
  addSection: () => jq,
  addTask: () => Qq,
  addTaskOrg: () => eY,
  clear: () => Xq,
  default: () => $_e,
  getCommonDb: () => Yq,
  getSections: () => Kq,
  getTasks: () => Zq
});
var yf = "", qq = 0, g7 = [], _2 = [], xf = [], Yq = /* @__PURE__ */ x(() => Q6, "getCommonDb"), Xq = /* @__PURE__ */ x(function() {
  g7.length = 0, _2.length = 0, yf = "", xf.length = 0, _n();
}, "clear"), jq = /* @__PURE__ */ x(function(t) {
  yf = t, g7.push(t);
}, "addSection"), Kq = /* @__PURE__ */ x(function() {
  return g7;
}, "getSections"), Zq = /* @__PURE__ */ x(function() {
  let t = BN();
  const e = 100;
  let r = 0;
  for (; !t && r < e; )
    t = BN(), r++;
  return _2.push(...xf), _2;
}, "getTasks"), Qq = /* @__PURE__ */ x(function(t, e, r) {
  const n = {
    id: qq++,
    section: yf,
    type: yf,
    task: t,
    score: e || 0,
    //if event is defined, then add it the events array
    events: r ? [r] : []
  };
  xf.push(n);
}, "addTask"), Jq = /* @__PURE__ */ x(function(t) {
  xf.find((r) => r.id === qq - 1).events.push(t);
}, "addEvent"), eY = /* @__PURE__ */ x(function(t) {
  const e = {
    section: yf,
    type: yf,
    description: t,
    task: t,
    classes: []
  };
  _2.push(e);
}, "addTaskOrg"), BN = /* @__PURE__ */ x(function() {
  const t = /* @__PURE__ */ x(function(r) {
    return xf[r].processed;
  }, "compileTask");
  let e = !0;
  for (const [r, n] of xf.entries())
    t(r), e = e && n.processed;
  return e;
}, "compileTasks"), $_e = {
  clear: Xq,
  getCommonDb: Yq,
  addSection: jq,
  getSections: Kq,
  getTasks: Zq,
  addTask: Qq,
  addTaskOrg: eY,
  addEvent: Jq
}, z_e = 12, vb = /* @__PURE__ */ x(function(t, e) {
  const r = t.append("rect");
  return r.attr("x", e.x), r.attr("y", e.y), r.attr("fill", e.fill), r.attr("stroke", e.stroke), r.attr("width", e.width), r.attr("height", e.height), r.attr("rx", e.rx), r.attr("ry", e.ry), e.class !== void 0 && r.attr("class", e.class), r;
}, "drawRect"), V_e = /* @__PURE__ */ x(function(t, e) {
  const n = t.append("circle").attr("cx", e.cx).attr("cy", e.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), i = t.append("g");
  i.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"), i.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 a(l) {
    const u = jd().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) + ")");
  }
  x(a, "smile");
  function s(l) {
    const u = jd().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) + ")");
  }
  x(s, "sad");
  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 x(o, "ambivalent"), e.score > 3 ? a(i) : e.score < 3 ? s(i) : o(i), n;
}, "drawFace"), G_e = /* @__PURE__ */ x(function(t, e) {
  const r = t.append("circle");
  return r.attr("cx", e.cx), r.attr("cy", e.cy), r.attr("class", "actor-" + e.pos), r.attr("fill", e.fill), r.attr("stroke", e.stroke), r.attr("r", e.r), r.class !== void 0 && r.attr("class", r.class), e.title !== void 0 && r.append("title").text(e.title), r;
}, "drawCircle"), tY = /* @__PURE__ */ x(function(t, e) {
  const r = e.text.replace(/<br\s*\/?>/gi, " "), n = t.append("text");
  n.attr("x", e.x), n.attr("y", e.y), n.attr("class", "legend"), n.style("text-anchor", e.anchor), e.class !== void 0 && n.attr("class", e.class);
  const i = n.append("tspan");
  return i.attr("x", e.x + e.textMargin * 2), i.text(r), n;
}, "drawText"), U_e = /* @__PURE__ */ x(function(t, e) {
  function r(i, a, s, o, l) {
    return i + "," + a + " " + (i + s) + "," + a + " " + (i + s) + "," + (a + o - l) + " " + (i + s - l * 1.2) + "," + (a + o) + " " + i + "," + (a + o);
  }
  x(r, "genPoints");
  const n = t.append("polygon");
  n.attr("points", r(e.x, e.y, 50, 20, 7)), n.attr("class", "labelBox"), e.y = e.y + e.labelMargin, e.x = e.x + 0.5 * e.labelMargin, tY(t, e);
}, "drawLabel"), W_e = /* @__PURE__ */ x(function(t, e, r) {
  const n = t.append("g"), i = m7();
  i.x = e.x, i.y = e.y, i.fill = e.fill, i.width = r.width, i.height = r.height, i.class = "journey-section section-type-" + e.num, i.rx = 3, i.ry = 3, vb(n, i), rY(r)(
    e.text,
    n,
    i.x,
    i.y,
    i.width,
    i.height,
    { class: "journey-section section-type-" + e.num },
    r,
    e.colour
  );
}, "drawSection"), FN = -1, H_e = /* @__PURE__ */ x(function(t, e, r) {
  const n = e.x + r.width / 2, i = t.append("g");
  FN++;
  const a = 300 + 5 * 30;
  i.append("line").attr("id", "task" + FN).attr("x1", n).attr("y1", e.y).attr("x2", n).attr("y2", a).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), V_e(i, {
    cx: n,
    cy: 300 + (5 - e.score) * 30,
    score: e.score
  });
  const s = m7();
  s.x = e.x, s.y = e.y, s.fill = e.fill, s.width = r.width, s.height = r.height, s.class = "task task-type-" + e.num, s.rx = 3, s.ry = 3, vb(i, s), rY(r)(
    e.task,
    i,
    s.x,
    s.y,
    s.width,
    s.height,
    { class: "task" },
    r,
    e.colour
  );
}, "drawTask"), q_e = /* @__PURE__ */ x(function(t, e) {
  vb(t, {
    x: e.startx,
    y: e.starty,
    width: e.stopx - e.startx,
    height: e.stopy - e.starty,
    fill: e.fill,
    class: "rect"
  }).lower();
}, "drawBackgroundRect"), Y_e = /* @__PURE__ */ x(function() {
  return {
    x: 0,
    y: 0,
    fill: void 0,
    "text-anchor": "start",
    width: 100,
    height: 100,
    textMargin: 0,
    rx: 0,
    ry: 0
  };
}, "getTextObj"), m7 = /* @__PURE__ */ x(function() {
  return {
    x: 0,
    y: 0,
    width: 100,
    anchor: "start",
    height: 100,
    rx: 0,
    ry: 0
  };
}, "getNoteRect"), rY = /* @__PURE__ */ function() {
  function t(i, a, s, o, l, u, h, d) {
    const f = a.append("text").attr("x", s + l / 2).attr("y", o + u / 2 + 5).style("font-color", d).style("text-anchor", "middle").text(i);
    n(f, h);
  }
  x(t, "byText");
  function e(i, a, s, o, l, u, h, d, f) {
    const { taskFontSize: p, taskFontFamily: g } = d, m = i.split(/<br\s*\/?>/gi);
    for (let v = 0; v < m.length; v++) {
      const y = v * p - p * (m.length - 1) / 2, b = a.append("text").attr("x", s + l / 2).attr("y", o).attr("fill", f).style("text-anchor", "middle").style("font-size", p).style("font-family", g);
      b.append("tspan").attr("x", s + l / 2).attr("dy", y).text(m[v]), b.attr("y", o + u / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), n(b, h);
    }
  }
  x(e, "byTspan");
  function r(i, a, s, o, l, u, h, d) {
    const f = a.append("switch"), g = f.append("foreignObject").attr("x", s).attr("y", o).attr("width", l).attr("height", u).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    g.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(i), e(i, f, s, o, l, u, h, d), n(g, h);
  }
  x(r, "byFo");
  function n(i, a) {
    for (const s in a)
      s in a && i.attr(s, a[s]);
  }
  return x(n, "_setTextAttrs"), function(i) {
    return i.textPlacement === "fo" ? r : i.textPlacement === "old" ? t : e;
  };
}(), X_e = /* @__PURE__ */ x(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");
}, "initGraphics");
function v7(t, e) {
  t.each(function() {
    var r = Qe(this), n = r.text().split(/(\s+|<br>)/).reverse(), i, a = [], s = 1.1, o = r.attr("y"), l = parseFloat(r.attr("dy")), u = r.text(null).append("tspan").attr("x", 0).attr("y", o).attr("dy", l + "em");
    for (let h = 0; h < n.length; h++)
      i = n[n.length - 1 - h], a.push(i), u.text(a.join(" ").trim()), (u.node().getComputedTextLength() > e || i === "<br>") && (a.pop(), u.text(a.join(" ").trim()), i === "<br>" ? a = [""] : a = [i], u = r.append("tspan").attr("x", 0).attr("y", o).attr("dy", s + "em").text(i));
  });
}
x(v7, "wrap");
var j_e = /* @__PURE__ */ x(function(t, e, r, n) {
  var d;
  const i = r % z_e - 1, a = t.append("g");
  e.section = i, a.attr(
    "class",
    (e.class ? e.class + " " : "") + "timeline-node " + ("section-" + i)
  );
  const s = a.append("g"), o = a.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(v7, e.width).node().getBBox(), h = (d = n.fontSize) != null && d.replace ? n.fontSize.replace("px", "") : n.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 + ")"), Z_e(s, e, i, n), e;
}, "drawNode"), K_e = /* @__PURE__ */ x(function(t, e, r) {
  var o;
  const n = t.append("g"), a = n.append("text").text(e.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(v7, e.width).node().getBBox(), s = (o = r.fontSize) != null && o.replace ? r.fontSize.replace("px", "") : r.fontSize;
  return n.remove(), a.height + s * 1.1 * 0.5 + e.padding;
}, "getVirtualNodeHeight"), Z_e = /* @__PURE__ */ x(function(t, e, r) {
  t.append("path").attr("id", "node-" + e.id).attr("class", "node-bkg node-" + e.type).attr(
    "d",
    `M0 ${e.height - 5} v${-e.height + 2 * 5} q0,-5 5,-5 h${e.width - 2 * 5} q5,0 5,5 v${e.height - 5} H0 Z`
  ), t.append("line").attr("class", "node-line-" + r).attr("x1", 0).attr("y1", e.height).attr("x2", e.width).attr("y2", e.height);
}, "defaultBkg"), Vc = {
  drawRect: vb,
  drawCircle: G_e,
  drawSection: W_e,
  drawText: tY,
  drawLabel: U_e,
  drawTask: H_e,
  drawBackgroundRect: q_e,
  getTextObj: Y_e,
  getNoteRect: m7,
  initGraphics: X_e,
  drawNode: j_e,
  getVirtualNodeHeight: K_e
}, Q_e = /* @__PURE__ */ x(function(t, e, r, n) {
  var L, N, A;
  const i = we(), a = ((L = i.timeline) == null ? void 0 : L.leftMargin) ?? 50;
  ae.debug("timeline", n.db);
  const s = i.securityLevel;
  let o;
  s === "sandbox" && (o = Qe("#i" + e));
  const u = Qe(s === "sandbox" ? o.nodes()[0].contentDocument.body : "body").select("#" + e);
  u.append("g");
  const h = n.db.getTasks(), d = n.db.getCommonDb().getDiagramTitle();
  ae.debug("task", h), Vc.initGraphics(u);
  const f = n.db.getSections();
  ae.debug("sections", f);
  let p = 0, g = 0, m = 0, v = 0, y = 50 + a, b = 50;
  v = 50;
  let w = 0, T = !0;
  f.forEach(function(O) {
    const P = {
      number: w,
      descr: O,
      section: w,
      width: 150,
      padding: 20,
      maxHeight: p
    }, S = Vc.getVirtualNodeHeight(u, P, i);
    ae.debug("sectionHeight before draw", S), p = Math.max(p, S + 20);
  });
  let E = 0, C = 0;
  ae.debug("tasks.length", h.length);
  for (const [O, P] of h.entries()) {
    const S = {
      number: O,
      descr: P,
      section: P.section,
      width: 150,
      padding: 20,
      maxHeight: g
    }, R = Vc.getVirtualNodeHeight(u, S, i);
    ae.debug("taskHeight before draw", R), g = Math.max(g, R + 20), E = Math.max(E, P.events.length);
    let I = 0;
    for (const D of P.events) {
      const M = {
        descr: D,
        section: P.section,
        number: P.section,
        width: 150,
        padding: 20,
        maxHeight: 50
      };
      I += Vc.getVirtualNodeHeight(u, M, i);
    }
    P.events.length > 0 && (I += (P.events.length - 1) * 10), C = Math.max(C, I);
  }
  ae.debug("maxSectionHeight before draw", p), ae.debug("maxTaskHeight before draw", g), f && f.length > 0 ? f.forEach((O) => {
    const P = h.filter((D) => D.section === O), S = {
      number: w,
      descr: O,
      section: w,
      width: 200 * Math.max(P.length, 1) - 50,
      padding: 20,
      maxHeight: p
    };
    ae.debug("sectionNode", S);
    const R = u.append("g"), I = Vc.drawNode(R, S, w, i);
    ae.debug("sectionNode output", I), R.attr("transform", `translate(${y}, ${v})`), b += p + 50, P.length > 0 && $N(
      u,
      P,
      w,
      y,
      b,
      g,
      i,
      E,
      C,
      p,
      !1
    ), y += 200 * Math.max(P.length, 1), b = v, w++;
  }) : (T = !1, $N(
    u,
    h,
    w,
    y,
    b,
    g,
    i,
    E,
    C,
    p,
    !0
  ));
  const k = u.node().getBBox();
  ae.debug("bounds", k), d && u.append("text").text(d).attr("x", k.width / 2 - a).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), m = T ? p + g + 150 : g + 100, u.append("g").attr("class", "lineWrapper").append("line").attr("x1", a).attr("y1", m).attr("x2", k.width + 3 * a).attr("y2", m).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"), Lg(
    void 0,
    u,
    ((N = i.timeline) == null ? void 0 : N.padding) ?? 50,
    ((A = i.timeline) == null ? void 0 : A.useMaxWidth) ?? !1
  );
}, "draw"), $N = /* @__PURE__ */ x(function(t, e, r, n, i, a, s, o, l, u, h) {
  var d;
  for (const f of e) {
    const p = {
      descr: f.task,
      section: r,
      number: r,
      width: 150,
      padding: 20,
      maxHeight: a
    };
    ae.debug("taskNode", p);
    const g = t.append("g").attr("class", "taskWrapper"), v = Vc.drawNode(g, p, r, s).height;
    if (ae.debug("taskHeight after draw", v), g.attr("transform", `translate(${n}, ${i})`), a = Math.max(a, v), f.events) {
      const y = t.append("g").attr("class", "lineWrapper");
      let b = a;
      i += 100, b = b + J_e(t, f.events, r, n, i, s), i -= 100, y.append("line").attr("x1", n + 190 / 2).attr("y1", i + a).attr("x2", n + 190 / 2).attr("y2", i + a + 100 + l + 100).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
    }
    n = n + 200, h && !((d = s.timeline) != null && d.disableMulticolor) && r++;
  }
  i = i - 10;
}, "drawTasks"), J_e = /* @__PURE__ */ x(function(t, e, r, n, i, a) {
  let s = 0;
  const o = i;
  i = i + 100;
  for (const l of e) {
    const u = {
      descr: l,
      section: r,
      number: r,
      width: 150,
      padding: 20,
      maxHeight: 50
    };
    ae.debug("eventNode", u);
    const h = t.append("g").attr("class", "eventWrapper"), f = Vc.drawNode(h, u, r, a).height;
    s = s + f, h.attr("transform", `translate(${n}, ${i})`), i = i + 10 + f;
  }
  return i = o, s;
}, "drawEvents"), e9e = {
  setConf: /* @__PURE__ */ x(() => {
  }, "setConf"),
  draw: Q_e
}, t9e = /* @__PURE__ */ x((t) => {
  let e = "";
  for (let r = 0; r < t.THEME_COLOR_LIMIT; r++)
    t["lineColor" + r] = t["lineColor" + r] || t["cScaleInv" + r], tc(t["lineColor" + r]) ? t["lineColor" + r] = _t(t["lineColor" + r], 20) : t["lineColor" + r] = It(t["lineColor" + r], 20);
  for (let r = 0; r < t.THEME_COLOR_LIMIT; r++) {
    const n = "" + (17 - 3 * r);
    e += `
    .section-${r - 1} rect, .section-${r - 1} path, .section-${r - 1} circle, .section-${r - 1} path  {
      fill: ${t["cScale" + r]};
    }
    .section-${r - 1} text {
     fill: ${t["cScaleLabel" + r]};
    }
    .node-icon-${r - 1} {
      font-size: 40px;
      color: ${t["cScaleLabel" + r]};
    }
    .section-edge-${r - 1}{
      stroke: ${t["cScale" + r]};
    }
    .edge-depth-${r - 1}{
      stroke-width: ${n};
    }
    .section-${r - 1} line {
      stroke: ${t["cScaleInv" + r]} ;
      stroke-width: 3;
    }

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

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }
    `;
  }
  return e;
}, "genSections"), r9e = /* @__PURE__ */ x((t) => `
  .edge {
    stroke-width: 3;
  }
  ${t9e(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%);
  }
`, "getStyles"), n9e = r9e, i9e = {
  db: Hq,
  renderer: e9e,
  parser: F_e,
  styles: n9e
};
const a9e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: i9e
}, Symbol.toStringTag, { value: "Module" })), ni = [];
for (let t = 0; t < 256; ++t)
  ni.push((t + 256).toString(16).slice(1));
function s9e(t, e = 0) {
  return (ni[t[e + 0]] + ni[t[e + 1]] + ni[t[e + 2]] + ni[t[e + 3]] + "-" + ni[t[e + 4]] + ni[t[e + 5]] + "-" + ni[t[e + 6]] + ni[t[e + 7]] + "-" + ni[t[e + 8]] + ni[t[e + 9]] + "-" + ni[t[e + 10]] + ni[t[e + 11]] + ni[t[e + 12]] + ni[t[e + 13]] + ni[t[e + 14]] + ni[t[e + 15]]).toLowerCase();
}
let B5;
const o9e = new Uint8Array(16);
function l9e() {
  if (!B5) {
    if (typeof crypto > "u" || !crypto.getRandomValues)
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    B5 = crypto.getRandomValues.bind(crypto);
  }
  return B5(o9e);
}
const c9e = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), zN = { randomUUID: c9e };
function u9e(t, e, r) {
  var i;
  if (zN.randomUUID && !t)
    return zN.randomUUID();
  t = t || {};
  const n = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? l9e();
  if (n.length < 16)
    throw new Error("Random bytes length must be >= 16");
  return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, s9e(n);
}
var P6 = function() {
  var t = /* @__PURE__ */ x(function(T, E, C, k) {
    for (C = C || {}, k = T.length; k--; C[T[k]] = E) ;
    return C;
  }, "o"), e = [1, 4], r = [1, 13], n = [1, 12], i = [1, 15], a = [1, 16], s = [1, 20], o = [1, 19], l = [6, 7, 8], u = [1, 26], h = [1, 24], d = [1, 25], f = [6, 7, 11], p = [1, 6, 13, 15, 16, 19, 22], g = [1, 33], m = [1, 34], v = [1, 6, 7, 11, 13, 15, 16, 19, 22], y = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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: /* @__PURE__ */ x(function(E, C, k, _, L, N, A) {
      var O = N.length - 1;
      switch (L) {
        case 6:
        case 7:
          return _;
        case 8:
          _.getLogger().trace("Stop NL ");
          break;
        case 9:
          _.getLogger().trace("Stop EOF ");
          break;
        case 11:
          _.getLogger().trace("Stop NL2 ");
          break;
        case 12:
          _.getLogger().trace("Stop EOF2 ");
          break;
        case 15:
          _.getLogger().info("Node: ", N[O].id), _.addNode(N[O - 1].length, N[O].id, N[O].descr, N[O].type);
          break;
        case 16:
          _.getLogger().trace("Icon: ", N[O]), _.decorateNode({ icon: N[O] });
          break;
        case 17:
        case 21:
          _.decorateNode({ class: N[O] });
          break;
        case 18:
          _.getLogger().trace("SPACELIST");
          break;
        case 19:
          _.getLogger().trace("Node: ", N[O].id), _.addNode(0, N[O].id, N[O].descr, N[O].type);
          break;
        case 20:
          _.decorateNode({ icon: N[O] });
          break;
        case 25:
          _.getLogger().trace("node found ..", N[O - 2]), this.$ = { id: N[O - 1], descr: N[O - 1], type: _.getType(N[O - 2], N[O]) };
          break;
        case 26:
          this.$ = { id: N[O], descr: N[O], type: _.nodeType.DEFAULT };
          break;
        case 27:
          _.getLogger().trace("node found ..", N[O - 3]), this.$ = { id: N[O - 3], descr: N[O - 1], type: _.getType(N[O - 2], N[O]) };
          break;
      }
    }, "anonymous"),
    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: r, 7: [1, 10], 9: 9, 12: 11, 13: n, 14: 14, 15: i, 16: a, 17: 17, 18: 18, 19: s, 22: o }, t(l, [2, 3]), { 1: [2, 2] }, t(l, [2, 4]), t(l, [2, 5]), { 1: [2, 6], 6: r, 12: 21, 13: n, 14: 14, 15: i, 16: a, 17: 17, 18: 18, 19: s, 22: o }, { 6: r, 9: 22, 12: 11, 13: n, 14: 14, 15: i, 16: a, 17: 17, 18: 18, 19: s, 22: o }, { 6: u, 7: h, 10: 23, 11: d }, t(f, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: s, 22: o }), t(f, [2, 18]), t(f, [2, 19]), t(f, [2, 20]), t(f, [2, 21]), t(f, [2, 23]), t(f, [2, 24]), t(f, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: u, 7: h, 10: 32, 11: d }, { 1: [2, 7], 6: r, 12: 21, 13: n, 14: 14, 15: i, 16: a, 17: 17, 18: 18, 19: s, 22: o }, t(p, [2, 14], { 7: g, 11: m }), t(v, [2, 8]), t(v, [2, 9]), t(v, [2, 10]), t(f, [2, 15]), t(f, [2, 16]), t(f, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, t(p, [2, 13], { 7: g, 11: m }), t(v, [2, 11]), t(v, [2, 12]), { 21: [1, 37] }, t(f, [2, 25]), t(f, [2, 27])],
    defaultActions: { 2: [2, 1], 6: [2, 2] },
    parseError: /* @__PURE__ */ x(function(E, C) {
      if (C.recoverable)
        this.trace(E);
      else {
        var k = new Error(E);
        throw k.hash = C, k;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(E) {
      var C = this, k = [0], _ = [], L = [null], N = [], A = this.table, O = "", P = 0, S = 0, R = 2, I = 1, D = N.slice.call(arguments, 1), M = Object.create(this.lexer), B = { yy: {} };
      for (var $ in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, $) && (B.yy[$] = this.yy[$]);
      M.setInput(E, B.yy), B.yy.lexer = M, B.yy.parser = this, typeof M.yylloc > "u" && (M.yylloc = {});
      var F = M.yylloc;
      N.push(F);
      var G = M.options && M.options.ranges;
      typeof B.yy.parseError == "function" ? this.parseError = B.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function H(pe) {
        k.length = k.length - 2 * pe, L.length = L.length - pe, N.length = N.length - pe;
      }
      x(H, "popStack");
      function ee() {
        var pe;
        return pe = _.pop() || M.lex() || I, typeof pe != "number" && (pe instanceof Array && (_ = pe, pe = _.pop()), pe = C.symbols_[pe] || pe), pe;
      }
      x(ee, "lex");
      for (var Y, re, ne, he, K = {}, Z, X, q, J; ; ) {
        if (re = k[k.length - 1], this.defaultActions[re] ? ne = this.defaultActions[re] : ((Y === null || typeof Y > "u") && (Y = ee()), ne = A[re] && A[re][Y]), typeof ne > "u" || !ne.length || !ne[0]) {
          var j = "";
          J = [];
          for (Z in A[re])
            this.terminals_[Z] && Z > R && J.push("'" + this.terminals_[Z] + "'");
          M.showPosition ? j = "Parse error on line " + (P + 1) + `:
` + M.showPosition() + `
Expecting ` + J.join(", ") + ", got '" + (this.terminals_[Y] || Y) + "'" : j = "Parse error on line " + (P + 1) + ": Unexpected " + (Y == I ? "end of input" : "'" + (this.terminals_[Y] || Y) + "'"), this.parseError(j, {
            text: M.match,
            token: this.terminals_[Y] || Y,
            line: M.yylineno,
            loc: F,
            expected: J
          });
        }
        if (ne[0] instanceof Array && ne.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + re + ", token: " + Y);
        switch (ne[0]) {
          case 1:
            k.push(Y), L.push(M.yytext), N.push(M.yylloc), k.push(ne[1]), Y = null, S = M.yyleng, O = M.yytext, P = M.yylineno, F = M.yylloc;
            break;
          case 2:
            if (X = this.productions_[ne[1]][1], K.$ = L[L.length - X], K._$ = {
              first_line: N[N.length - (X || 1)].first_line,
              last_line: N[N.length - 1].last_line,
              first_column: N[N.length - (X || 1)].first_column,
              last_column: N[N.length - 1].last_column
            }, G && (K._$.range = [
              N[N.length - (X || 1)].range[0],
              N[N.length - 1].range[1]
            ]), he = this.performAction.apply(K, [
              O,
              S,
              P,
              B.yy,
              ne[1],
              L,
              N
            ].concat(D)), typeof he < "u")
              return he;
            X && (k = k.slice(0, -1 * X * 2), L = L.slice(0, -1 * X), N = N.slice(0, -1 * X)), k.push(this.productions_[ne[1]][0]), L.push(K.$), N.push(K._$), q = A[k[k.length - 2]][k[k.length - 1]], k.push(q);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, b = /* @__PURE__ */ function() {
    var T = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(C, k) {
        if (this.yy.parser)
          this.yy.parser.parseError(C, k);
        else
          throw new Error(C);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(E, C) {
        return this.yy = C || this.yy || {}, this._input = E, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var E = this._input[0];
        this.yytext += E, this.yyleng++, this.offset++, this.match += E, this.matched += E;
        var C = E.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), E;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(E) {
        var C = E.length, k = E.split(/(?:\r\n?|\n)/g);
        this._input = E + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - C), this.offset -= C;
        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), k.length - 1 && (this.yylineno -= k.length - 1);
        var L = 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: k ? (k.length === _.length ? this.yylloc.first_column : 0) + _[_.length - k.length].length - k[0].length : this.yylloc.first_column - C
        }, this.options.ranges && (this.yylloc.range = [L[0], L[0] + this.yyleng - C]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(E) {
        this.unput(this.match.slice(E));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var E = this.matched.substr(0, this.matched.length - this.match.length);
        return (E.length > 20 ? "..." : "") + E.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var E = this.match;
        return E.length < 20 && (E += this._input.substr(0, 20 - E.length)), (E.substr(0, 20) + (E.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var E = this.pastInput(), C = new Array(E.length + 1).join("-");
        return E + this.upcomingInput() + `
` + C + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(E, C) {
        var k, _, L;
        if (this.options.backtrack_lexer && (L = {
          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 && (L.yylloc.range = this.yylloc.range.slice(0))), _ = E[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 + E[0].length
        }, this.yytext += E[0], this.match += E[0], this.matches = E, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(E[0].length), this.matched += E[0], k = this.performAction.call(this, this.yy, this, C, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), k)
          return k;
        if (this._backtrack) {
          for (var N in L)
            this[N] = L[N];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var E, C, k, _;
        this._more || (this.yytext = "", this.match = "");
        for (var L = this._currentRules(), N = 0; N < L.length; N++)
          if (k = this._input.match(this.rules[L[N]]), k && (!C || k[0].length > C[0].length)) {
            if (C = k, _ = N, this.options.backtrack_lexer) {
              if (E = this.test_match(k, L[N]), E !== !1)
                return E;
              if (this._backtrack) {
                C = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return C ? (E = this.test_match(C, L[_]), E !== !1 ? E : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var C = this.next();
        return C || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(C) {
        this.conditionStack.push(C);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var C = this.conditionStack.length - 1;
        return C > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(C) {
        return C = this.conditionStack.length - 1 - Math.abs(C || 0), C >= 0 ? this.conditionStack[C] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(C) {
        this.begin(C);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(C, k, _, L) {
        switch (_) {
          case 0:
            return C.getLogger().trace("Found comment", k.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:
            C.getLogger().trace("Begin icon"), this.begin("ICON");
            break;
          case 6:
            return C.getLogger().trace("SPACELINE"), 6;
          case 7:
            return 7;
          case 8:
            return 15;
          case 9:
            C.getLogger().trace("end icon"), this.popState();
            break;
          case 10:
            return C.getLogger().trace("Exploding node"), this.begin("NODE"), 19;
          case 11:
            return C.getLogger().trace("Cloud"), this.begin("NODE"), 19;
          case 12:
            return C.getLogger().trace("Explosion Bang"), this.begin("NODE"), 19;
          case 13:
            return C.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:
            C.getLogger().trace("Starting NSTR"), this.begin("NSTR");
            break;
          case 25:
            return C.getLogger().trace("description:", k.yytext), "NODE_DESCR";
          case 26:
            this.popState();
            break;
          case 27:
            return this.popState(), C.getLogger().trace("node end ))"), "NODE_DEND";
          case 28:
            return this.popState(), C.getLogger().trace("node end )"), "NODE_DEND";
          case 29:
            return this.popState(), C.getLogger().trace("node end ...", k.yytext), "NODE_DEND";
          case 30:
            return this.popState(), C.getLogger().trace("node end (("), "NODE_DEND";
          case 31:
            return this.popState(), C.getLogger().trace("node end (-"), "NODE_DEND";
          case 32:
            return this.popState(), C.getLogger().trace("node end (-"), "NODE_DEND";
          case 33:
            return this.popState(), C.getLogger().trace("node end (("), "NODE_DEND";
          case 34:
            return this.popState(), C.getLogger().trace("node end (("), "NODE_DEND";
          case 35:
            return C.getLogger().trace("Long description:", k.yytext), 20;
          case 36:
            return C.getLogger().trace("Long description:", k.yytext), 20;
        }
      }, "anonymous"),
      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 T;
  }();
  y.lexer = b;
  function w() {
    this.yy = {};
  }
  return x(w, "Parser"), w.prototype = y, y.Parser = w, new w();
}();
P6.parser = P6;
var h9e = P6, bo = {
  DEFAULT: 0,
  NO_BORDER: 0,
  ROUNDED_RECT: 1,
  RECT: 2,
  CIRCLE: 3,
  CLOUD: 4,
  BANG: 5,
  HEXAGON: 6
}, Od, d9e = (Od = class {
  constructor() {
    this.nodes = [], this.count = 0, this.elements = {}, this.getLogger = this.getLogger.bind(this), this.nodeType = bo, this.clear(), this.getType = this.getType.bind(this), this.getElementById = this.getElementById.bind(this), this.getParent = this.getParent.bind(this), this.getMindmap = this.getMindmap.bind(this), this.addNode = this.addNode.bind(this), this.decorateNode = this.decorateNode.bind(this);
  }
  clear() {
    this.nodes = [], this.count = 0, this.elements = {}, this.baseLevel = void 0;
  }
  getParent(e) {
    for (let r = this.nodes.length - 1; r >= 0; r--)
      if (this.nodes[r].level < e)
        return this.nodes[r];
    return null;
  }
  getMindmap() {
    return this.nodes.length > 0 ? this.nodes[0] : null;
  }
  addNode(e, r, n, i) {
    var h, d;
    ae.info("addNode", e, r, n, i);
    let a = !1;
    this.nodes.length === 0 ? (this.baseLevel = e, e = 0, a = !0) : this.baseLevel !== void 0 && (e = e - this.baseLevel, a = !1);
    const s = we();
    let o = ((h = s.mindmap) == null ? void 0 : h.padding) ?? hr.mindmap.padding;
    switch (i) {
      case this.nodeType.ROUNDED_RECT:
      case this.nodeType.RECT:
      case this.nodeType.HEXAGON:
        o *= 2;
        break;
    }
    const l = {
      id: this.count++,
      nodeId: fr(r, s),
      level: e,
      descr: fr(n, s),
      type: i,
      children: [],
      width: ((d = s.mindmap) == null ? void 0 : d.maxNodeWidth) ?? hr.mindmap.maxNodeWidth,
      padding: o,
      isRoot: a
    }, u = this.getParent(e);
    if (u)
      u.children.push(l), this.nodes.push(l);
    else if (a)
      this.nodes.push(l);
    else
      throw new Error(
        `There can be only one root. No parent could be found for ("${l.descr}")`
      );
  }
  getType(e, r) {
    switch (ae.debug("In get type", e, r), e) {
      case "[":
        return this.nodeType.RECT;
      case "(":
        return r === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD;
      case "((":
        return this.nodeType.CIRCLE;
      case ")":
        return this.nodeType.CLOUD;
      case "))":
        return this.nodeType.BANG;
      case "{{":
        return this.nodeType.HEXAGON;
      default:
        return this.nodeType.DEFAULT;
    }
  }
  setElementForId(e, r) {
    this.elements[e] = r;
  }
  getElementById(e) {
    return this.elements[e];
  }
  decorateNode(e) {
    if (!e)
      return;
    const r = we(), n = this.nodes[this.nodes.length - 1];
    e.icon && (n.icon = fr(e.icon, r)), e.class && (n.class = fr(e.class, r));
  }
  type2Str(e) {
    switch (e) {
      case this.nodeType.DEFAULT:
        return "no-border";
      case this.nodeType.RECT:
        return "rect";
      case this.nodeType.ROUNDED_RECT:
        return "rounded-rect";
      case this.nodeType.CIRCLE:
        return "circle";
      case this.nodeType.CLOUD:
        return "cloud";
      case this.nodeType.BANG:
        return "bang";
      case this.nodeType.HEXAGON:
        return "hexgon";
      default:
        return "no-border";
    }
  }
  /**
   * Assign section numbers to nodes based on their position relative to root
   * @param node - The mindmap node to process
   * @param sectionNumber - The section number to assign (undefined for root)
   */
  assignSections(e, r) {
    if (e.level === 0 ? e.section = void 0 : e.section = r, e.children)
      for (const [n, i] of e.children.entries()) {
        const a = e.level === 0 ? n : r;
        this.assignSections(i, a);
      }
  }
  /**
   * Convert mindmap tree structure to flat array of nodes
   * @param node - The mindmap node to process
   * @param processedNodes - Array to collect processed nodes
   */
  flattenNodes(e, r) {
    const n = ["mindmap-node"];
    e.isRoot === !0 ? n.push("section-root", "section--1") : e.section !== void 0 && n.push(`section-${e.section}`), e.class && n.push(e.class);
    const i = n.join(" "), a = /* @__PURE__ */ x((o) => {
      switch (o) {
        case bo.CIRCLE:
          return "mindmapCircle";
        case bo.RECT:
          return "rect";
        case bo.ROUNDED_RECT:
          return "rounded";
        case bo.CLOUD:
          return "cloud";
        case bo.BANG:
          return "bang";
        case bo.HEXAGON:
          return "hexagon";
        case bo.DEFAULT:
          return "defaultMindmapNode";
        case bo.NO_BORDER:
        default:
          return "rect";
      }
    }, "getShapeFromType"), s = {
      id: e.id.toString(),
      domId: "node_" + e.id.toString(),
      label: e.descr,
      isGroup: !1,
      shape: a(e.type),
      width: e.width,
      height: e.height ?? 0,
      padding: e.padding,
      cssClasses: i,
      cssStyles: [],
      look: "default",
      icon: e.icon,
      x: e.x,
      y: e.y,
      // Mindmap-specific properties
      level: e.level,
      nodeId: e.nodeId,
      type: e.type,
      section: e.section
    };
    if (r.push(s), e.children)
      for (const o of e.children)
        this.flattenNodes(o, r);
  }
  /**
   * Generate edges from parent-child relationships in mindmap tree
   * @param node - The mindmap node to process
   * @param edges - Array to collect edges
   */
  generateEdges(e, r) {
    if (e.children)
      for (const n of e.children) {
        let i = "edge";
        n.section !== void 0 && (i += ` section-edge-${n.section}`);
        const a = e.level + 1;
        i += ` edge-depth-${a}`;
        const s = {
          id: `edge_${e.id}_${n.id}`,
          start: e.id.toString(),
          end: n.id.toString(),
          type: "normal",
          curve: "basis",
          thickness: "normal",
          look: "default",
          classes: i,
          // Store mindmap-specific data
          depth: e.level,
          section: n.section
        };
        r.push(s), this.generateEdges(n, r);
      }
  }
  /**
   * Get structured data for layout algorithms
   * Following the pattern established by ER diagrams
   * @returns Structured data containing nodes, edges, and config
   */
  getData() {
    const e = this.getMindmap(), r = we(), i = jX().layout !== void 0, a = r;
    if (i || (a.layout = "cose-bilkent"), !e)
      return {
        nodes: [],
        edges: [],
        config: a
      };
    ae.debug("getData: mindmapRoot", e, r), this.assignSections(e);
    const s = [], o = [];
    this.flattenNodes(e, s), this.generateEdges(e, o), ae.debug(
      `getData: processed ${s.length} nodes and ${o.length} edges`
    );
    const l = /* @__PURE__ */ new Map();
    for (const u of s)
      l.set(u.id, {
        shape: u.shape,
        width: u.width,
        height: u.height,
        padding: u.padding
      });
    return {
      nodes: s,
      edges: o,
      config: a,
      // Store the root node for mindmap-specific layout algorithms
      rootNode: e,
      // Properties required by dagre layout algorithm
      markers: ["point"],
      // Mindmaps don't use markers
      direction: "TB",
      // Top-to-bottom direction for mindmaps
      nodeSpacing: 50,
      // Default spacing between nodes
      rankSpacing: 50,
      // Default spacing between ranks
      // Add shapes for ELK compatibility
      shapes: Object.fromEntries(l),
      // Additional properties that layout algorithms might expect
      type: "mindmap",
      diagramId: "mindmap-" + u9e()
    };
  }
  // Expose logger to grammar
  getLogger() {
    return ae;
  }
}, x(Od, "MindmapDB"), Od), f9e = /* @__PURE__ */ x(async (t, e, r, n) => {
  var l, u;
  ae.debug(`Rendering mindmap diagram
` + t);
  const i = n.db, a = i.getData(), s = Ff(e, a.config.securityLevel);
  a.type = n.type, a.layoutAlgorithm = Gg(a.config.layout, {
    fallback: "cose-bilkent"
  }), a.diagramId = e, i.getMindmap() && (a.nodes.forEach((h) => {
    h.shape === "rounded" ? (h.radius = 15, h.taper = 15, h.stroke = "none", h.width = 0, h.padding = 15) : h.shape === "circle" ? h.padding = 10 : h.shape === "rect" && (h.width = 0, h.padding = 10);
  }), await Af(a, s), zu(
    s,
    ((l = a.config.mindmap) == null ? void 0 : l.padding) ?? hr.mindmap.padding,
    "mindmapDiagram",
    ((u = a.config.mindmap) == null ? void 0 : u.useMaxWidth) ?? hr.mindmap.useMaxWidth
  ));
}, "draw"), p9e = {
  draw: f9e
}, g9e = /* @__PURE__ */ x((t) => {
  let e = "";
  for (let r = 0; r < t.THEME_COLOR_LIMIT; r++)
    t["lineColor" + r] = t["lineColor" + r] || t["cScaleInv" + r], tc(t["lineColor" + r]) ? t["lineColor" + r] = _t(t["lineColor" + r], 20) : t["lineColor" + r] = It(t["lineColor" + r], 20);
  for (let r = 0; r < t.THEME_COLOR_LIMIT; r++) {
    const n = "" + (17 - 3 * r);
    e += `
    .section-${r - 1} rect, .section-${r - 1} path, .section-${r - 1} circle, .section-${r - 1} polygon, .section-${r - 1} path  {
      fill: ${t["cScale" + r]};
    }
    .section-${r - 1} text {
     fill: ${t["cScaleLabel" + r]};
    }
    .node-icon-${r - 1} {
      font-size: 40px;
      color: ${t["cScaleLabel" + r]};
    }
    .section-edge-${r - 1}{
      stroke: ${t["cScale" + r]};
    }
    .edge-depth-${r - 1}{
      stroke-width: ${n};
    }
    .section-${r - 1} line {
      stroke: ${t["cScaleInv" + r]} ;
      stroke-width: 3;
    }

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }
    `;
  }
  return e;
}, "genSections"), m9e = /* @__PURE__ */ x((t) => `
  .edge {
    stroke-width: 3;
  }
  ${g9e(t)}
  .section-root rect, .section-root path, .section-root circle, .section-root polygon  {
    fill: ${t.git0};
  }
  .section-root text {
    fill: ${t.gitBranchLabel0};
  }
  .section-root span {
    color: ${t.gitBranchLabel0};
  }
  .section-2 span {
    color: ${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;
  }
`, "getStyles"), v9e = m9e, y9e = {
  get db() {
    return new d9e();
  },
  renderer: p9e,
  parser: h9e,
  styles: v9e
};
const x9e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: y9e
}, Symbol.toStringTag, { value: "Module" }));
var B6 = function() {
  var t = /* @__PURE__ */ x(function(k, _, L, N) {
    for (L = L || {}, N = k.length; N--; L[k[N]] = _) ;
    return L;
  }, "o"), e = [1, 4], r = [1, 13], n = [1, 12], i = [1, 15], a = [1, 16], s = [1, 20], o = [1, 19], l = [6, 7, 8], u = [1, 26], h = [1, 24], d = [1, 25], f = [6, 7, 11], p = [1, 31], g = [6, 7, 11, 24], m = [1, 6, 13, 16, 17, 20, 23], v = [1, 35], y = [1, 36], b = [1, 6, 7, 11, 13, 16, 17, 20, 23], w = [1, 38], T = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    yy: {},
    symbols_: { error: 2, start: 3, mindMap: 4, spaceLines: 5, SPACELINE: 6, NL: 7, KANBAN: 8, document: 9, stop: 10, EOF: 11, statement: 12, SPACELIST: 13, node: 14, shapeData: 15, ICON: 16, CLASS: 17, nodeWithId: 18, nodeWithoutId: 19, NODE_DSTART: 20, NODE_DESCR: 21, NODE_DEND: 22, NODE_ID: 23, SHAPE_DATA: 24, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "KANBAN", 11: "EOF", 13: "SPACELIST", 16: "ICON", 17: "CLASS", 20: "NODE_DSTART", 21: "NODE_DESCR", 22: "NODE_DEND", 23: "NODE_ID", 24: "SHAPE_DATA" },
    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, 3], [12, 2], [12, 2], [12, 2], [12, 1], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [19, 3], [18, 1], [18, 4], [15, 2], [15, 1]],
    performAction: /* @__PURE__ */ x(function(_, L, N, A, O, P, S) {
      var R = P.length - 1;
      switch (O) {
        case 6:
        case 7:
          return A;
        case 8:
          A.getLogger().trace("Stop NL ");
          break;
        case 9:
          A.getLogger().trace("Stop EOF ");
          break;
        case 11:
          A.getLogger().trace("Stop NL2 ");
          break;
        case 12:
          A.getLogger().trace("Stop EOF2 ");
          break;
        case 15:
          A.getLogger().info("Node: ", P[R - 1].id), A.addNode(P[R - 2].length, P[R - 1].id, P[R - 1].descr, P[R - 1].type, P[R]);
          break;
        case 16:
          A.getLogger().info("Node: ", P[R].id), A.addNode(P[R - 1].length, P[R].id, P[R].descr, P[R].type);
          break;
        case 17:
          A.getLogger().trace("Icon: ", P[R]), A.decorateNode({ icon: P[R] });
          break;
        case 18:
        case 23:
          A.decorateNode({ class: P[R] });
          break;
        case 19:
          A.getLogger().trace("SPACELIST");
          break;
        case 20:
          A.getLogger().trace("Node: ", P[R - 1].id), A.addNode(0, P[R - 1].id, P[R - 1].descr, P[R - 1].type, P[R]);
          break;
        case 21:
          A.getLogger().trace("Node: ", P[R].id), A.addNode(0, P[R].id, P[R].descr, P[R].type);
          break;
        case 22:
          A.decorateNode({ icon: P[R] });
          break;
        case 27:
          A.getLogger().trace("node found ..", P[R - 2]), this.$ = { id: P[R - 1], descr: P[R - 1], type: A.getType(P[R - 2], P[R]) };
          break;
        case 28:
          this.$ = { id: P[R], descr: P[R], type: 0 };
          break;
        case 29:
          A.getLogger().trace("node found ..", P[R - 3]), this.$ = { id: P[R - 3], descr: P[R - 1], type: A.getType(P[R - 2], P[R]) };
          break;
        case 30:
          this.$ = P[R - 1] + P[R];
          break;
        case 31:
          this.$ = P[R];
          break;
      }
    }, "anonymous"),
    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: r, 7: [1, 10], 9: 9, 12: 11, 13: n, 14: 14, 16: i, 17: a, 18: 17, 19: 18, 20: s, 23: o }, t(l, [2, 3]), { 1: [2, 2] }, t(l, [2, 4]), t(l, [2, 5]), { 1: [2, 6], 6: r, 12: 21, 13: n, 14: 14, 16: i, 17: a, 18: 17, 19: 18, 20: s, 23: o }, { 6: r, 9: 22, 12: 11, 13: n, 14: 14, 16: i, 17: a, 18: 17, 19: 18, 20: s, 23: o }, { 6: u, 7: h, 10: 23, 11: d }, t(f, [2, 24], { 18: 17, 19: 18, 14: 27, 16: [1, 28], 17: [1, 29], 20: s, 23: o }), t(f, [2, 19]), t(f, [2, 21], { 15: 30, 24: p }), t(f, [2, 22]), t(f, [2, 23]), t(g, [2, 25]), t(g, [2, 26]), t(g, [2, 28], { 20: [1, 32] }), { 21: [1, 33] }, { 6: u, 7: h, 10: 34, 11: d }, { 1: [2, 7], 6: r, 12: 21, 13: n, 14: 14, 16: i, 17: a, 18: 17, 19: 18, 20: s, 23: o }, t(m, [2, 14], { 7: v, 11: y }), t(b, [2, 8]), t(b, [2, 9]), t(b, [2, 10]), t(f, [2, 16], { 15: 37, 24: p }), t(f, [2, 17]), t(f, [2, 18]), t(f, [2, 20], { 24: w }), t(g, [2, 31]), { 21: [1, 39] }, { 22: [1, 40] }, t(m, [2, 13], { 7: v, 11: y }), t(b, [2, 11]), t(b, [2, 12]), t(f, [2, 15], { 24: w }), t(g, [2, 30]), { 22: [1, 41] }, t(g, [2, 27]), t(g, [2, 29])],
    defaultActions: { 2: [2, 1], 6: [2, 2] },
    parseError: /* @__PURE__ */ x(function(_, L) {
      if (L.recoverable)
        this.trace(_);
      else {
        var N = new Error(_);
        throw N.hash = L, N;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(_) {
      var L = this, N = [0], A = [], O = [null], P = [], S = this.table, R = "", I = 0, D = 0, M = 2, B = 1, $ = P.slice.call(arguments, 1), F = Object.create(this.lexer), G = { yy: {} };
      for (var H in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, H) && (G.yy[H] = this.yy[H]);
      F.setInput(_, G.yy), G.yy.lexer = F, G.yy.parser = this, typeof F.yylloc > "u" && (F.yylloc = {});
      var ee = F.yylloc;
      P.push(ee);
      var Y = F.options && F.options.ranges;
      typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function re(W) {
        N.length = N.length - 2 * W, O.length = O.length - W, P.length = P.length - W;
      }
      x(re, "popStack");
      function ne() {
        var W;
        return W = A.pop() || F.lex() || B, typeof W != "number" && (W instanceof Array && (A = W, W = A.pop()), W = L.symbols_[W] || W), W;
      }
      x(ne, "lex");
      for (var he, K, Z, X, q = {}, J, j, pe, te; ; ) {
        if (K = N[N.length - 1], this.defaultActions[K] ? Z = this.defaultActions[K] : ((he === null || typeof he > "u") && (he = ne()), Z = S[K] && S[K][he]), typeof Z > "u" || !Z.length || !Z[0]) {
          var Ae = "";
          te = [];
          for (J in S[K])
            this.terminals_[J] && J > M && te.push("'" + this.terminals_[J] + "'");
          F.showPosition ? Ae = "Parse error on line " + (I + 1) + `:
` + F.showPosition() + `
Expecting ` + te.join(", ") + ", got '" + (this.terminals_[he] || he) + "'" : Ae = "Parse error on line " + (I + 1) + ": Unexpected " + (he == B ? "end of input" : "'" + (this.terminals_[he] || he) + "'"), this.parseError(Ae, {
            text: F.match,
            token: this.terminals_[he] || he,
            line: F.yylineno,
            loc: ee,
            expected: te
          });
        }
        if (Z[0] instanceof Array && Z.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + K + ", token: " + he);
        switch (Z[0]) {
          case 1:
            N.push(he), O.push(F.yytext), P.push(F.yylloc), N.push(Z[1]), he = null, D = F.yyleng, R = F.yytext, I = F.yylineno, ee = F.yylloc;
            break;
          case 2:
            if (j = this.productions_[Z[1]][1], q.$ = O[O.length - j], q._$ = {
              first_line: P[P.length - (j || 1)].first_line,
              last_line: P[P.length - 1].last_line,
              first_column: P[P.length - (j || 1)].first_column,
              last_column: P[P.length - 1].last_column
            }, Y && (q._$.range = [
              P[P.length - (j || 1)].range[0],
              P[P.length - 1].range[1]
            ]), X = this.performAction.apply(q, [
              R,
              D,
              I,
              G.yy,
              Z[1],
              O,
              P
            ].concat($)), typeof X < "u")
              return X;
            j && (N = N.slice(0, -1 * j * 2), O = O.slice(0, -1 * j), P = P.slice(0, -1 * j)), N.push(this.productions_[Z[1]][0]), O.push(q.$), P.push(q._$), pe = S[N[N.length - 2]][N[N.length - 1]], N.push(pe);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, E = /* @__PURE__ */ function() {
    var k = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(L, N) {
        if (this.yy.parser)
          this.yy.parser.parseError(L, N);
        else
          throw new Error(L);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(_, L) {
        return this.yy = L || this.yy || {}, this._input = _, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var _ = this._input[0];
        this.yytext += _, this.yyleng++, this.offset++, this.match += _, this.matched += _;
        var L = _.match(/(?:\r\n?|\n).*/g);
        return L ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), _;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(_) {
        var L = _.length, N = _.split(/(?:\r\n?|\n)/g);
        this._input = _ + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - L), this.offset -= L;
        var A = 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 O = 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 === A.length ? this.yylloc.first_column : 0) + A[A.length - N.length].length - N[0].length : this.yylloc.first_column - L
        }, this.options.ranges && (this.yylloc.range = [O[0], O[0] + this.yyleng - L]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(_) {
        this.unput(this.match.slice(_));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var _ = this.matched.substr(0, this.matched.length - this.match.length);
        return (_.length > 20 ? "..." : "") + _.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var _ = this.match;
        return _.length < 20 && (_ += this._input.substr(0, 20 - _.length)), (_.substr(0, 20) + (_.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var _ = this.pastInput(), L = new Array(_.length + 1).join("-");
        return _ + this.upcomingInput() + `
` + L + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(_, L) {
        var N, A, O;
        if (this.options.backtrack_lexer && (O = {
          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 && (O.yylloc.range = this.yylloc.range.slice(0))), A = _[0].match(/(?:\r\n?|\n).*/g), A && (this.yylineno += A.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: A ? A[A.length - 1].length - A[A.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + _[0].length
        }, this.yytext += _[0], this.match += _[0], this.matches = _, 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(_[0].length), this.matched += _[0], N = this.performAction.call(this, this.yy, this, L, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), N)
          return N;
        if (this._backtrack) {
          for (var P in O)
            this[P] = O[P];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var _, L, N, A;
        this._more || (this.yytext = "", this.match = "");
        for (var O = this._currentRules(), P = 0; P < O.length; P++)
          if (N = this._input.match(this.rules[O[P]]), N && (!L || N[0].length > L[0].length)) {
            if (L = N, A = P, this.options.backtrack_lexer) {
              if (_ = this.test_match(N, O[P]), _ !== !1)
                return _;
              if (this._backtrack) {
                L = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return L ? (_ = this.test_match(L, O[A]), _ !== !1 ? _ : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var L = this.next();
        return L || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(L) {
        this.conditionStack.push(L);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var L = this.conditionStack.length - 1;
        return L > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(L) {
        return L = this.conditionStack.length - 1 - Math.abs(L || 0), L >= 0 ? this.conditionStack[L] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(L) {
        this.begin(L);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(L, N, A, O) {
        switch (A) {
          case 0:
            return this.pushState("shapeData"), N.yytext = "", 24;
          case 1:
            return this.pushState("shapeDataStr"), 24;
          case 2:
            return this.popState(), 24;
          case 3:
            const P = /\n\s*/g;
            return N.yytext = N.yytext.replace(P, "<br/>"), 24;
          case 4:
            return 24;
          case 5:
            this.popState();
            break;
          case 6:
            return L.getLogger().trace("Found comment", N.yytext), 6;
          case 7:
            return 8;
          case 8:
            this.begin("CLASS");
            break;
          case 9:
            return this.popState(), 17;
          case 10:
            this.popState();
            break;
          case 11:
            L.getLogger().trace("Begin icon"), this.begin("ICON");
            break;
          case 12:
            return L.getLogger().trace("SPACELINE"), 6;
          case 13:
            return 7;
          case 14:
            return 16;
          case 15:
            L.getLogger().trace("end icon"), this.popState();
            break;
          case 16:
            return L.getLogger().trace("Exploding node"), this.begin("NODE"), 20;
          case 17:
            return L.getLogger().trace("Cloud"), this.begin("NODE"), 20;
          case 18:
            return L.getLogger().trace("Explosion Bang"), this.begin("NODE"), 20;
          case 19:
            return L.getLogger().trace("Cloud Bang"), this.begin("NODE"), 20;
          case 20:
            return this.begin("NODE"), 20;
          case 21:
            return this.begin("NODE"), 20;
          case 22:
            return this.begin("NODE"), 20;
          case 23:
            return this.begin("NODE"), 20;
          case 24:
            return 13;
          case 25:
            return 23;
          case 26:
            return 11;
          case 27:
            this.begin("NSTR2");
            break;
          case 28:
            return "NODE_DESCR";
          case 29:
            this.popState();
            break;
          case 30:
            L.getLogger().trace("Starting NSTR"), this.begin("NSTR");
            break;
          case 31:
            return L.getLogger().trace("description:", N.yytext), "NODE_DESCR";
          case 32:
            this.popState();
            break;
          case 33:
            return this.popState(), L.getLogger().trace("node end ))"), "NODE_DEND";
          case 34:
            return this.popState(), L.getLogger().trace("node end )"), "NODE_DEND";
          case 35:
            return this.popState(), L.getLogger().trace("node end ...", N.yytext), "NODE_DEND";
          case 36:
            return this.popState(), L.getLogger().trace("node end (("), "NODE_DEND";
          case 37:
            return this.popState(), L.getLogger().trace("node end (-"), "NODE_DEND";
          case 38:
            return this.popState(), L.getLogger().trace("node end (-"), "NODE_DEND";
          case 39:
            return this.popState(), L.getLogger().trace("node end (("), "NODE_DEND";
          case 40:
            return this.popState(), L.getLogger().trace("node end (("), "NODE_DEND";
          case 41:
            return L.getLogger().trace("Long description:", N.yytext), 21;
          case 42:
            return L.getLogger().trace("Long description:", N.yytext), 21;
        }
      }, "anonymous"),
      rules: [/^(?:@\{)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^\"]+)/i, /^(?:[^}^"]+)/i, /^(?:\})/i, /^(?:\s*%%.*)/i, /^(?:kanban\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: { shapeDataEndBracket: { rules: [], inclusive: !1 }, shapeDataStr: { rules: [2, 3], inclusive: !1 }, shapeData: { rules: [1, 4, 5], inclusive: !1 }, CLASS: { rules: [9, 10], inclusive: !1 }, ICON: { rules: [14, 15], inclusive: !1 }, NSTR2: { rules: [28, 29], inclusive: !1 }, NSTR: { rules: [31, 32], inclusive: !1 }, NODE: { rules: [27, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], inclusive: !1 }, INITIAL: { rules: [0, 6, 7, 8, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], inclusive: !0 } }
    };
    return k;
  }();
  T.lexer = E;
  function C() {
    this.yy = {};
  }
  return x(C, "Parser"), C.prototype = T, T.Parser = C, new C();
}();
B6.parser = B6;
var b9e = B6, Ua = [], y7 = [], F6 = 0, x7 = {}, w9e = /* @__PURE__ */ x(() => {
  Ua = [], y7 = [], F6 = 0, x7 = {};
}, "clear"), T9e = /* @__PURE__ */ x((t) => {
  if (Ua.length === 0)
    return null;
  const e = Ua[0].level;
  let r = null;
  for (let n = Ua.length - 1; n >= 0; n--)
    if (Ua[n].level === e && !r && (r = Ua[n]), Ua[n].level < e)
      throw new Error('Items without section detected, found section ("' + Ua[n].label + '")');
  return t === (r == null ? void 0 : r.level) ? null : r;
}, "getSection"), nY = /* @__PURE__ */ x(function() {
  return y7;
}, "getSections"), E9e = /* @__PURE__ */ x(function() {
  const t = [], e = [], r = nY(), n = we();
  for (const i of r) {
    const a = {
      id: i.id,
      label: fr(i.label ?? "", n),
      isGroup: !0,
      ticket: i.ticket,
      shape: "kanbanSection",
      level: i.level,
      look: n.look
    };
    e.push(a);
    const s = Ua.filter((o) => o.parentId === i.id);
    for (const o of s) {
      const l = {
        id: o.id,
        parentId: i.id,
        label: fr(o.label ?? "", n),
        isGroup: !1,
        ticket: o == null ? void 0 : o.ticket,
        priority: o == null ? void 0 : o.priority,
        assigned: o == null ? void 0 : o.assigned,
        icon: o == null ? void 0 : o.icon,
        shape: "kanbanItem",
        level: o.level,
        rx: 5,
        ry: 5,
        cssStyles: ["text-align: left"]
      };
      e.push(l);
    }
  }
  return { nodes: e, edges: t, other: {}, config: we() };
}, "getData"), k9e = /* @__PURE__ */ x((t, e, r, n, i) => {
  var u, h;
  const a = we();
  let s = ((u = a.mindmap) == null ? void 0 : u.padding) ?? hr.mindmap.padding;
  switch (n) {
    case In.ROUNDED_RECT:
    case In.RECT:
    case In.HEXAGON:
      s *= 2;
  }
  const o = {
    id: fr(e, a) || "kbn" + F6++,
    level: t,
    label: fr(r, a),
    width: ((h = a.mindmap) == null ? void 0 : h.maxNodeWidth) ?? hr.mindmap.maxNodeWidth,
    padding: s,
    isGroup: !1
  };
  if (i !== void 0) {
    let d;
    i.includes(`
`) ? d = i + `
` : d = `{
` + i + `
}`;
    const f = Q2(d, { schema: Z2 });
    if (f.shape && (f.shape !== f.shape.toLowerCase() || f.shape.includes("_")))
      throw new Error(`No such shape: ${f.shape}. Shape names should be lowercase.`);
    f != null && f.shape && f.shape === "kanbanItem" && (o.shape = f == null ? void 0 : f.shape), f != null && f.label && (o.label = f == null ? void 0 : f.label), f != null && f.icon && (o.icon = f == null ? void 0 : f.icon.toString()), f != null && f.assigned && (o.assigned = f == null ? void 0 : f.assigned.toString()), f != null && f.ticket && (o.ticket = f == null ? void 0 : f.ticket.toString()), f != null && f.priority && (o.priority = f == null ? void 0 : f.priority);
  }
  const l = T9e(t);
  l ? o.parentId = l.id || "kbn" + F6++ : y7.push(o), Ua.push(o);
}, "addNode"), In = {
  DEFAULT: 0,
  NO_BORDER: 0,
  ROUNDED_RECT: 1,
  RECT: 2,
  CIRCLE: 3,
  CLOUD: 4,
  BANG: 5,
  HEXAGON: 6
}, S9e = /* @__PURE__ */ x((t, e) => {
  switch (ae.debug("In get type", t, e), t) {
    case "[":
      return In.RECT;
    case "(":
      return e === ")" ? In.ROUNDED_RECT : In.CLOUD;
    case "((":
      return In.CIRCLE;
    case ")":
      return In.CLOUD;
    case "))":
      return In.BANG;
    case "{{":
      return In.HEXAGON;
    default:
      return In.DEFAULT;
  }
}, "getType"), C9e = /* @__PURE__ */ x((t, e) => {
  x7[t] = e;
}, "setElementForId"), A9e = /* @__PURE__ */ x((t) => {
  if (!t)
    return;
  const e = we(), r = Ua[Ua.length - 1];
  t.icon && (r.icon = fr(t.icon, e)), t.class && (r.cssClasses = fr(t.class, e));
}, "decorateNode"), _9e = /* @__PURE__ */ x((t) => {
  switch (t) {
    case In.DEFAULT:
      return "no-border";
    case In.RECT:
      return "rect";
    case In.ROUNDED_RECT:
      return "rounded-rect";
    case In.CIRCLE:
      return "circle";
    case In.CLOUD:
      return "cloud";
    case In.BANG:
      return "bang";
    case In.HEXAGON:
      return "hexgon";
    default:
      return "no-border";
  }
}, "type2Str"), L9e = /* @__PURE__ */ x(() => ae, "getLogger"), R9e = /* @__PURE__ */ x((t) => x7[t], "getElementById"), N9e = {
  clear: w9e,
  addNode: k9e,
  getSections: nY,
  getData: E9e,
  nodeType: In,
  getType: S9e,
  setElementForId: C9e,
  decorateNode: A9e,
  type2Str: _9e,
  getLogger: L9e,
  getElementById: R9e
}, M9e = N9e, D9e = /* @__PURE__ */ x(async (t, e, r, n) => {
  var v, y, b, w, T;
  ae.debug(`Rendering kanban diagram
` + t);
  const a = n.db.getData(), s = we();
  s.htmlLabels = !1;
  const o = tl(e), l = o.append("g");
  l.attr("class", "sections");
  const u = o.append("g");
  u.attr("class", "items");
  const h = a.nodes.filter(
    // TODO: TypeScript 5.5 will infer this predicate automatically
    (E) => E.isGroup
  );
  let d = 0;
  const f = 10, p = [];
  let g = 25;
  for (const E of h) {
    const C = ((v = s == null ? void 0 : s.kanban) == null ? void 0 : v.sectionWidth) || 200;
    d = d + 1, E.x = C * d + (d - 1) * f / 2, E.width = C, E.y = 0, E.height = C * 3, E.rx = 5, E.ry = 5, E.cssClasses = E.cssClasses + " section-" + d;
    const k = await ZE(l, E);
    g = Math.max(g, (y = k == null ? void 0 : k.labelBBox) == null ? void 0 : y.height), p.push(k);
  }
  let m = 0;
  for (const E of h) {
    const C = p[m];
    m = m + 1;
    const k = ((b = s == null ? void 0 : s.kanban) == null ? void 0 : b.sectionWidth) || 200, _ = -k * 3 / 2 + g;
    let L = _;
    const N = a.nodes.filter((P) => P.parentId === E.id);
    for (const P of N) {
      if (P.isGroup)
        throw new Error("Groups within groups are not allowed in Kanban diagrams");
      P.x = E.x, P.width = k - 1.5 * f;
      const R = (await ux(u, P, { config: s })).node().getBBox();
      P.y = L + R.height / 2, await zw(P), L = P.y + R.height / 2 + f / 2;
    }
    const A = C.cluster.select("rect"), O = Math.max(L - _ + 3 * f, 50) + (g - 25);
    A.attr("height", O);
  }
  Lg(
    void 0,
    o,
    ((w = s.mindmap) == null ? void 0 : w.padding) ?? hr.kanban.padding,
    ((T = s.mindmap) == null ? void 0 : T.useMaxWidth) ?? hr.kanban.useMaxWidth
  );
}, "draw"), I9e = {
  draw: D9e
}, O9e = /* @__PURE__ */ x((t) => {
  let e = "";
  for (let n = 0; n < t.THEME_COLOR_LIMIT; n++)
    t["lineColor" + n] = t["lineColor" + n] || t["cScaleInv" + n], tc(t["lineColor" + n]) ? t["lineColor" + n] = _t(t["lineColor" + n], 20) : t["lineColor" + n] = It(t["lineColor" + n], 20);
  const r = /* @__PURE__ */ x((n, i) => t.darkMode ? It(n, i) : _t(n, i), "adjuster");
  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: ${r(t["cScale" + n], 10)};
      stroke: ${r(t["cScale" + n], 10)};

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

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

  .kanban-ticket-link {
    fill: ${t.background};
    stroke: ${t.nodeBorder};
    text-decoration: underline;
  }
    `;
  }
  return e;
}, "genSections"), P9e = /* @__PURE__ */ x((t) => `
  .edge {
    stroke-width: 3;
  }
  ${O9e(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;
  }
  .cluster-label, .label {
    color: ${t.textColor};
    fill: ${t.textColor};
    }
  .kanban-label {
    dy: 1em;
    alignment-baseline: middle;
    text-anchor: middle;
    dominant-baseline: middle;
    text-align: center;
  }
    ${l1()}
`, "getStyles"), B9e = P9e, F9e = {
  db: M9e,
  renderer: I9e,
  parser: b9e,
  styles: B9e
};
const $9e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: F9e
}, Symbol.toStringTag, { value: "Module" }));
function VN(t, e) {
  let r;
  if (e === void 0)
    for (const n of t)
      n != null && (r < n || r === void 0 && n >= n) && (r = n);
  else {
    let n = -1;
    for (let i of t)
      (i = e(i, ++n, t)) != null && (r < i || r === void 0 && i >= i) && (r = i);
  }
  return r;
}
function iY(t, e) {
  let r;
  if (e === void 0)
    for (const n of t)
      n != null && (r > n || r === void 0 && n >= n) && (r = n);
  else {
    let n = -1;
    for (let i of t)
      (i = e(i, ++n, t)) != null && (r > i || r === void 0 && i >= i) && (r = i);
  }
  return r;
}
function F5(t, e) {
  let r = 0;
  if (e === void 0)
    for (let n of t)
      (n = +n) && (r += n);
  else {
    let n = -1;
    for (let i of t)
      (i = +e(i, ++n, t)) && (r += i);
  }
  return r;
}
function z9e(t) {
  return t.target.depth;
}
function V9e(t) {
  return t.depth;
}
function G9e(t, e) {
  return e - 1 - t.height;
}
function aY(t, e) {
  return t.sourceLinks.length ? t.depth : e - 1;
}
function U9e(t) {
  return t.targetLinks.length ? t.depth : t.sourceLinks.length ? iY(t.sourceLinks, z9e) - 1 : 0;
}
function Dm(t) {
  return function() {
    return t;
  };
}
function GN(t, e) {
  return L2(t.source, e.source) || t.index - e.index;
}
function UN(t, e) {
  return L2(t.target, e.target) || t.index - e.index;
}
function L2(t, e) {
  return t.y0 - e.y0;
}
function $5(t) {
  return t.value;
}
function W9e(t) {
  return t.index;
}
function H9e(t) {
  return t.nodes;
}
function q9e(t) {
  return t.links;
}
function WN(t, e) {
  const r = t.get(e);
  if (!r) throw new Error("missing: " + e);
  return r;
}
function HN({ nodes: t }) {
  for (const e of t) {
    let r = e.y0, n = r;
    for (const i of e.sourceLinks)
      i.y0 = r + i.width / 2, r += i.width;
    for (const i of e.targetLinks)
      i.y1 = n + i.width / 2, n += i.width;
  }
}
function Y9e() {
  let t = 0, e = 0, r = 1, n = 1, i = 24, a = 8, s, o = W9e, l = aY, u, h, d = H9e, f = q9e, p = 6;
  function g() {
    const R = { nodes: d.apply(null, arguments), links: f.apply(null, arguments) };
    return m(R), v(R), y(R), b(R), E(R), HN(R), R;
  }
  g.update = function(R) {
    return HN(R), R;
  }, g.nodeId = function(R) {
    return arguments.length ? (o = typeof R == "function" ? R : Dm(R), g) : o;
  }, g.nodeAlign = function(R) {
    return arguments.length ? (l = typeof R == "function" ? R : Dm(R), g) : l;
  }, g.nodeSort = function(R) {
    return arguments.length ? (u = R, g) : u;
  }, g.nodeWidth = function(R) {
    return arguments.length ? (i = +R, g) : i;
  }, g.nodePadding = function(R) {
    return arguments.length ? (a = s = +R, g) : a;
  }, g.nodes = function(R) {
    return arguments.length ? (d = typeof R == "function" ? R : Dm(R), g) : d;
  }, g.links = function(R) {
    return arguments.length ? (f = typeof R == "function" ? R : Dm(R), g) : f;
  }, g.linkSort = function(R) {
    return arguments.length ? (h = R, g) : h;
  }, g.size = function(R) {
    return arguments.length ? (t = e = 0, r = +R[0], n = +R[1], g) : [r - t, n - e];
  }, g.extent = function(R) {
    return arguments.length ? (t = +R[0][0], r = +R[1][0], e = +R[0][1], n = +R[1][1], g) : [[t, e], [r, n]];
  }, g.iterations = function(R) {
    return arguments.length ? (p = +R, g) : p;
  };
  function m({ nodes: R, links: I }) {
    for (const [M, B] of R.entries())
      B.index = M, B.sourceLinks = [], B.targetLinks = [];
    const D = new Map(R.map((M, B) => [o(M, B, R), M]));
    for (const [M, B] of I.entries()) {
      B.index = M;
      let { source: $, target: F } = B;
      typeof $ != "object" && ($ = B.source = WN(D, $)), typeof F != "object" && (F = B.target = WN(D, F)), $.sourceLinks.push(B), F.targetLinks.push(B);
    }
    if (h != null)
      for (const { sourceLinks: M, targetLinks: B } of R)
        M.sort(h), B.sort(h);
  }
  function v({ nodes: R }) {
    for (const I of R)
      I.value = I.fixedValue === void 0 ? Math.max(F5(I.sourceLinks, $5), F5(I.targetLinks, $5)) : I.fixedValue;
  }
  function y({ nodes: R }) {
    const I = R.length;
    let D = new Set(R), M = /* @__PURE__ */ new Set(), B = 0;
    for (; D.size; ) {
      for (const $ of D) {
        $.depth = B;
        for (const { target: F } of $.sourceLinks)
          M.add(F);
      }
      if (++B > I) throw new Error("circular link");
      D = M, M = /* @__PURE__ */ new Set();
    }
  }
  function b({ nodes: R }) {
    const I = R.length;
    let D = new Set(R), M = /* @__PURE__ */ new Set(), B = 0;
    for (; D.size; ) {
      for (const $ of D) {
        $.height = B;
        for (const { source: F } of $.targetLinks)
          M.add(F);
      }
      if (++B > I) throw new Error("circular link");
      D = M, M = /* @__PURE__ */ new Set();
    }
  }
  function w({ nodes: R }) {
    const I = VN(R, (B) => B.depth) + 1, D = (r - t - i) / (I - 1), M = new Array(I);
    for (const B of R) {
      const $ = Math.max(0, Math.min(I - 1, Math.floor(l.call(null, B, I))));
      B.layer = $, B.x0 = t + $ * D, B.x1 = B.x0 + i, M[$] ? M[$].push(B) : M[$] = [B];
    }
    if (u) for (const B of M)
      B.sort(u);
    return M;
  }
  function T(R) {
    const I = iY(R, (D) => (n - e - (D.length - 1) * s) / F5(D, $5));
    for (const D of R) {
      let M = e;
      for (const B of D) {
        B.y0 = M, B.y1 = M + B.value * I, M = B.y1 + s;
        for (const $ of B.sourceLinks)
          $.width = $.value * I;
      }
      M = (n - M + s) / (D.length + 1);
      for (let B = 0; B < D.length; ++B) {
        const $ = D[B];
        $.y0 += M * (B + 1), $.y1 += M * (B + 1);
      }
      O(D);
    }
  }
  function E(R) {
    const I = w(R);
    s = Math.min(a, (n - e) / (VN(I, (D) => D.length) - 1)), T(I);
    for (let D = 0; D < p; ++D) {
      const M = Math.pow(0.99, D), B = Math.max(1 - M, (D + 1) / p);
      k(I, M, B), C(I, M, B);
    }
  }
  function C(R, I, D) {
    for (let M = 1, B = R.length; M < B; ++M) {
      const $ = R[M];
      for (const F of $) {
        let G = 0, H = 0;
        for (const { source: Y, value: re } of F.targetLinks) {
          let ne = re * (F.layer - Y.layer);
          G += P(Y, F) * ne, H += ne;
        }
        if (!(H > 0)) continue;
        let ee = (G / H - F.y0) * I;
        F.y0 += ee, F.y1 += ee, A(F);
      }
      u === void 0 && $.sort(L2), _($, D);
    }
  }
  function k(R, I, D) {
    for (let M = R.length, B = M - 2; B >= 0; --B) {
      const $ = R[B];
      for (const F of $) {
        let G = 0, H = 0;
        for (const { target: Y, value: re } of F.sourceLinks) {
          let ne = re * (Y.layer - F.layer);
          G += S(F, Y) * ne, H += ne;
        }
        if (!(H > 0)) continue;
        let ee = (G / H - F.y0) * I;
        F.y0 += ee, F.y1 += ee, A(F);
      }
      u === void 0 && $.sort(L2), _($, D);
    }
  }
  function _(R, I) {
    const D = R.length >> 1, M = R[D];
    N(R, M.y0 - s, D - 1, I), L(R, M.y1 + s, D + 1, I), N(R, n, R.length - 1, I), L(R, e, 0, I);
  }
  function L(R, I, D, M) {
    for (; D < R.length; ++D) {
      const B = R[D], $ = (I - B.y0) * M;
      $ > 1e-6 && (B.y0 += $, B.y1 += $), I = B.y1 + s;
    }
  }
  function N(R, I, D, M) {
    for (; D >= 0; --D) {
      const B = R[D], $ = (B.y1 - I) * M;
      $ > 1e-6 && (B.y0 -= $, B.y1 -= $), I = B.y0 - s;
    }
  }
  function A({ sourceLinks: R, targetLinks: I }) {
    if (h === void 0) {
      for (const { source: { sourceLinks: D } } of I)
        D.sort(UN);
      for (const { target: { targetLinks: D } } of R)
        D.sort(GN);
    }
  }
  function O(R) {
    if (h === void 0)
      for (const { sourceLinks: I, targetLinks: D } of R)
        I.sort(UN), D.sort(GN);
  }
  function P(R, I) {
    let D = R.y0 - (R.sourceLinks.length - 1) * s / 2;
    for (const { target: M, width: B } of R.sourceLinks) {
      if (M === I) break;
      D += B + s;
    }
    for (const { source: M, width: B } of I.targetLinks) {
      if (M === R) break;
      D -= B;
    }
    return D;
  }
  function S(R, I) {
    let D = I.y0 - (I.targetLinks.length - 1) * s / 2;
    for (const { source: M, width: B } of I.targetLinks) {
      if (M === R) break;
      D += B + s;
    }
    for (const { target: M, width: B } of R.sourceLinks) {
      if (M === I) break;
      D -= B;
    }
    return D;
  }
  return g;
}
var $6 = Math.PI, z6 = 2 * $6, Oc = 1e-6, X9e = z6 - Oc;
function V6() {
  this._x0 = this._y0 = // start of current subpath
  this._x1 = this._y1 = null, this._ = "";
}
function sY() {
  return new V6();
}
V6.prototype = sY.prototype = {
  constructor: V6,
  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, r, n) {
    this._ += "Q" + +t + "," + +e + "," + (this._x1 = +r) + "," + (this._y1 = +n);
  },
  bezierCurveTo: function(t, e, r, n, i, a) {
    this._ += "C" + +t + "," + +e + "," + +r + "," + +n + "," + (this._x1 = +i) + "," + (this._y1 = +a);
  },
  arcTo: function(t, e, r, n, i) {
    t = +t, e = +e, r = +r, n = +n, i = +i;
    var a = this._x1, s = this._y1, o = r - t, l = n - e, u = a - t, h = s - e, d = u * u + h * h;
    if (i < 0) throw new Error("negative radius: " + i);
    if (this._x1 === null)
      this._ += "M" + (this._x1 = t) + "," + (this._y1 = e);
    else if (d > Oc) if (!(Math.abs(h * o - l * u) > Oc) || !i)
      this._ += "L" + (this._x1 = t) + "," + (this._y1 = e);
    else {
      var f = r - a, p = n - s, g = o * o + l * l, m = f * f + p * p, v = Math.sqrt(g), y = Math.sqrt(d), b = i * Math.tan(($6 - Math.acos((g + d - m) / (2 * v * y))) / 2), w = b / y, T = b / v;
      Math.abs(w - 1) > Oc && (this._ += "L" + (t + w * u) + "," + (e + w * h)), this._ += "A" + i + "," + i + ",0,0," + +(h * f > u * p) + "," + (this._x1 = t + T * o) + "," + (this._y1 = e + T * l);
    }
  },
  arc: function(t, e, r, n, i, a) {
    t = +t, e = +e, r = +r, a = !!a;
    var s = r * Math.cos(n), o = r * Math.sin(n), l = t + s, u = e + o, h = 1 ^ a, d = a ? n - i : i - n;
    if (r < 0) throw new Error("negative radius: " + r);
    this._x1 === null ? this._ += "M" + l + "," + u : (Math.abs(this._x1 - l) > Oc || Math.abs(this._y1 - u) > Oc) && (this._ += "L" + l + "," + u), r && (d < 0 && (d = d % z6 + z6), d > X9e ? this._ += "A" + r + "," + r + ",0,1," + h + "," + (t - s) + "," + (e - o) + "A" + r + "," + r + ",0,1," + h + "," + (this._x1 = l) + "," + (this._y1 = u) : d > Oc && (this._ += "A" + r + "," + r + ",0," + +(d >= $6) + "," + h + "," + (this._x1 = t + r * Math.cos(i)) + "," + (this._y1 = e + r * Math.sin(i))));
  },
  rect: function(t, e, r, n) {
    this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +e) + "h" + +r + "v" + +n + "h" + -r + "Z";
  },
  toString: function() {
    return this._;
  }
};
function qN(t) {
  return function() {
    return t;
  };
}
function j9e(t) {
  return t[0];
}
function K9e(t) {
  return t[1];
}
var Z9e = Array.prototype.slice;
function Q9e(t) {
  return t.source;
}
function J9e(t) {
  return t.target;
}
function eLe(t) {
  var e = Q9e, r = J9e, n = j9e, i = K9e, a = null;
  function s() {
    var o, l = Z9e.call(arguments), u = e.apply(this, l), h = r.apply(this, l);
    if (a || (a = o = sY()), t(a, +n.apply(this, (l[0] = u, l)), +i.apply(this, l), +n.apply(this, (l[0] = h, l)), +i.apply(this, l)), o) return a = null, o + "" || null;
  }
  return s.source = function(o) {
    return arguments.length ? (e = o, s) : e;
  }, s.target = function(o) {
    return arguments.length ? (r = o, s) : r;
  }, s.x = function(o) {
    return arguments.length ? (n = typeof o == "function" ? o : qN(+o), s) : n;
  }, s.y = function(o) {
    return arguments.length ? (i = typeof o == "function" ? o : qN(+o), s) : i;
  }, s.context = function(o) {
    return arguments.length ? (a = o ?? null, s) : a;
  }, s;
}
function tLe(t, e, r, n, i) {
  t.moveTo(e, r), t.bezierCurveTo(e = (e + n) / 2, r, e, i, n, i);
}
function rLe() {
  return eLe(tLe);
}
function nLe(t) {
  return [t.source.x1, t.y0];
}
function iLe(t) {
  return [t.target.x0, t.y1];
}
function aLe() {
  return rLe().source(nLe).target(iLe);
}
var G6 = function() {
  var t = /* @__PURE__ */ x(function(o, l, u, h) {
    for (u = u || {}, h = o.length; h--; u[o[h]] = l) ;
    return u;
  }, "o"), e = [1, 9], r = [1, 10], n = [1, 5, 10, 12], i = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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: /* @__PURE__ */ x(function(l, u, h, d, f, p, g) {
      var m = p.length - 1;
      switch (f) {
        case 7:
          const v = d.findOrCreateNode(p[m - 4].trim().replaceAll('""', '"')), y = d.findOrCreateNode(p[m - 2].trim().replaceAll('""', '"')), b = parseFloat(p[m].trim());
          d.addLink(v, y, b);
          break;
        case 8:
        case 9:
        case 11:
          this.$ = p[m];
          break;
        case 10:
          this.$ = p[m - 1];
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: e, 20: r }, { 1: [2, 6], 7: 11, 10: [1, 12] }, t(r, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, t(n, [2, 8]), t(n, [2, 9]), { 19: [1, 16] }, t(n, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, t(r, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: e, 20: r }, { 15: 18, 16: 7, 17: 8, 18: e, 20: r }, { 18: [1, 19] }, t(r, [2, 3]), { 12: [1, 20] }, t(n, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: e, 20: r }, t([1, 5, 10], [2, 7])],
    defaultActions: { 11: [2, 1], 12: [2, 5] },
    parseError: /* @__PURE__ */ x(function(l, u) {
      if (u.recoverable)
        this.trace(l);
      else {
        var h = new Error(l);
        throw h.hash = u, h;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(l) {
      var u = this, h = [0], d = [], f = [null], p = [], g = this.table, m = "", v = 0, y = 0, b = 2, w = 1, T = p.slice.call(arguments, 1), E = Object.create(this.lexer), C = { yy: {} };
      for (var k in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, k) && (C.yy[k] = this.yy[k]);
      E.setInput(l, C.yy), C.yy.lexer = E, C.yy.parser = this, typeof E.yylloc > "u" && (E.yylloc = {});
      var _ = E.yylloc;
      p.push(_);
      var L = E.options && E.options.ranges;
      typeof C.yy.parseError == "function" ? this.parseError = C.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function N(G) {
        h.length = h.length - 2 * G, f.length = f.length - G, p.length = p.length - G;
      }
      x(N, "popStack");
      function A() {
        var G;
        return G = d.pop() || E.lex() || w, typeof G != "number" && (G instanceof Array && (d = G, G = d.pop()), G = u.symbols_[G] || G), G;
      }
      x(A, "lex");
      for (var O, P, S, R, I = {}, D, M, B, $; ; ) {
        if (P = h[h.length - 1], this.defaultActions[P] ? S = this.defaultActions[P] : ((O === null || typeof O > "u") && (O = A()), S = g[P] && g[P][O]), typeof S > "u" || !S.length || !S[0]) {
          var F = "";
          $ = [];
          for (D in g[P])
            this.terminals_[D] && D > b && $.push("'" + this.terminals_[D] + "'");
          E.showPosition ? F = "Parse error on line " + (v + 1) + `:
` + E.showPosition() + `
Expecting ` + $.join(", ") + ", got '" + (this.terminals_[O] || O) + "'" : F = "Parse error on line " + (v + 1) + ": Unexpected " + (O == w ? "end of input" : "'" + (this.terminals_[O] || O) + "'"), this.parseError(F, {
            text: E.match,
            token: this.terminals_[O] || O,
            line: E.yylineno,
            loc: _,
            expected: $
          });
        }
        if (S[0] instanceof Array && S.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + P + ", token: " + O);
        switch (S[0]) {
          case 1:
            h.push(O), f.push(E.yytext), p.push(E.yylloc), h.push(S[1]), O = null, y = E.yyleng, m = E.yytext, v = E.yylineno, _ = E.yylloc;
            break;
          case 2:
            if (M = this.productions_[S[1]][1], I.$ = f[f.length - M], I._$ = {
              first_line: p[p.length - (M || 1)].first_line,
              last_line: p[p.length - 1].last_line,
              first_column: p[p.length - (M || 1)].first_column,
              last_column: p[p.length - 1].last_column
            }, L && (I._$.range = [
              p[p.length - (M || 1)].range[0],
              p[p.length - 1].range[1]
            ]), R = this.performAction.apply(I, [
              m,
              y,
              v,
              C.yy,
              S[1],
              f,
              p
            ].concat(T)), typeof R < "u")
              return R;
            M && (h = h.slice(0, -1 * M * 2), f = f.slice(0, -1 * M), p = p.slice(0, -1 * M)), h.push(this.productions_[S[1]][0]), f.push(I.$), p.push(I._$), B = g[h[h.length - 2]][h[h.length - 1]], h.push(B);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, a = /* @__PURE__ */ function() {
    var o = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(u, h) {
        if (this.yy.parser)
          this.yy.parser.parseError(u, h);
        else
          throw new Error(u);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(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;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(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;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(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 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), h.length - 1 && (this.yylineno -= h.length - 1);
        var f = 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 === d.length ? this.yylloc.first_column : 0) + d[d.length - h.length].length - h[0].length : this.yylloc.first_column - u
        }, this.options.ranges && (this.yylloc.range = [f[0], f[0] + this.yyleng - u]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(l) {
        this.unput(this.match.slice(l));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var l = this.matched.substr(0, this.matched.length - this.match.length);
        return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(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, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var l = this.pastInput(), u = new Array(l.length + 1).join("-");
        return l + this.upcomingInput() + `
` + u + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(l, u) {
        var h, d, f;
        if (this.options.backtrack_lexer && (f = {
          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 && (f.yylloc.range = this.yylloc.range.slice(0))), d = l[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 + 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 f)
            this[p] = f[p];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var l, u, h, d;
        this._more || (this.yytext = "", this.match = "");
        for (var f = this._currentRules(), p = 0; p < f.length; p++)
          if (h = this._input.match(this.rules[f[p]]), h && (!u || h[0].length > u[0].length)) {
            if (u = h, d = p, this.options.backtrack_lexer) {
              if (l = this.test_match(h, f[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, f[d]), 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
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var u = this.next();
        return u || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(u) {
        this.conditionStack.push(u);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var u = this.conditionStack.length - 1;
        return u > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(u) {
        return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(u) {
        this.begin(u);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ x(function(u, h, d, f) {
        switch (d) {
          case 0:
            return this.pushState("csv"), 4;
          case 1:
            return this.pushState("csv"), 4;
          case 2:
            return 10;
          case 3:
            return 5;
          case 4:
            return 12;
          case 5:
            return this.pushState("escaped_text"), 18;
          case 6:
            return 20;
          case 7:
            return this.popState("escaped_text"), 18;
          case 8:
            return 19;
        }
      }, "anonymous"),
      rules: [/^(?:sankey-beta\b)/i, /^(?:sankey\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: [2, 3, 4, 5, 6, 7, 8], inclusive: !1 }, escaped_text: { rules: [7, 8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8], inclusive: !0 } }
    };
    return o;
  }();
  i.lexer = a;
  function s() {
    this.yy = {};
  }
  return x(s, "Parser"), s.prototype = i, i.Parser = s, new s();
}();
G6.parser = G6;
var R2 = G6, yb = [], xb = [], N2 = /* @__PURE__ */ new Map(), sLe = /* @__PURE__ */ x(() => {
  yb = [], xb = [], N2 = /* @__PURE__ */ new Map(), _n();
}, "clear"), Pd, oLe = (Pd = class {
  constructor(e, r, n = 0) {
    this.source = e, this.target = r, this.value = n;
  }
}, x(Pd, "SankeyLink"), Pd), lLe = /* @__PURE__ */ x((t, e, r) => {
  yb.push(new oLe(t, e, r));
}, "addLink"), Bd, cLe = (Bd = class {
  constructor(e) {
    this.ID = e;
  }
}, x(Bd, "SankeyNode"), Bd), uLe = /* @__PURE__ */ x((t) => {
  t = at.sanitizeText(t, we());
  let e = N2.get(t);
  return e === void 0 && (e = new cLe(t), N2.set(t, e), xb.push(e)), e;
}, "findOrCreateNode"), hLe = /* @__PURE__ */ x(() => xb, "getNodes"), dLe = /* @__PURE__ */ x(() => yb, "getLinks"), fLe = /* @__PURE__ */ x(() => ({
  nodes: xb.map((t) => ({ id: t.ID })),
  links: yb.map((t) => ({
    source: t.source.ID,
    target: t.target.ID,
    value: t.value
  }))
}), "getGraph"), pLe = {
  nodesMap: N2,
  getConfig: /* @__PURE__ */ x(() => we().sankey, "getConfig"),
  getNodes: hLe,
  getLinks: dLe,
  getGraph: fLe,
  addLink: lLe,
  findOrCreateNode: uLe,
  getAccTitle: Vn,
  setAccTitle: Cn,
  getAccDescription: Un,
  setAccDescription: Gn,
  getDiagramTitle: Ln,
  setDiagramTitle: Qn,
  clear: sLe
}, Bo, YN = (Bo = class {
  static next(e) {
    return new Bo(e + ++Bo.count);
  }
  constructor(e) {
    this.id = e, this.href = `#${e}`;
  }
  toString() {
    return "url(" + this.href + ")";
  }
}, x(Bo, "Uid"), Bo.count = 0, Bo), gLe = {
  left: V9e,
  right: G9e,
  center: U9e,
  justify: aY
}, mLe = /* @__PURE__ */ x(function(t, e, r, n) {
  const { securityLevel: i, sankey: a } = we(), s = RM.sankey;
  let o;
  i === "sandbox" && (o = Qe("#i" + e));
  const l = Qe(i === "sandbox" ? o.nodes()[0].contentDocument.body : "body"), u = i === "sandbox" ? l.select(`[id="${e}"]`) : Qe(`[id="${e}"]`), h = (a == null ? void 0 : a.width) ?? s.width, d = (a == null ? void 0 : a.height) ?? s.width, f = (a == null ? void 0 : a.useMaxWidth) ?? s.useMaxWidth, p = (a == null ? void 0 : a.nodeAlignment) ?? s.nodeAlignment, g = (a == null ? void 0 : a.prefix) ?? s.prefix, m = (a == null ? void 0 : a.suffix) ?? s.suffix, v = (a == null ? void 0 : a.showValues) ?? s.showValues, y = n.db.getGraph(), b = gLe[p];
  Y9e().nodeId((N) => N.id).nodeWidth(10).nodePadding(10 + (v ? 15 : 0)).nodeAlign(b).extent([
    [0, 0],
    [h, d]
  ])(y);
  const E = Qc(Ete);
  u.append("g").attr("class", "nodes").selectAll(".node").data(y.nodes).join("g").attr("class", "node").attr("id", (N) => (N.uid = YN.next("node-")).id).attr("transform", function(N) {
    return "translate(" + N.x0 + "," + N.y0 + ")";
  }).attr("x", (N) => N.x0).attr("y", (N) => N.y0).append("rect").attr("height", (N) => N.y1 - N.y0).attr("width", (N) => N.x1 - N.x0).attr("fill", (N) => E(N.id));
  const C = /* @__PURE__ */ x(({ id: N, value: A }) => v ? `${N}
${g}${Math.round(A * 100) / 100}${m}` : N, "getText");
  u.append("g").attr("class", "node-labels").attr("font-size", 14).selectAll("text").data(y.nodes).join("text").attr("x", (N) => N.x0 < h / 2 ? N.x1 + 6 : N.x0 - 6).attr("y", (N) => (N.y1 + N.y0) / 2).attr("dy", `${v ? "0" : "0.35"}em`).attr("text-anchor", (N) => N.x0 < h / 2 ? "start" : "end").text(C);
  const k = u.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(y.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply"), _ = (a == null ? void 0 : a.linkColor) ?? "gradient";
  if (_ === "gradient") {
    const N = k.append("linearGradient").attr("id", (A) => (A.uid = YN.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (A) => A.source.x1).attr("x2", (A) => A.target.x0);
    N.append("stop").attr("offset", "0%").attr("stop-color", (A) => E(A.source.id)), N.append("stop").attr("offset", "100%").attr("stop-color", (A) => E(A.target.id));
  }
  let L;
  switch (_) {
    case "gradient":
      L = /* @__PURE__ */ x((N) => N.uid, "coloring");
      break;
    case "source":
      L = /* @__PURE__ */ x((N) => E(N.source.id), "coloring");
      break;
    case "target":
      L = /* @__PURE__ */ x((N) => E(N.target.id), "coloring");
      break;
    default:
      L = _;
  }
  k.append("path").attr("d", aLe()).attr("stroke", L).attr("stroke-width", (N) => Math.max(1, N.width)), Lg(void 0, u, 0, f);
}, "draw"), vLe = {
  draw: mLe
}, yLe = /* @__PURE__ */ x((t) => t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, `
`).trim(), "prepareTextForParsing"), xLe = /* @__PURE__ */ x((t) => `.label {
      font-family: ${t.fontFamily};
    }`, "getStyles"), bLe = xLe, wLe = R2.parse.bind(R2);
R2.parse = (t) => wLe(yLe(t));
var TLe = {
  styles: bLe,
  parser: R2,
  db: pLe,
  renderer: vLe
};
const ELe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: TLe
}, Symbol.toStringTag, { value: "Module" }));
var kLe = hr.packet, Fd, oY = (Fd = class {
  constructor() {
    this.packet = [], this.setAccTitle = Cn, this.getAccTitle = Vn, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.getAccDescription = Un, this.setAccDescription = Gn;
  }
  getConfig() {
    const e = qi({
      ...kLe,
      ...gr().packet
    });
    return e.showBits && (e.paddingY += 10), e;
  }
  getPacket() {
    return this.packet;
  }
  pushWord(e) {
    e.length > 0 && this.packet.push(e);
  }
  clear() {
    _n(), this.packet = [];
  }
}, x(Fd, "PacketDB"), Fd), SLe = 1e4, CLe = /* @__PURE__ */ x((t, e) => {
  Vu(t, e);
  let r = -1, n = [], i = 1;
  const { bitsPerRow: a } = e.getConfig();
  for (let { start: s, end: o, bits: l, label: u } of t.blocks) {
    if (s !== void 0 && o !== void 0 && o < s)
      throw new Error(`Packet block ${s} - ${o} is invalid. End must be greater than start.`);
    if (s ?? (s = r + 1), s !== r + 1)
      throw new Error(
        `Packet block ${s} - ${o ?? s} is not contiguous. It should start from ${r + 1}.`
      );
    if (l === 0)
      throw new Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);
    for (o ?? (o = s + (l ?? 1) - 1), l ?? (l = o - s + 1), r = o, ae.debug(`Packet block ${s} - ${r} with label ${u}`); n.length <= a + 1 && e.getPacket().length < SLe; ) {
      const [h, d] = ALe({ start: s, end: o, bits: l, label: u }, i, a);
      if (n.push(h), h.end + 1 === i * a && (e.pushWord(n), n = [], i++), !d)
        break;
      ({ start: s, end: o, bits: l, label: u } = d);
    }
  }
  e.pushWord(n);
}, "populate"), ALe = /* @__PURE__ */ x((t, e, r) => {
  if (t.start === void 0)
    throw new Error("start should have been set during first phase");
  if (t.end === void 0)
    throw new Error("end should have been set during first phase");
  if (t.start > t.end)
    throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);
  if (t.end + 1 <= e * r)
    return [t, void 0];
  const n = e * r - 1, i = e * r;
  return [
    {
      start: t.start,
      end: n,
      label: t.label,
      bits: n - t.start
    },
    {
      start: i,
      end: t.end,
      label: t.label,
      bits: t.end - i
    }
  ];
}, "getNextFittingBlock"), lY = {
  // @ts-expect-error - PacketDB is not assignable to DiagramDB
  parser: { yy: void 0 },
  parse: /* @__PURE__ */ x(async (t) => {
    var n;
    const e = await yc("packet", t), r = (n = lY.parser) == null ? void 0 : n.yy;
    if (!(r instanceof oY))
      throw new Error(
        "parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
      );
    ae.debug(e), CLe(e, r);
  }, "parse")
}, _Le = /* @__PURE__ */ x((t, e, r, n) => {
  const i = n.db, a = i.getConfig(), { rowHeight: s, paddingY: o, bitWidth: l, bitsPerRow: u } = a, h = i.getPacket(), d = i.getDiagramTitle(), f = s + o, p = f * (h.length + 1) - (d ? 0 : s), g = l * u + 2, m = tl(e);
  m.attr("viewbox", `0 0 ${g} ${p}`), Ki(m, p, g, a.useMaxWidth);
  for (const [v, y] of h.entries())
    LLe(m, y, v, a);
  m.append("text").text(d).attr("x", g / 2).attr("y", p - f / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
}, "draw"), LLe = /* @__PURE__ */ x((t, e, r, { rowHeight: n, paddingX: i, paddingY: a, bitWidth: s, bitsPerRow: o, showBits: l }) => {
  const u = t.append("g"), h = r * (n + a) + a;
  for (const d of e) {
    const f = d.start % o * s + 1, p = (d.end - d.start + 1) * s - i;
    if (u.append("rect").attr("x", f).attr("y", h).attr("width", p).attr("height", n).attr("class", "packetBlock"), u.append("text").attr("x", f + p / 2).attr("y", h + n / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(d.label), !l)
      continue;
    const g = d.end === d.start, m = h - 2;
    u.append("text").attr("x", f + (g ? p / 2 : 0)).attr("y", m).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", g ? "middle" : "start").text(d.start), g || u.append("text").attr("x", f + p).attr("y", m).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(d.end);
  }
}, "drawWord"), RLe = { draw: _Le }, NLe = {
  byteFontSize: "10px",
  startByteColor: "black",
  endByteColor: "black",
  labelColor: "black",
  labelFontSize: "12px",
  titleColor: "black",
  titleFontSize: "14px",
  blockStrokeColor: "black",
  blockStrokeWidth: "1",
  blockFillColor: "#efefef"
}, MLe = /* @__PURE__ */ x(({ packet: t } = {}) => {
  const e = qi(NLe, t);
  return `
	.packetByte {
		font-size: ${e.byteFontSize};
	}
	.packetByte.start {
		fill: ${e.startByteColor};
	}
	.packetByte.end {
		fill: ${e.endByteColor};
	}
	.packetLabel {
		fill: ${e.labelColor};
		font-size: ${e.labelFontSize};
	}
	.packetTitle {
		fill: ${e.titleColor};
		font-size: ${e.titleFontSize};
	}
	.packetBlock {
		stroke: ${e.blockStrokeColor};
		stroke-width: ${e.blockStrokeWidth};
		fill: ${e.blockFillColor};
	}
	`;
}, "styles"), DLe = {
  parser: lY,
  get db() {
    return new oY();
  },
  renderer: RLe,
  styles: MLe
};
const ILe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: DLe
}, Symbol.toStringTag, { value: "Module" }));
var vh = {
  showLegend: !0,
  ticks: 5,
  max: null,
  min: 0,
  graticule: "circle"
}, cY = {
  axes: [],
  curves: [],
  options: vh
}, Xu = structuredClone(cY), OLe = hr.radar, PLe = /* @__PURE__ */ x(() => qi({
  ...OLe,
  ...gr().radar
}), "getConfig"), uY = /* @__PURE__ */ x(() => Xu.axes, "getAxes"), BLe = /* @__PURE__ */ x(() => Xu.curves, "getCurves"), FLe = /* @__PURE__ */ x(() => Xu.options, "getOptions"), $Le = /* @__PURE__ */ x((t) => {
  Xu.axes = t.map((e) => ({
    name: e.name,
    label: e.label ?? e.name
  }));
}, "setAxes"), zLe = /* @__PURE__ */ x((t) => {
  Xu.curves = t.map((e) => ({
    name: e.name,
    label: e.label ?? e.name,
    entries: VLe(e.entries)
  }));
}, "setCurves"), VLe = /* @__PURE__ */ x((t) => {
  if (t[0].axis == null)
    return t.map((r) => r.value);
  const e = uY();
  if (e.length === 0)
    throw new Error("Axes must be populated before curves for reference entries");
  return e.map((r) => {
    const n = t.find((i) => {
      var a;
      return ((a = i.axis) == null ? void 0 : a.$refText) === r.name;
    });
    if (n === void 0)
      throw new Error("Missing entry for axis " + r.label);
    return n.value;
  });
}, "computeCurveEntries"), GLe = /* @__PURE__ */ x((t) => {
  var r, n, i, a, s;
  const e = t.reduce(
    (o, l) => (o[l.name] = l, o),
    {}
  );
  Xu.options = {
    showLegend: ((r = e.showLegend) == null ? void 0 : r.value) ?? vh.showLegend,
    ticks: ((n = e.ticks) == null ? void 0 : n.value) ?? vh.ticks,
    max: ((i = e.max) == null ? void 0 : i.value) ?? vh.max,
    min: ((a = e.min) == null ? void 0 : a.value) ?? vh.min,
    graticule: ((s = e.graticule) == null ? void 0 : s.value) ?? vh.graticule
  };
}, "setOptions"), ULe = /* @__PURE__ */ x(() => {
  _n(), Xu = structuredClone(cY);
}, "clear"), vp = {
  getAxes: uY,
  getCurves: BLe,
  getOptions: FLe,
  setAxes: $Le,
  setCurves: zLe,
  setOptions: GLe,
  getConfig: PLe,
  clear: ULe,
  setAccTitle: Cn,
  getAccTitle: Vn,
  setDiagramTitle: Qn,
  getDiagramTitle: Ln,
  getAccDescription: Un,
  setAccDescription: Gn
}, WLe = /* @__PURE__ */ x((t) => {
  Vu(t, vp);
  const { axes: e, curves: r, options: n } = t;
  vp.setAxes(e), vp.setCurves(r), vp.setOptions(n);
}, "populate"), HLe = {
  parse: /* @__PURE__ */ x(async (t) => {
    const e = await yc("radar", t);
    ae.debug(e), WLe(e);
  }, "parse")
}, qLe = /* @__PURE__ */ x((t, e, r, n) => {
  const i = n.db, a = i.getAxes(), s = i.getCurves(), o = i.getOptions(), l = i.getConfig(), u = i.getDiagramTitle(), h = tl(e), d = YLe(h, l), f = o.max ?? Math.max(...s.map((m) => Math.max(...m.entries))), p = o.min, g = Math.min(l.width, l.height) / 2;
  XLe(d, a, g, o.ticks, o.graticule), jLe(d, a, g, l), hY(d, a, s, p, f, o.graticule, l), pY(d, s, o.showLegend, l), d.append("text").attr("class", "radarTitle").text(u).attr("x", 0).attr("y", -l.height / 2 - l.marginTop);
}, "draw"), YLe = /* @__PURE__ */ x((t, e) => {
  const r = e.width + e.marginLeft + e.marginRight, n = e.height + e.marginTop + e.marginBottom, i = {
    x: e.marginLeft + e.width / 2,
    y: e.marginTop + e.height / 2
  };
  return t.attr("viewbox", `0 0 ${r} ${n}`).attr("width", r).attr("height", n), t.append("g").attr("transform", `translate(${i.x}, ${i.y})`);
}, "drawFrame"), XLe = /* @__PURE__ */ x((t, e, r, n, i) => {
  if (i === "circle")
    for (let a = 0; a < n; a++) {
      const s = r * (a + 1) / n;
      t.append("circle").attr("r", s).attr("class", "radarGraticule");
    }
  else if (i === "polygon") {
    const a = e.length;
    for (let s = 0; s < n; s++) {
      const o = r * (s + 1) / n, l = e.map((u, h) => {
        const d = 2 * h * Math.PI / a - Math.PI / 2, f = o * Math.cos(d), p = o * Math.sin(d);
        return `${f},${p}`;
      }).join(" ");
      t.append("polygon").attr("points", l).attr("class", "radarGraticule");
    }
  }
}, "drawGraticule"), jLe = /* @__PURE__ */ x((t, e, r, n) => {
  const i = e.length;
  for (let a = 0; a < i; a++) {
    const s = e[a].label, o = 2 * a * Math.PI / i - Math.PI / 2;
    t.append("line").attr("x1", 0).attr("y1", 0).attr("x2", r * n.axisScaleFactor * Math.cos(o)).attr("y2", r * n.axisScaleFactor * Math.sin(o)).attr("class", "radarAxisLine"), t.append("text").text(s).attr("x", r * n.axisLabelFactor * Math.cos(o)).attr("y", r * n.axisLabelFactor * Math.sin(o)).attr("class", "radarAxisLabel");
  }
}, "drawAxes");
function hY(t, e, r, n, i, a, s) {
  const o = e.length, l = Math.min(s.width, s.height) / 2;
  r.forEach((u, h) => {
    if (u.entries.length !== o)
      return;
    const d = u.entries.map((f, p) => {
      const g = 2 * Math.PI * p / o - Math.PI / 2, m = dY(f, n, i, l), v = m * Math.cos(g), y = m * Math.sin(g);
      return { x: v, y };
    });
    a === "circle" ? t.append("path").attr("d", fY(d, s.curveTension)).attr("class", `radarCurve-${h}`) : a === "polygon" && t.append("polygon").attr("points", d.map((f) => `${f.x},${f.y}`).join(" ")).attr("class", `radarCurve-${h}`);
  });
}
x(hY, "drawCurves");
function dY(t, e, r, n) {
  const i = Math.min(Math.max(t, e), r);
  return n * (i - e) / (r - e);
}
x(dY, "relativeRadius");
function fY(t, e) {
  const r = t.length;
  let n = `M${t[0].x},${t[0].y}`;
  for (let i = 0; i < r; i++) {
    const a = t[(i - 1 + r) % r], s = t[i], o = t[(i + 1) % r], l = t[(i + 2) % r], u = {
      x: s.x + (o.x - a.x) * e,
      y: s.y + (o.y - a.y) * e
    }, h = {
      x: o.x - (l.x - s.x) * e,
      y: o.y - (l.y - s.y) * e
    };
    n += ` C${u.x},${u.y} ${h.x},${h.y} ${o.x},${o.y}`;
  }
  return `${n} Z`;
}
x(fY, "closedRoundCurve");
function pY(t, e, r, n) {
  if (!r)
    return;
  const i = (n.width / 2 + n.marginRight) * 3 / 4, a = -(n.height / 2 + n.marginTop) * 3 / 4, s = 20;
  e.forEach((o, l) => {
    const u = t.append("g").attr("transform", `translate(${i}, ${a + l * s})`);
    u.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${l}`), u.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(o.label);
  });
}
x(pY, "drawLegend");
var KLe = { draw: qLe }, ZLe = /* @__PURE__ */ x((t, e) => {
  let r = "";
  for (let n = 0; n < t.THEME_COLOR_LIMIT; n++) {
    const i = t[`cScale${n}`];
    r += `
		.radarCurve-${n} {
			color: ${i};
			fill: ${i};
			fill-opacity: ${e.curveOpacity};
			stroke: ${i};
			stroke-width: ${e.curveStrokeWidth};
		}
		.radarLegendBox-${n} {
			fill: ${i};
			fill-opacity: ${e.curveOpacity};
			stroke: ${i};
		}
		`;
  }
  return r;
}, "genIndexStyles"), QLe = /* @__PURE__ */ x((t) => {
  const e = F2(), r = gr(), n = qi(e, r.themeVariables), i = qi(n.radar, t);
  return { themeVariables: n, radarOptions: i };
}, "buildRadarStyleOptions"), JLe = /* @__PURE__ */ x(({ radar: t } = {}) => {
  const { themeVariables: e, radarOptions: r } = QLe(t);
  return `
	.radarTitle {
		font-size: ${e.fontSize};
		color: ${e.titleColor};
		dominant-baseline: hanging;
		text-anchor: middle;
	}
	.radarAxisLine {
		stroke: ${r.axisColor};
		stroke-width: ${r.axisStrokeWidth};
	}
	.radarAxisLabel {
		dominant-baseline: middle;
		text-anchor: middle;
		font-size: ${r.axisLabelFontSize}px;
		color: ${r.axisColor};
	}
	.radarGraticule {
		fill: ${r.graticuleColor};
		fill-opacity: ${r.graticuleOpacity};
		stroke: ${r.graticuleColor};
		stroke-width: ${r.graticuleStrokeWidth};
	}
	.radarLegendText {
		text-anchor: start;
		font-size: ${r.legendFontSize}px;
		dominant-baseline: hanging;
	}
	${ZLe(e, r)}
	`;
}, "styles"), eRe = {
  parser: HLe,
  db: vp,
  renderer: KLe,
  styles: JLe
};
const tRe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: eRe
}, Symbol.toStringTag, { value: "Module" }));
var U6 = function() {
  var t = /* @__PURE__ */ x(function(w, T, E, C) {
    for (E = E || {}, C = w.length; C--; E[w[C]] = T) ;
    return E;
  }, "o"), e = [1, 15], r = [1, 7], n = [1, 13], i = [1, 14], a = [1, 19], s = [1, 16], o = [1, 17], l = [1, 18], u = [8, 30], h = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], d = [1, 23], f = [1, 24], p = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], g = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], m = [1, 49], v = {
    trace: /* @__PURE__ */ x(function() {
    }, "trace"),
    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, NODE_ID: 31, nodeShapeNLabel: 32, dirList: 33, DIR: 34, NODE_DSTART: 35, NODE_DEND: 36, BLOCK_ARROW_START: 37, BLOCK_ARROW_END: 38, classDef: 39, CLASSDEF_ID: 40, CLASSDEF_STYLEOPTS: 41, DEFAULT: 42, class: 43, CLASSENTITY_IDS: 44, STYLECLASS: 45, style: 46, STYLE_ENTITY_IDS: 47, STYLE_DEFINITION_DATA: 48, $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: "NODE_ID", 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" },
    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], [33, 1], [33, 2], [32, 3], [32, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
    performAction: /* @__PURE__ */ x(function(T, E, C, k, _, L, N) {
      var A = L.length - 1;
      switch (_) {
        case 4:
          k.getLogger().debug("Rule: separator (NL) ");
          break;
        case 5:
          k.getLogger().debug("Rule: separator (Space) ");
          break;
        case 6:
          k.getLogger().debug("Rule: separator (EOF) ");
          break;
        case 7:
          k.getLogger().debug("Rule: hierarchy: ", L[A - 1]), k.setHierarchy(L[A - 1]);
          break;
        case 8:
          k.getLogger().debug("Stop NL ");
          break;
        case 9:
          k.getLogger().debug("Stop EOF ");
          break;
        case 10:
          k.getLogger().debug("Stop NL2 ");
          break;
        case 11:
          k.getLogger().debug("Stop EOF2 ");
          break;
        case 12:
          k.getLogger().debug("Rule: statement: ", L[A]), typeof L[A].length == "number" ? this.$ = L[A] : this.$ = [L[A]];
          break;
        case 13:
          k.getLogger().debug("Rule: statement #2: ", L[A - 1]), this.$ = [L[A - 1]].concat(L[A]);
          break;
        case 14:
          k.getLogger().debug("Rule: link: ", L[A], T), this.$ = { edgeTypeStr: L[A], label: "" };
          break;
        case 15:
          k.getLogger().debug("Rule: LABEL link: ", L[A - 3], L[A - 1], L[A]), this.$ = { edgeTypeStr: L[A], label: L[A - 1] };
          break;
        case 18:
          const O = parseInt(L[A]), P = k.generateId();
          this.$ = { id: P, type: "space", label: "", width: O, children: [] };
          break;
        case 23:
          k.getLogger().debug("Rule: (nodeStatement link node) ", L[A - 2], L[A - 1], L[A], " typestr: ", L[A - 1].edgeTypeStr);
          const S = k.edgeStrToEdgeData(L[A - 1].edgeTypeStr);
          this.$ = [
            { id: L[A - 2].id, label: L[A - 2].label, type: L[A - 2].type, directions: L[A - 2].directions },
            { id: L[A - 2].id + "-" + L[A].id, start: L[A - 2].id, end: L[A].id, label: L[A - 1].label, type: "edge", directions: L[A].directions, arrowTypeEnd: S, arrowTypeStart: "arrow_open" },
            { id: L[A].id, label: L[A].label, type: k.typeStr2Type(L[A].typeStr), directions: L[A].directions }
          ];
          break;
        case 24:
          k.getLogger().debug("Rule: nodeStatement (abc88 node size) ", L[A - 1], L[A]), this.$ = { id: L[A - 1].id, label: L[A - 1].label, type: k.typeStr2Type(L[A - 1].typeStr), directions: L[A - 1].directions, widthInColumns: parseInt(L[A], 10) };
          break;
        case 25:
          k.getLogger().debug("Rule: nodeStatement (node) ", L[A]), this.$ = { id: L[A].id, label: L[A].label, type: k.typeStr2Type(L[A].typeStr), directions: L[A].directions, widthInColumns: 1 };
          break;
        case 26:
          k.getLogger().debug("APA123", this ? this : "na"), k.getLogger().debug("COLUMNS: ", L[A]), this.$ = { type: "column-setting", columns: L[A] === "auto" ? -1 : parseInt(L[A]) };
          break;
        case 27:
          k.getLogger().debug("Rule: id-block statement : ", L[A - 2], L[A - 1]), k.generateId(), this.$ = { ...L[A - 2], type: "composite", children: L[A - 1] };
          break;
        case 28:
          k.getLogger().debug("Rule: blockStatement : ", L[A - 2], L[A - 1], L[A]);
          const R = k.generateId();
          this.$ = { id: R, type: "composite", label: "", children: L[A - 1] };
          break;
        case 29:
          k.getLogger().debug("Rule: node (NODE_ID separator): ", L[A]), this.$ = { id: L[A] };
          break;
        case 30:
          k.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", L[A - 1], L[A]), this.$ = { id: L[A - 1], label: L[A].label, typeStr: L[A].typeStr, directions: L[A].directions };
          break;
        case 31:
          k.getLogger().debug("Rule: dirList: ", L[A]), this.$ = [L[A]];
          break;
        case 32:
          k.getLogger().debug("Rule: dirList: ", L[A - 1], L[A]), this.$ = [L[A - 1]].concat(L[A]);
          break;
        case 33:
          k.getLogger().debug("Rule: nodeShapeNLabel: ", L[A - 2], L[A - 1], L[A]), this.$ = { typeStr: L[A - 2] + L[A], label: L[A - 1] };
          break;
        case 34:
          k.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", L[A - 3], L[A - 2], " #3:", L[A - 1], L[A]), this.$ = { typeStr: L[A - 3] + L[A], label: L[A - 2], directions: L[A - 1] };
          break;
        case 35:
        case 36:
          this.$ = { type: "classDef", id: L[A - 1].trim(), css: L[A].trim() };
          break;
        case 37:
          this.$ = { type: "applyClass", id: L[A - 1].trim(), styleClass: L[A].trim() };
          break;
        case 38:
          this.$ = { type: "applyStyles", id: L[A - 1].trim(), stylesStr: L[A].trim() };
          break;
      }
    }, "anonymous"),
    table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: e, 11: 3, 13: 4, 19: 5, 20: 6, 21: r, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: n, 29: i, 31: a, 39: s, 43: o, 46: 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, 10: e, 21: r, 28: n, 29: i, 31: a, 39: s, 43: o, 46: l }), t(h, [2, 16], { 14: 22, 15: d, 16: f }), 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, 31: a }, { 10: e, 11: 27, 13: 4, 19: 5, 20: 6, 21: r, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: n, 29: i, 31: a, 39: s, 43: o, 46: l }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, t(g, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, t(u, [2, 13]), { 26: 35, 31: a }, { 31: [2, 14] }, { 17: [1, 36] }, t(p, [2, 24]), { 10: e, 11: 37, 13: 4, 14: 22, 15: d, 16: f, 19: 5, 20: 6, 21: r, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: n, 29: i, 31: a, 39: s, 43: o, 46: l }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, t(g, [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]), { 36: [1, 47] }, { 33: 48, 34: m }, { 15: [1, 50] }, t(h, [2, 27]), t(g, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: m, 38: [2, 31] }, { 31: [2, 15] }, t(g, [2, 34]), { 38: [2, 32] }],
    defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
    parseError: /* @__PURE__ */ x(function(T, E) {
      if (E.recoverable)
        this.trace(T);
      else {
        var C = new Error(T);
        throw C.hash = E, C;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ x(function(T) {
      var E = this, C = [0], k = [], _ = [null], L = [], N = this.table, A = "", O = 0, P = 0, S = 2, R = 1, I = L.slice.call(arguments, 1), D = Object.create(this.lexer), M = { yy: {} };
      for (var B in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, B) && (M.yy[B] = this.yy[B]);
      D.setInput(T, M.yy), M.yy.lexer = D, M.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {});
      var $ = D.yylloc;
      L.push($);
      var F = D.options && D.options.ranges;
      typeof M.yy.parseError == "function" ? this.parseError = M.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function G(j) {
        C.length = C.length - 2 * j, _.length = _.length - j, L.length = L.length - j;
      }
      x(G, "popStack");
      function H() {
        var j;
        return j = k.pop() || D.lex() || R, typeof j != "number" && (j instanceof Array && (k = j, j = k.pop()), j = E.symbols_[j] || j), j;
      }
      x(H, "lex");
      for (var ee, Y, re, ne, he = {}, K, Z, X, q; ; ) {
        if (Y = C[C.length - 1], this.defaultActions[Y] ? re = this.defaultActions[Y] : ((ee === null || typeof ee > "u") && (ee = H()), re = N[Y] && N[Y][ee]), typeof re > "u" || !re.length || !re[0]) {
          var J = "";
          q = [];
          for (K in N[Y])
            this.terminals_[K] && K > S && q.push("'" + this.terminals_[K] + "'");
          D.showPosition ? J = "Parse error on line " + (O + 1) + `:
` + D.showPosition() + `
Expecting ` + q.join(", ") + ", got '" + (this.terminals_[ee] || ee) + "'" : J = "Parse error on line " + (O + 1) + ": Unexpected " + (ee == R ? "end of input" : "'" + (this.terminals_[ee] || ee) + "'"), this.parseError(J, {
            text: D.match,
            token: this.terminals_[ee] || ee,
            line: D.yylineno,
            loc: $,
            expected: q
          });
        }
        if (re[0] instanceof Array && re.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Y + ", token: " + ee);
        switch (re[0]) {
          case 1:
            C.push(ee), _.push(D.yytext), L.push(D.yylloc), C.push(re[1]), ee = null, P = D.yyleng, A = D.yytext, O = D.yylineno, $ = D.yylloc;
            break;
          case 2:
            if (Z = this.productions_[re[1]][1], he.$ = _[_.length - Z], he._$ = {
              first_line: L[L.length - (Z || 1)].first_line,
              last_line: L[L.length - 1].last_line,
              first_column: L[L.length - (Z || 1)].first_column,
              last_column: L[L.length - 1].last_column
            }, F && (he._$.range = [
              L[L.length - (Z || 1)].range[0],
              L[L.length - 1].range[1]
            ]), ne = this.performAction.apply(he, [
              A,
              P,
              O,
              M.yy,
              re[1],
              _,
              L
            ].concat(I)), typeof ne < "u")
              return ne;
            Z && (C = C.slice(0, -1 * Z * 2), _ = _.slice(0, -1 * Z), L = L.slice(0, -1 * Z)), C.push(this.productions_[re[1]][0]), _.push(he.$), L.push(he._$), X = N[C[C.length - 2]][C[C.length - 1]], C.push(X);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, y = /* @__PURE__ */ function() {
    var w = {
      EOF: 1,
      parseError: /* @__PURE__ */ x(function(E, C) {
        if (this.yy.parser)
          this.yy.parser.parseError(E, C);
        else
          throw new Error(E);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ x(function(T, E) {
        return this.yy = E || this.yy || {}, this._input = T, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
          first_line: 1,
          first_column: 0,
          last_line: 1,
          last_column: 0
        }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
      }, "setInput"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ x(function() {
        var T = this._input[0];
        this.yytext += T, this.yyleng++, this.offset++, this.match += T, this.matched += T;
        var E = T.match(/(?:\r\n?|\n).*/g);
        return E ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), T;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ x(function(T) {
        var E = T.length, C = T.split(/(?:\r\n?|\n)/g);
        this._input = T + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - E), this.offset -= E;
        var k = 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), C.length - 1 && (this.yylineno -= C.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: C ? (C.length === k.length ? this.yylloc.first_column : 0) + k[k.length - C.length].length - C[0].length : this.yylloc.first_column - E
        }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - E]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ x(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ x(function() {
        if (this.options.backtrack_lexer)
          this._backtrack = !0;
        else
          return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ x(function(T) {
        this.unput(this.match.slice(T));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ x(function() {
        var T = this.matched.substr(0, this.matched.length - this.match.length);
        return (T.length > 20 ? "..." : "") + T.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ x(function() {
        var T = this.match;
        return T.length < 20 && (T += this._input.substr(0, 20 - T.length)), (T.substr(0, 20) + (T.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ x(function() {
        var T = this.pastInput(), E = new Array(T.length + 1).join("-");
        return T + this.upcomingInput() + `
` + E + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ x(function(T, E) {
        var C, k, _;
        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))), k = T[0].match(/(?:\r\n?|\n).*/g), k && (this.yylineno += k.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: k ? k[k.length - 1].length - k[k.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + T[0].length
        }, this.yytext += T[0], this.match += T[0], this.matches = T, 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(T[0].length), this.matched += T[0], C = this.performAction.call(this, this.yy, this, E, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), C)
          return C;
        if (this._backtrack) {
          for (var L in _)
            this[L] = _[L];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ x(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var T, E, C, k;
        this._more || (this.yytext = "", this.match = "");
        for (var _ = this._currentRules(), L = 0; L < _.length; L++)
          if (C = this._input.match(this.rules[_[L]]), C && (!E || C[0].length > E[0].length)) {
            if (E = C, k = L, this.options.backtrack_lexer) {
              if (T = this.test_match(C, _[L]), T !== !1)
                return T;
              if (this._backtrack) {
                E = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return E ? (T = this.test_match(E, _[k]), T !== !1 ? T : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ x(function() {
        var E = this.next();
        return E || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ x(function(E) {
        this.conditionStack.push(E);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ x(function() {
        var E = this.conditionStack.length - 1;
        return E > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ x(function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      }, "_currentRules"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ x(function(E) {
        return E = this.conditionStack.length - 1 - Math.abs(E || 0), E >= 0 ? this.conditionStack[E] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ x(function(E) {
        this.begin(E);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ x(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: {},
      performAction: /* @__PURE__ */ x(function(E, C, k, _) {
        switch (k) {
          case 0:
            return E.getLogger().debug("Found block-beta"), 10;
          case 1:
            return E.getLogger().debug("Found id-block"), 29;
          case 2:
            return E.getLogger().debug("Found block"), 10;
          case 3:
            E.getLogger().debug(".", C.yytext);
            break;
          case 4:
            E.getLogger().debug("_", C.yytext);
            break;
          case 5:
            return 5;
          case 6:
            return C.yytext = -1, 28;
          case 7:
            return C.yytext = C.yytext.replace(/columns\s+/, ""), E.getLogger().debug("COLUMNS (LEX)", C.yytext), 28;
          case 8:
            this.pushState("md_string");
            break;
          case 9:
            return "MD_STR";
          case 10:
            this.popState();
            break;
          case 11:
            this.pushState("string");
            break;
          case 12:
            E.getLogger().debug("LEX: POPPING STR:", C.yytext), this.popState();
            break;
          case 13:
            return E.getLogger().debug("LEX: STR end:", C.yytext), "STR";
          case 14:
            return C.yytext = C.yytext.replace(/space\:/, ""), E.getLogger().debug("SPACE NUM (LEX)", C.yytext), 21;
          case 15:
            return C.yytext = "1", E.getLogger().debug("COLUMNS (LEX)", C.yytext), 21;
          case 16:
            return 42;
          case 17:
            return "LINKSTYLE";
          case 18:
            return "INTERPOLATE";
          case 19:
            return this.pushState("CLASSDEF"), 39;
          case 20:
            return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
          case 21:
            return this.popState(), this.pushState("CLASSDEFID"), 40;
          case 22:
            return this.popState(), 41;
          case 23:
            return this.pushState("CLASS"), 43;
          case 24:
            return this.popState(), this.pushState("CLASS_STYLE"), 44;
          case 25:
            return this.popState(), 45;
          case 26:
            return this.pushState("STYLE_STMNT"), 46;
          case 27:
            return this.popState(), this.pushState("STYLE_DEFINITION"), 47;
          case 28:
            return this.popState(), 48;
          case 29:
            return this.pushState("acc_title"), "acc_title";
          case 30:
            return this.popState(), "acc_title_value";
          case 31:
            return this.pushState("acc_descr"), "acc_descr";
          case 32:
            return this.popState(), "acc_descr_value";
          case 33:
            this.pushState("acc_descr_multiline");
            break;
          case 34:
            this.popState();
            break;
          case 35:
            return "acc_descr_multiline_value";
          case 36:
            return 30;
          case 37:
            return this.popState(), E.getLogger().debug("Lex: (("), "NODE_DEND";
          case 38:
            return this.popState(), E.getLogger().debug("Lex: (("), "NODE_DEND";
          case 39:
            return this.popState(), E.getLogger().debug("Lex: ))"), "NODE_DEND";
          case 40:
            return this.popState(), E.getLogger().debug("Lex: (("), "NODE_DEND";
          case 41:
            return this.popState(), E.getLogger().debug("Lex: (("), "NODE_DEND";
          case 42:
            return this.popState(), E.getLogger().debug("Lex: (-"), "NODE_DEND";
          case 43:
            return this.popState(), E.getLogger().debug("Lex: -)"), "NODE_DEND";
          case 44:
            return this.popState(), E.getLogger().debug("Lex: (("), "NODE_DEND";
          case 45:
            return this.popState(), E.getLogger().debug("Lex: ]]"), "NODE_DEND";
          case 46:
            return this.popState(), E.getLogger().debug("Lex: ("), "NODE_DEND";
          case 47:
            return this.popState(), E.getLogger().debug("Lex: ])"), "NODE_DEND";
          case 48:
            return this.popState(), E.getLogger().debug("Lex: /]"), "NODE_DEND";
          case 49:
            return this.popState(), E.getLogger().debug("Lex: /]"), "NODE_DEND";
          case 50:
            return this.popState(), E.getLogger().debug("Lex: )]"), "NODE_DEND";
          case 51:
            return this.popState(), E.getLogger().debug("Lex: )"), "NODE_DEND";
          case 52:
            return this.popState(), E.getLogger().debug("Lex: ]>"), "NODE_DEND";
          case 53:
            return this.popState(), E.getLogger().debug("Lex: ]"), "NODE_DEND";
          case 54:
            return E.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 35;
          case 55:
            return E.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 35;
          case 56:
            return E.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 35;
          case 57:
            return E.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
          case 58:
            return E.getLogger().debug("Lex: ((("), this.pushState("NODE"), 35;
          case 59:
            return E.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
          case 60:
            return E.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
          case 61:
            return E.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
          case 62:
            return E.getLogger().debug("Lexc: >"), this.pushState("NODE"), 35;
          case 63:
            return E.getLogger().debug("Lexa: (["), this.pushState("NODE"), 35;
          case 64:
            return E.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
          case 65:
            return this.pushState("NODE"), 35;
          case 66:
            return this.pushState("NODE"), 35;
          case 67:
            return this.pushState("NODE"), 35;
          case 68:
            return this.pushState("NODE"), 35;
          case 69:
            return this.pushState("NODE"), 35;
          case 70:
            return this.pushState("NODE"), 35;
          case 71:
            return this.pushState("NODE"), 35;
          case 72:
            return E.getLogger().debug("Lexa: ["), this.pushState("NODE"), 35;
          case 73:
            return this.pushState("BLOCK_ARROW"), E.getLogger().debug("LEX ARR START"), 37;
          case 74:
            return E.getLogger().debug("Lex: NODE_ID", C.yytext), 31;
          case 75:
            return E.getLogger().debug("Lex: EOF", C.yytext), 8;
          case 76:
            this.pushState("md_string");
            break;
          case 77:
            this.pushState("md_string");
            break;
          case 78:
            return "NODE_DESCR";
          case 79:
            this.popState();
            break;
          case 80:
            E.getLogger().debug("Lex: Starting string"), this.pushState("string");
            break;
          case 81:
            E.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
            break;
          case 82:
            return E.getLogger().debug("LEX: NODE_DESCR:", C.yytext), "NODE_DESCR";
          case 83:
            E.getLogger().debug("LEX POPPING"), this.popState();
            break;
          case 84:
            E.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
            break;
          case 85:
            return C.yytext = C.yytext.replace(/^,\s*/, ""), E.getLogger().debug("Lex (right): dir:", C.yytext), "DIR";
          case 86:
            return C.yytext = C.yytext.replace(/^,\s*/, ""), E.getLogger().debug("Lex (left):", C.yytext), "DIR";
          case 87:
            return C.yytext = C.yytext.replace(/^,\s*/, ""), E.getLogger().debug("Lex (x):", C.yytext), "DIR";
          case 88:
            return C.yytext = C.yytext.replace(/^,\s*/, ""), E.getLogger().debug("Lex (y):", C.yytext), "DIR";
          case 89:
            return C.yytext = C.yytext.replace(/^,\s*/, ""), E.getLogger().debug("Lex (up):", C.yytext), "DIR";
          case 90:
            return C.yytext = C.yytext.replace(/^,\s*/, ""), E.getLogger().debug("Lex (down):", C.yytext), "DIR";
          case 91:
            return C.yytext = "]>", E.getLogger().debug("Lex (ARROW_DIR end):", C.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
          case 92:
            return E.getLogger().debug("Lex: LINK", "#" + C.yytext + "#"), 15;
          case 93:
            return E.getLogger().debug("Lex: LINK", C.yytext), 15;
          case 94:
            return E.getLogger().debug("Lex: LINK", C.yytext), 15;
          case 95:
            return E.getLogger().debug("Lex: LINK", C.yytext), 15;
          case 96:
            return E.getLogger().debug("Lex: START_LINK", C.yytext), this.pushState("LLABEL"), 16;
          case 97:
            return E.getLogger().debug("Lex: START_LINK", C.yytext), this.pushState("LLABEL"), 16;
          case 98:
            return E.getLogger().debug("Lex: START_LINK", C.yytext), this.pushState("LLABEL"), 16;
          case 99:
            this.pushState("md_string");
            break;
          case 100:
            return E.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
          case 101:
            return this.popState(), E.getLogger().debug("Lex: LINK", "#" + C.yytext + "#"), 15;
          case 102:
            return this.popState(), E.getLogger().debug("Lex: LINK", C.yytext), 15;
          case 103:
            return this.popState(), E.getLogger().debug("Lex: LINK", C.yytext), 15;
          case 104:
            return E.getLogger().debug("Lex: COLON", C.yytext), C.yytext = C.yytext.slice(1), 27;
        }
      }, "anonymous"),
      rules: [/^(?:block-beta\b)/, /^(?:block:)/, /^(?:block\b)/, /^(?:[\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: [28], inclusive: !1 }, STYLE_STMNT: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [22], inclusive: !1 }, CLASSDEF: { rules: [20, 21], inclusive: !1 }, CLASS_STYLE: { rules: [25], inclusive: !1 }, CLASS: { rules: [24], inclusive: !1 }, LLABEL: { rules: [99, 100, 101, 102, 103], inclusive: !1 }, ARROW_DIR: { rules: [85, 86, 87, 88, 89, 90, 91], inclusive: !1 }, BLOCK_ARROW: { rules: [76, 81, 84], inclusive: !1 }, NODE: { rules: [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 77, 80], inclusive: !1 }, md_string: { rules: [9, 10, 78, 79], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [12, 13, 82, 83], inclusive: !1 }, acc_descr_multiline: { rules: [34, 35], inclusive: !1 }, acc_descr: { rules: [32], inclusive: !1 }, acc_title: { rules: [30], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 23, 26, 29, 31, 33, 36, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 92, 93, 94, 95, 96, 97, 98, 104], inclusive: !0 } }
    };
    return w;
  }();
  v.lexer = y;
  function b() {
    this.yy = {};
  }
  return x(b, "Parser"), b.prototype = v, v.Parser = b, new b();
}();
U6.parser = U6;
var rRe = U6, ws = /* @__PURE__ */ new Map(), b7 = [], W6 = /* @__PURE__ */ new Map(), XN = "color", jN = "fill", nRe = "bgFill", gY = ",", iRe = we(), M2 = /* @__PURE__ */ new Map(), aRe = /* @__PURE__ */ x((t) => at.sanitizeText(t, iRe), "sanitizeText"), sRe = /* @__PURE__ */ x(function(t, e = "") {
  let r = M2.get(t);
  r || (r = { id: t, styles: [], textStyles: [] }, M2.set(t, r)), e != null && e.split(gY).forEach((n) => {
    const i = n.replace(/([^;]*);/, "$1").trim();
    if (RegExp(XN).exec(n)) {
      const s = i.replace(jN, nRe).replace(XN, jN);
      r.textStyles.push(s);
    }
    r.styles.push(i);
  });
}, "addStyleClass"), oRe = /* @__PURE__ */ x(function(t, e = "") {
  const r = ws.get(t);
  e != null && (r.styles = e.split(gY));
}, "addStyle2Node"), lRe = /* @__PURE__ */ x(function(t, e) {
  t.split(",").forEach(function(r) {
    let n = ws.get(r);
    if (n === void 0) {
      const i = r.trim();
      n = { id: i, type: "na", children: [] }, ws.set(i, n);
    }
    n.classes || (n.classes = []), n.classes.push(e);
  });
}, "setCssClass"), mY = /* @__PURE__ */ x((t, e) => {
  const r = t.flat(), n = [], i = r.find((s) => (s == null ? void 0 : s.type) === "column-setting"), a = (i == null ? void 0 : i.columns) ?? -1;
  for (const s of r) {
    if (typeof a == "number" && a > 0 && s.type !== "column-setting" && typeof s.widthInColumns == "number" && s.widthInColumns > a && ae.warn(
      `Block ${s.id} width ${s.widthInColumns} exceeds configured column width ${a}`
    ), s.label && (s.label = aRe(s.label)), s.type === "classDef") {
      sRe(s.id, s.css);
      continue;
    }
    if (s.type === "applyClass") {
      lRe(s.id, (s == null ? void 0 : s.styleClass) ?? "");
      continue;
    }
    if (s.type === "applyStyles") {
      s != null && s.stylesStr && oRe(s.id, s == null ? void 0 : s.stylesStr);
      continue;
    }
    if (s.type === "column-setting")
      e.columns = s.columns ?? -1;
    else if (s.type === "edge") {
      const o = (W6.get(s.id) ?? 0) + 1;
      W6.set(s.id, o), s.id = o + "-" + s.id, b7.push(s);
    } else {
      s.label || (s.type === "composite" ? s.label = "" : s.label = s.id);
      const o = ws.get(s.id);
      if (o === void 0 ? ws.set(s.id, s) : (s.type !== "na" && (o.type = s.type), s.label !== s.id && (o.label = s.label)), s.children && mY(s.children, s), s.type === "space") {
        const l = s.width ?? 1;
        for (let u = 0; u < l; u++) {
          const h = $n(s);
          h.id = h.id + "-" + u, ws.set(h.id, h), n.push(h);
        }
      } else o === void 0 && n.push(s);
    }
  }
  e.children = n;
}, "populateBlockDatabase"), w7 = [], Dp = { id: "root", type: "composite", children: [], columns: -1 }, cRe = /* @__PURE__ */ x(() => {
  ae.debug("Clear called"), _n(), Dp = { id: "root", type: "composite", children: [], columns: -1 }, ws = /* @__PURE__ */ new Map([["root", Dp]]), w7 = [], M2 = /* @__PURE__ */ new Map(), b7 = [], W6 = /* @__PURE__ */ new Map();
}, "clear");
function vY(t) {
  switch (ae.debug("typeStr2Type", t), t) {
    case "[]":
      return "square";
    case "()":
      return ae.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";
  }
}
x(vY, "typeStr2Type");
function yY(t) {
  switch (ae.debug("typeStr2Type", t), t) {
    case "==":
      return "thick";
    default:
      return "normal";
  }
}
x(yY, "edgeTypeStr2Type");
function xY(t) {
  switch (t.replace(/^[\s-]+|[\s-]+$/g, "")) {
    case "x":
      return "arrow_cross";
    case "o":
      return "arrow_circle";
    case ">":
      return "arrow_point";
    default:
      return "";
  }
}
x(xY, "edgeStrToEdgeData");
var KN = 0, uRe = /* @__PURE__ */ x(() => (KN++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + KN), "generateId"), hRe = /* @__PURE__ */ x((t) => {
  Dp.children = t, mY(t, Dp), w7 = Dp.children;
}, "setHierarchy"), dRe = /* @__PURE__ */ x((t) => {
  const e = ws.get(t);
  return e ? e.columns ? e.columns : e.children ? e.children.length : -1 : -1;
}, "getColumns"), fRe = /* @__PURE__ */ x(() => [...ws.values()], "getBlocksFlat"), pRe = /* @__PURE__ */ x(() => w7 || [], "getBlocks"), gRe = /* @__PURE__ */ x(() => b7, "getEdges"), mRe = /* @__PURE__ */ x((t) => ws.get(t), "getBlock"), vRe = /* @__PURE__ */ x((t) => {
  ws.set(t.id, t);
}, "setBlock"), yRe = /* @__PURE__ */ x(() => ae, "getLogger"), xRe = /* @__PURE__ */ x(function() {
  return M2;
}, "getClasses"), bRe = {
  getConfig: /* @__PURE__ */ x(() => gr().block, "getConfig"),
  typeStr2Type: vY,
  edgeTypeStr2Type: yY,
  edgeStrToEdgeData: xY,
  getLogger: yRe,
  getBlocksFlat: fRe,
  getBlocks: pRe,
  getEdges: gRe,
  setHierarchy: hRe,
  getBlock: mRe,
  setBlock: vRe,
  getColumns: dRe,
  getClasses: xRe,
  clear: cRe,
  generateId: uRe
}, wRe = bRe, Im = /* @__PURE__ */ x((t, e) => {
  const r = K6, n = r(t, "r"), i = r(t, "g"), a = r(t, "b");
  return _l(n, i, a, e);
}, "fade"), TRe = /* @__PURE__ */ x((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: ${Im(t.edgeLabelBackground, 0.5)};
    // background-color:
  }

  .node .cluster {
    // fill: ${Im(t.mainBkg, 0.5)};
    fill: ${Im(t.clusterBkg, 0.5)};
    stroke: ${Im(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};
  }
  ${l1()}
`, "getStyles"), ERe = TRe, kRe = /* @__PURE__ */ x((t, e, r, n) => {
  e.forEach((i) => {
    IRe[i](t, r, n);
  });
}, "insertMarkers"), SRe = /* @__PURE__ */ x((t, e, r) => {
  ae.trace("Making markers for ", r), t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "extension"), CRe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "composition"), ARe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "aggregation"), _Re = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "dependency"), LRe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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", r + "_" + 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);
}, "lollipop"), RRe = /* @__PURE__ */ x((t, e, r) => {
  t.append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "point"), NRe = /* @__PURE__ */ x((t, e, r) => {
  t.append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "circle"), MRe = /* @__PURE__ */ x((t, e, r) => {
  t.append("marker").attr("id", r + "_" + 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", r + "_" + 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");
}, "cross"), DRe = /* @__PURE__ */ x((t, e, r) => {
  t.append("defs").append("marker").attr("id", r + "_" + 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");
}, "barb"), IRe = {
  extension: SRe,
  composition: CRe,
  aggregation: ARe,
  dependency: _Re,
  lollipop: LRe,
  point: RRe,
  circle: NRe,
  cross: MRe,
  barb: DRe
}, ORe = kRe, lM, cM, pn = ((cM = (lM = we()) == null ? void 0 : lM.block) == null ? void 0 : cM.padding) ?? 8;
function bY(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 r = e % t, n = Math.floor(e / t);
  return { px: r, py: n };
}
x(bY, "calculateBlockPosition");
var PRe = /* @__PURE__ */ x((t) => {
  let e = 0, r = 0;
  for (const n of t.children) {
    const { width: i, height: a, x: s, y: o } = n.size ?? { width: 0, height: 0, x: 0, y: 0 };
    ae.debug(
      "getMaxChildSize abc95 child:",
      n.id,
      "width:",
      i,
      "height:",
      a,
      "x:",
      s,
      "y:",
      o,
      n.type
    ), n.type !== "space" && (i > e && (e = i / (t.widthInColumns ?? 1)), a > r && (r = a));
  }
  return { width: e, height: r };
}, "getMaxChildSize");
function D2(t, e, r = 0, n = 0) {
  var s, o, l, u, h, d, f, p, g, m, v;
  ae.debug(
    "setBlockSizes abc95 (start)",
    t.id,
    (s = t == null ? void 0 : t.size) == null ? void 0 : s.x,
    "block width =",
    t == null ? void 0 : t.size,
    "siblingWidth",
    r
  ), (o = t == null ? void 0 : t.size) != null && o.width || (t.size = {
    width: r,
    height: n,
    x: 0,
    y: 0
  });
  let i = 0, a = 0;
  if (((l = t.children) == null ? void 0 : l.length) > 0) {
    for (const _ of t.children)
      D2(_, e);
    const y = PRe(t);
    i = y.width, a = y.height, ae.debug("setBlockSizes abc95 maxWidth of", t.id, ":s children is ", i, a);
    for (const _ of t.children)
      _.size && (ae.debug(
        `abc95 Setting size of children of ${t.id} id=${_.id} ${i} ${a} ${JSON.stringify(_.size)}`
      ), _.size.width = i * (_.widthInColumns ?? 1) + pn * ((_.widthInColumns ?? 1) - 1), _.size.height = a, _.size.x = 0, _.size.y = 0, ae.debug(
        `abc95 updating size of ${t.id} children child:${_.id} maxWidth:${i} maxHeight:${a}`
      ));
    for (const _ of t.children)
      D2(_, e, i, a);
    const b = t.columns ?? -1;
    let w = 0;
    for (const _ of t.children)
      w += _.widthInColumns ?? 1;
    let T = t.children.length;
    b > 0 && b < w && (T = b);
    const E = Math.ceil(w / T);
    let C = T * (i + pn) + pn, k = E * (a + pn) + pn;
    if (C < r) {
      ae.debug(
        `Detected to small sibling: abc95 ${t.id} siblingWidth ${r} siblingHeight ${n} width ${C}`
      ), C = r, k = n;
      const _ = (r - T * pn - pn) / T, L = (n - E * pn - pn) / E;
      ae.debug("Size indata abc88", t.id, "childWidth", _, "maxWidth", i), ae.debug("Size indata abc88", t.id, "childHeight", L, "maxHeight", a), ae.debug("Size indata abc88 xSize", T, "padding", pn);
      for (const N of t.children)
        N.size && (N.size.width = _, N.size.height = L, N.size.x = 0, N.size.y = 0);
    }
    if (ae.debug(
      `abc95 (finale calc) ${t.id} xSize ${T} ySize ${E} columns ${b}${t.children.length} width=${Math.max(C, ((u = t.size) == null ? void 0 : u.width) || 0)}`
    ), C < (((h = t == null ? void 0 : t.size) == null ? void 0 : h.width) || 0)) {
      C = ((d = t == null ? void 0 : t.size) == null ? void 0 : d.width) || 0;
      const _ = b > 0 ? Math.min(t.children.length, b) : t.children.length;
      if (_ > 0) {
        const L = (C - _ * pn - pn) / _;
        ae.debug("abc95 (growing to fit) width", t.id, C, (f = t.size) == null ? void 0 : f.width, L);
        for (const N of t.children)
          N.size && (N.size.width = L);
      }
    }
    t.size = {
      width: C,
      height: k,
      x: 0,
      y: 0
    };
  }
  ae.debug(
    "setBlockSizes abc94 (done)",
    t.id,
    (p = t == null ? void 0 : t.size) == null ? void 0 : p.x,
    (g = t == null ? void 0 : t.size) == null ? void 0 : g.width,
    (m = t == null ? void 0 : t.size) == null ? void 0 : m.y,
    (v = t == null ? void 0 : t.size) == null ? void 0 : v.height
  );
}
x(D2, "setBlockSizes");
function T7(t, e) {
  var n, i, a, s, o, l, u, h, d, f, p, g, m, v, y, b, w;
  ae.debug(
    `abc85 layout blocks (=>layoutBlocks) ${t.id} x: ${(n = t == null ? void 0 : t.size) == null ? void 0 : n.x} y: ${(i = t == null ? void 0 : t.size) == null ? void 0 : i.y} width: ${(a = t == null ? void 0 : t.size) == null ? void 0 : a.width}`
  );
  const r = t.columns ?? -1;
  if (ae.debug("layoutBlocks columns abc95", t.id, "=>", r, t), t.children && // find max width of children
  t.children.length > 0) {
    const T = ((o = (s = t == null ? void 0 : t.children[0]) == null ? void 0 : s.size) == null ? void 0 : o.width) ?? 0, E = t.children.length * T + (t.children.length - 1) * pn;
    ae.debug("widthOfChildren 88", E, "posX");
    let C = 0;
    ae.debug("abc91 block?.size?.x", t.id, (l = t == null ? void 0 : t.size) == null ? void 0 : l.x);
    let k = (u = t == null ? void 0 : t.size) != null && u.x ? ((h = t == null ? void 0 : t.size) == null ? void 0 : h.x) + (-((d = t == null ? void 0 : t.size) == null ? void 0 : d.width) / 2 || 0) : -pn, _ = 0;
    for (const L of t.children) {
      const N = t;
      if (!L.size)
        continue;
      const { width: A, height: O } = L.size, { px: P, py: S } = bY(r, C);
      if (S != _ && (_ = S, k = (f = t == null ? void 0 : t.size) != null && f.x ? ((p = t == null ? void 0 : t.size) == null ? void 0 : p.x) + (-((g = t == null ? void 0 : t.size) == null ? void 0 : g.width) / 2 || 0) : -pn, ae.debug("New row in layout for block", t.id, " and child ", L.id, _)), ae.debug(
        `abc89 layout blocks (child) id: ${L.id} Pos: ${C} (px, py) ${P},${S} (${(m = N == null ? void 0 : N.size) == null ? void 0 : m.x},${(v = N == null ? void 0 : N.size) == null ? void 0 : v.y}) parent: ${N.id} width: ${A}${pn}`
      ), N.size) {
        const I = A / 2;
        L.size.x = k + pn + I, ae.debug(
          `abc91 layout blocks (calc) px, pyid:${L.id} startingPos=X${k} new startingPosX${L.size.x} ${I} padding=${pn} width=${A} halfWidth=${I} => x:${L.size.x} y:${L.size.y} ${L.widthInColumns} (width * (child?.w || 1)) / 2 ${A * ((L == null ? void 0 : L.widthInColumns) ?? 1) / 2}`
        ), k = L.size.x + I, L.size.y = N.size.y - N.size.height / 2 + S * (O + pn) + O / 2 + pn, ae.debug(
          `abc88 layout blocks (calc) px, pyid:${L.id}startingPosX${k}${pn}${I}=>x:${L.size.x}y:${L.size.y}${L.widthInColumns}(width * (child?.w || 1)) / 2${A * ((L == null ? void 0 : L.widthInColumns) ?? 1) / 2}`
        );
      }
      L.children && T7(L);
      let R = (L == null ? void 0 : L.widthInColumns) ?? 1;
      r > 0 && (R = Math.min(R, r - C % r)), C += R, ae.debug("abc88 columnsPos", L, C);
    }
  }
  ae.debug(
    `layout blocks (<==layoutBlocks) ${t.id} x: ${(y = t == null ? void 0 : t.size) == null ? void 0 : y.x} y: ${(b = t == null ? void 0 : t.size) == null ? void 0 : b.y} width: ${(w = t == null ? void 0 : t.size) == null ? void 0 : w.width}`
  );
}
x(T7, "layoutBlocks");
function E7(t, { minX: e, minY: r, maxX: n, maxY: i } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
  if (t.size && t.id !== "root") {
    const { x: a, y: s, width: o, height: l } = t.size;
    a - o / 2 < e && (e = a - o / 2), s - l / 2 < r && (r = s - l / 2), a + o / 2 > n && (n = a + o / 2), s + l / 2 > i && (i = s + l / 2);
  }
  if (t.children)
    for (const a of t.children)
      ({ minX: e, minY: r, maxX: n, maxY: i } = E7(a, { minX: e, minY: r, maxX: n, maxY: i }));
  return { minX: e, minY: r, maxX: n, maxY: i };
}
x(E7, "findBounds");
function wY(t) {
  const e = t.getBlock("root");
  if (!e)
    return;
  D2(e, t, 0, 0), T7(e), ae.debug("getBlocks", JSON.stringify(e, null, 2));
  const { minX: r, minY: n, maxX: i, maxY: a } = E7(e), s = a - n, o = i - r;
  return { x: r, y: n, width: o, height: s };
}
x(wY, "layout");
function H6(t, e) {
  e && t.attr("style", e);
}
x(H6, "applyStyle");
function TY(t, e) {
  const r = Qe(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), n = r.append("xhtml:div"), i = t.label, a = t.isNode ? "nodeLabel" : "edgeLabel", s = n.append("span");
  return s.html(fr(i, e)), H6(s, t.labelStyle), s.attr("class", a), H6(n, t.labelStyle), n.style("display", "inline-block"), n.style("white-space", "nowrap"), n.attr("xmlns", "http://www.w3.org/1999/xhtml"), r.node();
}
x(TY, "addHtmlLabel");
var BRe = /* @__PURE__ */ x(async (t, e, r, n) => {
  let i = t || "";
  typeof i == "object" && (i = i[0]);
  const a = we();
  if (Ir(a.flowchart.htmlLabels)) {
    i = i.replace(/\\n|\n/g, "<br />"), ae.debug("vertexText" + i);
    const s = await XE(Zs(i)), o = {
      isNode: n,
      label: s,
      labelStyle: e.replace("fill:", "color:")
    };
    return TY(o, a);
  } else {
    const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
    s.setAttribute("style", e.replace("color:", "fill:"));
    let o = [];
    typeof i == "string" ? o = i.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(i) ? o = i : o = [];
    for (const l of o) {
      const u = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
      u.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), u.setAttribute("dy", "1em"), u.setAttribute("x", "0"), r ? u.setAttribute("class", "title-row") : u.setAttribute("class", "row"), u.textContent = l.trim(), s.appendChild(u);
    }
    return s;
  }
}, "createLabel"), qa = BRe, FRe = /* @__PURE__ */ x((t, e, r, n, i) => {
  e.arrowTypeStart && ZN(t, "start", e.arrowTypeStart, r, n, i), e.arrowTypeEnd && ZN(t, "end", e.arrowTypeEnd, r, n, i);
}, "addEdgeMarkers"), $Re = {
  arrow_cross: "cross",
  arrow_point: "point",
  arrow_barb: "barb",
  arrow_circle: "circle",
  aggregation: "aggregation",
  extension: "extension",
  composition: "composition",
  dependency: "dependency",
  lollipop: "lollipop"
}, ZN = /* @__PURE__ */ x((t, e, r, n, i, a) => {
  const s = $Re[r];
  if (!s) {
    ae.warn(`Unknown arrow type: ${r}`);
    return;
  }
  const o = e === "start" ? "Start" : "End";
  t.attr(`marker-${e}`, `url(${n}#${i}_${a}-${s}${o})`);
}, "addEdgeMarker"), q6 = {}, bi = {}, zRe = /* @__PURE__ */ x(async (t, e) => {
  const r = we(), n = Ir(r.flowchart.htmlLabels), i = e.labelType === "markdown" ? Ma(
    t,
    e.label,
    {
      style: e.labelStyle,
      useHtmlLabels: n,
      addSvgBackground: !0
    },
    r
  ) : await qa(e.label, e.labelStyle), a = t.insert("g").attr("class", "edgeLabel"), s = a.insert("g").attr("class", "label");
  s.node().appendChild(i);
  let o = i.getBBox();
  if (n) {
    const u = i.children[0], h = Qe(i);
    o = u.getBoundingClientRect(), h.attr("width", o.width), h.attr("height", o.height);
  }
  s.attr("transform", "translate(" + -o.width / 2 + ", " + -o.height / 2 + ")"), q6[e.id] = a, e.width = o.width, e.height = o.height;
  let l;
  if (e.startLabelLeft) {
    const u = await qa(e.startLabelLeft, e.labelStyle), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), bi[e.id] || (bi[e.id] = {}), bi[e.id].startLeft = h, yp(l, e.startLabelLeft);
  }
  if (e.startLabelRight) {
    const u = await qa(e.startLabelRight, e.labelStyle), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = h.node().appendChild(u), d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), bi[e.id] || (bi[e.id] = {}), bi[e.id].startRight = h, yp(l, e.startLabelRight);
  }
  if (e.endLabelLeft) {
    const u = await qa(e.endLabelLeft, e.labelStyle), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), h.node().appendChild(u), bi[e.id] || (bi[e.id] = {}), bi[e.id].endLeft = h, yp(l, e.endLabelLeft);
  }
  if (e.endLabelRight) {
    const u = await qa(e.endLabelRight, e.labelStyle), h = t.insert("g").attr("class", "edgeTerminals"), d = h.insert("g").attr("class", "inner");
    l = d.node().appendChild(u);
    const f = u.getBBox();
    d.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), h.node().appendChild(u), bi[e.id] || (bi[e.id] = {}), bi[e.id].endRight = h, yp(l, e.endLabelRight);
  }
  return i;
}, "insertEdgeLabel");
function yp(t, e) {
  we().flowchart.htmlLabels && t && (t.style.width = e.length * 9 + "px", t.style.height = "12px");
}
x(yp, "setTerminalWidth");
var VRe = /* @__PURE__ */ x((t, e) => {
  ae.debug("Moving label abc88 ", t.id, t.label, q6[t.id], e);
  let r = e.updatedPath ? e.updatedPath : e.originalPath;
  const n = we(), { subGraphTitleTotalMargin: i } = Ig(n);
  if (t.label) {
    const a = q6[t.id];
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcLabelPosition(r);
      ae.debug(
        "Moving label " + t.label + " from (",
        s,
        ",",
        o,
        ") to (",
        l.x,
        ",",
        l.y,
        ") abc88"
      ), e.updatedPath && (s = l.x, o = l.y);
    }
    a.attr("transform", `translate(${s}, ${o + i / 2})`);
  }
  if (t.startLabelLeft) {
    const a = bi[t.id].startLeft;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(t.arrowTypeStart ? 10 : 0, "start_left", r);
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
  if (t.startLabelRight) {
    const a = bi[t.id].startRight;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(
        t.arrowTypeStart ? 10 : 0,
        "start_right",
        r
      );
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
  if (t.endLabelLeft) {
    const a = bi[t.id].endLeft;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(t.arrowTypeEnd ? 10 : 0, "end_left", r);
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
  if (t.endLabelRight) {
    const a = bi[t.id].endRight;
    let s = t.x, o = t.y;
    if (r) {
      const l = Kt.calcTerminalLabelPosition(t.arrowTypeEnd ? 10 : 0, "end_right", r);
      s = l.x, o = l.y;
    }
    a.attr("transform", `translate(${s}, ${o})`);
  }
}, "positionEdgeLabel"), GRe = /* @__PURE__ */ x((t, e) => {
  const r = t.x, n = t.y, i = Math.abs(e.x - r), a = Math.abs(e.y - n), s = t.width / 2, o = t.height / 2;
  return i >= s || a >= o;
}, "outsideNode"), URe = /* @__PURE__ */ x((t, e, r) => {
  ae.debug(`intersection calc abc89:
  outsidePoint: ${JSON.stringify(e)}
  insidePoint : ${JSON.stringify(r)}
  node        : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);
  const n = t.x, i = t.y, a = Math.abs(n - r.x), s = t.width / 2;
  let o = r.x < e.x ? s - a : s + a;
  const l = t.height / 2, u = Math.abs(e.y - r.y), h = Math.abs(e.x - r.x);
  if (Math.abs(i - e.y) * s > Math.abs(n - e.x) * l) {
    let d = r.y < e.y ? e.y - l - i : i - l - e.y;
    o = h * d / u;
    const f = {
      x: r.x < e.x ? r.x + o : r.x - h + o,
      y: r.y < e.y ? r.y + u - d : r.y - u + d
    };
    return o === 0 && (f.x = e.x, f.y = e.y), h === 0 && (f.x = e.x), u === 0 && (f.y = e.y), ae.debug(`abc89 topp/bott calc, Q ${u}, q ${d}, R ${h}, r ${o}`, f), f;
  } else {
    r.x < e.x ? o = e.x - s - n : o = n - s - e.x;
    let d = u * o / h, f = r.x < e.x ? r.x + h - o : r.x - h + o, p = r.y < e.y ? r.y + d : r.y - d;
    return ae.debug(`sides calc abc89, Q ${u}, q ${d}, R ${h}, r ${o}`, { _x: f, _y: p }), o === 0 && (f = e.x, p = e.y), h === 0 && (f = e.x), u === 0 && (p = e.y), { x: f, y: p };
  }
}, "intersection"), QN = /* @__PURE__ */ x((t, e) => {
  ae.debug("abc88 cutPathAtIntersect", t, e);
  let r = [], n = t[0], i = !1;
  return t.forEach((a) => {
    if (!GRe(e, a) && !i) {
      const s = URe(e, n, a);
      let o = !1;
      r.forEach((l) => {
        o = o || l.x === s.x && l.y === s.y;
      }), r.some((l) => l.x === s.x && l.y === s.y) || r.push(s), i = !0;
    } else
      n = a, i || r.push(a);
  }), r;
}, "cutPathAtIntersect"), WRe = /* @__PURE__ */ x(function(t, e, r, n, i, a, s) {
  let o = r.points;
  ae.debug("abc88 InsertEdge: edge=", r, "e=", e);
  let l = !1;
  const u = a.node(e.v);
  var h = a.node(e.w);
  h != null && h.intersect && (u != null && u.intersect) && (o = o.slice(1, r.points.length - 1), o.unshift(u.intersect(o[0])), o.push(h.intersect(o[o.length - 1]))), r.toCluster && (ae.debug("to cluster abc88", n[r.toCluster]), o = QN(r.points, n[r.toCluster].node), l = !0), r.fromCluster && (ae.debug("from cluster abc88", n[r.fromCluster]), o = QN(o.reverse(), n[r.fromCluster].node).reverse(), l = !0);
  const d = o.filter((T) => !Number.isNaN(T.y));
  let f = Rh;
  r.curve && (i === "graph" || i === "flowchart") && (f = r.curve);
  const { x: p, y: g } = MO(r), m = Gp().x(p).y(g).curve(f);
  let v;
  switch (r.thickness) {
    case "normal":
      v = "edge-thickness-normal";
      break;
    case "thick":
      v = "edge-thickness-thick";
      break;
    case "invisible":
      v = "edge-thickness-thick";
      break;
    default:
      v = "";
  }
  switch (r.pattern) {
    case "solid":
      v += " edge-pattern-solid";
      break;
    case "dotted":
      v += " edge-pattern-dotted";
      break;
    case "dashed":
      v += " edge-pattern-dashed";
      break;
  }
  const y = t.append("path").attr("d", m(d)).attr("id", r.id).attr("class", " " + v + (r.classes ? " " + r.classes : "")).attr("style", r.style);
  let b = "";
  (we().flowchart.arrowMarkerAbsolute || we().state.arrowMarkerAbsolute) && (b = z2(!0)), FRe(y, r, b, s, i);
  let w = {};
  return l && (w.updatedPath = o), w.originalPath = r.points, w;
}, "insertEdge"), HRe = /* @__PURE__ */ x((t) => {
  const e = /* @__PURE__ */ new Set();
  for (const r of t)
    switch (r) {
      case "x":
        e.add("right"), e.add("left");
        break;
      case "y":
        e.add("up"), e.add("down");
        break;
      default:
        e.add(r);
        break;
    }
  return e;
}, "expandAndDeduplicateDirections"), qRe = /* @__PURE__ */ x((t, e, r) => {
  const n = HRe(t), i = 2, a = e.height + 2 * r.padding, s = a / i, o = e.width + 2 * s + r.padding, l = r.padding / 2;
  return n.has("right") && n.has("left") && n.has("up") && n.has("down") ? [
    // Bottom
    { x: 0, y: 0 },
    { x: s, y: 0 },
    { x: o / 2, y: 2 * l },
    { x: o - s, y: 0 },
    { x: o, y: 0 },
    // Right
    { x: o, y: -a / 3 },
    { x: o + 2 * l, y: -a / 2 },
    { x: o, y: -2 * a / 3 },
    { x: o, y: -a },
    // Top
    { x: o - s, y: -a },
    { x: o / 2, y: -a - 2 * l },
    { x: s, y: -a },
    // Left
    { x: 0, y: -a },
    { x: 0, y: -2 * a / 3 },
    { x: -2 * l, y: -a / 2 },
    { x: 0, y: -a / 3 }
  ] : n.has("right") && n.has("left") && n.has("up") ? [
    { x: s, y: 0 },
    { x: o - s, y: 0 },
    { x: o, y: -a / 2 },
    { x: o - s, y: -a },
    { x: s, y: -a },
    { x: 0, y: -a / 2 }
  ] : n.has("right") && n.has("left") && n.has("down") ? [
    { x: 0, y: 0 },
    { x: s, y: -a },
    { x: o - s, y: -a },
    { x: o, y: 0 }
  ] : n.has("right") && n.has("up") && n.has("down") ? [
    { x: 0, y: 0 },
    { x: o, y: -s },
    { x: o, y: -a + s },
    { x: 0, y: -a }
  ] : n.has("left") && n.has("up") && n.has("down") ? [
    { x: o, y: 0 },
    { x: 0, y: -s },
    { x: 0, y: -a + s },
    { x: o, y: -a }
  ] : n.has("right") && n.has("left") ? [
    { x: s, y: 0 },
    { x: s, y: -l },
    { x: o - s, y: -l },
    { x: o - s, y: 0 },
    { x: o, y: -a / 2 },
    { x: o - s, y: -a },
    { x: o - s, y: -a + l },
    { x: s, y: -a + l },
    { x: s, y: -a },
    { x: 0, y: -a / 2 }
  ] : n.has("up") && n.has("down") ? [
    // Bottom center
    { x: o / 2, y: 0 },
    // Left pont of bottom arrow
    { x: 0, y: -l },
    { x: s, y: -l },
    // Left top over vertical section
    { x: s, y: -a + l },
    { x: 0, y: -a + l },
    // Top of arrow
    { x: o / 2, y: -a },
    { x: o, y: -a + l },
    // Top of right vertical bar
    { x: o - s, y: -a + l },
    { x: o - s, y: -l },
    { x: o, y: -l }
  ] : n.has("right") && n.has("up") ? [
    { x: 0, y: 0 },
    { x: o, y: -s },
    { x: 0, y: -a }
  ] : n.has("right") && n.has("down") ? [
    { x: 0, y: 0 },
    { x: o, y: 0 },
    { x: 0, y: -a }
  ] : n.has("left") && n.has("up") ? [
    { x: o, y: 0 },
    { x: 0, y: -s },
    { x: o, y: -a }
  ] : n.has("left") && n.has("down") ? [
    { x: o, y: 0 },
    { x: 0, y: 0 },
    { x: o, y: -a }
  ] : n.has("right") ? [
    { x: s, y: -l },
    { x: s, y: -l },
    { x: o - s, y: -l },
    { x: o - s, y: 0 },
    { x: o, y: -a / 2 },
    { x: o - s, y: -a },
    { x: o - s, y: -a + l },
    // top left corner of arrow
    { x: s, y: -a + l },
    { x: s, y: -a + l }
  ] : n.has("left") ? [
    { x: s, y: 0 },
    { x: s, y: -l },
    // Two points, the right corners
    { x: o - s, y: -l },
    { x: o - s, y: -a + l },
    { x: s, y: -a + l },
    { x: s, y: -a },
    { x: 0, y: -a / 2 }
  ] : n.has("up") ? [
    // Bottom center
    { x: s, y: -l },
    // Left top over vertical section
    { x: s, y: -a + l },
    { x: 0, y: -a + l },
    // Top of arrow
    { x: o / 2, y: -a },
    { x: o, y: -a + l },
    // Top of right vertical bar
    { x: o - s, y: -a + l },
    { x: o - s, y: -l }
  ] : n.has("down") ? [
    // Bottom center
    { x: o / 2, y: 0 },
    // Left pont of bottom arrow
    { x: 0, y: -l },
    { x: s, y: -l },
    // Left top over vertical section
    { x: s, y: -a + l },
    { x: o - s, y: -a + l },
    { x: o - s, y: -l },
    { x: o, y: -l }
  ] : [{ x: 0, y: 0 }];
}, "getArrowPoints");
function EY(t, e) {
  return t.intersect(e);
}
x(EY, "intersectNode");
var YRe = EY;
function kY(t, e, r, n) {
  var i = t.x, a = t.y, s = i - n.x, o = a - n.y, l = Math.sqrt(e * e * o * o + r * r * s * s), u = Math.abs(e * r * s / l);
  n.x < i && (u = -u);
  var h = Math.abs(e * r * o / l);
  return n.y < a && (h = -h), { x: i + u, y: a + h };
}
x(kY, "intersectEllipse");
var SY = kY;
function CY(t, e, r) {
  return SY(t, e, e, r);
}
x(CY, "intersectCircle");
var XRe = CY;
function AY(t, e, r, n) {
  var i, a, s, o, l, u, h, d, f, p, g, m, v, y, b;
  if (i = e.y - t.y, s = t.x - e.x, l = e.x * t.y - t.x * e.y, f = i * r.x + s * r.y + l, p = i * n.x + s * n.y + l, !(f !== 0 && p !== 0 && Y6(f, p)) && (a = n.y - r.y, o = r.x - n.x, u = n.x * r.y - r.x * n.y, h = a * t.x + o * t.y + u, d = a * e.x + o * e.y + u, !(h !== 0 && d !== 0 && Y6(h, d)) && (g = i * o - a * s, g !== 0)))
    return m = Math.abs(g / 2), v = s * u - o * l, y = v < 0 ? (v - m) / g : (v + m) / g, v = a * l - i * u, b = v < 0 ? (v - m) / g : (v + m) / g, { x: y, y: b };
}
x(AY, "intersectLine");
function Y6(t, e) {
  return t * e > 0;
}
x(Y6, "sameSign");
var jRe = AY, KRe = _Y;
function _Y(t, e, r) {
  var n = t.x, i = t.y, a = [], s = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY;
  typeof e.forEach == "function" ? e.forEach(function(g) {
    s = Math.min(s, g.x), o = Math.min(o, g.y);
  }) : (s = Math.min(s, e.x), o = Math.min(o, e.y));
  for (var l = n - t.width / 2 - s, u = i - t.height / 2 - o, h = 0; h < e.length; h++) {
    var d = e[h], f = e[h < e.length - 1 ? h + 1 : 0], p = jRe(
      t,
      r,
      { x: l + d.x, y: u + d.y },
      { x: l + f.x, y: u + f.y }
    );
    p && a.push(p);
  }
  return a.length ? (a.length > 1 && a.sort(function(g, m) {
    var v = g.x - r.x, y = g.y - r.y, b = Math.sqrt(v * v + y * y), w = m.x - r.x, T = m.y - r.y, E = Math.sqrt(w * w + T * T);
    return b < E ? -1 : b === E ? 0 : 1;
  }), a[0]) : t;
}
x(_Y, "intersectPolygon");
var ZRe = /* @__PURE__ */ x((t, e) => {
  var r = t.x, n = t.y, i = e.x - r, a = e.y - n, s = t.width / 2, o = t.height / 2, l, u;
  return Math.abs(a) * s > Math.abs(i) * o ? (a < 0 && (o = -o), l = a === 0 ? 0 : o * i / a, u = o) : (i < 0 && (s = -s), l = s, u = i === 0 ? 0 : s * a / i), { x: r + l, y: n + u };
}, "intersectRect"), QRe = ZRe, Qr = {
  node: YRe,
  circle: XRe,
  ellipse: SY,
  polygon: KRe,
  rect: QRe
}, ti = /* @__PURE__ */ x(async (t, e, r, n) => {
  const i = we();
  let a;
  const s = e.useHtmlLabels || Ir(i.flowchart.htmlLabels);
  r ? a = r : a = "node default";
  const o = t.insert("g").attr("class", a).attr("id", e.domId || e.id), l = o.insert("g").attr("class", "label").attr("style", e.labelStyle);
  let u;
  e.labelText === void 0 ? u = "" : u = typeof e.labelText == "string" ? e.labelText : e.labelText[0];
  const h = l.node();
  let d;
  e.labelType === "markdown" ? d = Ma(
    l,
    fr(Zs(u), i),
    {
      useHtmlLabels: s,
      width: e.width || i.flowchart.wrappingWidth,
      classes: "markdown-node-label"
    },
    i
  ) : d = h.appendChild(
    await qa(
      fr(Zs(u), i),
      e.labelStyle,
      !1,
      n
    )
  );
  let f = d.getBBox();
  const p = e.padding / 2;
  if (Ir(i.flowchart.htmlLabels)) {
    const g = d.children[0], m = Qe(d), v = g.getElementsByTagName("img");
    if (v) {
      const y = u.replace(/<img[^>]*>/g, "").trim() === "";
      await Promise.all(
        [...v].map(
          (b) => new Promise((w) => {
            function T() {
              if (b.style.display = "flex", b.style.flexDirection = "column", y) {
                const E = i.fontSize ? i.fontSize : window.getComputedStyle(document.body).fontSize, k = parseInt(E, 10) * 5 + "px";
                b.style.minWidth = k, b.style.maxWidth = k;
              } else
                b.style.width = "100%";
              w(b);
            }
            x(T, "setupImage"), setTimeout(() => {
              b.complete && T();
            }), b.addEventListener("error", T), b.addEventListener("load", T);
          })
        )
      );
    }
    f = g.getBoundingClientRect(), m.attr("width", f.width), m.attr("height", f.height);
  }
  return s ? l.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")") : l.attr("transform", "translate(0, " + -f.height / 2 + ")"), e.centerLabel && l.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), l.insert("rect", ":first-child"), { shapeSvg: o, bbox: f, halfPadding: p, label: l };
}, "labelHelper"), dn = /* @__PURE__ */ x((t, e) => {
  const r = e.node().getBBox();
  t.width = r.width, t.height = r.height;
}, "updateNodeBounds");
function Ls(t, e, r, n) {
  return t.insert("polygon", ":first-child").attr(
    "points",
    n.map(function(i) {
      return i.x + "," + i.y;
    }).join(" ")
  ).attr("class", "label-container").attr("transform", "translate(" + -e / 2 + "," + r / 2 + ")");
}
x(Ls, "insertPolygonShape");
var JRe = /* @__PURE__ */ x(async (t, e) => {
  e.useHtmlLabels || we().flowchart.htmlLabels || (e.centerLabel = !0);
  const { shapeSvg: n, bbox: i, halfPadding: a } = await ti(
    t,
    e,
    "node " + e.classes,
    !0
  );
  ae.info("Classes = ", e.classes);
  const s = n.insert("rect", ":first-child");
  return s.attr("rx", e.rx).attr("ry", e.ry).attr("x", -i.width / 2 - a).attr("y", -i.height / 2 - a).attr("width", i.width + e.padding).attr("height", i.height + e.padding), dn(e, s), e.intersect = function(o) {
    return Qr.rect(e, o);
  }, n;
}, "note"), eNe = JRe, JN = /* @__PURE__ */ x((t) => t ? " " + t : "", "formatClass"), Ba = /* @__PURE__ */ x((t, e) => `${e || "node default"}${JN(t.classes)} ${JN(
  t.class
)}`, "getClassesFromNode"), eM = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = i + a, o = [
    { x: s / 2, y: 0 },
    { x: s, y: -s / 2 },
    { x: s / 2, y: -s },
    { x: 0, y: -s / 2 }
  ];
  ae.info("Question main (Circle)");
  const l = Ls(r, s, s, o);
  return l.attr("style", e.style), dn(e, l), e.intersect = function(u) {
    return ae.warn("Intersect called"), Qr.polygon(e, o, u);
  }, r;
}, "question"), tNe = /* @__PURE__ */ x((t, e) => {
  const r = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), n = 28, i = [
    { x: 0, y: n / 2 },
    { x: n / 2, y: 0 },
    { x: 0, y: -n / 2 },
    { x: -n / 2, y: 0 }
  ];
  return r.insert("polygon", ":first-child").attr(
    "points",
    i.map(function(s) {
      return s.x + "," + s.y;
    }).join(" ")
  ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), e.width = 28, e.height = 28, e.intersect = function(s) {
    return Qr.circle(e, 14, s);
  }, r;
}, "choice"), rNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = 4, a = n.height + e.padding, s = a / i, o = n.width + 2 * s + e.padding, l = [
    { x: s, y: 0 },
    { x: o - s, y: 0 },
    { x: o, y: -a / 2 },
    { x: o - s, y: -a },
    { x: s, y: -a },
    { x: 0, y: -a / 2 }
  ], u = Ls(r, o, a, l);
  return u.attr("style", e.style), dn(e, u), e.intersect = function(h) {
    return Qr.polygon(e, l, h);
  }, r;
}, "hexagon"), nNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(t, e, void 0, !0), i = 2, a = n.height + 2 * e.padding, s = a / i, o = n.width + 2 * s + e.padding, l = qRe(e.directions, n, e), u = Ls(r, o, a, l);
  return u.attr("style", e.style), dn(e, u), e.intersect = function(h) {
    return Qr.polygon(e, l, h);
  }, r;
}, "block_arrow"), iNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: -a / 2, y: 0 },
    { x: i, y: 0 },
    { x: i, y: -a },
    { x: -a / 2, y: -a },
    { x: 0, y: -a / 2 }
  ];
  return Ls(r, i, a, s).attr("style", e.style), e.width = i + a, e.height = a, e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "rect_left_inv_arrow"), aNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(t, e, Ba(e), !0), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: -2 * a / 6, y: 0 },
    { x: i - a / 6, y: 0 },
    { x: i + 2 * a / 6, y: -a },
    { x: a / 6, y: -a }
  ], o = Ls(r, i, a, s);
  return o.attr("style", e.style), dn(e, o), e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "lean_right"), sNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: 2 * a / 6, y: 0 },
    { x: i + a / 6, y: 0 },
    { x: i - 2 * a / 6, y: -a },
    { x: -a / 6, y: -a }
  ], o = Ls(r, i, a, s);
  return o.attr("style", e.style), dn(e, o), e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "lean_left"), oNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: -2 * a / 6, y: 0 },
    { x: i + 2 * a / 6, y: 0 },
    { x: i - a / 6, y: -a },
    { x: a / 6, y: -a }
  ], o = Ls(r, i, a, s);
  return o.attr("style", e.style), dn(e, o), e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "trapezoid"), lNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: a / 6, y: 0 },
    { x: i - a / 6, y: 0 },
    { x: i + 2 * a / 6, y: -a },
    { x: -2 * a / 6, y: -a }
  ], o = Ls(r, i, a, s);
  return o.attr("style", e.style), dn(e, o), e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "inv_trapezoid"), cNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: 0, y: 0 },
    { x: i + a / 2, y: 0 },
    { x: i, y: -a / 2 },
    { x: i + a / 2, y: -a },
    { x: 0, y: -a }
  ], o = Ls(r, i, a, s);
  return o.attr("style", e.style), dn(e, o), e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "rect_right_inv_arrow"), uNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = i / 2, s = a / (2.5 + i / 50), o = n.height + s + e.padding, l = "M 0," + s + " a " + a + "," + s + " 0,0,0 " + i + " 0 a " + a + "," + s + " 0,0,0 " + -i + " 0 l 0," + o + " a " + a + "," + s + " 0,0,0 " + i + " 0 l 0," + -o, u = r.attr("label-offset-y", s).insert("path", ":first-child").attr("style", e.style).attr("d", l).attr("transform", "translate(" + -i / 2 + "," + -(o / 2 + s) + ")");
  return dn(e, u), e.intersect = function(h) {
    const d = Qr.rect(e, h), f = d.x - e.x;
    if (a != 0 && (Math.abs(f) < e.width / 2 || Math.abs(f) == e.width / 2 && Math.abs(d.y - e.y) > e.height / 2 - s)) {
      let p = s * s * (1 - f * f / (a * a));
      p != 0 && (p = Math.sqrt(p)), p = s - p, h.y - e.y > 0 && (p = -p), d.y += p;
    }
    return d;
  }, r;
}, "cylinder"), hNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n, halfPadding: i } = await ti(
    t,
    e,
    "node " + e.classes + " " + e.class,
    !0
  ), a = r.insert("rect", ":first-child"), s = e.positioned ? e.width : n.width + e.padding, o = e.positioned ? e.height : n.height + e.padding, l = e.positioned ? -s / 2 : -n.width / 2 - i, u = e.positioned ? -o / 2 : -n.height / 2 - i;
  if (a.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", s).attr("height", o), e.props) {
    const h = new Set(Object.keys(e.props));
    e.props.borders && (bb(a, e.props.borders, s, o), h.delete("borders")), h.forEach((d) => {
      ae.warn(`Unknown node property ${d}`);
    });
  }
  return dn(e, a), e.intersect = function(h) {
    return Qr.rect(e, h);
  }, r;
}, "rect"), dNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n, halfPadding: i } = await ti(
    t,
    e,
    "node " + e.classes,
    !0
  ), a = r.insert("rect", ":first-child"), s = e.positioned ? e.width : n.width + e.padding, o = e.positioned ? e.height : n.height + e.padding, l = e.positioned ? -s / 2 : -n.width / 2 - i, u = e.positioned ? -o / 2 : -n.height / 2 - i;
  if (a.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", s).attr("height", o), e.props) {
    const h = new Set(Object.keys(e.props));
    e.props.borders && (bb(a, e.props.borders, s, o), h.delete("borders")), h.forEach((d) => {
      ae.warn(`Unknown node property ${d}`);
    });
  }
  return dn(e, a), e.intersect = function(h) {
    return Qr.rect(e, h);
  }, r;
}, "composite"), fNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r } = await ti(t, e, "label", !0);
  ae.trace("Classes = ", e.class);
  const n = r.insert("rect", ":first-child"), i = 0, a = 0;
  if (n.attr("width", i).attr("height", a), r.attr("class", "label edgeLabel"), e.props) {
    const s = new Set(Object.keys(e.props));
    e.props.borders && (bb(n, e.props.borders, i, a), s.delete("borders")), s.forEach((o) => {
      ae.warn(`Unknown node property ${o}`);
    });
  }
  return dn(e, n), e.intersect = function(s) {
    return Qr.rect(e, s);
  }, r;
}, "labelRect");
function bb(t, e, r, n) {
  const i = [], a = /* @__PURE__ */ x((o) => {
    i.push(o, 0);
  }, "addBorder"), s = /* @__PURE__ */ x((o) => {
    i.push(0, o);
  }, "skipBorder");
  e.includes("t") ? (ae.debug("add top border"), a(r)) : s(r), e.includes("r") ? (ae.debug("add right border"), a(n)) : s(n), e.includes("b") ? (ae.debug("add bottom border"), a(r)) : s(r), e.includes("l") ? (ae.debug("add left border"), a(n)) : s(n), t.attr("stroke-dasharray", i.join(" "));
}
x(bb, "applyNodePropertyBorders");
var pNe = /* @__PURE__ */ x(async (t, e) => {
  let r;
  e.classes ? r = "node " + e.classes : r = "node default";
  const n = t.insert("g").attr("class", r).attr("id", e.domId || e.id), i = n.insert("rect", ":first-child"), a = n.insert("line"), s = n.insert("g").attr("class", "label"), o = e.labelText.flat ? e.labelText.flat() : e.labelText;
  let l = "";
  typeof o == "object" ? l = o[0] : l = o, ae.info("Label text abc79", l, o, typeof o == "object");
  const u = s.node().appendChild(await qa(l, e.labelStyle, !0, !0));
  let h = { width: 0, height: 0 };
  if (Ir(we().flowchart.htmlLabels)) {
    const m = u.children[0], v = Qe(u);
    h = m.getBoundingClientRect(), v.attr("width", h.width), v.attr("height", h.height);
  }
  ae.info("Text 2", o);
  const d = o.slice(1, o.length);
  let f = u.getBBox();
  const p = s.node().appendChild(
    await qa(
      d.join ? d.join("<br/>") : d,
      e.labelStyle,
      !0,
      !0
    )
  );
  if (Ir(we().flowchart.htmlLabels)) {
    const m = p.children[0], v = Qe(p);
    h = m.getBoundingClientRect(), v.attr("width", h.width), v.attr("height", h.height);
  }
  const g = e.padding / 2;
  return Qe(p).attr(
    "transform",
    "translate( " + // (titleBox.width - bbox.width) / 2 +
    (h.width > f.width ? 0 : (f.width - h.width) / 2) + ", " + (f.height + g + 5) + ")"
  ), Qe(u).attr(
    "transform",
    "translate( " + // (titleBox.width - bbox.width) / 2 +
    (h.width < f.width ? 0 : -(f.width - h.width) / 2) + ", 0)"
  ), h = s.node().getBBox(), s.attr(
    "transform",
    "translate(" + -h.width / 2 + ", " + (-h.height / 2 - g + 3) + ")"
  ), i.attr("class", "outer title-state").attr("x", -h.width / 2 - g).attr("y", -h.height / 2 - g).attr("width", h.width + e.padding).attr("height", h.height + e.padding), a.attr("class", "divider").attr("x1", -h.width / 2 - g).attr("x2", h.width / 2 + g).attr("y1", -h.height / 2 - g + f.height + g).attr("y2", -h.height / 2 - g + f.height + g), dn(e, i), e.intersect = function(m) {
    return Qr.rect(e, m);
  }, n;
}, "rectWithTitle"), gNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.height + e.padding, a = n.width + i / 4 + e.padding, s = r.insert("rect", ":first-child").attr("style", e.style).attr("rx", i / 2).attr("ry", i / 2).attr("x", -a / 2).attr("y", -i / 2).attr("width", a).attr("height", i);
  return dn(e, s), e.intersect = function(o) {
    return Qr.rect(e, o);
  }, r;
}, "stadium"), mNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n, halfPadding: i } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), a = r.insert("circle", ":first-child");
  return a.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("r", n.width / 2 + i).attr("width", n.width + e.padding).attr("height", n.height + e.padding), ae.info("Circle main"), dn(e, a), e.intersect = function(s) {
    return ae.info("Circle intersect", e, n.width / 2 + i, s), Qr.circle(e, n.width / 2 + i, s);
  }, r;
}, "circle"), vNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n, halfPadding: i } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), a = 5, s = r.insert("g", ":first-child"), o = s.insert("circle"), l = s.insert("circle");
  return s.attr("class", e.class), o.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("r", n.width / 2 + i + a).attr("width", n.width + e.padding + a * 2).attr("height", n.height + e.padding + a * 2), l.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("r", n.width / 2 + i).attr("width", n.width + e.padding).attr("height", n.height + e.padding), ae.info("DoubleCircle main"), dn(e, o), e.intersect = function(u) {
    return ae.info("DoubleCircle intersect", e, n.width / 2 + i + a, u), Qr.circle(e, n.width / 2 + i + a, u);
  }, r;
}, "doublecircle"), yNe = /* @__PURE__ */ x(async (t, e) => {
  const { shapeSvg: r, bbox: n } = await ti(
    t,
    e,
    Ba(e, void 0),
    !0
  ), i = n.width + e.padding, a = n.height + e.padding, s = [
    { x: 0, y: 0 },
    { x: i, y: 0 },
    { x: i, y: -a },
    { x: 0, y: -a },
    { x: 0, y: 0 },
    { x: -8, y: 0 },
    { x: i + 8, y: 0 },
    { x: i + 8, y: -a },
    { x: -8, y: -a },
    { x: -8, y: 0 }
  ], o = Ls(r, i, a, s);
  return o.attr("style", e.style), dn(e, o), e.intersect = function(l) {
    return Qr.polygon(e, s, l);
  }, r;
}, "subroutine"), xNe = /* @__PURE__ */ x((t, e) => {
  const r = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), n = r.insert("circle", ":first-child");
  return n.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), dn(e, n), e.intersect = function(i) {
    return Qr.circle(e, 7, i);
  }, r;
}, "start"), tM = /* @__PURE__ */ x((t, e, r) => {
  const n = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id);
  let i = 70, a = 10;
  r === "LR" && (i = 10, a = 70);
  const s = n.append("rect").attr("x", -1 * i / 2).attr("y", -1 * a / 2).attr("width", i).attr("height", a).attr("class", "fork-join");
  return dn(e, s), e.height = e.height + e.padding / 2, e.width = e.width + e.padding / 2, e.intersect = function(o) {
    return Qr.rect(e, o);
  }, n;
}, "forkJoin"), bNe = /* @__PURE__ */ x((t, e) => {
  const r = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), n = r.insert("circle", ":first-child"), i = r.insert("circle", ":first-child");
  return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), n.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), dn(e, i), e.intersect = function(a) {
    return Qr.circle(e, 7, a);
  }, r;
}, "end"), wNe = /* @__PURE__ */ x(async (t, e) => {
  var _;
  const r = e.padding / 2, n = 4, i = 8;
  let a;
  e.classes ? a = "node " + e.classes : a = "node default";
  const s = t.insert("g").attr("class", a).attr("id", e.domId || e.id), o = s.insert("rect", ":first-child"), l = s.insert("line"), u = s.insert("line");
  let h = 0, d = n;
  const f = s.insert("g").attr("class", "label");
  let p = 0;
  const g = (_ = e.classData.annotations) == null ? void 0 : _[0], m = e.classData.annotations[0] ? "«" + e.classData.annotations[0] + "»" : "", v = f.node().appendChild(await qa(m, e.labelStyle, !0, !0));
  let y = v.getBBox();
  if (Ir(we().flowchart.htmlLabels)) {
    const L = v.children[0], N = Qe(v);
    y = L.getBoundingClientRect(), N.attr("width", y.width), N.attr("height", y.height);
  }
  e.classData.annotations[0] && (d += y.height + n, h += y.width);
  let b = e.classData.label;
  e.classData.type !== void 0 && e.classData.type !== "" && (we().flowchart.htmlLabels ? b += "&lt;" + e.classData.type + "&gt;" : b += "<" + e.classData.type + ">");
  const w = f.node().appendChild(await qa(b, e.labelStyle, !0, !0));
  Qe(w).attr("class", "classTitle");
  let T = w.getBBox();
  if (Ir(we().flowchart.htmlLabels)) {
    const L = w.children[0], N = Qe(w);
    T = L.getBoundingClientRect(), N.attr("width", T.width), N.attr("height", T.height);
  }
  d += T.height + n, T.width > h && (h = T.width);
  const E = [];
  e.classData.members.forEach(async (L) => {
    const N = L.getDisplayDetails();
    let A = N.displayText;
    we().flowchart.htmlLabels && (A = A.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
    const O = f.node().appendChild(
      await qa(
        A,
        N.cssStyle ? N.cssStyle : e.labelStyle,
        !0,
        !0
      )
    );
    let P = O.getBBox();
    if (Ir(we().flowchart.htmlLabels)) {
      const S = O.children[0], R = Qe(O);
      P = S.getBoundingClientRect(), R.attr("width", P.width), R.attr("height", P.height);
    }
    P.width > h && (h = P.width), d += P.height + n, E.push(O);
  }), d += i;
  const C = [];
  if (e.classData.methods.forEach(async (L) => {
    const N = L.getDisplayDetails();
    let A = N.displayText;
    we().flowchart.htmlLabels && (A = A.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
    const O = f.node().appendChild(
      await qa(
        A,
        N.cssStyle ? N.cssStyle : e.labelStyle,
        !0,
        !0
      )
    );
    let P = O.getBBox();
    if (Ir(we().flowchart.htmlLabels)) {
      const S = O.children[0], R = Qe(O);
      P = S.getBoundingClientRect(), R.attr("width", P.width), R.attr("height", P.height);
    }
    P.width > h && (h = P.width), d += P.height + n, C.push(O);
  }), d += i, g) {
    let L = (h - y.width) / 2;
    Qe(v).attr(
      "transform",
      "translate( " + (-1 * h / 2 + L) + ", " + -1 * d / 2 + ")"
    ), p = y.height + n;
  }
  let k = (h - T.width) / 2;
  return Qe(w).attr(
    "transform",
    "translate( " + (-1 * h / 2 + k) + ", " + (-1 * d / 2 + p) + ")"
  ), p += T.height + n, l.attr("class", "divider").attr("x1", -h / 2 - r).attr("x2", h / 2 + r).attr("y1", -d / 2 - r + i + p).attr("y2", -d / 2 - r + i + p), p += i, E.forEach((L) => {
    Qe(L).attr(
      "transform",
      "translate( " + -h / 2 + ", " + (-1 * d / 2 + p + i / 2) + ")"
    );
    const N = L == null ? void 0 : L.getBBox();
    p += ((N == null ? void 0 : N.height) ?? 0) + n;
  }), p += i, u.attr("class", "divider").attr("x1", -h / 2 - r).attr("x2", h / 2 + r).attr("y1", -d / 2 - r + i + p).attr("y2", -d / 2 - r + i + p), p += i, C.forEach((L) => {
    Qe(L).attr(
      "transform",
      "translate( " + -h / 2 + ", " + (-1 * d / 2 + p) + ")"
    );
    const N = L == null ? void 0 : L.getBBox();
    p += ((N == null ? void 0 : N.height) ?? 0) + n;
  }), o.attr("style", e.style).attr("class", "outer title-state").attr("x", -h / 2 - r).attr("y", -(d / 2) - r).attr("width", h + e.padding).attr("height", d + e.padding), dn(e, o), e.intersect = function(L) {
    return Qr.rect(e, L);
  }, s;
}, "class_box"), rM = {
  rhombus: eM,
  composite: dNe,
  question: eM,
  rect: hNe,
  labelRect: fNe,
  rectWithTitle: pNe,
  choice: tNe,
  circle: mNe,
  doublecircle: vNe,
  stadium: gNe,
  hexagon: rNe,
  block_arrow: nNe,
  rect_left_inv_arrow: iNe,
  lean_right: aNe,
  lean_left: sNe,
  trapezoid: oNe,
  inv_trapezoid: lNe,
  rect_right_inv_arrow: cNe,
  cylinder: uNe,
  start: xNe,
  end: bNe,
  note: eNe,
  subroutine: yNe,
  fork: tM,
  join: tM,
  class_box: wNe
}, Dv = {}, LY = /* @__PURE__ */ x(async (t, e, r) => {
  let n, i;
  if (e.link) {
    let a;
    we().securityLevel === "sandbox" ? a = "_top" : e.linkTarget && (a = e.linkTarget || "_blank"), n = t.insert("svg:a").attr("xlink:href", e.link).attr("target", a), i = await rM[e.shape](n, e, r);
  } else
    i = await rM[e.shape](t, e, r), n = i;
  return e.tooltip && i.attr("title", e.tooltip), e.class && i.attr("class", "node default " + e.class), Dv[e.id] = n, e.haveCallback && Dv[e.id].attr("class", Dv[e.id].attr("class") + " clickable"), n;
}, "insertNode"), TNe = /* @__PURE__ */ x((t) => {
  const e = Dv[t.id];
  ae.trace(
    "Transforming node",
    t.diff,
    t,
    "translate(" + (t.x - t.width / 2 - 5) + ", " + t.width / 2 + ")"
  );
  const r = 8, n = t.diff || 0;
  return t.clusterNode ? e.attr(
    "transform",
    "translate(" + (t.x + n - t.width / 2) + ", " + (t.y - t.height / 2 - r) + ")"
  ) : e.attr("transform", "translate(" + t.x + ", " + t.y + ")"), n;
}, "positionNode");
function k7(t, e, r = !1) {
  var f, p, g;
  const n = t;
  let i = "default";
  (((f = n == null ? void 0 : n.classes) == null ? void 0 : f.length) || 0) > 0 && (i = ((n == null ? void 0 : n.classes) ?? []).join(" ")), i = i + " flowchart-label";
  let a = 0, s = "", o;
  switch (n.type) {
    case "round":
      a = 5, s = "rect";
      break;
    case "composite":
      a = 0, s = "composite", o = 0;
      break;
    case "square":
      s = "rect";
      break;
    case "diamond":
      s = "question";
      break;
    case "hexagon":
      s = "hexagon";
      break;
    case "block_arrow":
      s = "block_arrow";
      break;
    case "odd":
      s = "rect_left_inv_arrow";
      break;
    case "lean_right":
      s = "lean_right";
      break;
    case "lean_left":
      s = "lean_left";
      break;
    case "trapezoid":
      s = "trapezoid";
      break;
    case "inv_trapezoid":
      s = "inv_trapezoid";
      break;
    case "rect_left_inv_arrow":
      s = "rect_left_inv_arrow";
      break;
    case "circle":
      s = "circle";
      break;
    case "ellipse":
      s = "ellipse";
      break;
    case "stadium":
      s = "stadium";
      break;
    case "subroutine":
      s = "subroutine";
      break;
    case "cylinder":
      s = "cylinder";
      break;
    case "group":
      s = "rect";
      break;
    case "doublecircle":
      s = "doublecircle";
      break;
    default:
      s = "rect";
  }
  const l = OE((n == null ? void 0 : n.styles) ?? []), u = n.label, h = n.size ?? { width: 0, height: 0, x: 0, y: 0 };
  return {
    labelStyle: l.labelStyle,
    shape: s,
    labelText: u,
    rx: a,
    ry: a,
    class: i,
    style: l.style,
    id: n.id,
    directions: n.directions,
    width: h.width,
    height: h.height,
    x: h.x,
    y: h.y,
    positioned: r,
    intersect: void 0,
    type: n.type,
    padding: o ?? ((g = (p = gr()) == null ? void 0 : p.block) == null ? void 0 : g.padding) ?? 0
  };
}
x(k7, "getNodeFromBlock");
async function RY(t, e, r) {
  const n = k7(e, r, !1);
  if (n.type === "group")
    return;
  const i = gr(), a = await LY(t, n, { config: i }), s = a.node().getBBox(), o = r.getBlock(n.id);
  o.size = { width: s.width, height: s.height, x: 0, y: 0, node: a }, r.setBlock(o), a.remove();
}
x(RY, "calculateBlockSize");
async function NY(t, e, r) {
  const n = k7(e, r, !0);
  if (r.getBlock(n.id).type !== "space") {
    const a = gr();
    await LY(t, n, { config: a }), e.intersect = n == null ? void 0 : n.intersect, TNe(n);
  }
}
x(NY, "insertBlockPositioned");
async function wb(t, e, r, n) {
  for (const i of e)
    await n(t, i, r), i.children && await wb(t, i.children, r, n);
}
x(wb, "performOperations");
async function MY(t, e, r) {
  await wb(t, e, r, RY);
}
x(MY, "calculateBlockSizes");
async function DY(t, e, r) {
  await wb(t, e, r, NY);
}
x(DY, "insertBlocks");
async function IY(t, e, r, n, i) {
  const a = new va({
    multigraph: !0,
    compound: !0
  });
  a.setGraph({
    rankdir: "TB",
    nodesep: 10,
    ranksep: 10,
    marginx: 8,
    marginy: 8
  });
  for (const s of r)
    s.size && a.setNode(s.id, {
      width: s.size.width,
      height: s.size.height,
      intersect: s.intersect
    });
  for (const s of e)
    if (s.start && s.end) {
      const o = n.getBlock(s.start), l = n.getBlock(s.end);
      if (o != null && o.size && (l != null && l.size)) {
        const u = o.size, h = l.size, d = [
          { 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 }
        ];
        WRe(
          t,
          { v: s.start, w: s.end, name: s.id },
          {
            ...s,
            arrowTypeEnd: s.arrowTypeEnd,
            arrowTypeStart: s.arrowTypeStart,
            points: d,
            classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
          },
          void 0,
          "block",
          a,
          i
        ), s.label && (await zRe(t, {
          ...s,
          label: s.label,
          labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
          arrowTypeEnd: s.arrowTypeEnd,
          arrowTypeStart: s.arrowTypeStart,
          points: d,
          classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
        }), VRe(
          { ...s, x: d[1].x, y: d[1].y },
          {
            originalPath: d
          }
        ));
      }
    }
}
x(IY, "insertEdges");
var ENe = /* @__PURE__ */ x(function(t, e) {
  return e.db.getClasses();
}, "getClasses"), kNe = /* @__PURE__ */ x(async function(t, e, r, n) {
  const { securityLevel: i, block: a } = gr(), s = n.db;
  let o;
  i === "sandbox" && (o = Qe("#i" + e));
  const l = Qe(i === "sandbox" ? o.nodes()[0].contentDocument.body : "body"), u = i === "sandbox" ? l.select(`[id="${e}"]`) : Qe(`[id="${e}"]`);
  ORe(u, ["point", "circle", "cross"], n.type, e);
  const d = s.getBlocks(), f = s.getBlocksFlat(), p = s.getEdges(), g = u.insert("g").attr("class", "block");
  await MY(g, d, s);
  const m = wY(s);
  if (await DY(g, d, s), await IY(g, p, f, s, e), m) {
    const v = m, y = Math.max(1, Math.round(0.125 * (v.width / v.height))), b = v.height + y + 10, w = v.width + 10, { useMaxWidth: T } = a;
    Ki(u, b, w, !!T), ae.debug("Here Bounds", m, v), u.attr(
      "viewBox",
      `${v.x - 5} ${v.y - 5} ${v.width + 10} ${v.height + 10}`
    );
  }
}, "draw"), SNe = {
  draw: kNe,
  getClasses: ENe
}, CNe = {
  parser: rRe,
  db: wRe,
  renderer: SNe,
  styles: ERe
};
const ANe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: CNe
}, Symbol.toStringTag, { value: "Module" }));
var OY = { exports: {} }, z5 = { exports: {} }, V5 = { exports: {} }, nM;
function _Ne() {
  return nM || (nM = 1, function(t, e) {
    (function(n, i) {
      t.exports = i();
    })(ro, function() {
      return (
        /******/
        function(r) {
          var n = {};
          function i(a) {
            if (n[a])
              return n[a].exports;
            var s = n[a] = {
              /******/
              i: a,
              /******/
              l: !1,
              /******/
              exports: {}
              /******/
            };
            return r[a].call(s.exports, s, s.exports, i), s.l = !0, s.exports;
          }
          return i.m = r, i.c = n, i.i = function(a) {
            return a;
          }, i.d = function(a, s, o) {
            i.o(a, s) || Object.defineProperty(a, s, {
              /******/
              configurable: !1,
              /******/
              enumerable: !0,
              /******/
              get: o
              /******/
            });
          }, i.n = function(a) {
            var s = a && a.__esModule ? (
              /******/
              function() {
                return a.default;
              }
            ) : (
              /******/
              function() {
                return a;
              }
            );
            return i.d(s, "a", s), s;
          }, i.o = function(a, s) {
            return Object.prototype.hasOwnProperty.call(a, s);
          }, i.p = "", i(i.s = 28);
        }([
          /* 0 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.QUALITY = 1, a.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, a.DEFAULT_INCREMENTAL = !1, a.DEFAULT_ANIMATION_ON_LAYOUT = !0, a.DEFAULT_ANIMATION_DURING_LAYOUT = !1, a.DEFAULT_ANIMATION_PERIOD = 50, a.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, a.DEFAULT_GRAPH_MARGIN = 15, a.NODE_DIMENSIONS_INCLUDE_LABELS = !1, a.SIMPLE_NODE_SIZE = 40, a.SIMPLE_NODE_HALF_SIZE = a.SIMPLE_NODE_SIZE / 2, a.EMPTY_COMPOUND_NODE_SIZE = 40, a.MIN_EDGE_LENGTH = 1, a.WORLD_BOUNDARY = 1e6, a.INITIAL_WORLD_BOUNDARY = a.WORLD_BOUNDARY / 1e3, a.WORLD_CENTER_X = 1200, a.WORLD_CENTER_Y = 900, r.exports = a;
          },
          /* 1 */
          /***/
          function(r, n, i) {
            var a = i(2), s = i(8), o = i(9);
            function l(h, d, f) {
              a.call(this, f), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = f, this.bendpoints = [], this.source = h, this.target = d;
            }
            l.prototype = Object.create(a.prototype);
            for (var u in a)
              l[u] = a[u];
            l.prototype.getSource = function() {
              return this.source;
            }, l.prototype.getTarget = function() {
              return this.target;
            }, l.prototype.isInterGraph = function() {
              return this.isInterGraph;
            }, l.prototype.getLength = function() {
              return this.length;
            }, l.prototype.isOverlapingSourceAndTarget = function() {
              return this.isOverlapingSourceAndTarget;
            }, l.prototype.getBendpoints = function() {
              return this.bendpoints;
            }, l.prototype.getLca = function() {
              return this.lca;
            }, l.prototype.getSourceInLca = function() {
              return this.sourceInLca;
            }, l.prototype.getTargetInLca = function() {
              return this.targetInLca;
            }, l.prototype.getOtherEnd = function(h) {
              if (this.source === h)
                return this.target;
              if (this.target === h)
                return this.source;
              throw "Node is not incident with this edge";
            }, l.prototype.getOtherEndInGraph = function(h, d) {
              for (var f = this.getOtherEnd(h), p = d.getGraphManager().getRoot(); ; ) {
                if (f.getOwner() == d)
                  return f;
                if (f.getOwner() == p)
                  break;
                f = f.getOwner().getParent();
              }
              return null;
            }, l.prototype.updateLength = function() {
              var h = new Array(4);
              this.isOverlapingSourceAndTarget = s.getIntersection(this.target.getRect(), this.source.getRect(), h), this.isOverlapingSourceAndTarget || (this.lengthX = h[0] - h[2], this.lengthY = h[1] - h[3], Math.abs(this.lengthX) < 1 && (this.lengthX = o.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = o.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY));
            }, l.prototype.updateLengthSimple = function() {
              this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = o.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = o.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
            }, r.exports = l;
          },
          /* 2 */
          /***/
          function(r, n, i) {
            function a(s) {
              this.vGraphObject = s;
            }
            r.exports = a;
          },
          /* 3 */
          /***/
          function(r, n, i) {
            var a = i(2), s = i(10), o = i(13), l = i(0), u = i(16), h = i(5);
            function d(p, g, m, v) {
              m == null && v == null && (v = g), a.call(this, v), p.graphManager != null && (p = p.graphManager), this.estimatedSize = s.MIN_VALUE, this.inclusionTreeDepth = s.MAX_VALUE, this.vGraphObject = v, this.edges = [], this.graphManager = p, m != null && g != null ? this.rect = new o(g.x, g.y, m.width, m.height) : this.rect = new o();
            }
            d.prototype = Object.create(a.prototype);
            for (var f in a)
              d[f] = a[f];
            d.prototype.getEdges = function() {
              return this.edges;
            }, d.prototype.getChild = function() {
              return this.child;
            }, d.prototype.getOwner = function() {
              return this.owner;
            }, d.prototype.getWidth = function() {
              return this.rect.width;
            }, d.prototype.setWidth = function(p) {
              this.rect.width = p;
            }, d.prototype.getHeight = function() {
              return this.rect.height;
            }, d.prototype.setHeight = function(p) {
              this.rect.height = p;
            }, d.prototype.getCenterX = function() {
              return this.rect.x + this.rect.width / 2;
            }, d.prototype.getCenterY = function() {
              return this.rect.y + this.rect.height / 2;
            }, d.prototype.getCenter = function() {
              return new h(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
            }, d.prototype.getLocation = function() {
              return new h(this.rect.x, this.rect.y);
            }, d.prototype.getRect = function() {
              return this.rect;
            }, d.prototype.getDiagonal = function() {
              return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
            }, d.prototype.getHalfTheDiagonal = function() {
              return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
            }, d.prototype.setRect = function(p, g) {
              this.rect.x = p.x, this.rect.y = p.y, this.rect.width = g.width, this.rect.height = g.height;
            }, d.prototype.setCenter = function(p, g) {
              this.rect.x = p - this.rect.width / 2, this.rect.y = g - this.rect.height / 2;
            }, d.prototype.setLocation = function(p, g) {
              this.rect.x = p, this.rect.y = g;
            }, d.prototype.moveBy = function(p, g) {
              this.rect.x += p, this.rect.y += g;
            }, d.prototype.getEdgeListToNode = function(p) {
              var g = [], m = this;
              return m.edges.forEach(function(v) {
                if (v.target == p) {
                  if (v.source != m) throw "Incorrect edge source!";
                  g.push(v);
                }
              }), g;
            }, d.prototype.getEdgesBetween = function(p) {
              var g = [], m = this;
              return m.edges.forEach(function(v) {
                if (!(v.source == m || v.target == m)) throw "Incorrect edge source and/or target";
                (v.target == p || v.source == p) && g.push(v);
              }), g;
            }, d.prototype.getNeighborsList = function() {
              var p = /* @__PURE__ */ new Set(), g = this;
              return g.edges.forEach(function(m) {
                if (m.source == g)
                  p.add(m.target);
                else {
                  if (m.target != g)
                    throw "Incorrect incidency!";
                  p.add(m.source);
                }
              }), p;
            }, d.prototype.withChildren = function() {
              var p = /* @__PURE__ */ new Set(), g, m;
              if (p.add(this), this.child != null)
                for (var v = this.child.getNodes(), y = 0; y < v.length; y++)
                  g = v[y], m = g.withChildren(), m.forEach(function(b) {
                    p.add(b);
                  });
              return p;
            }, d.prototype.getNoOfChildren = function() {
              var p = 0, g;
              if (this.child == null)
                p = 1;
              else
                for (var m = this.child.getNodes(), v = 0; v < m.length; v++)
                  g = m[v], p += g.getNoOfChildren();
              return p == 0 && (p = 1), p;
            }, d.prototype.getEstimatedSize = function() {
              if (this.estimatedSize == s.MIN_VALUE)
                throw "assert failed";
              return this.estimatedSize;
            }, d.prototype.calcEstimatedSize = function() {
              return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize);
            }, d.prototype.scatter = function() {
              var p, g, m = -l.INITIAL_WORLD_BOUNDARY, v = l.INITIAL_WORLD_BOUNDARY;
              p = l.WORLD_CENTER_X + u.nextDouble() * (v - m) + m;
              var y = -l.INITIAL_WORLD_BOUNDARY, b = l.INITIAL_WORLD_BOUNDARY;
              g = l.WORLD_CENTER_Y + u.nextDouble() * (b - y) + y, this.rect.x = p, this.rect.y = g;
            }, d.prototype.updateBounds = function() {
              if (this.getChild() == null)
                throw "assert failed";
              if (this.getChild().getNodes().length != 0) {
                var p = this.getChild();
                if (p.updateBounds(!0), this.rect.x = p.getLeft(), this.rect.y = p.getTop(), this.setWidth(p.getRight() - p.getLeft()), this.setHeight(p.getBottom() - p.getTop()), l.NODE_DIMENSIONS_INCLUDE_LABELS) {
                  var g = p.getRight() - p.getLeft(), m = p.getBottom() - p.getTop();
                  this.labelWidth && (this.labelPosHorizontal == "left" ? (this.rect.x -= this.labelWidth, this.setWidth(g + this.labelWidth)) : this.labelPosHorizontal == "center" && this.labelWidth > g ? (this.rect.x -= (this.labelWidth - g) / 2, this.setWidth(this.labelWidth)) : this.labelPosHorizontal == "right" && this.setWidth(g + this.labelWidth)), this.labelHeight && (this.labelPosVertical == "top" ? (this.rect.y -= this.labelHeight, this.setHeight(m + this.labelHeight)) : this.labelPosVertical == "center" && this.labelHeight > m ? (this.rect.y -= (this.labelHeight - m) / 2, this.setHeight(this.labelHeight)) : this.labelPosVertical == "bottom" && this.setHeight(m + this.labelHeight));
                }
              }
            }, d.prototype.getInclusionTreeDepth = function() {
              if (this.inclusionTreeDepth == s.MAX_VALUE)
                throw "assert failed";
              return this.inclusionTreeDepth;
            }, d.prototype.transform = function(p) {
              var g = this.rect.x;
              g > l.WORLD_BOUNDARY ? g = l.WORLD_BOUNDARY : g < -l.WORLD_BOUNDARY && (g = -l.WORLD_BOUNDARY);
              var m = this.rect.y;
              m > l.WORLD_BOUNDARY ? m = l.WORLD_BOUNDARY : m < -l.WORLD_BOUNDARY && (m = -l.WORLD_BOUNDARY);
              var v = new h(g, m), y = p.inverseTransformPoint(v);
              this.setLocation(y.x, y.y);
            }, d.prototype.getLeft = function() {
              return this.rect.x;
            }, d.prototype.getRight = function() {
              return this.rect.x + this.rect.width;
            }, d.prototype.getTop = function() {
              return this.rect.y;
            }, d.prototype.getBottom = function() {
              return this.rect.y + this.rect.height;
            }, d.prototype.getParent = function() {
              return this.owner == null ? null : this.owner.getParent();
            }, r.exports = d;
          },
          /* 4 */
          /***/
          function(r, n, i) {
            var a = i(0);
            function s() {
            }
            for (var o in a)
              s[o] = a[o];
            s.MAX_ITERATIONS = 2500, s.DEFAULT_EDGE_LENGTH = 50, s.DEFAULT_SPRING_STRENGTH = 0.45, s.DEFAULT_REPULSION_STRENGTH = 4500, s.DEFAULT_GRAVITY_STRENGTH = 0.4, s.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, s.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, s.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3, s.COOLING_ADAPTATION_FACTOR = 0.33, s.ADAPTATION_LOWER_NODE_LIMIT = 1e3, s.ADAPTATION_UPPER_NODE_LIMIT = 5e3, s.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, s.MAX_NODE_DISPLACEMENT = s.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, s.MIN_REPULSION_DIST = s.DEFAULT_EDGE_LENGTH / 10, s.CONVERGENCE_CHECK_PERIOD = 100, s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1, s.MIN_EDGE_LENGTH = 1, s.GRID_CALCULATION_CHECK_PERIOD = 10, r.exports = s;
          },
          /* 5 */
          /***/
          function(r, n, i) {
            function a(s, o) {
              s == null && o == null ? (this.x = 0, this.y = 0) : (this.x = s, this.y = o);
            }
            a.prototype.getX = function() {
              return this.x;
            }, a.prototype.getY = function() {
              return this.y;
            }, a.prototype.setX = function(s) {
              this.x = s;
            }, a.prototype.setY = function(s) {
              this.y = s;
            }, a.prototype.getDifference = function(s) {
              return new DimensionD(this.x - s.x, this.y - s.y);
            }, a.prototype.getCopy = function() {
              return new a(this.x, this.y);
            }, a.prototype.translate = function(s) {
              return this.x += s.width, this.y += s.height, this;
            }, r.exports = a;
          },
          /* 6 */
          /***/
          function(r, n, i) {
            var a = i(2), s = i(10), o = i(0), l = i(7), u = i(3), h = i(1), d = i(13), f = i(12), p = i(11);
            function g(v, y, b) {
              a.call(this, b), this.estimatedSize = s.MIN_VALUE, this.margin = o.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = v, y != null && y instanceof l ? this.graphManager = y : y != null && y instanceof Layout && (this.graphManager = y.graphManager);
            }
            g.prototype = Object.create(a.prototype);
            for (var m in a)
              g[m] = a[m];
            g.prototype.getNodes = function() {
              return this.nodes;
            }, g.prototype.getEdges = function() {
              return this.edges;
            }, g.prototype.getGraphManager = function() {
              return this.graphManager;
            }, g.prototype.getParent = function() {
              return this.parent;
            }, g.prototype.getLeft = function() {
              return this.left;
            }, g.prototype.getRight = function() {
              return this.right;
            }, g.prototype.getTop = function() {
              return this.top;
            }, g.prototype.getBottom = function() {
              return this.bottom;
            }, g.prototype.isConnected = function() {
              return this.isConnected;
            }, g.prototype.add = function(v, y, b) {
              if (y == null && b == null) {
                var w = v;
                if (this.graphManager == null)
                  throw "Graph has no graph mgr!";
                if (this.getNodes().indexOf(w) > -1)
                  throw "Node already in graph!";
                return w.owner = this, this.getNodes().push(w), w;
              } else {
                var T = v;
                if (!(this.getNodes().indexOf(y) > -1 && this.getNodes().indexOf(b) > -1))
                  throw "Source or target not in graph!";
                if (!(y.owner == b.owner && y.owner == this))
                  throw "Both owners must be this graph!";
                return y.owner != b.owner ? null : (T.source = y, T.target = b, T.isInterGraph = !1, this.getEdges().push(T), y.edges.push(T), b != y && b.edges.push(T), T);
              }
            }, g.prototype.remove = function(v) {
              var y = v;
              if (v instanceof u) {
                if (y == null)
                  throw "Node is null!";
                if (!(y.owner != null && y.owner == this))
                  throw "Owner graph is invalid!";
                if (this.graphManager == null)
                  throw "Owner graph manager is invalid!";
                for (var b = y.edges.slice(), w, T = b.length, E = 0; E < T; E++)
                  w = b[E], w.isInterGraph ? this.graphManager.remove(w) : w.source.owner.remove(w);
                var C = this.nodes.indexOf(y);
                if (C == -1)
                  throw "Node not in owner node list!";
                this.nodes.splice(C, 1);
              } else if (v instanceof h) {
                var w = v;
                if (w == null)
                  throw "Edge is null!";
                if (!(w.source != null && w.target != null))
                  throw "Source and/or target is null!";
                if (!(w.source.owner != null && w.target.owner != null && w.source.owner == this && w.target.owner == this))
                  throw "Source and/or target owner is invalid!";
                var k = w.source.edges.indexOf(w), _ = w.target.edges.indexOf(w);
                if (!(k > -1 && _ > -1))
                  throw "Source and/or target doesn't know this edge!";
                w.source.edges.splice(k, 1), w.target != w.source && w.target.edges.splice(_, 1);
                var C = w.source.owner.getEdges().indexOf(w);
                if (C == -1)
                  throw "Not in owner's edge list!";
                w.source.owner.getEdges().splice(C, 1);
              }
            }, g.prototype.updateLeftTop = function() {
              for (var v = s.MAX_VALUE, y = s.MAX_VALUE, b, w, T, E = this.getNodes(), C = E.length, k = 0; k < C; k++) {
                var _ = E[k];
                b = _.getTop(), w = _.getLeft(), v > b && (v = b), y > w && (y = w);
              }
              return v == s.MAX_VALUE ? null : (E[0].getParent().paddingLeft != null ? T = E[0].getParent().paddingLeft : T = this.margin, this.left = y - T, this.top = v - T, new f(this.left, this.top));
            }, g.prototype.updateBounds = function(v) {
              for (var y = s.MAX_VALUE, b = -s.MAX_VALUE, w = s.MAX_VALUE, T = -s.MAX_VALUE, E, C, k, _, L, N = this.nodes, A = N.length, O = 0; O < A; O++) {
                var P = N[O];
                v && P.child != null && P.updateBounds(), E = P.getLeft(), C = P.getRight(), k = P.getTop(), _ = P.getBottom(), y > E && (y = E), b < C && (b = C), w > k && (w = k), T < _ && (T = _);
              }
              var S = new d(y, w, b - y, T - w);
              y == s.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), N[0].getParent().paddingLeft != null ? L = N[0].getParent().paddingLeft : L = this.margin, this.left = S.x - L, this.right = S.x + S.width + L, this.top = S.y - L, this.bottom = S.y + S.height + L;
            }, g.calculateBounds = function(v) {
              for (var y = s.MAX_VALUE, b = -s.MAX_VALUE, w = s.MAX_VALUE, T = -s.MAX_VALUE, E, C, k, _, L = v.length, N = 0; N < L; N++) {
                var A = v[N];
                E = A.getLeft(), C = A.getRight(), k = A.getTop(), _ = A.getBottom(), y > E && (y = E), b < C && (b = C), w > k && (w = k), T < _ && (T = _);
              }
              var O = new d(y, w, b - y, T - w);
              return O;
            }, g.prototype.getInclusionTreeDepth = function() {
              return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
            }, g.prototype.getEstimatedSize = function() {
              if (this.estimatedSize == s.MIN_VALUE)
                throw "assert failed";
              return this.estimatedSize;
            }, g.prototype.calcEstimatedSize = function() {
              for (var v = 0, y = this.nodes, b = y.length, w = 0; w < b; w++) {
                var T = y[w];
                v += T.calcEstimatedSize();
              }
              return v == 0 ? this.estimatedSize = o.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = v / Math.sqrt(this.nodes.length), this.estimatedSize;
            }, g.prototype.updateConnected = function() {
              var v = this;
              if (this.nodes.length == 0) {
                this.isConnected = !0;
                return;
              }
              var y = new p(), b = /* @__PURE__ */ new Set(), w = this.nodes[0], T, E, C = w.withChildren();
              for (C.forEach(function(O) {
                y.push(O), b.add(O);
              }); y.length !== 0; ) {
                w = y.shift(), T = w.getEdges();
                for (var k = T.length, _ = 0; _ < k; _++) {
                  var L = T[_];
                  if (E = L.getOtherEndInGraph(w, this), E != null && !b.has(E)) {
                    var N = E.withChildren();
                    N.forEach(function(O) {
                      y.push(O), b.add(O);
                    });
                  }
                }
              }
              if (this.isConnected = !1, b.size >= this.nodes.length) {
                var A = 0;
                b.forEach(function(O) {
                  O.owner == v && A++;
                }), A == this.nodes.length && (this.isConnected = !0);
              }
            }, r.exports = g;
          },
          /* 7 */
          /***/
          function(r, n, i) {
            var a, s = i(1);
            function o(l) {
              a = i(6), this.layout = l, this.graphs = [], this.edges = [];
            }
            o.prototype.addRoot = function() {
              var l = this.layout.newGraph(), u = this.layout.newNode(null), h = this.add(l, u);
              return this.setRootGraph(h), this.rootGraph;
            }, o.prototype.add = function(l, u, h, d, f) {
              if (h == null && d == null && f == null) {
                if (l == null)
                  throw "Graph is null!";
                if (u == null)
                  throw "Parent node is null!";
                if (this.graphs.indexOf(l) > -1)
                  throw "Graph already in this graph mgr!";
                if (this.graphs.push(l), l.parent != null)
                  throw "Already has a parent!";
                if (u.child != null)
                  throw "Already has a child!";
                return l.parent = u, u.child = l, l;
              } else {
                f = h, d = u, h = l;
                var p = d.getOwner(), g = f.getOwner();
                if (!(p != null && p.getGraphManager() == this))
                  throw "Source not in this graph mgr!";
                if (!(g != null && g.getGraphManager() == this))
                  throw "Target not in this graph mgr!";
                if (p == g)
                  return h.isInterGraph = !1, p.add(h, d, f);
                if (h.isInterGraph = !0, h.source = d, h.target = f, this.edges.indexOf(h) > -1)
                  throw "Edge already in inter-graph edge list!";
                if (this.edges.push(h), !(h.source != null && h.target != null))
                  throw "Edge source and/or target is null!";
                if (!(h.source.edges.indexOf(h) == -1 && h.target.edges.indexOf(h) == -1))
                  throw "Edge already in source and/or target incidency list!";
                return h.source.edges.push(h), h.target.edges.push(h), h;
              }
            }, o.prototype.remove = function(l) {
              if (l instanceof a) {
                var u = l;
                if (u.getGraphManager() != this)
                  throw "Graph not in this graph mgr";
                if (!(u == this.rootGraph || u.parent != null && u.parent.graphManager == this))
                  throw "Invalid parent node!";
                var h = [];
                h = h.concat(u.getEdges());
                for (var d, f = h.length, p = 0; p < f; p++)
                  d = h[p], u.remove(d);
                var g = [];
                g = g.concat(u.getNodes());
                var m;
                f = g.length;
                for (var p = 0; p < f; p++)
                  m = g[p], u.remove(m);
                u == this.rootGraph && this.setRootGraph(null);
                var v = this.graphs.indexOf(u);
                this.graphs.splice(v, 1), u.parent = null;
              } else if (l instanceof s) {
                if (d = l, d == null)
                  throw "Edge is null!";
                if (!d.isInterGraph)
                  throw "Not an inter-graph edge!";
                if (!(d.source != null && d.target != null))
                  throw "Source and/or target is null!";
                if (!(d.source.edges.indexOf(d) != -1 && d.target.edges.indexOf(d) != -1))
                  throw "Source and/or target doesn't know this edge!";
                var v = d.source.edges.indexOf(d);
                if (d.source.edges.splice(v, 1), v = d.target.edges.indexOf(d), d.target.edges.splice(v, 1), !(d.source.owner != null && d.source.owner.getGraphManager() != null))
                  throw "Edge owner graph or owner graph manager is null!";
                if (d.source.owner.getGraphManager().edges.indexOf(d) == -1)
                  throw "Not in owner graph manager's edge list!";
                var v = d.source.owner.getGraphManager().edges.indexOf(d);
                d.source.owner.getGraphManager().edges.splice(v, 1);
              }
            }, o.prototype.updateBounds = function() {
              this.rootGraph.updateBounds(!0);
            }, o.prototype.getGraphs = function() {
              return this.graphs;
            }, o.prototype.getAllNodes = function() {
              if (this.allNodes == null) {
                for (var l = [], u = this.getGraphs(), h = u.length, d = 0; d < h; d++)
                  l = l.concat(u[d].getNodes());
                this.allNodes = l;
              }
              return this.allNodes;
            }, o.prototype.resetAllNodes = function() {
              this.allNodes = null;
            }, o.prototype.resetAllEdges = function() {
              this.allEdges = null;
            }, o.prototype.resetAllNodesToApplyGravitation = function() {
              this.allNodesToApplyGravitation = null;
            }, o.prototype.getAllEdges = function() {
              if (this.allEdges == null) {
                var l = [], u = this.getGraphs();
                u.length;
                for (var h = 0; h < u.length; h++)
                  l = l.concat(u[h].getEdges());
                l = l.concat(this.edges), this.allEdges = l;
              }
              return this.allEdges;
            }, o.prototype.getAllNodesToApplyGravitation = function() {
              return this.allNodesToApplyGravitation;
            }, o.prototype.setAllNodesToApplyGravitation = function(l) {
              if (this.allNodesToApplyGravitation != null)
                throw "assert failed";
              this.allNodesToApplyGravitation = l;
            }, o.prototype.getRoot = function() {
              return this.rootGraph;
            }, o.prototype.setRootGraph = function(l) {
              if (l.getGraphManager() != this)
                throw "Root not in this graph mgr!";
              this.rootGraph = l, l.parent == null && (l.parent = this.layout.newNode("Root node"));
            }, o.prototype.getLayout = function() {
              return this.layout;
            }, o.prototype.isOneAncestorOfOther = function(l, u) {
              if (!(l != null && u != null))
                throw "assert failed";
              if (l == u)
                return !0;
              var h = l.getOwner(), d;
              do {
                if (d = h.getParent(), d == null)
                  break;
                if (d == u)
                  return !0;
                if (h = d.getOwner(), h == null)
                  break;
              } while (!0);
              h = u.getOwner();
              do {
                if (d = h.getParent(), d == null)
                  break;
                if (d == l)
                  return !0;
                if (h = d.getOwner(), h == null)
                  break;
              } while (!0);
              return !1;
            }, o.prototype.calcLowestCommonAncestors = function() {
              for (var l, u, h, d, f, p = this.getAllEdges(), g = p.length, m = 0; m < g; m++) {
                if (l = p[m], u = l.source, h = l.target, l.lca = null, l.sourceInLca = u, l.targetInLca = h, u == h) {
                  l.lca = u.getOwner();
                  continue;
                }
                for (d = u.getOwner(); l.lca == null; ) {
                  for (l.targetInLca = h, f = h.getOwner(); l.lca == null; ) {
                    if (f == d) {
                      l.lca = f;
                      break;
                    }
                    if (f == this.rootGraph)
                      break;
                    if (l.lca != null)
                      throw "assert failed";
                    l.targetInLca = f.getParent(), f = l.targetInLca.getOwner();
                  }
                  if (d == this.rootGraph)
                    break;
                  l.lca == null && (l.sourceInLca = d.getParent(), d = l.sourceInLca.getOwner());
                }
                if (l.lca == null)
                  throw "assert failed";
              }
            }, o.prototype.calcLowestCommonAncestor = function(l, u) {
              if (l == u)
                return l.getOwner();
              var h = l.getOwner();
              do {
                if (h == null)
                  break;
                var d = u.getOwner();
                do {
                  if (d == null)
                    break;
                  if (d == h)
                    return d;
                  d = d.getParent().getOwner();
                } while (!0);
                h = h.getParent().getOwner();
              } while (!0);
              return h;
            }, o.prototype.calcInclusionTreeDepths = function(l, u) {
              l == null && u == null && (l = this.rootGraph, u = 1);
              for (var h, d = l.getNodes(), f = d.length, p = 0; p < f; p++)
                h = d[p], h.inclusionTreeDepth = u, h.child != null && this.calcInclusionTreeDepths(h.child, u + 1);
            }, o.prototype.includesInvalidEdge = function() {
              for (var l, u = [], h = this.edges.length, d = 0; d < h; d++)
                l = this.edges[d], this.isOneAncestorOfOther(l.source, l.target) && u.push(l);
              for (var d = 0; d < u.length; d++)
                this.remove(u[d]);
              return !1;
            }, r.exports = o;
          },
          /* 8 */
          /***/
          function(r, n, i) {
            var a = i(12);
            function s() {
            }
            s.calcSeparationAmount = function(o, l, u, h) {
              if (!o.intersects(l))
                throw "assert failed";
              var d = new Array(2);
              this.decideDirectionsForOverlappingNodes(o, l, d), u[0] = Math.min(o.getRight(), l.getRight()) - Math.max(o.x, l.x), u[1] = Math.min(o.getBottom(), l.getBottom()) - Math.max(o.y, l.y), o.getX() <= l.getX() && o.getRight() >= l.getRight() ? u[0] += Math.min(l.getX() - o.getX(), o.getRight() - l.getRight()) : l.getX() <= o.getX() && l.getRight() >= o.getRight() && (u[0] += Math.min(o.getX() - l.getX(), l.getRight() - o.getRight())), o.getY() <= l.getY() && o.getBottom() >= l.getBottom() ? u[1] += Math.min(l.getY() - o.getY(), o.getBottom() - l.getBottom()) : l.getY() <= o.getY() && l.getBottom() >= o.getBottom() && (u[1] += Math.min(o.getY() - l.getY(), l.getBottom() - o.getBottom()));
              var f = Math.abs((l.getCenterY() - o.getCenterY()) / (l.getCenterX() - o.getCenterX()));
              l.getCenterY() === o.getCenterY() && l.getCenterX() === o.getCenterX() && (f = 1);
              var p = f * u[0], g = u[1] / f;
              u[0] < g ? g = u[0] : p = u[1], u[0] = -1 * d[0] * (g / 2 + h), u[1] = -1 * d[1] * (p / 2 + h);
            }, s.decideDirectionsForOverlappingNodes = function(o, l, u) {
              o.getCenterX() < l.getCenterX() ? u[0] = -1 : u[0] = 1, o.getCenterY() < l.getCenterY() ? u[1] = -1 : u[1] = 1;
            }, s.getIntersection2 = function(o, l, u) {
              var h = o.getCenterX(), d = o.getCenterY(), f = l.getCenterX(), p = l.getCenterY();
              if (o.intersects(l))
                return u[0] = h, u[1] = d, u[2] = f, u[3] = p, !0;
              var g = o.getX(), m = o.getY(), v = o.getRight(), y = o.getX(), b = o.getBottom(), w = o.getRight(), T = o.getWidthHalf(), E = o.getHeightHalf(), C = l.getX(), k = l.getY(), _ = l.getRight(), L = l.getX(), N = l.getBottom(), A = l.getRight(), O = l.getWidthHalf(), P = l.getHeightHalf(), S = !1, R = !1;
              if (h === f) {
                if (d > p)
                  return u[0] = h, u[1] = m, u[2] = f, u[3] = N, !1;
                if (d < p)
                  return u[0] = h, u[1] = b, u[2] = f, u[3] = k, !1;
              } else if (d === p) {
                if (h > f)
                  return u[0] = g, u[1] = d, u[2] = _, u[3] = p, !1;
                if (h < f)
                  return u[0] = v, u[1] = d, u[2] = C, u[3] = p, !1;
              } else {
                var I = o.height / o.width, D = l.height / l.width, M = (p - d) / (f - h), B = void 0, $ = void 0, F = void 0, G = void 0, H = void 0, ee = void 0;
                if (-I === M ? h > f ? (u[0] = y, u[1] = b, S = !0) : (u[0] = v, u[1] = m, S = !0) : I === M && (h > f ? (u[0] = g, u[1] = m, S = !0) : (u[0] = w, u[1] = b, S = !0)), -D === M ? f > h ? (u[2] = L, u[3] = N, R = !0) : (u[2] = _, u[3] = k, R = !0) : D === M && (f > h ? (u[2] = C, u[3] = k, R = !0) : (u[2] = A, u[3] = N, R = !0)), S && R)
                  return !1;
                if (h > f ? d > p ? (B = this.getCardinalDirection(I, M, 4), $ = this.getCardinalDirection(D, M, 2)) : (B = this.getCardinalDirection(-I, M, 3), $ = this.getCardinalDirection(-D, M, 1)) : d > p ? (B = this.getCardinalDirection(-I, M, 1), $ = this.getCardinalDirection(-D, M, 3)) : (B = this.getCardinalDirection(I, M, 2), $ = this.getCardinalDirection(D, M, 4)), !S)
                  switch (B) {
                    case 1:
                      G = m, F = h + -E / M, u[0] = F, u[1] = G;
                      break;
                    case 2:
                      F = w, G = d + T * M, u[0] = F, u[1] = G;
                      break;
                    case 3:
                      G = b, F = h + E / M, u[0] = F, u[1] = G;
                      break;
                    case 4:
                      F = y, G = d + -T * M, u[0] = F, u[1] = G;
                      break;
                  }
                if (!R)
                  switch ($) {
                    case 1:
                      ee = k, H = f + -P / M, u[2] = H, u[3] = ee;
                      break;
                    case 2:
                      H = A, ee = p + O * M, u[2] = H, u[3] = ee;
                      break;
                    case 3:
                      ee = N, H = f + P / M, u[2] = H, u[3] = ee;
                      break;
                    case 4:
                      H = L, ee = p + -O * M, u[2] = H, u[3] = ee;
                      break;
                  }
              }
              return !1;
            }, s.getCardinalDirection = function(o, l, u) {
              return o > l ? u : 1 + u % 4;
            }, s.getIntersection = function(o, l, u, h) {
              if (h == null)
                return this.getIntersection2(o, l, u);
              var d = o.x, f = o.y, p = l.x, g = l.y, m = u.x, v = u.y, y = h.x, b = h.y, w = void 0, T = void 0, E = void 0, C = void 0, k = void 0, _ = void 0, L = void 0, N = void 0, A = void 0;
              return E = g - f, k = d - p, L = p * f - d * g, C = b - v, _ = m - y, N = y * v - m * b, A = E * _ - C * k, A === 0 ? null : (w = (k * N - _ * L) / A, T = (C * L - E * N) / A, new a(w, T));
            }, s.angleOfVector = function(o, l, u, h) {
              var d = void 0;
              return o !== u ? (d = Math.atan((h - l) / (u - o)), u < o ? d += Math.PI : h < l && (d += this.TWO_PI)) : h < l ? d = this.ONE_AND_HALF_PI : d = this.HALF_PI, d;
            }, s.doIntersect = function(o, l, u, h) {
              var d = o.x, f = o.y, p = l.x, g = l.y, m = u.x, v = u.y, y = h.x, b = h.y, w = (p - d) * (b - v) - (y - m) * (g - f);
              if (w === 0)
                return !1;
              var T = ((b - v) * (y - d) + (m - y) * (b - f)) / w, E = ((f - g) * (y - d) + (p - d) * (b - f)) / w;
              return 0 < T && T < 1 && 0 < E && E < 1;
            }, s.findCircleLineIntersections = function(o, l, u, h, d, f, p) {
              var g = (u - o) * (u - o) + (h - l) * (h - l), m = 2 * ((o - d) * (u - o) + (l - f) * (h - l)), v = (o - d) * (o - d) + (l - f) * (l - f) - p * p, y = m * m - 4 * g * v;
              if (y >= 0) {
                var b = (-m + Math.sqrt(m * m - 4 * g * v)) / (2 * g), w = (-m - Math.sqrt(m * m - 4 * g * v)) / (2 * g), T = null;
                return b >= 0 && b <= 1 ? [b] : w >= 0 && w <= 1 ? [w] : T;
              } else return null;
            }, s.HALF_PI = 0.5 * Math.PI, s.ONE_AND_HALF_PI = 1.5 * Math.PI, s.TWO_PI = 2 * Math.PI, s.THREE_PI = 3 * Math.PI, r.exports = s;
          },
          /* 9 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.sign = function(s) {
              return s > 0 ? 1 : s < 0 ? -1 : 0;
            }, a.floor = function(s) {
              return s < 0 ? Math.ceil(s) : Math.floor(s);
            }, a.ceil = function(s) {
              return s < 0 ? Math.floor(s) : Math.ceil(s);
            }, r.exports = a;
          },
          /* 10 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.MAX_VALUE = 2147483647, a.MIN_VALUE = -2147483648, r.exports = a;
          },
          /* 11 */
          /***/
          function(r, n, i) {
            var a = /* @__PURE__ */ function() {
              function d(f, p) {
                for (var g = 0; g < p.length; g++) {
                  var m = p[g];
                  m.enumerable = m.enumerable || !1, m.configurable = !0, "value" in m && (m.writable = !0), Object.defineProperty(f, m.key, m);
                }
              }
              return function(f, p, g) {
                return p && d(f.prototype, p), g && d(f, g), f;
              };
            }();
            function s(d, f) {
              if (!(d instanceof f))
                throw new TypeError("Cannot call a class as a function");
            }
            var o = function(f) {
              return { value: f, next: null, prev: null };
            }, l = function(f, p, g, m) {
              return f !== null ? f.next = p : m.head = p, g !== null ? g.prev = p : m.tail = p, p.prev = f, p.next = g, m.length++, p;
            }, u = function(f, p) {
              var g = f.prev, m = f.next;
              return g !== null ? g.next = m : p.head = m, m !== null ? m.prev = g : p.tail = g, f.prev = f.next = null, p.length--, f;
            }, h = function() {
              function d(f) {
                var p = this;
                s(this, d), this.length = 0, this.head = null, this.tail = null, f != null && f.forEach(function(g) {
                  return p.push(g);
                });
              }
              return a(d, [{
                key: "size",
                value: function() {
                  return this.length;
                }
              }, {
                key: "insertBefore",
                value: function(p, g) {
                  return l(g.prev, o(p), g, this);
                }
              }, {
                key: "insertAfter",
                value: function(p, g) {
                  return l(g, o(p), g.next, this);
                }
              }, {
                key: "insertNodeBefore",
                value: function(p, g) {
                  return l(g.prev, p, g, this);
                }
              }, {
                key: "insertNodeAfter",
                value: function(p, g) {
                  return l(g, p, g.next, this);
                }
              }, {
                key: "push",
                value: function(p) {
                  return l(this.tail, o(p), null, this);
                }
              }, {
                key: "unshift",
                value: function(p) {
                  return l(null, o(p), this.head, this);
                }
              }, {
                key: "remove",
                value: function(p) {
                  return u(p, this);
                }
              }, {
                key: "pop",
                value: function() {
                  return u(this.tail, this).value;
                }
              }, {
                key: "popNode",
                value: function() {
                  return u(this.tail, this);
                }
              }, {
                key: "shift",
                value: function() {
                  return u(this.head, this).value;
                }
              }, {
                key: "shiftNode",
                value: function() {
                  return u(this.head, this);
                }
              }, {
                key: "get_object_at",
                value: function(p) {
                  if (p <= this.length()) {
                    for (var g = 1, m = this.head; g < p; )
                      m = m.next, g++;
                    return m.value;
                  }
                }
              }, {
                key: "set_object_at",
                value: function(p, g) {
                  if (p <= this.length()) {
                    for (var m = 1, v = this.head; m < p; )
                      v = v.next, m++;
                    v.value = g;
                  }
                }
              }]), d;
            }();
            r.exports = h;
          },
          /* 12 */
          /***/
          function(r, n, i) {
            function a(s, o, l) {
              this.x = null, this.y = null, s == null && o == null && l == null ? (this.x = 0, this.y = 0) : typeof s == "number" && typeof o == "number" && l == null ? (this.x = s, this.y = o) : s.constructor.name == "Point" && o == null && l == null && (l = s, this.x = l.x, this.y = l.y);
            }
            a.prototype.getX = function() {
              return this.x;
            }, a.prototype.getY = function() {
              return this.y;
            }, a.prototype.getLocation = function() {
              return new a(this.x, this.y);
            }, a.prototype.setLocation = function(s, o, l) {
              s.constructor.name == "Point" && o == null && l == null ? (l = s, this.setLocation(l.x, l.y)) : typeof s == "number" && typeof o == "number" && l == null && (parseInt(s) == s && parseInt(o) == o ? this.move(s, o) : (this.x = Math.floor(s + 0.5), this.y = Math.floor(o + 0.5)));
            }, a.prototype.move = function(s, o) {
              this.x = s, this.y = o;
            }, a.prototype.translate = function(s, o) {
              this.x += s, this.y += o;
            }, a.prototype.equals = function(s) {
              if (s.constructor.name == "Point") {
                var o = s;
                return this.x == o.x && this.y == o.y;
              }
              return this == s;
            }, a.prototype.toString = function() {
              return new a().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
            }, r.exports = a;
          },
          /* 13 */
          /***/
          function(r, n, i) {
            function a(s, o, l, u) {
              this.x = 0, this.y = 0, this.width = 0, this.height = 0, s != null && o != null && l != null && u != null && (this.x = s, this.y = o, this.width = l, this.height = u);
            }
            a.prototype.getX = function() {
              return this.x;
            }, a.prototype.setX = function(s) {
              this.x = s;
            }, a.prototype.getY = function() {
              return this.y;
            }, a.prototype.setY = function(s) {
              this.y = s;
            }, a.prototype.getWidth = function() {
              return this.width;
            }, a.prototype.setWidth = function(s) {
              this.width = s;
            }, a.prototype.getHeight = function() {
              return this.height;
            }, a.prototype.setHeight = function(s) {
              this.height = s;
            }, a.prototype.getRight = function() {
              return this.x + this.width;
            }, a.prototype.getBottom = function() {
              return this.y + this.height;
            }, a.prototype.intersects = function(s) {
              return !(this.getRight() < s.x || this.getBottom() < s.y || s.getRight() < this.x || s.getBottom() < this.y);
            }, a.prototype.getCenterX = function() {
              return this.x + this.width / 2;
            }, a.prototype.getMinX = function() {
              return this.getX();
            }, a.prototype.getMaxX = function() {
              return this.getX() + this.width;
            }, a.prototype.getCenterY = function() {
              return this.y + this.height / 2;
            }, a.prototype.getMinY = function() {
              return this.getY();
            }, a.prototype.getMaxY = function() {
              return this.getY() + this.height;
            }, a.prototype.getWidthHalf = function() {
              return this.width / 2;
            }, a.prototype.getHeightHalf = function() {
              return this.height / 2;
            }, r.exports = a;
          },
          /* 14 */
          /***/
          function(r, n, i) {
            var a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
              return typeof o;
            } : function(o) {
              return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
            };
            function s() {
            }
            s.lastID = 0, s.createID = function(o) {
              return s.isPrimitive(o) ? o : (o.uniqueID != null || (o.uniqueID = s.getString(), s.lastID++), o.uniqueID);
            }, s.getString = function(o) {
              return o == null && (o = s.lastID), "Object#" + o;
            }, s.isPrimitive = function(o) {
              var l = typeof o > "u" ? "undefined" : a(o);
              return o == null || l != "object" && l != "function";
            }, r.exports = s;
          },
          /* 15 */
          /***/
          function(r, n, i) {
            function a(m) {
              if (Array.isArray(m)) {
                for (var v = 0, y = Array(m.length); v < m.length; v++)
                  y[v] = m[v];
                return y;
              } else
                return Array.from(m);
            }
            var s = i(0), o = i(7), l = i(3), u = i(1), h = i(6), d = i(5), f = i(17), p = i(29);
            function g(m) {
              p.call(this), this.layoutQuality = s.QUALITY, this.createBendsAsNeeded = s.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = s.DEFAULT_INCREMENTAL, this.animationOnLayout = s.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = s.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = s.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = s.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new o(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, m != null && (this.isRemoteUse = m);
            }
            g.RANDOM_SEED = 1, g.prototype = Object.create(p.prototype), g.prototype.getGraphManager = function() {
              return this.graphManager;
            }, g.prototype.getAllNodes = function() {
              return this.graphManager.getAllNodes();
            }, g.prototype.getAllEdges = function() {
              return this.graphManager.getAllEdges();
            }, g.prototype.getAllNodesToApplyGravitation = function() {
              return this.graphManager.getAllNodesToApplyGravitation();
            }, g.prototype.newGraphManager = function() {
              var m = new o(this);
              return this.graphManager = m, m;
            }, g.prototype.newGraph = function(m) {
              return new h(null, this.graphManager, m);
            }, g.prototype.newNode = function(m) {
              return new l(this.graphManager, m);
            }, g.prototype.newEdge = function(m) {
              return new u(null, null, m);
            }, g.prototype.checkLayoutSuccess = function() {
              return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
            }, g.prototype.runLayout = function() {
              this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters();
              var m;
              return this.checkLayoutSuccess() ? m = !1 : m = this.layout(), s.ANIMATE === "during" ? !1 : (m && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, m);
            }, g.prototype.doPostLayout = function() {
              this.incremental || this.transform(), this.update();
            }, g.prototype.update2 = function() {
              if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) {
                for (var m = this.graphManager.getAllEdges(), v = 0; v < m.length; v++)
                  m[v];
                for (var y = this.graphManager.getRoot().getNodes(), v = 0; v < y.length; v++)
                  y[v];
                this.update(this.graphManager.getRoot());
              }
            }, g.prototype.update = function(m) {
              if (m == null)
                this.update2();
              else if (m instanceof l) {
                var v = m;
                if (v.getChild() != null)
                  for (var y = v.getChild().getNodes(), b = 0; b < y.length; b++)
                    update(y[b]);
                if (v.vGraphObject != null) {
                  var w = v.vGraphObject;
                  w.update(v);
                }
              } else if (m instanceof u) {
                var T = m;
                if (T.vGraphObject != null) {
                  var E = T.vGraphObject;
                  E.update(T);
                }
              } else if (m instanceof h) {
                var C = m;
                if (C.vGraphObject != null) {
                  var k = C.vGraphObject;
                  k.update(C);
                }
              }
            }, g.prototype.initParameters = function() {
              this.isSubLayout || (this.layoutQuality = s.QUALITY, this.animationDuringLayout = s.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = s.DEFAULT_ANIMATION_PERIOD, this.animationOnLayout = s.DEFAULT_ANIMATION_ON_LAYOUT, this.incremental = s.DEFAULT_INCREMENTAL, this.createBendsAsNeeded = s.DEFAULT_CREATE_BENDS_AS_NEEDED, this.uniformLeafNodeSizes = s.DEFAULT_UNIFORM_LEAF_NODE_SIZES), this.animationDuringLayout && (this.animationOnLayout = !1);
            }, g.prototype.transform = function(m) {
              if (m == null)
                this.transform(new d(0, 0));
              else {
                var v = new f(), y = this.graphManager.getRoot().updateLeftTop();
                if (y != null) {
                  v.setWorldOrgX(m.x), v.setWorldOrgY(m.y), v.setDeviceOrgX(y.x), v.setDeviceOrgY(y.y);
                  for (var b = this.getAllNodes(), w, T = 0; T < b.length; T++)
                    w = b[T], w.transform(v);
                }
              }
            }, g.prototype.positionNodesRandomly = function(m) {
              if (m == null)
                this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0);
              else
                for (var v, y, b = m.getNodes(), w = 0; w < b.length; w++)
                  v = b[w], y = v.getChild(), y == null || y.getNodes().length == 0 ? v.scatter() : (this.positionNodesRandomly(y), v.updateBounds());
            }, g.prototype.getFlatForest = function() {
              for (var m = [], v = !0, y = this.graphManager.getRoot().getNodes(), b = !0, w = 0; w < y.length; w++)
                y[w].getChild() != null && (b = !1);
              if (!b)
                return m;
              var T = /* @__PURE__ */ new Set(), E = [], C = /* @__PURE__ */ new Map(), k = [];
              for (k = k.concat(y); k.length > 0 && v; ) {
                for (E.push(k[0]); E.length > 0 && v; ) {
                  var _ = E[0];
                  E.splice(0, 1), T.add(_);
                  for (var L = _.getEdges(), w = 0; w < L.length; w++) {
                    var N = L[w].getOtherEnd(_);
                    if (C.get(_) != N)
                      if (!T.has(N))
                        E.push(N), C.set(N, _);
                      else {
                        v = !1;
                        break;
                      }
                  }
                }
                if (!v)
                  m = [];
                else {
                  var A = [].concat(a(T));
                  m.push(A);
                  for (var w = 0; w < A.length; w++) {
                    var O = A[w], P = k.indexOf(O);
                    P > -1 && k.splice(P, 1);
                  }
                  T = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map();
                }
              }
              return m;
            }, g.prototype.createDummyNodesForBendpoints = function(m) {
              for (var v = [], y = m.source, b = this.graphManager.calcLowestCommonAncestor(m.source, m.target), w = 0; w < m.bendpoints.length; w++) {
                var T = this.newNode(null);
                T.setRect(new Point(0, 0), new Dimension(1, 1)), b.add(T);
                var E = this.newEdge(null);
                this.graphManager.add(E, y, T), v.add(T), y = T;
              }
              var E = this.newEdge(null);
              return this.graphManager.add(E, y, m.target), this.edgeToDummyNodes.set(m, v), m.isInterGraph() ? this.graphManager.remove(m) : b.remove(m), v;
            }, g.prototype.createBendpointsFromDummyNodes = function() {
              var m = [];
              m = m.concat(this.graphManager.getAllEdges()), m = [].concat(a(this.edgeToDummyNodes.keys())).concat(m);
              for (var v = 0; v < m.length; v++) {
                var y = m[v];
                if (y.bendpoints.length > 0) {
                  for (var b = this.edgeToDummyNodes.get(y), w = 0; w < b.length; w++) {
                    var T = b[w], E = new d(T.getCenterX(), T.getCenterY()), C = y.bendpoints.get(w);
                    C.x = E.x, C.y = E.y, T.getOwner().remove(T);
                  }
                  this.graphManager.add(y, y.source, y.target);
                }
              }
            }, g.transform = function(m, v, y, b) {
              if (y != null && b != null) {
                var w = v;
                if (m <= 50) {
                  var T = v / y;
                  w -= (v - T) / 50 * (50 - m);
                } else {
                  var E = v * b;
                  w += (E - v) / 50 * (m - 50);
                }
                return w;
              } else {
                var C, k;
                return m <= 50 ? (C = 9 * v / 500, k = v / 10) : (C = 9 * v / 50, k = -8 * v), C * m + k;
              }
            }, g.findCenterOfTree = function(m) {
              var v = [];
              v = v.concat(m);
              var y = [], b = /* @__PURE__ */ new Map(), w = !1, T = null;
              (v.length == 1 || v.length == 2) && (w = !0, T = v[0]);
              for (var E = 0; E < v.length; E++) {
                var C = v[E], k = C.getNeighborsList().size;
                b.set(C, C.getNeighborsList().size), k == 1 && y.push(C);
              }
              var _ = [];
              for (_ = _.concat(y); !w; ) {
                var L = [];
                L = L.concat(_), _ = [];
                for (var E = 0; E < v.length; E++) {
                  var C = v[E], N = v.indexOf(C);
                  N >= 0 && v.splice(N, 1);
                  var A = C.getNeighborsList();
                  A.forEach(function(S) {
                    if (y.indexOf(S) < 0) {
                      var R = b.get(S), I = R - 1;
                      I == 1 && _.push(S), b.set(S, I);
                    }
                  });
                }
                y = y.concat(_), (v.length == 1 || v.length == 2) && (w = !0, T = v[0]);
              }
              return T;
            }, g.prototype.setGraphManager = function(m) {
              this.graphManager = m;
            }, r.exports = g;
          },
          /* 16 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.seed = 1, a.x = 0, a.nextDouble = function() {
              return a.x = Math.sin(a.seed++) * 1e4, a.x - Math.floor(a.x);
            }, r.exports = a;
          },
          /* 17 */
          /***/
          function(r, n, i) {
            var a = i(5);
            function s(o, l) {
              this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1;
            }
            s.prototype.getWorldOrgX = function() {
              return this.lworldOrgX;
            }, s.prototype.setWorldOrgX = function(o) {
              this.lworldOrgX = o;
            }, s.prototype.getWorldOrgY = function() {
              return this.lworldOrgY;
            }, s.prototype.setWorldOrgY = function(o) {
              this.lworldOrgY = o;
            }, s.prototype.getWorldExtX = function() {
              return this.lworldExtX;
            }, s.prototype.setWorldExtX = function(o) {
              this.lworldExtX = o;
            }, s.prototype.getWorldExtY = function() {
              return this.lworldExtY;
            }, s.prototype.setWorldExtY = function(o) {
              this.lworldExtY = o;
            }, s.prototype.getDeviceOrgX = function() {
              return this.ldeviceOrgX;
            }, s.prototype.setDeviceOrgX = function(o) {
              this.ldeviceOrgX = o;
            }, s.prototype.getDeviceOrgY = function() {
              return this.ldeviceOrgY;
            }, s.prototype.setDeviceOrgY = function(o) {
              this.ldeviceOrgY = o;
            }, s.prototype.getDeviceExtX = function() {
              return this.ldeviceExtX;
            }, s.prototype.setDeviceExtX = function(o) {
              this.ldeviceExtX = o;
            }, s.prototype.getDeviceExtY = function() {
              return this.ldeviceExtY;
            }, s.prototype.setDeviceExtY = function(o) {
              this.ldeviceExtY = o;
            }, s.prototype.transformX = function(o) {
              var l = 0, u = this.lworldExtX;
              return u != 0 && (l = this.ldeviceOrgX + (o - this.lworldOrgX) * this.ldeviceExtX / u), l;
            }, s.prototype.transformY = function(o) {
              var l = 0, u = this.lworldExtY;
              return u != 0 && (l = this.ldeviceOrgY + (o - this.lworldOrgY) * this.ldeviceExtY / u), l;
            }, s.prototype.inverseTransformX = function(o) {
              var l = 0, u = this.ldeviceExtX;
              return u != 0 && (l = this.lworldOrgX + (o - this.ldeviceOrgX) * this.lworldExtX / u), l;
            }, s.prototype.inverseTransformY = function(o) {
              var l = 0, u = this.ldeviceExtY;
              return u != 0 && (l = this.lworldOrgY + (o - this.ldeviceOrgY) * this.lworldExtY / u), l;
            }, s.prototype.inverseTransformPoint = function(o) {
              var l = new a(this.inverseTransformX(o.x), this.inverseTransformY(o.y));
              return l;
            }, r.exports = s;
          },
          /* 18 */
          /***/
          function(r, n, i) {
            function a(p) {
              if (Array.isArray(p)) {
                for (var g = 0, m = Array(p.length); g < p.length; g++)
                  m[g] = p[g];
                return m;
              } else
                return Array.from(p);
            }
            var s = i(15), o = i(4), l = i(0), u = i(8), h = i(9);
            function d() {
              s.call(this), this.useSmartIdealEdgeLengthCalculation = o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = o.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = o.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = o.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.displacementThresholdPerNode = 3 * o.DEFAULT_EDGE_LENGTH / 100, this.coolingFactor = o.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.initialCoolingFactor = o.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.totalDisplacement = 0, this.oldTotalDisplacement = 0, this.maxIterations = o.MAX_ITERATIONS;
            }
            d.prototype = Object.create(s.prototype);
            for (var f in s)
              d[f] = s[f];
            d.prototype.initParameters = function() {
              s.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = [];
            }, d.prototype.calcIdealEdgeLengths = function() {
              for (var p, g, m, v, y, b, w, T = this.getGraphManager().getAllEdges(), E = 0; E < T.length; E++)
                p = T[E], g = p.idealLength, p.isInterGraph && (v = p.getSource(), y = p.getTarget(), b = p.getSourceInLca().getEstimatedSize(), w = p.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (p.idealLength += b + w - 2 * l.SIMPLE_NODE_SIZE), m = p.getLca().getInclusionTreeDepth(), p.idealLength += g * o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (v.getInclusionTreeDepth() + y.getInclusionTreeDepth() - 2 * m));
            }, d.prototype.initSpringEmbedder = function() {
              var p = this.getAllNodes().length;
              this.incremental ? (p > o.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * o.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (p - o.ADAPTATION_LOWER_NODE_LIMIT) / (o.ADAPTATION_UPPER_NODE_LIMIT - o.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - o.COOLING_ADAPTATION_FACTOR))), this.maxNodeDisplacement = o.MAX_NODE_DISPLACEMENT_INCREMENTAL) : (p > o.ADAPTATION_LOWER_NODE_LIMIT ? this.coolingFactor = Math.max(o.COOLING_ADAPTATION_FACTOR, 1 - (p - o.ADAPTATION_LOWER_NODE_LIMIT) / (o.ADAPTATION_UPPER_NODE_LIMIT - o.ADAPTATION_LOWER_NODE_LIMIT) * (1 - o.COOLING_ADAPTATION_FACTOR)) : this.coolingFactor = 1, this.initialCoolingFactor = this.coolingFactor, this.maxNodeDisplacement = o.MAX_NODE_DISPLACEMENT), this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations), this.displacementThresholdPerNode = 3 * o.DEFAULT_EDGE_LENGTH / 100, this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length, this.repulsionRange = this.calcRepulsionRange();
            }, d.prototype.calcSpringForces = function() {
              for (var p = this.getAllEdges(), g, m = 0; m < p.length; m++)
                g = p[m], this.calcSpringForce(g, g.idealLength);
            }, d.prototype.calcRepulsionForces = function() {
              var p = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, m, v, y, b, w = this.getAllNodes(), T;
              if (this.useFRGridVariant)
                for (this.totalIterations % o.GRID_CALCULATION_CHECK_PERIOD == 1 && p && this.updateGrid(), T = /* @__PURE__ */ new Set(), m = 0; m < w.length; m++)
                  y = w[m], this.calculateRepulsionForceOfANode(y, T, p, g), T.add(y);
              else
                for (m = 0; m < w.length; m++)
                  for (y = w[m], v = m + 1; v < w.length; v++)
                    b = w[v], y.getOwner() == b.getOwner() && this.calcRepulsionForce(y, b);
            }, d.prototype.calcGravitationalForces = function() {
              for (var p, g = this.getAllNodesToApplyGravitation(), m = 0; m < g.length; m++)
                p = g[m], this.calcGravitationalForce(p);
            }, d.prototype.moveNodes = function() {
              for (var p = this.getAllNodes(), g, m = 0; m < p.length; m++)
                g = p[m], g.move();
            }, d.prototype.calcSpringForce = function(p, g) {
              var m = p.getSource(), v = p.getTarget(), y, b, w, T;
              if (this.uniformLeafNodeSizes && m.getChild() == null && v.getChild() == null)
                p.updateLengthSimple();
              else if (p.updateLength(), p.isOverlapingSourceAndTarget)
                return;
              y = p.getLength(), y != 0 && (b = p.edgeElasticity * (y - g), w = b * (p.lengthX / y), T = b * (p.lengthY / y), m.springForceX += w, m.springForceY += T, v.springForceX -= w, v.springForceY -= T);
            }, d.prototype.calcRepulsionForce = function(p, g) {
              var m = p.getRect(), v = g.getRect(), y = new Array(2), b = new Array(4), w, T, E, C, k, _, L;
              if (m.intersects(v)) {
                u.calcSeparationAmount(m, v, y, o.DEFAULT_EDGE_LENGTH / 2), _ = 2 * y[0], L = 2 * y[1];
                var N = p.noOfChildren * g.noOfChildren / (p.noOfChildren + g.noOfChildren);
                p.repulsionForceX -= N * _, p.repulsionForceY -= N * L, g.repulsionForceX += N * _, g.repulsionForceY += N * L;
              } else
                this.uniformLeafNodeSizes && p.getChild() == null && g.getChild() == null ? (w = v.getCenterX() - m.getCenterX(), T = v.getCenterY() - m.getCenterY()) : (u.getIntersection(m, v, b), w = b[2] - b[0], T = b[3] - b[1]), Math.abs(w) < o.MIN_REPULSION_DIST && (w = h.sign(w) * o.MIN_REPULSION_DIST), Math.abs(T) < o.MIN_REPULSION_DIST && (T = h.sign(T) * o.MIN_REPULSION_DIST), E = w * w + T * T, C = Math.sqrt(E), k = (p.nodeRepulsion / 2 + g.nodeRepulsion / 2) * p.noOfChildren * g.noOfChildren / E, _ = k * w / C, L = k * T / C, p.repulsionForceX -= _, p.repulsionForceY -= L, g.repulsionForceX += _, g.repulsionForceY += L;
            }, d.prototype.calcGravitationalForce = function(p) {
              var g, m, v, y, b, w, T, E;
              g = p.getOwner(), m = (g.getRight() + g.getLeft()) / 2, v = (g.getTop() + g.getBottom()) / 2, y = p.getCenterX() - m, b = p.getCenterY() - v, w = Math.abs(y) + p.getWidth() / 2, T = Math.abs(b) + p.getHeight() / 2, p.getOwner() == this.graphManager.getRoot() ? (E = g.getEstimatedSize() * this.gravityRangeFactor, (w > E || T > E) && (p.gravitationForceX = -this.gravityConstant * y, p.gravitationForceY = -this.gravityConstant * b)) : (E = g.getEstimatedSize() * this.compoundGravityRangeFactor, (w > E || T > E) && (p.gravitationForceX = -this.gravityConstant * y * this.compoundGravityConstant, p.gravitationForceY = -this.gravityConstant * b * this.compoundGravityConstant));
            }, d.prototype.isConverged = function() {
              var p, g = !1;
              return this.totalIterations > this.maxIterations / 3 && (g = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), p = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, p || g;
            }, d.prototype.animate = function() {
              this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++);
            }, d.prototype.calcNoOfChildrenForAllNodes = function() {
              for (var p, g = this.graphManager.getAllNodes(), m = 0; m < g.length; m++)
                p = g[m], p.noOfChildren = p.getNoOfChildren();
            }, d.prototype.calcGrid = function(p) {
              var g = 0, m = 0;
              g = parseInt(Math.ceil((p.getRight() - p.getLeft()) / this.repulsionRange)), m = parseInt(Math.ceil((p.getBottom() - p.getTop()) / this.repulsionRange));
              for (var v = new Array(g), y = 0; y < g; y++)
                v[y] = new Array(m);
              for (var y = 0; y < g; y++)
                for (var b = 0; b < m; b++)
                  v[y][b] = new Array();
              return v;
            }, d.prototype.addNodeToGrid = function(p, g, m) {
              var v = 0, y = 0, b = 0, w = 0;
              v = parseInt(Math.floor((p.getRect().x - g) / this.repulsionRange)), y = parseInt(Math.floor((p.getRect().width + p.getRect().x - g) / this.repulsionRange)), b = parseInt(Math.floor((p.getRect().y - m) / this.repulsionRange)), w = parseInt(Math.floor((p.getRect().height + p.getRect().y - m) / this.repulsionRange));
              for (var T = v; T <= y; T++)
                for (var E = b; E <= w; E++)
                  this.grid[T][E].push(p), p.setGridCoordinates(v, y, b, w);
            }, d.prototype.updateGrid = function() {
              var p, g, m = this.getAllNodes();
              for (this.grid = this.calcGrid(this.graphManager.getRoot()), p = 0; p < m.length; p++)
                g = m[p], this.addNodeToGrid(g, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
            }, d.prototype.calculateRepulsionForceOfANode = function(p, g, m, v) {
              if (this.totalIterations % o.GRID_CALCULATION_CHECK_PERIOD == 1 && m || v) {
                var y = /* @__PURE__ */ new Set();
                p.surrounding = new Array();
                for (var b, w = this.grid, T = p.startX - 1; T < p.finishX + 2; T++)
                  for (var E = p.startY - 1; E < p.finishY + 2; E++)
                    if (!(T < 0 || E < 0 || T >= w.length || E >= w[0].length)) {
                      for (var C = 0; C < w[T][E].length; C++)
                        if (b = w[T][E][C], !(p.getOwner() != b.getOwner() || p == b) && !g.has(b) && !y.has(b)) {
                          var k = Math.abs(p.getCenterX() - b.getCenterX()) - (p.getWidth() / 2 + b.getWidth() / 2), _ = Math.abs(p.getCenterY() - b.getCenterY()) - (p.getHeight() / 2 + b.getHeight() / 2);
                          k <= this.repulsionRange && _ <= this.repulsionRange && y.add(b);
                        }
                    }
                p.surrounding = [].concat(a(y));
              }
              for (T = 0; T < p.surrounding.length; T++)
                this.calcRepulsionForce(p, p.surrounding[T]);
            }, d.prototype.calcRepulsionRange = function() {
              return 0;
            }, r.exports = d;
          },
          /* 19 */
          /***/
          function(r, n, i) {
            var a = i(1), s = i(4);
            function o(u, h, d) {
              a.call(this, u, h, d), this.idealLength = s.DEFAULT_EDGE_LENGTH, this.edgeElasticity = s.DEFAULT_SPRING_STRENGTH;
            }
            o.prototype = Object.create(a.prototype);
            for (var l in a)
              o[l] = a[l];
            r.exports = o;
          },
          /* 20 */
          /***/
          function(r, n, i) {
            var a = i(3), s = i(4);
            function o(u, h, d, f) {
              a.call(this, u, h, d, f), this.nodeRepulsion = s.DEFAULT_REPULSION_STRENGTH, this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0, this.startX = 0, this.finishX = 0, this.startY = 0, this.finishY = 0, this.surrounding = [];
            }
            o.prototype = Object.create(a.prototype);
            for (var l in a)
              o[l] = a[l];
            o.prototype.setGridCoordinates = function(u, h, d, f) {
              this.startX = u, this.finishX = h, this.startY = d, this.finishY = f;
            }, r.exports = o;
          },
          /* 21 */
          /***/
          function(r, n, i) {
            function a(s, o) {
              this.width = 0, this.height = 0, s !== null && o !== null && (this.height = o, this.width = s);
            }
            a.prototype.getWidth = function() {
              return this.width;
            }, a.prototype.setWidth = function(s) {
              this.width = s;
            }, a.prototype.getHeight = function() {
              return this.height;
            }, a.prototype.setHeight = function(s) {
              this.height = s;
            }, r.exports = a;
          },
          /* 22 */
          /***/
          function(r, n, i) {
            var a = i(14);
            function s() {
              this.map = {}, this.keys = [];
            }
            s.prototype.put = function(o, l) {
              var u = a.createID(o);
              this.contains(u) || (this.map[u] = l, this.keys.push(o));
            }, s.prototype.contains = function(o) {
              return a.createID(o), this.map[o] != null;
            }, s.prototype.get = function(o) {
              var l = a.createID(o);
              return this.map[l];
            }, s.prototype.keySet = function() {
              return this.keys;
            }, r.exports = s;
          },
          /* 23 */
          /***/
          function(r, n, i) {
            var a = i(14);
            function s() {
              this.set = {};
            }
            s.prototype.add = function(o) {
              var l = a.createID(o);
              this.contains(l) || (this.set[l] = o);
            }, s.prototype.remove = function(o) {
              delete this.set[a.createID(o)];
            }, s.prototype.clear = function() {
              this.set = {};
            }, s.prototype.contains = function(o) {
              return this.set[a.createID(o)] == o;
            }, s.prototype.isEmpty = function() {
              return this.size() === 0;
            }, s.prototype.size = function() {
              return Object.keys(this.set).length;
            }, s.prototype.addAllTo = function(o) {
              for (var l = Object.keys(this.set), u = l.length, h = 0; h < u; h++)
                o.push(this.set[l[h]]);
            }, s.prototype.size = function() {
              return Object.keys(this.set).length;
            }, s.prototype.addAll = function(o) {
              for (var l = o.length, u = 0; u < l; u++) {
                var h = o[u];
                this.add(h);
              }
            }, r.exports = s;
          },
          /* 24 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.multMat = function(s, o) {
              for (var l = [], u = 0; u < s.length; u++) {
                l[u] = [];
                for (var h = 0; h < o[0].length; h++) {
                  l[u][h] = 0;
                  for (var d = 0; d < s[0].length; d++)
                    l[u][h] += s[u][d] * o[d][h];
                }
              }
              return l;
            }, a.transpose = function(s) {
              for (var o = [], l = 0; l < s[0].length; l++) {
                o[l] = [];
                for (var u = 0; u < s.length; u++)
                  o[l][u] = s[u][l];
              }
              return o;
            }, a.multCons = function(s, o) {
              for (var l = [], u = 0; u < s.length; u++)
                l[u] = s[u] * o;
              return l;
            }, a.minusOp = function(s, o) {
              for (var l = [], u = 0; u < s.length; u++)
                l[u] = s[u] - o[u];
              return l;
            }, a.dotProduct = function(s, o) {
              for (var l = 0, u = 0; u < s.length; u++)
                l += s[u] * o[u];
              return l;
            }, a.mag = function(s) {
              return Math.sqrt(this.dotProduct(s, s));
            }, a.normalize = function(s) {
              for (var o = [], l = this.mag(s), u = 0; u < s.length; u++)
                o[u] = s[u] / l;
              return o;
            }, a.multGamma = function(s) {
              for (var o = [], l = 0, u = 0; u < s.length; u++)
                l += s[u];
              l *= -1 / s.length;
              for (var h = 0; h < s.length; h++)
                o[h] = l + s[h];
              return o;
            }, a.multL = function(s, o, l) {
              for (var u = [], h = [], d = [], f = 0; f < o[0].length; f++) {
                for (var p = 0, g = 0; g < o.length; g++)
                  p += -0.5 * o[g][f] * s[g];
                h[f] = p;
              }
              for (var m = 0; m < l.length; m++) {
                for (var v = 0, y = 0; y < l.length; y++)
                  v += l[m][y] * h[y];
                d[m] = v;
              }
              for (var b = 0; b < o.length; b++) {
                for (var w = 0, T = 0; T < o[0].length; T++)
                  w += o[b][T] * d[T];
                u[b] = w;
              }
              return u;
            }, r.exports = a;
          },
          /* 25 */
          /***/
          function(r, n, i) {
            var a = /* @__PURE__ */ function() {
              function u(h, d) {
                for (var f = 0; f < d.length; f++) {
                  var p = d[f];
                  p.enumerable = p.enumerable || !1, p.configurable = !0, "value" in p && (p.writable = !0), Object.defineProperty(h, p.key, p);
                }
              }
              return function(h, d, f) {
                return d && u(h.prototype, d), f && u(h, f), h;
              };
            }();
            function s(u, h) {
              if (!(u instanceof h))
                throw new TypeError("Cannot call a class as a function");
            }
            var o = i(11), l = function() {
              function u(h, d) {
                s(this, u), (d !== null || d !== void 0) && (this.compareFunction = this._defaultCompareFunction);
                var f = void 0;
                h instanceof o ? f = h.size() : f = h.length, this._quicksort(h, 0, f - 1);
              }
              return a(u, [{
                key: "_quicksort",
                value: function(d, f, p) {
                  if (f < p) {
                    var g = this._partition(d, f, p);
                    this._quicksort(d, f, g), this._quicksort(d, g + 1, p);
                  }
                }
              }, {
                key: "_partition",
                value: function(d, f, p) {
                  for (var g = this._get(d, f), m = f, v = p; ; ) {
                    for (; this.compareFunction(g, this._get(d, v)); )
                      v--;
                    for (; this.compareFunction(this._get(d, m), g); )
                      m++;
                    if (m < v)
                      this._swap(d, m, v), m++, v--;
                    else return v;
                  }
                }
              }, {
                key: "_get",
                value: function(d, f) {
                  return d instanceof o ? d.get_object_at(f) : d[f];
                }
              }, {
                key: "_set",
                value: function(d, f, p) {
                  d instanceof o ? d.set_object_at(f, p) : d[f] = p;
                }
              }, {
                key: "_swap",
                value: function(d, f, p) {
                  var g = this._get(d, f);
                  this._set(d, f, this._get(d, p)), this._set(d, p, g);
                }
              }, {
                key: "_defaultCompareFunction",
                value: function(d, f) {
                  return f > d;
                }
              }]), u;
            }();
            r.exports = l;
          },
          /* 26 */
          /***/
          function(r, n, i) {
            function a() {
            }
            a.svd = function(s) {
              this.U = null, this.V = null, this.s = null, this.m = 0, this.n = 0, this.m = s.length, this.n = s[0].length;
              var o = Math.min(this.m, this.n);
              this.s = function(qe) {
                for (var rt = []; qe-- > 0; )
                  rt.push(0);
                return rt;
              }(Math.min(this.m + 1, this.n)), this.U = function(qe) {
                var rt = function ct(ut) {
                  if (ut.length == 0)
                    return 0;
                  for (var nt = [], bt = 0; bt < ut[0]; bt++)
                    nt.push(ct(ut.slice(1)));
                  return nt;
                };
                return rt(qe);
              }([this.m, o]), this.V = function(qe) {
                var rt = function ct(ut) {
                  if (ut.length == 0)
                    return 0;
                  for (var nt = [], bt = 0; bt < ut[0]; bt++)
                    nt.push(ct(ut.slice(1)));
                  return nt;
                };
                return rt(qe);
              }([this.n, this.n]);
              for (var l = function(qe) {
                for (var rt = []; qe-- > 0; )
                  rt.push(0);
                return rt;
              }(this.n), u = function(qe) {
                for (var rt = []; qe-- > 0; )
                  rt.push(0);
                return rt;
              }(this.m), h = !0, d = Math.min(this.m - 1, this.n), f = Math.max(0, Math.min(this.n - 2, this.m)), p = 0; p < Math.max(d, f); p++) {
                if (p < d) {
                  this.s[p] = 0;
                  for (var g = p; g < this.m; g++)
                    this.s[p] = a.hypot(this.s[p], s[g][p]);
                  if (this.s[p] !== 0) {
                    s[p][p] < 0 && (this.s[p] = -this.s[p]);
                    for (var m = p; m < this.m; m++)
                      s[m][p] /= this.s[p];
                    s[p][p] += 1;
                  }
                  this.s[p] = -this.s[p];
                }
                for (var v = p + 1; v < this.n; v++) {
                  if (/* @__PURE__ */ function(qe, rt) {
                    return qe && rt;
                  }(p < d, this.s[p] !== 0)) {
                    for (var y = 0, b = p; b < this.m; b++)
                      y += s[b][p] * s[b][v];
                    y = -y / s[p][p];
                    for (var w = p; w < this.m; w++)
                      s[w][v] += y * s[w][p];
                  }
                  l[v] = s[p][v];
                }
                if (/* @__PURE__ */ function(qe, rt) {
                  return rt;
                }(h, p < d))
                  for (var T = p; T < this.m; T++)
                    this.U[T][p] = s[T][p];
                if (p < f) {
                  l[p] = 0;
                  for (var E = p + 1; E < this.n; E++)
                    l[p] = a.hypot(l[p], l[E]);
                  if (l[p] !== 0) {
                    l[p + 1] < 0 && (l[p] = -l[p]);
                    for (var C = p + 1; C < this.n; C++)
                      l[C] /= l[p];
                    l[p + 1] += 1;
                  }
                  if (l[p] = -l[p], /* @__PURE__ */ function(qe, rt) {
                    return qe && rt;
                  }(p + 1 < this.m, l[p] !== 0)) {
                    for (var k = p + 1; k < this.m; k++)
                      u[k] = 0;
                    for (var _ = p + 1; _ < this.n; _++)
                      for (var L = p + 1; L < this.m; L++)
                        u[L] += l[_] * s[L][_];
                    for (var N = p + 1; N < this.n; N++)
                      for (var A = -l[N] / l[p + 1], O = p + 1; O < this.m; O++)
                        s[O][N] += A * u[O];
                  }
                  for (var P = p + 1; P < this.n; P++)
                    this.V[P][p] = l[P];
                }
              }
              var S = Math.min(this.n, this.m + 1);
              d < this.n && (this.s[d] = s[d][d]), this.m < S && (this.s[S - 1] = 0), f + 1 < S && (l[f] = s[f][S - 1]), l[S - 1] = 0;
              {
                for (var R = d; R < o; R++) {
                  for (var I = 0; I < this.m; I++)
                    this.U[I][R] = 0;
                  this.U[R][R] = 1;
                }
                for (var D = d - 1; D >= 0; D--)
                  if (this.s[D] !== 0) {
                    for (var M = D + 1; M < o; M++) {
                      for (var B = 0, $ = D; $ < this.m; $++)
                        B += this.U[$][D] * this.U[$][M];
                      B = -B / this.U[D][D];
                      for (var F = D; F < this.m; F++)
                        this.U[F][M] += B * this.U[F][D];
                    }
                    for (var G = D; G < this.m; G++)
                      this.U[G][D] = -this.U[G][D];
                    this.U[D][D] = 1 + this.U[D][D];
                    for (var H = 0; H < D - 1; H++)
                      this.U[H][D] = 0;
                  } else {
                    for (var ee = 0; ee < this.m; ee++)
                      this.U[ee][D] = 0;
                    this.U[D][D] = 1;
                  }
              }
              for (var Y = this.n - 1; Y >= 0; Y--) {
                if (/* @__PURE__ */ function(qe, rt) {
                  return qe && rt;
                }(Y < f, l[Y] !== 0))
                  for (var re = Y + 1; re < o; re++) {
                    for (var ne = 0, he = Y + 1; he < this.n; he++)
                      ne += this.V[he][Y] * this.V[he][re];
                    ne = -ne / this.V[Y + 1][Y];
                    for (var K = Y + 1; K < this.n; K++)
                      this.V[K][re] += ne * this.V[K][Y];
                  }
                for (var Z = 0; Z < this.n; Z++)
                  this.V[Z][Y] = 0;
                this.V[Y][Y] = 1;
              }
              for (var X = S - 1, q = Math.pow(2, -52), J = Math.pow(2, -966); S > 0; ) {
                var j = void 0, pe = void 0;
                for (j = S - 2; j >= -1 && j !== -1; j--)
                  if (Math.abs(l[j]) <= J + q * (Math.abs(this.s[j]) + Math.abs(this.s[j + 1]))) {
                    l[j] = 0;
                    break;
                  }
                if (j === S - 2)
                  pe = 4;
                else {
                  var te = void 0;
                  for (te = S - 1; te >= j && te !== j; te--) {
                    var Ae = (te !== S ? Math.abs(l[te]) : 0) + (te !== j + 1 ? Math.abs(l[te - 1]) : 0);
                    if (Math.abs(this.s[te]) <= J + q * Ae) {
                      this.s[te] = 0;
                      break;
                    }
                  }
                  te === j ? pe = 3 : te === S - 1 ? pe = 1 : (pe = 2, j = te);
                }
                switch (j++, pe) {
                  case 1:
                    {
                      var W = l[S - 2];
                      l[S - 2] = 0;
                      for (var Oe = S - 2; Oe >= j; Oe--) {
                        var ue = a.hypot(this.s[Oe], W), Ve = this.s[Oe] / ue, Ge = W / ue;
                        this.s[Oe] = ue, Oe !== j && (W = -Ge * l[Oe - 1], l[Oe - 1] = Ve * l[Oe - 1]);
                        for (var Ue = 0; Ue < this.n; Ue++)
                          ue = Ve * this.V[Ue][Oe] + Ge * this.V[Ue][S - 1], this.V[Ue][S - 1] = -Ge * this.V[Ue][Oe] + Ve * this.V[Ue][S - 1], this.V[Ue][Oe] = ue;
                      }
                    }
                    break;
                  case 2:
                    {
                      var ke = l[j - 1];
                      l[j - 1] = 0;
                      for (var Pe = j; Pe < S; Pe++) {
                        var Se = a.hypot(this.s[Pe], ke), _e = this.s[Pe] / Se, ze = ke / Se;
                        this.s[Pe] = Se, ke = -ze * l[Pe], l[Pe] = _e * l[Pe];
                        for (var me = 0; me < this.m; me++)
                          Se = _e * this.U[me][Pe] + ze * this.U[me][j - 1], this.U[me][j - 1] = -ze * this.U[me][Pe] + _e * this.U[me][j - 1], this.U[me][Pe] = Se;
                      }
                    }
                    break;
                  case 3:
                    {
                      var Me = Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[S - 1]), Math.abs(this.s[S - 2])), Math.abs(l[S - 2])), Math.abs(this.s[j])), Math.abs(l[j])), Q = this.s[S - 1] / Me, ce = this.s[S - 2] / Me, z = l[S - 2] / Me, oe = this.s[j] / Me, se = l[j] / Me, ge = ((ce + Q) * (ce - Q) + z * z) / 2, de = Q * z * (Q * z), be = 0;
                      /* @__PURE__ */ (function(qe, rt) {
                        return qe || rt;
                      })(ge !== 0, de !== 0) && (be = Math.sqrt(ge * ge + de), ge < 0 && (be = -be), be = de / (ge + be));
                      for (var Ce = (oe + Q) * (oe - Q) + be, Te = oe * se, Ne = j; Ne < S - 1; Ne++) {
                        var Xe = a.hypot(Ce, Te), Ye = Ce / Xe, Ke = Te / Xe;
                        Ne !== j && (l[Ne - 1] = Xe), Ce = Ye * this.s[Ne] + Ke * l[Ne], l[Ne] = Ye * l[Ne] - Ke * this.s[Ne], Te = Ke * this.s[Ne + 1], this.s[Ne + 1] = Ye * this.s[Ne + 1];
                        for (var Ze = 0; Ze < this.n; Ze++)
                          Xe = Ye * this.V[Ze][Ne] + Ke * this.V[Ze][Ne + 1], this.V[Ze][Ne + 1] = -Ke * this.V[Ze][Ne] + Ye * this.V[Ze][Ne + 1], this.V[Ze][Ne] = Xe;
                        if (Xe = a.hypot(Ce, Te), Ye = Ce / Xe, Ke = Te / Xe, this.s[Ne] = Xe, Ce = Ye * l[Ne] + Ke * this.s[Ne + 1], this.s[Ne + 1] = -Ke * l[Ne] + Ye * this.s[Ne + 1], Te = Ke * l[Ne + 1], l[Ne + 1] = Ye * l[Ne + 1], Ne < this.m - 1)
                          for (var Be = 0; Be < this.m; Be++)
                            Xe = Ye * this.U[Be][Ne] + Ke * this.U[Be][Ne + 1], this.U[Be][Ne + 1] = -Ke * this.U[Be][Ne] + Ye * this.U[Be][Ne + 1], this.U[Be][Ne] = Xe;
                      }
                      l[S - 2] = Ce;
                    }
                    break;
                  case 4:
                    {
                      if (this.s[j] <= 0) {
                        this.s[j] = this.s[j] < 0 ? -this.s[j] : 0;
                        for (var He = 0; He <= X; He++)
                          this.V[He][j] = -this.V[He][j];
                      }
                      for (; j < X && !(this.s[j] >= this.s[j + 1]); ) {
                        var ht = this.s[j];
                        if (this.s[j] = this.s[j + 1], this.s[j + 1] = ht, j < this.n - 1)
                          for (var st = 0; st < this.n; st++)
                            ht = this.V[st][j + 1], this.V[st][j + 1] = this.V[st][j], this.V[st][j] = ht;
                        if (j < this.m - 1)
                          for (var We = 0; We < this.m; We++)
                            ht = this.U[We][j + 1], this.U[We][j + 1] = this.U[We][j], this.U[We][j] = ht;
                        j++;
                      }
                      S--;
                    }
                    break;
                }
              }
              var kt = { U: this.U, V: this.V, S: this.s };
              return kt;
            }, a.hypot = function(s, o) {
              var l = void 0;
              return Math.abs(s) > Math.abs(o) ? (l = o / s, l = Math.abs(s) * Math.sqrt(1 + l * l)) : o != 0 ? (l = s / o, l = Math.abs(o) * Math.sqrt(1 + l * l)) : l = 0, l;
            }, r.exports = a;
          },
          /* 27 */
          /***/
          function(r, n, i) {
            var a = /* @__PURE__ */ function() {
              function l(u, h) {
                for (var d = 0; d < h.length; d++) {
                  var f = h[d];
                  f.enumerable = f.enumerable || !1, f.configurable = !0, "value" in f && (f.writable = !0), Object.defineProperty(u, f.key, f);
                }
              }
              return function(u, h, d) {
                return h && l(u.prototype, h), d && l(u, d), u;
              };
            }();
            function s(l, u) {
              if (!(l instanceof u))
                throw new TypeError("Cannot call a class as a function");
            }
            var o = function() {
              function l(u, h) {
                var d = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, f = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, p = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
                s(this, l), this.sequence1 = u, this.sequence2 = h, this.match_score = d, this.mismatch_penalty = f, this.gap_penalty = p, this.iMax = u.length + 1, this.jMax = h.length + 1, this.grid = new Array(this.iMax);
                for (var g = 0; g < this.iMax; g++) {
                  this.grid[g] = new Array(this.jMax);
                  for (var m = 0; m < this.jMax; m++)
                    this.grid[g][m] = 0;
                }
                this.tracebackGrid = new Array(this.iMax);
                for (var v = 0; v < this.iMax; v++) {
                  this.tracebackGrid[v] = new Array(this.jMax);
                  for (var y = 0; y < this.jMax; y++)
                    this.tracebackGrid[v][y] = [null, null, null];
                }
                this.alignments = [], this.score = -1, this.computeGrids();
              }
              return a(l, [{
                key: "getScore",
                value: function() {
                  return this.score;
                }
              }, {
                key: "getAlignments",
                value: function() {
                  return this.alignments;
                }
                // Main dynamic programming procedure
              }, {
                key: "computeGrids",
                value: function() {
                  for (var h = 1; h < this.jMax; h++)
                    this.grid[0][h] = this.grid[0][h - 1] + this.gap_penalty, this.tracebackGrid[0][h] = [!1, !1, !0];
                  for (var d = 1; d < this.iMax; d++)
                    this.grid[d][0] = this.grid[d - 1][0] + this.gap_penalty, this.tracebackGrid[d][0] = [!1, !0, !1];
                  for (var f = 1; f < this.iMax; f++)
                    for (var p = 1; p < this.jMax; p++) {
                      var g = void 0;
                      this.sequence1[f - 1] === this.sequence2[p - 1] ? g = this.grid[f - 1][p - 1] + this.match_score : g = this.grid[f - 1][p - 1] + this.mismatch_penalty;
                      var m = this.grid[f - 1][p] + this.gap_penalty, v = this.grid[f][p - 1] + this.gap_penalty, y = [g, m, v], b = this.arrayAllMaxIndexes(y);
                      this.grid[f][p] = y[b[0]], this.tracebackGrid[f][p] = [b.includes(0), b.includes(1), b.includes(2)];
                    }
                  this.score = this.grid[this.iMax - 1][this.jMax - 1];
                }
                // Gets all possible valid sequence combinations
              }, {
                key: "alignmentTraceback",
                value: function() {
                  var h = [];
                  for (h.push({
                    pos: [this.sequence1.length, this.sequence2.length],
                    seq1: "",
                    seq2: ""
                  }); h[0]; ) {
                    var d = h[0], f = this.tracebackGrid[d.pos[0]][d.pos[1]];
                    f[0] && h.push({
                      pos: [d.pos[0] - 1, d.pos[1] - 1],
                      seq1: this.sequence1[d.pos[0] - 1] + d.seq1,
                      seq2: this.sequence2[d.pos[1] - 1] + d.seq2
                    }), f[1] && h.push({
                      pos: [d.pos[0] - 1, d.pos[1]],
                      seq1: this.sequence1[d.pos[0] - 1] + d.seq1,
                      seq2: "-" + d.seq2
                    }), f[2] && h.push({
                      pos: [d.pos[0], d.pos[1] - 1],
                      seq1: "-" + d.seq1,
                      seq2: this.sequence2[d.pos[1] - 1] + d.seq2
                    }), d.pos[0] === 0 && d.pos[1] === 0 && this.alignments.push({
                      sequence1: d.seq1,
                      sequence2: d.seq2
                    }), h.shift();
                  }
                  return this.alignments;
                }
                // Helper Functions
              }, {
                key: "getAllIndexes",
                value: function(h, d) {
                  for (var f = [], p = -1; (p = h.indexOf(d, p + 1)) !== -1; )
                    f.push(p);
                  return f;
                }
              }, {
                key: "arrayAllMaxIndexes",
                value: function(h) {
                  return this.getAllIndexes(h, Math.max.apply(null, h));
                }
              }]), l;
            }();
            r.exports = o;
          },
          /* 28 */
          /***/
          function(r, n, i) {
            var a = function() {
            };
            a.FDLayout = i(18), a.FDLayoutConstants = i(4), a.FDLayoutEdge = i(19), a.FDLayoutNode = i(20), a.DimensionD = i(21), a.HashMap = i(22), a.HashSet = i(23), a.IGeometry = i(8), a.IMath = i(9), a.Integer = i(10), a.Point = i(12), a.PointD = i(5), a.RandomSeed = i(16), a.RectangleD = i(13), a.Transform = i(17), a.UniqueIDGeneretor = i(14), a.Quicksort = i(25), a.LinkedList = i(11), a.LGraphObject = i(2), a.LGraph = i(6), a.LEdge = i(1), a.LGraphManager = i(7), a.LNode = i(3), a.Layout = i(15), a.LayoutConstants = i(0), a.NeedlemanWunsch = i(27), a.Matrix = i(24), a.SVD = i(26), r.exports = a;
          },
          /* 29 */
          /***/
          function(r, n, i) {
            function a() {
              this.listeners = [];
            }
            var s = a.prototype;
            s.addListener = function(o, l) {
              this.listeners.push({
                event: o,
                callback: l
              });
            }, s.removeListener = function(o, l) {
              for (var u = this.listeners.length; u >= 0; u--) {
                var h = this.listeners[u];
                h.event === o && h.callback === l && this.listeners.splice(u, 1);
              }
            }, s.emit = function(o, l) {
              for (var u = 0; u < this.listeners.length; u++) {
                var h = this.listeners[u];
                o === h.event && h.callback(l);
              }
            }, r.exports = a;
          }
          /******/
        ])
      );
    });
  }(V5)), V5.exports;
}
var iM;
function LNe() {
  return iM || (iM = 1, function(t, e) {
    (function(n, i) {
      t.exports = i(_Ne());
    })(ro, function(r) {
      return (
        /******/
        (() => {
          var n = {
            /***/
            45: (
              /***/
              (o, l, u) => {
                var h = {};
                h.layoutBase = u(551), h.CoSEConstants = u(806), h.CoSEEdge = u(767), h.CoSEGraph = u(880), h.CoSEGraphManager = u(578), h.CoSELayout = u(765), h.CoSENode = u(991), h.ConstraintHandler = u(902), o.exports = h;
              }
            ),
            /***/
            806: (
              /***/
              (o, l, u) => {
                var h = u(551).FDLayoutConstants;
                function d() {
                }
                for (var f in h)
                  d[f] = h[f];
                d.DEFAULT_USE_MULTI_LEVEL_SCALING = !1, d.DEFAULT_RADIAL_SEPARATION = h.DEFAULT_EDGE_LENGTH, d.DEFAULT_COMPONENT_SEPERATION = 60, d.TILE = !0, d.TILING_PADDING_VERTICAL = 10, d.TILING_PADDING_HORIZONTAL = 10, d.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, d.ENFORCE_CONSTRAINTS = !0, d.APPLY_LAYOUT = !0, d.RELAX_MOVEMENT_ON_CONSTRAINTS = !0, d.TREE_REDUCTION_ON_INCREMENTAL = !0, d.PURE_INCREMENTAL = d.DEFAULT_INCREMENTAL, o.exports = d;
              }
            ),
            /***/
            767: (
              /***/
              (o, l, u) => {
                var h = u(551).FDLayoutEdge;
                function d(p, g, m) {
                  h.call(this, p, g, m);
                }
                d.prototype = Object.create(h.prototype);
                for (var f in h)
                  d[f] = h[f];
                o.exports = d;
              }
            ),
            /***/
            880: (
              /***/
              (o, l, u) => {
                var h = u(551).LGraph;
                function d(p, g, m) {
                  h.call(this, p, g, m);
                }
                d.prototype = Object.create(h.prototype);
                for (var f in h)
                  d[f] = h[f];
                o.exports = d;
              }
            ),
            /***/
            578: (
              /***/
              (o, l, u) => {
                var h = u(551).LGraphManager;
                function d(p) {
                  h.call(this, p);
                }
                d.prototype = Object.create(h.prototype);
                for (var f in h)
                  d[f] = h[f];
                o.exports = d;
              }
            ),
            /***/
            765: (
              /***/
              (o, l, u) => {
                var h = u(551).FDLayout, d = u(578), f = u(880), p = u(991), g = u(767), m = u(806), v = u(902), y = u(551).FDLayoutConstants, b = u(551).LayoutConstants, w = u(551).Point, T = u(551).PointD, E = u(551).DimensionD, C = u(551).Layout, k = u(551).Integer, _ = u(551).IGeometry, L = u(551).LGraph, N = u(551).Transform, A = u(551).LinkedList;
                function O() {
                  h.call(this), this.toBeTiled = {}, this.constraints = {};
                }
                O.prototype = Object.create(h.prototype);
                for (var P in h)
                  O[P] = h[P];
                O.prototype.newGraphManager = function() {
                  var S = new d(this);
                  return this.graphManager = S, S;
                }, O.prototype.newGraph = function(S) {
                  return new f(null, this.graphManager, S);
                }, O.prototype.newNode = function(S) {
                  return new p(this.graphManager, S);
                }, O.prototype.newEdge = function(S) {
                  return new g(null, null, S);
                }, O.prototype.initParameters = function() {
                  h.prototype.initParameters.call(this, arguments), this.isSubLayout || (m.DEFAULT_EDGE_LENGTH < 10 ? this.idealEdgeLength = 10 : this.idealEdgeLength = m.DEFAULT_EDGE_LENGTH, this.useSmartIdealEdgeLengthCalculation = m.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = y.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = y.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = y.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.prunedNodesAll = [], this.growTreeIterations = 0, this.afterGrowthIterations = 0, this.isTreeGrowing = !1, this.isGrowthFinished = !1);
                }, O.prototype.initSpringEmbedder = function() {
                  h.prototype.initSpringEmbedder.call(this), this.coolingCycle = 0, this.maxCoolingCycle = this.maxIterations / y.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = 0.04, this.coolingAdjuster = 1;
                }, O.prototype.layout = function() {
                  var S = b.DEFAULT_CREATE_BENDS_AS_NEEDED;
                  return S && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout();
                }, O.prototype.classicLayout = function() {
                  if (this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(), this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity), this.calcNoOfChildrenForAllNodes(), this.graphManager.calcLowestCommonAncestors(), this.graphManager.calcInclusionTreeDepths(), this.graphManager.getRoot().calcEstimatedSize(), this.calcIdealEdgeLengths(), this.incremental) {
                    if (m.TREE_REDUCTION_ON_INCREMENTAL) {
                      this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
                      var R = new Set(this.getAllNodes()), I = this.nodesWithGravity.filter(function(B) {
                        return R.has(B);
                      });
                      this.graphManager.setAllNodesToApplyGravitation(I);
                    }
                  } else {
                    var S = this.getFlatForest();
                    if (S.length > 0)
                      this.positionNodesRadially(S);
                    else {
                      this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
                      var R = new Set(this.getAllNodes()), I = this.nodesWithGravity.filter(function(D) {
                        return R.has(D);
                      });
                      this.graphManager.setAllNodesToApplyGravitation(I), this.positionNodesRandomly();
                    }
                  }
                  return Object.keys(this.constraints).length > 0 && (v.handleConstraints(this), this.initConstraintVariables()), this.initSpringEmbedder(), m.APPLY_LAYOUT && this.runSpringEmbedder(), !0;
                }, O.prototype.tick = function() {
                  if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished)
                    if (this.prunedNodesAll.length > 0)
                      this.isTreeGrowing = !0;
                    else
                      return !0;
                  if (this.totalIterations % y.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
                    if (this.isConverged())
                      if (this.prunedNodesAll.length > 0)
                        this.isTreeGrowing = !0;
                      else
                        return !0;
                    this.coolingCycle++, this.layoutQuality == 0 ? this.coolingAdjuster = this.coolingCycle : this.layoutQuality == 1 && (this.coolingAdjuster = this.coolingCycle / 3), this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature), this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
                  }
                  if (this.isTreeGrowing) {
                    if (this.growTreeIterations % 10 == 0)
                      if (this.prunedNodesAll.length > 0) {
                        this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation();
                        var S = new Set(this.getAllNodes()), R = this.nodesWithGravity.filter(function(M) {
                          return S.has(M);
                        });
                        this.graphManager.setAllNodesToApplyGravitation(R), this.graphManager.updateBounds(), this.updateGrid(), m.PURE_INCREMENTAL ? this.coolingFactor = y.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 : this.coolingFactor = y.DEFAULT_COOLING_FACTOR_INCREMENTAL;
                      } else
                        this.isTreeGrowing = !1, this.isGrowthFinished = !0;
                    this.growTreeIterations++;
                  }
                  if (this.isGrowthFinished) {
                    if (this.isConverged())
                      return !0;
                    this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), m.PURE_INCREMENTAL ? this.coolingFactor = y.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100) : this.coolingFactor = y.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++;
                  }
                  var I = !this.isTreeGrowing && !this.isGrowthFinished, D = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
                  return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(I, D), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1;
                }, O.prototype.getPositionsData = function() {
                  for (var S = this.graphManager.getAllNodes(), R = {}, I = 0; I < S.length; I++) {
                    var D = S[I].rect, M = S[I].id;
                    R[M] = {
                      id: M,
                      x: D.getCenterX(),
                      y: D.getCenterY(),
                      w: D.width,
                      h: D.height
                    };
                  }
                  return R;
                }, O.prototype.runSpringEmbedder = function() {
                  this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod;
                  var S = !1;
                  if (y.ANIMATE === "during")
                    this.emit("layoutstarted");
                  else {
                    for (; !S; )
                      S = this.tick();
                    this.graphManager.updateBounds();
                  }
                }, O.prototype.moveNodes = function() {
                  for (var S = this.getAllNodes(), R, I = 0; I < S.length; I++)
                    R = S[I], R.calculateDisplacement();
                  Object.keys(this.constraints).length > 0 && this.updateDisplacements();
                  for (var I = 0; I < S.length; I++)
                    R = S[I], R.move();
                }, O.prototype.initConstraintVariables = function() {
                  var S = this;
                  this.idToNodeMap = /* @__PURE__ */ new Map(), this.fixedNodeSet = /* @__PURE__ */ new Set();
                  for (var R = this.graphManager.getAllNodes(), I = 0; I < R.length; I++) {
                    var D = R[I];
                    this.idToNodeMap.set(D.id, D);
                  }
                  var M = function K(Z) {
                    for (var X = Z.getChild().getNodes(), q, J = 0, j = 0; j < X.length; j++)
                      q = X[j], q.getChild() == null ? S.fixedNodeSet.has(q.id) && (J += 100) : J += K(q);
                    return J;
                  };
                  if (this.constraints.fixedNodeConstraint) {
                    this.constraints.fixedNodeConstraint.forEach(function(X) {
                      S.fixedNodeSet.add(X.nodeId);
                    });
                    for (var R = this.graphManager.getAllNodes(), D, I = 0; I < R.length; I++)
                      if (D = R[I], D.getChild() != null) {
                        var B = M(D);
                        B > 0 && (D.fixedNodeWeight = B);
                      }
                  }
                  if (this.constraints.relativePlacementConstraint) {
                    var $ = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
                    if (this.dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map(), this.dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map(), this.fixedNodesOnHorizontal = /* @__PURE__ */ new Set(), this.fixedNodesOnVertical = /* @__PURE__ */ new Set(), this.fixedNodeSet.forEach(function(K) {
                      S.fixedNodesOnHorizontal.add(K), S.fixedNodesOnVertical.add(K);
                    }), this.constraints.alignmentConstraint) {
                      if (this.constraints.alignmentConstraint.vertical)
                        for (var G = this.constraints.alignmentConstraint.vertical, I = 0; I < G.length; I++)
                          this.dummyToNodeForVerticalAlignment.set("dummy" + I, []), G[I].forEach(function(Z) {
                            $.set(Z, "dummy" + I), S.dummyToNodeForVerticalAlignment.get("dummy" + I).push(Z), S.fixedNodeSet.has(Z) && S.fixedNodesOnHorizontal.add("dummy" + I);
                          });
                      if (this.constraints.alignmentConstraint.horizontal)
                        for (var H = this.constraints.alignmentConstraint.horizontal, I = 0; I < H.length; I++)
                          this.dummyToNodeForHorizontalAlignment.set("dummy" + I, []), H[I].forEach(function(Z) {
                            F.set(Z, "dummy" + I), S.dummyToNodeForHorizontalAlignment.get("dummy" + I).push(Z), S.fixedNodeSet.has(Z) && S.fixedNodesOnVertical.add("dummy" + I);
                          });
                    }
                    if (m.RELAX_MOVEMENT_ON_CONSTRAINTS)
                      this.shuffle = function(K) {
                        var Z, X, q;
                        for (q = K.length - 1; q >= 2 * K.length / 3; q--)
                          Z = Math.floor(Math.random() * (q + 1)), X = K[q], K[q] = K[Z], K[Z] = X;
                        return K;
                      }, this.nodesInRelativeHorizontal = [], this.nodesInRelativeVertical = [], this.nodeToRelativeConstraintMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToRelativeConstraintMapVertical = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapVertical = /* @__PURE__ */ new Map(), this.constraints.relativePlacementConstraint.forEach(function(K) {
                        if (K.left) {
                          var Z = $.has(K.left) ? $.get(K.left) : K.left, X = $.has(K.right) ? $.get(K.right) : K.right;
                          S.nodesInRelativeHorizontal.includes(Z) || (S.nodesInRelativeHorizontal.push(Z), S.nodeToRelativeConstraintMapHorizontal.set(Z, []), S.dummyToNodeForVerticalAlignment.has(Z) ? S.nodeToTempPositionMapHorizontal.set(Z, S.idToNodeMap.get(S.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()) : S.nodeToTempPositionMapHorizontal.set(Z, S.idToNodeMap.get(Z).getCenterX())), S.nodesInRelativeHorizontal.includes(X) || (S.nodesInRelativeHorizontal.push(X), S.nodeToRelativeConstraintMapHorizontal.set(X, []), S.dummyToNodeForVerticalAlignment.has(X) ? S.nodeToTempPositionMapHorizontal.set(X, S.idToNodeMap.get(S.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()) : S.nodeToTempPositionMapHorizontal.set(X, S.idToNodeMap.get(X).getCenterX())), S.nodeToRelativeConstraintMapHorizontal.get(Z).push({ right: X, gap: K.gap }), S.nodeToRelativeConstraintMapHorizontal.get(X).push({ left: Z, gap: K.gap });
                        } else {
                          var q = F.has(K.top) ? F.get(K.top) : K.top, J = F.has(K.bottom) ? F.get(K.bottom) : K.bottom;
                          S.nodesInRelativeVertical.includes(q) || (S.nodesInRelativeVertical.push(q), S.nodeToRelativeConstraintMapVertical.set(q, []), S.dummyToNodeForHorizontalAlignment.has(q) ? S.nodeToTempPositionMapVertical.set(q, S.idToNodeMap.get(S.dummyToNodeForHorizontalAlignment.get(q)[0]).getCenterY()) : S.nodeToTempPositionMapVertical.set(q, S.idToNodeMap.get(q).getCenterY())), S.nodesInRelativeVertical.includes(J) || (S.nodesInRelativeVertical.push(J), S.nodeToRelativeConstraintMapVertical.set(J, []), S.dummyToNodeForHorizontalAlignment.has(J) ? S.nodeToTempPositionMapVertical.set(J, S.idToNodeMap.get(S.dummyToNodeForHorizontalAlignment.get(J)[0]).getCenterY()) : S.nodeToTempPositionMapVertical.set(J, S.idToNodeMap.get(J).getCenterY())), S.nodeToRelativeConstraintMapVertical.get(q).push({ bottom: J, gap: K.gap }), S.nodeToRelativeConstraintMapVertical.get(J).push({ top: q, gap: K.gap });
                        }
                      });
                    else {
                      var ee = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
                      this.constraints.relativePlacementConstraint.forEach(function(K) {
                        if (K.left) {
                          var Z = $.has(K.left) ? $.get(K.left) : K.left, X = $.has(K.right) ? $.get(K.right) : K.right;
                          ee.has(Z) ? ee.get(Z).push(X) : ee.set(Z, [X]), ee.has(X) ? ee.get(X).push(Z) : ee.set(X, [Z]);
                        } else {
                          var q = F.has(K.top) ? F.get(K.top) : K.top, J = F.has(K.bottom) ? F.get(K.bottom) : K.bottom;
                          Y.has(q) ? Y.get(q).push(J) : Y.set(q, [J]), Y.has(J) ? Y.get(J).push(q) : Y.set(J, [q]);
                        }
                      });
                      var re = function(Z, X) {
                        var q = [], J = [], j = new A(), pe = /* @__PURE__ */ new Set(), te = 0;
                        return Z.forEach(function(Ae, W) {
                          if (!pe.has(W)) {
                            q[te] = [], J[te] = !1;
                            var Oe = W;
                            for (j.push(Oe), pe.add(Oe), q[te].push(Oe); j.length != 0; ) {
                              Oe = j.shift(), X.has(Oe) && (J[te] = !0);
                              var ue = Z.get(Oe);
                              ue.forEach(function(Ve) {
                                pe.has(Ve) || (j.push(Ve), pe.add(Ve), q[te].push(Ve));
                              });
                            }
                            te++;
                          }
                        }), { components: q, isFixed: J };
                      }, ne = re(ee, S.fixedNodesOnHorizontal);
                      this.componentsOnHorizontal = ne.components, this.fixedComponentsOnHorizontal = ne.isFixed;
                      var he = re(Y, S.fixedNodesOnVertical);
                      this.componentsOnVertical = he.components, this.fixedComponentsOnVertical = he.isFixed;
                    }
                  }
                }, O.prototype.updateDisplacements = function() {
                  var S = this;
                  if (this.constraints.fixedNodeConstraint && this.constraints.fixedNodeConstraint.forEach(function(he) {
                    var K = S.idToNodeMap.get(he.nodeId);
                    K.displacementX = 0, K.displacementY = 0;
                  }), this.constraints.alignmentConstraint) {
                    if (this.constraints.alignmentConstraint.vertical)
                      for (var R = this.constraints.alignmentConstraint.vertical, I = 0; I < R.length; I++) {
                        for (var D = 0, M = 0; M < R[I].length; M++) {
                          if (this.fixedNodeSet.has(R[I][M])) {
                            D = 0;
                            break;
                          }
                          D += this.idToNodeMap.get(R[I][M]).displacementX;
                        }
                        for (var B = D / R[I].length, M = 0; M < R[I].length; M++)
                          this.idToNodeMap.get(R[I][M]).displacementX = B;
                      }
                    if (this.constraints.alignmentConstraint.horizontal)
                      for (var $ = this.constraints.alignmentConstraint.horizontal, I = 0; I < $.length; I++) {
                        for (var F = 0, M = 0; M < $[I].length; M++) {
                          if (this.fixedNodeSet.has($[I][M])) {
                            F = 0;
                            break;
                          }
                          F += this.idToNodeMap.get($[I][M]).displacementY;
                        }
                        for (var G = F / $[I].length, M = 0; M < $[I].length; M++)
                          this.idToNodeMap.get($[I][M]).displacementY = G;
                      }
                  }
                  if (this.constraints.relativePlacementConstraint)
                    if (m.RELAX_MOVEMENT_ON_CONSTRAINTS)
                      this.totalIterations % 10 == 0 && (this.shuffle(this.nodesInRelativeHorizontal), this.shuffle(this.nodesInRelativeVertical)), this.nodesInRelativeHorizontal.forEach(function(he) {
                        if (!S.fixedNodesOnHorizontal.has(he)) {
                          var K = 0;
                          S.dummyToNodeForVerticalAlignment.has(he) ? K = S.idToNodeMap.get(S.dummyToNodeForVerticalAlignment.get(he)[0]).displacementX : K = S.idToNodeMap.get(he).displacementX, S.nodeToRelativeConstraintMapHorizontal.get(he).forEach(function(Z) {
                            if (Z.right) {
                              var X = S.nodeToTempPositionMapHorizontal.get(Z.right) - S.nodeToTempPositionMapHorizontal.get(he) - K;
                              X < Z.gap && (K -= Z.gap - X);
                            } else {
                              var X = S.nodeToTempPositionMapHorizontal.get(he) - S.nodeToTempPositionMapHorizontal.get(Z.left) + K;
                              X < Z.gap && (K += Z.gap - X);
                            }
                          }), S.nodeToTempPositionMapHorizontal.set(he, S.nodeToTempPositionMapHorizontal.get(he) + K), S.dummyToNodeForVerticalAlignment.has(he) ? S.dummyToNodeForVerticalAlignment.get(he).forEach(function(Z) {
                            S.idToNodeMap.get(Z).displacementX = K;
                          }) : S.idToNodeMap.get(he).displacementX = K;
                        }
                      }), this.nodesInRelativeVertical.forEach(function(he) {
                        if (!S.fixedNodesOnHorizontal.has(he)) {
                          var K = 0;
                          S.dummyToNodeForHorizontalAlignment.has(he) ? K = S.idToNodeMap.get(S.dummyToNodeForHorizontalAlignment.get(he)[0]).displacementY : K = S.idToNodeMap.get(he).displacementY, S.nodeToRelativeConstraintMapVertical.get(he).forEach(function(Z) {
                            if (Z.bottom) {
                              var X = S.nodeToTempPositionMapVertical.get(Z.bottom) - S.nodeToTempPositionMapVertical.get(he) - K;
                              X < Z.gap && (K -= Z.gap - X);
                            } else {
                              var X = S.nodeToTempPositionMapVertical.get(he) - S.nodeToTempPositionMapVertical.get(Z.top) + K;
                              X < Z.gap && (K += Z.gap - X);
                            }
                          }), S.nodeToTempPositionMapVertical.set(he, S.nodeToTempPositionMapVertical.get(he) + K), S.dummyToNodeForHorizontalAlignment.has(he) ? S.dummyToNodeForHorizontalAlignment.get(he).forEach(function(Z) {
                            S.idToNodeMap.get(Z).displacementY = K;
                          }) : S.idToNodeMap.get(he).displacementY = K;
                        }
                      });
                    else {
                      for (var I = 0; I < this.componentsOnHorizontal.length; I++) {
                        var H = this.componentsOnHorizontal[I];
                        if (this.fixedComponentsOnHorizontal[I])
                          for (var M = 0; M < H.length; M++)
                            this.dummyToNodeForVerticalAlignment.has(H[M]) ? this.dummyToNodeForVerticalAlignment.get(H[M]).forEach(function(Z) {
                              S.idToNodeMap.get(Z).displacementX = 0;
                            }) : this.idToNodeMap.get(H[M]).displacementX = 0;
                        else {
                          for (var ee = 0, Y = 0, M = 0; M < H.length; M++)
                            if (this.dummyToNodeForVerticalAlignment.has(H[M])) {
                              var re = this.dummyToNodeForVerticalAlignment.get(H[M]);
                              ee += re.length * this.idToNodeMap.get(re[0]).displacementX, Y += re.length;
                            } else
                              ee += this.idToNodeMap.get(H[M]).displacementX, Y++;
                          for (var ne = ee / Y, M = 0; M < H.length; M++)
                            this.dummyToNodeForVerticalAlignment.has(H[M]) ? this.dummyToNodeForVerticalAlignment.get(H[M]).forEach(function(Z) {
                              S.idToNodeMap.get(Z).displacementX = ne;
                            }) : this.idToNodeMap.get(H[M]).displacementX = ne;
                        }
                      }
                      for (var I = 0; I < this.componentsOnVertical.length; I++) {
                        var H = this.componentsOnVertical[I];
                        if (this.fixedComponentsOnVertical[I])
                          for (var M = 0; M < H.length; M++)
                            this.dummyToNodeForHorizontalAlignment.has(H[M]) ? this.dummyToNodeForHorizontalAlignment.get(H[M]).forEach(function(X) {
                              S.idToNodeMap.get(X).displacementY = 0;
                            }) : this.idToNodeMap.get(H[M]).displacementY = 0;
                        else {
                          for (var ee = 0, Y = 0, M = 0; M < H.length; M++)
                            if (this.dummyToNodeForHorizontalAlignment.has(H[M])) {
                              var re = this.dummyToNodeForHorizontalAlignment.get(H[M]);
                              ee += re.length * this.idToNodeMap.get(re[0]).displacementY, Y += re.length;
                            } else
                              ee += this.idToNodeMap.get(H[M]).displacementY, Y++;
                          for (var ne = ee / Y, M = 0; M < H.length; M++)
                            this.dummyToNodeForHorizontalAlignment.has(H[M]) ? this.dummyToNodeForHorizontalAlignment.get(H[M]).forEach(function(j) {
                              S.idToNodeMap.get(j).displacementY = ne;
                            }) : this.idToNodeMap.get(H[M]).displacementY = ne;
                        }
                      }
                    }
                }, O.prototype.calculateNodesToApplyGravitationTo = function() {
                  var S = [], R, I = this.graphManager.getGraphs(), D = I.length, M;
                  for (M = 0; M < D; M++)
                    R = I[M], R.updateConnected(), R.isConnected || (S = S.concat(R.getNodes()));
                  return S;
                }, O.prototype.createBendpoints = function() {
                  var S = [];
                  S = S.concat(this.graphManager.getAllEdges());
                  var R = /* @__PURE__ */ new Set(), I;
                  for (I = 0; I < S.length; I++) {
                    var D = S[I];
                    if (!R.has(D)) {
                      var M = D.getSource(), B = D.getTarget();
                      if (M == B)
                        D.getBendpoints().push(new T()), D.getBendpoints().push(new T()), this.createDummyNodesForBendpoints(D), R.add(D);
                      else {
                        var $ = [];
                        if ($ = $.concat(M.getEdgeListToNode(B)), $ = $.concat(B.getEdgeListToNode(M)), !R.has($[0])) {
                          if ($.length > 1) {
                            var F;
                            for (F = 0; F < $.length; F++) {
                              var G = $[F];
                              G.getBendpoints().push(new T()), this.createDummyNodesForBendpoints(G);
                            }
                          }
                          $.forEach(function(H) {
                            R.add(H);
                          });
                        }
                      }
                    }
                    if (R.size == S.length)
                      break;
                  }
                }, O.prototype.positionNodesRadially = function(S) {
                  for (var R = new w(0, 0), I = Math.ceil(Math.sqrt(S.length)), D = 0, M = 0, B = 0, $ = new T(0, 0), F = 0; F < S.length; F++) {
                    F % I == 0 && (B = 0, M = D, F != 0 && (M += m.DEFAULT_COMPONENT_SEPERATION), D = 0);
                    var G = S[F], H = C.findCenterOfTree(G);
                    R.x = B, R.y = M, $ = O.radialLayout(G, H, R), $.y > D && (D = Math.floor($.y)), B = Math.floor($.x + m.DEFAULT_COMPONENT_SEPERATION);
                  }
                  this.transform(new T(b.WORLD_CENTER_X - $.x / 2, b.WORLD_CENTER_Y - $.y / 2));
                }, O.radialLayout = function(S, R, I) {
                  var D = Math.max(this.maxDiagonalInTree(S), m.DEFAULT_RADIAL_SEPARATION);
                  O.branchRadialLayout(R, null, 0, 359, 0, D);
                  var M = L.calculateBounds(S), B = new N();
                  B.setDeviceOrgX(M.getMinX()), B.setDeviceOrgY(M.getMinY()), B.setWorldOrgX(I.x), B.setWorldOrgY(I.y);
                  for (var $ = 0; $ < S.length; $++) {
                    var F = S[$];
                    F.transform(B);
                  }
                  var G = new T(M.getMaxX(), M.getMaxY());
                  return B.inverseTransformPoint(G);
                }, O.branchRadialLayout = function(S, R, I, D, M, B) {
                  var $ = (D - I + 1) / 2;
                  $ < 0 && ($ += 180);
                  var F = ($ + I) % 360, G = F * _.TWO_PI / 360, H = M * Math.cos(G), ee = M * Math.sin(G);
                  S.setCenter(H, ee);
                  var Y = [];
                  Y = Y.concat(S.getEdges());
                  var re = Y.length;
                  R != null && re--;
                  for (var ne = 0, he = Y.length, K, Z = S.getEdgesBetween(R); Z.length > 1; ) {
                    var X = Z[0];
                    Z.splice(0, 1);
                    var q = Y.indexOf(X);
                    q >= 0 && Y.splice(q, 1), he--, re--;
                  }
                  R != null ? K = (Y.indexOf(Z[0]) + 1) % he : K = 0;
                  for (var J = Math.abs(D - I) / re, j = K; ne != re; j = ++j % he) {
                    var pe = Y[j].getOtherEnd(S);
                    if (pe != R) {
                      var te = (I + ne * J) % 360, Ae = (te + J) % 360;
                      O.branchRadialLayout(pe, S, te, Ae, M + B, B), ne++;
                    }
                  }
                }, O.maxDiagonalInTree = function(S) {
                  for (var R = k.MIN_VALUE, I = 0; I < S.length; I++) {
                    var D = S[I], M = D.getDiagonal();
                    M > R && (R = M);
                  }
                  return R;
                }, O.prototype.calcRepulsionRange = function() {
                  return 2 * (this.level + 1) * this.idealEdgeLength;
                }, O.prototype.groupZeroDegreeMembers = function() {
                  var S = this, R = {};
                  this.memberGroups = {}, this.idToDummyNode = {};
                  for (var I = [], D = this.graphManager.getAllNodes(), M = 0; M < D.length; M++) {
                    var B = D[M], $ = B.getParent();
                    this.getNodeDegreeWithChildren(B) === 0 && ($.id == null || !this.getToBeTiled($)) && I.push(B);
                  }
                  for (var M = 0; M < I.length; M++) {
                    var B = I[M], F = B.getParent().id;
                    typeof R[F] > "u" && (R[F] = []), R[F] = R[F].concat(B);
                  }
                  Object.keys(R).forEach(function(G) {
                    if (R[G].length > 1) {
                      var H = "DummyCompound_" + G;
                      S.memberGroups[H] = R[G];
                      var ee = R[G][0].getParent(), Y = new p(S.graphManager);
                      Y.id = H, Y.paddingLeft = ee.paddingLeft || 0, Y.paddingRight = ee.paddingRight || 0, Y.paddingBottom = ee.paddingBottom || 0, Y.paddingTop = ee.paddingTop || 0, S.idToDummyNode[H] = Y;
                      var re = S.getGraphManager().add(S.newGraph(), Y), ne = ee.getChild();
                      ne.add(Y);
                      for (var he = 0; he < R[G].length; he++) {
                        var K = R[G][he];
                        ne.remove(K), re.add(K);
                      }
                    }
                  });
                }, O.prototype.clearCompounds = function() {
                  var S = {}, R = {};
                  this.performDFSOnCompounds();
                  for (var I = 0; I < this.compoundOrder.length; I++)
                    R[this.compoundOrder[I].id] = this.compoundOrder[I], S[this.compoundOrder[I].id] = [].concat(this.compoundOrder[I].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[I].getChild()), this.compoundOrder[I].child = null;
                  this.graphManager.resetAllNodes(), this.tileCompoundMembers(S, R);
                }, O.prototype.clearZeroDegreeMembers = function() {
                  var S = this, R = this.tiledZeroDegreePack = [];
                  Object.keys(this.memberGroups).forEach(function(I) {
                    var D = S.idToDummyNode[I];
                    if (R[I] = S.tileNodes(S.memberGroups[I], D.paddingLeft + D.paddingRight), D.rect.width = R[I].width, D.rect.height = R[I].height, D.setCenter(R[I].centerX, R[I].centerY), D.labelMarginLeft = 0, D.labelMarginTop = 0, m.NODE_DIMENSIONS_INCLUDE_LABELS) {
                      var M = D.rect.width, B = D.rect.height;
                      D.labelWidth && (D.labelPosHorizontal == "left" ? (D.rect.x -= D.labelWidth, D.setWidth(M + D.labelWidth), D.labelMarginLeft = D.labelWidth) : D.labelPosHorizontal == "center" && D.labelWidth > M ? (D.rect.x -= (D.labelWidth - M) / 2, D.setWidth(D.labelWidth), D.labelMarginLeft = (D.labelWidth - M) / 2) : D.labelPosHorizontal == "right" && D.setWidth(M + D.labelWidth)), D.labelHeight && (D.labelPosVertical == "top" ? (D.rect.y -= D.labelHeight, D.setHeight(B + D.labelHeight), D.labelMarginTop = D.labelHeight) : D.labelPosVertical == "center" && D.labelHeight > B ? (D.rect.y -= (D.labelHeight - B) / 2, D.setHeight(D.labelHeight), D.labelMarginTop = (D.labelHeight - B) / 2) : D.labelPosVertical == "bottom" && D.setHeight(B + D.labelHeight));
                    }
                  });
                }, O.prototype.repopulateCompounds = function() {
                  for (var S = this.compoundOrder.length - 1; S >= 0; S--) {
                    var R = this.compoundOrder[S], I = R.id, D = R.paddingLeft, M = R.paddingTop, B = R.labelMarginLeft, $ = R.labelMarginTop;
                    this.adjustLocations(this.tiledMemberPack[I], R.rect.x, R.rect.y, D, M, B, $);
                  }
                }, O.prototype.repopulateZeroDegreeMembers = function() {
                  var S = this, R = this.tiledZeroDegreePack;
                  Object.keys(R).forEach(function(I) {
                    var D = S.idToDummyNode[I], M = D.paddingLeft, B = D.paddingTop, $ = D.labelMarginLeft, F = D.labelMarginTop;
                    S.adjustLocations(R[I], D.rect.x, D.rect.y, M, B, $, F);
                  });
                }, O.prototype.getToBeTiled = function(S) {
                  var R = S.id;
                  if (this.toBeTiled[R] != null)
                    return this.toBeTiled[R];
                  var I = S.getChild();
                  if (I == null)
                    return this.toBeTiled[R] = !1, !1;
                  for (var D = I.getNodes(), M = 0; M < D.length; M++) {
                    var B = D[M];
                    if (this.getNodeDegree(B) > 0)
                      return this.toBeTiled[R] = !1, !1;
                    if (B.getChild() == null) {
                      this.toBeTiled[B.id] = !1;
                      continue;
                    }
                    if (!this.getToBeTiled(B))
                      return this.toBeTiled[R] = !1, !1;
                  }
                  return this.toBeTiled[R] = !0, !0;
                }, O.prototype.getNodeDegree = function(S) {
                  S.id;
                  for (var R = S.getEdges(), I = 0, D = 0; D < R.length; D++) {
                    var M = R[D];
                    M.getSource().id !== M.getTarget().id && (I = I + 1);
                  }
                  return I;
                }, O.prototype.getNodeDegreeWithChildren = function(S) {
                  var R = this.getNodeDegree(S);
                  if (S.getChild() == null)
                    return R;
                  for (var I = S.getChild().getNodes(), D = 0; D < I.length; D++) {
                    var M = I[D];
                    R += this.getNodeDegreeWithChildren(M);
                  }
                  return R;
                }, O.prototype.performDFSOnCompounds = function() {
                  this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
                }, O.prototype.fillCompexOrderByDFS = function(S) {
                  for (var R = 0; R < S.length; R++) {
                    var I = S[R];
                    I.getChild() != null && this.fillCompexOrderByDFS(I.getChild().getNodes()), this.getToBeTiled(I) && this.compoundOrder.push(I);
                  }
                }, O.prototype.adjustLocations = function(S, R, I, D, M, B, $) {
                  R += D + B, I += M + $;
                  for (var F = R, G = 0; G < S.rows.length; G++) {
                    var H = S.rows[G];
                    R = F;
                    for (var ee = 0, Y = 0; Y < H.length; Y++) {
                      var re = H[Y];
                      re.rect.x = R, re.rect.y = I, R += re.rect.width + S.horizontalPadding, re.rect.height > ee && (ee = re.rect.height);
                    }
                    I += ee + S.verticalPadding;
                  }
                }, O.prototype.tileCompoundMembers = function(S, R) {
                  var I = this;
                  this.tiledMemberPack = [], Object.keys(S).forEach(function(D) {
                    var M = R[D];
                    if (I.tiledMemberPack[D] = I.tileNodes(S[D], M.paddingLeft + M.paddingRight), M.rect.width = I.tiledMemberPack[D].width, M.rect.height = I.tiledMemberPack[D].height, M.setCenter(I.tiledMemberPack[D].centerX, I.tiledMemberPack[D].centerY), M.labelMarginLeft = 0, M.labelMarginTop = 0, m.NODE_DIMENSIONS_INCLUDE_LABELS) {
                      var B = M.rect.width, $ = M.rect.height;
                      M.labelWidth && (M.labelPosHorizontal == "left" ? (M.rect.x -= M.labelWidth, M.setWidth(B + M.labelWidth), M.labelMarginLeft = M.labelWidth) : M.labelPosHorizontal == "center" && M.labelWidth > B ? (M.rect.x -= (M.labelWidth - B) / 2, M.setWidth(M.labelWidth), M.labelMarginLeft = (M.labelWidth - B) / 2) : M.labelPosHorizontal == "right" && M.setWidth(B + M.labelWidth)), M.labelHeight && (M.labelPosVertical == "top" ? (M.rect.y -= M.labelHeight, M.setHeight($ + M.labelHeight), M.labelMarginTop = M.labelHeight) : M.labelPosVertical == "center" && M.labelHeight > $ ? (M.rect.y -= (M.labelHeight - $) / 2, M.setHeight(M.labelHeight), M.labelMarginTop = (M.labelHeight - $) / 2) : M.labelPosVertical == "bottom" && M.setHeight($ + M.labelHeight));
                    }
                  });
                }, O.prototype.tileNodes = function(S, R) {
                  var I = this.tileNodesByFavoringDim(S, R, !0), D = this.tileNodesByFavoringDim(S, R, !1), M = this.getOrgRatio(I), B = this.getOrgRatio(D), $;
                  return B < M ? $ = D : $ = I, $;
                }, O.prototype.getOrgRatio = function(S) {
                  var R = S.width, I = S.height, D = R / I;
                  return D < 1 && (D = 1 / D), D;
                }, O.prototype.calcIdealRowWidth = function(S, R) {
                  var I = m.TILING_PADDING_VERTICAL, D = m.TILING_PADDING_HORIZONTAL, M = S.length, B = 0, $ = 0, F = 0;
                  S.forEach(function(he) {
                    B += he.getWidth(), $ += he.getHeight(), he.getWidth() > F && (F = he.getWidth());
                  });
                  var G = B / M, H = $ / M, ee = Math.pow(I - D, 2) + 4 * (G + D) * (H + I) * M, Y = (D - I + Math.sqrt(ee)) / (2 * (G + D)), re;
                  R ? (re = Math.ceil(Y), re == Y && re++) : re = Math.floor(Y);
                  var ne = re * (G + D) - D;
                  return F > ne && (ne = F), ne += D * 2, ne;
                }, O.prototype.tileNodesByFavoringDim = function(S, R, I) {
                  var D = m.TILING_PADDING_VERTICAL, M = m.TILING_PADDING_HORIZONTAL, B = m.TILING_COMPARE_BY, $ = {
                    rows: [],
                    rowWidth: [],
                    rowHeight: [],
                    width: 0,
                    height: R,
                    // assume minHeight equals to minWidth
                    verticalPadding: D,
                    horizontalPadding: M,
                    centerX: 0,
                    centerY: 0
                  };
                  B && ($.idealRowWidth = this.calcIdealRowWidth(S, I));
                  var F = function(K) {
                    return K.rect.width * K.rect.height;
                  }, G = function(K, Z) {
                    return F(Z) - F(K);
                  };
                  S.sort(function(he, K) {
                    var Z = G;
                    return $.idealRowWidth ? (Z = B, Z(he.id, K.id)) : Z(he, K);
                  });
                  for (var H = 0, ee = 0, Y = 0; Y < S.length; Y++) {
                    var re = S[Y];
                    H += re.getCenterX(), ee += re.getCenterY();
                  }
                  $.centerX = H / S.length, $.centerY = ee / S.length;
                  for (var Y = 0; Y < S.length; Y++) {
                    var re = S[Y];
                    if ($.rows.length == 0)
                      this.insertNodeToRow($, re, 0, R);
                    else if (this.canAddHorizontal($, re.rect.width, re.rect.height)) {
                      var ne = $.rows.length - 1;
                      $.idealRowWidth || (ne = this.getShortestRowIndex($)), this.insertNodeToRow($, re, ne, R);
                    } else
                      this.insertNodeToRow($, re, $.rows.length, R);
                    this.shiftToLastRow($);
                  }
                  return $;
                }, O.prototype.insertNodeToRow = function(S, R, I, D) {
                  var M = D;
                  if (I == S.rows.length) {
                    var B = [];
                    S.rows.push(B), S.rowWidth.push(M), S.rowHeight.push(0);
                  }
                  var $ = S.rowWidth[I] + R.rect.width;
                  S.rows[I].length > 0 && ($ += S.horizontalPadding), S.rowWidth[I] = $, S.width < $ && (S.width = $);
                  var F = R.rect.height;
                  I > 0 && (F += S.verticalPadding);
                  var G = 0;
                  F > S.rowHeight[I] && (G = S.rowHeight[I], S.rowHeight[I] = F, G = S.rowHeight[I] - G), S.height += G, S.rows[I].push(R);
                }, O.prototype.getShortestRowIndex = function(S) {
                  for (var R = -1, I = Number.MAX_VALUE, D = 0; D < S.rows.length; D++)
                    S.rowWidth[D] < I && (R = D, I = S.rowWidth[D]);
                  return R;
                }, O.prototype.getLongestRowIndex = function(S) {
                  for (var R = -1, I = Number.MIN_VALUE, D = 0; D < S.rows.length; D++)
                    S.rowWidth[D] > I && (R = D, I = S.rowWidth[D]);
                  return R;
                }, O.prototype.canAddHorizontal = function(S, R, I) {
                  if (S.idealRowWidth) {
                    var D = S.rows.length - 1, M = S.rowWidth[D];
                    return M + R + S.horizontalPadding <= S.idealRowWidth;
                  }
                  var B = this.getShortestRowIndex(S);
                  if (B < 0)
                    return !0;
                  var $ = S.rowWidth[B];
                  if ($ + S.horizontalPadding + R <= S.width) return !0;
                  var F = 0;
                  S.rowHeight[B] < I && B > 0 && (F = I + S.verticalPadding - S.rowHeight[B]);
                  var G;
                  S.width - $ >= R + S.horizontalPadding ? G = (S.height + F) / ($ + R + S.horizontalPadding) : G = (S.height + F) / S.width, F = I + S.verticalPadding;
                  var H;
                  return S.width < R ? H = (S.height + F) / R : H = (S.height + F) / S.width, H < 1 && (H = 1 / H), G < 1 && (G = 1 / G), G < H;
                }, O.prototype.shiftToLastRow = function(S) {
                  var R = this.getLongestRowIndex(S), I = S.rowWidth.length - 1, D = S.rows[R], M = D[D.length - 1], B = M.width + S.horizontalPadding;
                  if (S.width - S.rowWidth[I] > B && R != I) {
                    D.splice(-1, 1), S.rows[I].push(M), S.rowWidth[R] = S.rowWidth[R] - B, S.rowWidth[I] = S.rowWidth[I] + B, S.width = S.rowWidth[instance.getLongestRowIndex(S)];
                    for (var $ = Number.MIN_VALUE, F = 0; F < D.length; F++)
                      D[F].height > $ && ($ = D[F].height);
                    R > 0 && ($ += S.verticalPadding);
                    var G = S.rowHeight[R] + S.rowHeight[I];
                    S.rowHeight[R] = $, S.rowHeight[I] < M.height + S.verticalPadding && (S.rowHeight[I] = M.height + S.verticalPadding);
                    var H = S.rowHeight[R] + S.rowHeight[I];
                    S.height += H - G, this.shiftToLastRow(S);
                  }
                }, O.prototype.tilingPreLayout = function() {
                  m.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers());
                }, O.prototype.tilingPostLayout = function() {
                  m.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds());
                }, O.prototype.reduceTrees = function() {
                  for (var S = [], R = !0, I; R; ) {
                    var D = this.graphManager.getAllNodes(), M = [];
                    R = !1;
                    for (var B = 0; B < D.length; B++)
                      if (I = D[B], I.getEdges().length == 1 && !I.getEdges()[0].isInterGraph && I.getChild() == null) {
                        if (m.PURE_INCREMENTAL) {
                          var $ = I.getEdges()[0].getOtherEnd(I), F = new E(I.getCenterX() - $.getCenterX(), I.getCenterY() - $.getCenterY());
                          M.push([I, I.getEdges()[0], I.getOwner(), F]);
                        } else
                          M.push([I, I.getEdges()[0], I.getOwner()]);
                        R = !0;
                      }
                    if (R == !0) {
                      for (var G = [], H = 0; H < M.length; H++)
                        M[H][0].getEdges().length == 1 && (G.push(M[H]), M[H][0].getOwner().remove(M[H][0]));
                      S.push(G), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
                    }
                  }
                  this.prunedNodesAll = S;
                }, O.prototype.growTree = function(S) {
                  for (var R = S.length, I = S[R - 1], D, M = 0; M < I.length; M++)
                    D = I[M], this.findPlaceforPrunedNode(D), D[2].add(D[0]), D[2].add(D[1], D[1].source, D[1].target);
                  S.splice(S.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
                }, O.prototype.findPlaceforPrunedNode = function(S) {
                  var R, I, D = S[0];
                  if (D == S[1].source ? I = S[1].target : I = S[1].source, m.PURE_INCREMENTAL)
                    D.setCenter(I.getCenterX() + S[3].getWidth(), I.getCenterY() + S[3].getHeight());
                  else {
                    var M = I.startX, B = I.finishX, $ = I.startY, F = I.finishY, G = 0, H = 0, ee = 0, Y = 0, re = [G, ee, H, Y];
                    if ($ > 0)
                      for (var ne = M; ne <= B; ne++)
                        re[0] += this.grid[ne][$ - 1].length + this.grid[ne][$].length - 1;
                    if (B < this.grid.length - 1)
                      for (var ne = $; ne <= F; ne++)
                        re[1] += this.grid[B + 1][ne].length + this.grid[B][ne].length - 1;
                    if (F < this.grid[0].length - 1)
                      for (var ne = M; ne <= B; ne++)
                        re[2] += this.grid[ne][F + 1].length + this.grid[ne][F].length - 1;
                    if (M > 0)
                      for (var ne = $; ne <= F; ne++)
                        re[3] += this.grid[M - 1][ne].length + this.grid[M][ne].length - 1;
                    for (var he = k.MAX_VALUE, K, Z, X = 0; X < re.length; X++)
                      re[X] < he ? (he = re[X], K = 1, Z = X) : re[X] == he && K++;
                    if (K == 3 && he == 0)
                      re[0] == 0 && re[1] == 0 && re[2] == 0 ? R = 1 : re[0] == 0 && re[1] == 0 && re[3] == 0 ? R = 0 : re[0] == 0 && re[2] == 0 && re[3] == 0 ? R = 3 : re[1] == 0 && re[2] == 0 && re[3] == 0 && (R = 2);
                    else if (K == 2 && he == 0) {
                      var q = Math.floor(Math.random() * 2);
                      re[0] == 0 && re[1] == 0 ? q == 0 ? R = 0 : R = 1 : re[0] == 0 && re[2] == 0 ? q == 0 ? R = 0 : R = 2 : re[0] == 0 && re[3] == 0 ? q == 0 ? R = 0 : R = 3 : re[1] == 0 && re[2] == 0 ? q == 0 ? R = 1 : R = 2 : re[1] == 0 && re[3] == 0 ? q == 0 ? R = 1 : R = 3 : q == 0 ? R = 2 : R = 3;
                    } else if (K == 4 && he == 0) {
                      var q = Math.floor(Math.random() * 4);
                      R = q;
                    } else
                      R = Z;
                    R == 0 ? D.setCenter(I.getCenterX(), I.getCenterY() - I.getHeight() / 2 - y.DEFAULT_EDGE_LENGTH - D.getHeight() / 2) : R == 1 ? D.setCenter(I.getCenterX() + I.getWidth() / 2 + y.DEFAULT_EDGE_LENGTH + D.getWidth() / 2, I.getCenterY()) : R == 2 ? D.setCenter(I.getCenterX(), I.getCenterY() + I.getHeight() / 2 + y.DEFAULT_EDGE_LENGTH + D.getHeight() / 2) : D.setCenter(I.getCenterX() - I.getWidth() / 2 - y.DEFAULT_EDGE_LENGTH - D.getWidth() / 2, I.getCenterY());
                  }
                }, o.exports = O;
              }
            ),
            /***/
            991: (
              /***/
              (o, l, u) => {
                var h = u(551).FDLayoutNode, d = u(551).IMath;
                function f(g, m, v, y) {
                  h.call(this, g, m, v, y);
                }
                f.prototype = Object.create(h.prototype);
                for (var p in h)
                  f[p] = h[p];
                f.prototype.calculateDisplacement = function() {
                  var g = this.graphManager.getLayout();
                  this.getChild() != null && this.fixedNodeWeight ? (this.displacementX += g.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight, this.displacementY += g.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight) : (this.displacementX += g.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY += g.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren), Math.abs(this.displacementX) > g.coolingFactor * g.maxNodeDisplacement && (this.displacementX = g.coolingFactor * g.maxNodeDisplacement * d.sign(this.displacementX)), Math.abs(this.displacementY) > g.coolingFactor * g.maxNodeDisplacement && (this.displacementY = g.coolingFactor * g.maxNodeDisplacement * d.sign(this.displacementY)), this.child && this.child.getNodes().length > 0 && this.propogateDisplacementToChildren(this.displacementX, this.displacementY);
                }, f.prototype.propogateDisplacementToChildren = function(g, m) {
                  for (var v = this.getChild().getNodes(), y, b = 0; b < v.length; b++)
                    y = v[b], y.getChild() == null ? (y.displacementX += g, y.displacementY += m) : y.propogateDisplacementToChildren(g, m);
                }, f.prototype.move = function() {
                  var g = this.graphManager.getLayout();
                  (this.child == null || this.child.getNodes().length == 0) && (this.moveBy(this.displacementX, this.displacementY), g.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY)), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0;
                }, f.prototype.setPred1 = function(g) {
                  this.pred1 = g;
                }, f.prototype.getPred1 = function() {
                  return pred1;
                }, f.prototype.getPred2 = function() {
                  return pred2;
                }, f.prototype.setNext = function(g) {
                  this.next = g;
                }, f.prototype.getNext = function() {
                  return next;
                }, f.prototype.setProcessed = function(g) {
                  this.processed = g;
                }, f.prototype.isProcessed = function() {
                  return processed;
                }, o.exports = f;
              }
            ),
            /***/
            902: (
              /***/
              (o, l, u) => {
                function h(v) {
                  if (Array.isArray(v)) {
                    for (var y = 0, b = Array(v.length); y < v.length; y++)
                      b[y] = v[y];
                    return b;
                  } else
                    return Array.from(v);
                }
                var d = u(806), f = u(551).LinkedList, p = u(551).Matrix, g = u(551).SVD;
                function m() {
                }
                m.handleConstraints = function(v) {
                  var y = {};
                  y.fixedNodeConstraint = v.constraints.fixedNodeConstraint, y.alignmentConstraint = v.constraints.alignmentConstraint, y.relativePlacementConstraint = v.constraints.relativePlacementConstraint;
                  for (var b = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = [], E = [], C = v.getAllNodes(), k = 0, _ = 0; _ < C.length; _++) {
                    var L = C[_];
                    L.getChild() == null && (w.set(L.id, k++), T.push(L.getCenterX()), E.push(L.getCenterY()), b.set(L.id, L));
                  }
                  y.relativePlacementConstraint && y.relativePlacementConstraint.forEach(function(ce) {
                    !ce.gap && ce.gap != 0 && (ce.left ? ce.gap = d.DEFAULT_EDGE_LENGTH + b.get(ce.left).getWidth() / 2 + b.get(ce.right).getWidth() / 2 : ce.gap = d.DEFAULT_EDGE_LENGTH + b.get(ce.top).getHeight() / 2 + b.get(ce.bottom).getHeight() / 2);
                  });
                  var N = function(z, oe) {
                    return { x: z.x - oe.x, y: z.y - oe.y };
                  }, A = function(z) {
                    var oe = 0, se = 0;
                    return z.forEach(function(ge) {
                      oe += T[w.get(ge)], se += E[w.get(ge)];
                    }), { x: oe / z.size, y: se / z.size };
                  }, O = function(z, oe, se, ge, de) {
                    function be(Be, He) {
                      var ht = new Set(Be), st = !0, We = !1, kt = void 0;
                      try {
                        for (var qe = He[Symbol.iterator](), rt; !(st = (rt = qe.next()).done); st = !0) {
                          var ct = rt.value;
                          ht.add(ct);
                        }
                      } catch (ut) {
                        We = !0, kt = ut;
                      } finally {
                        try {
                          !st && qe.return && qe.return();
                        } finally {
                          if (We)
                            throw kt;
                        }
                      }
                      return ht;
                    }
                    var Ce = /* @__PURE__ */ new Map();
                    z.forEach(function(Be, He) {
                      Ce.set(He, 0);
                    }), z.forEach(function(Be, He) {
                      Be.forEach(function(ht) {
                        Ce.set(ht.id, Ce.get(ht.id) + 1);
                      });
                    });
                    var Te = /* @__PURE__ */ new Map(), Ne = /* @__PURE__ */ new Map(), Xe = new f();
                    Ce.forEach(function(Be, He) {
                      Be == 0 ? (Xe.push(He), se || (oe == "horizontal" ? Te.set(He, w.has(He) ? T[w.get(He)] : ge.get(He)) : Te.set(He, w.has(He) ? E[w.get(He)] : ge.get(He)))) : Te.set(He, Number.NEGATIVE_INFINITY), se && Ne.set(He, /* @__PURE__ */ new Set([He]));
                    }), se && de.forEach(function(Be) {
                      var He = [];
                      if (Be.forEach(function(We) {
                        se.has(We) && He.push(We);
                      }), He.length > 0) {
                        var ht = 0;
                        He.forEach(function(We) {
                          oe == "horizontal" ? (Te.set(We, w.has(We) ? T[w.get(We)] : ge.get(We)), ht += Te.get(We)) : (Te.set(We, w.has(We) ? E[w.get(We)] : ge.get(We)), ht += Te.get(We));
                        }), ht = ht / He.length, Be.forEach(function(We) {
                          se.has(We) || Te.set(We, ht);
                        });
                      } else {
                        var st = 0;
                        Be.forEach(function(We) {
                          oe == "horizontal" ? st += w.has(We) ? T[w.get(We)] : ge.get(We) : st += w.has(We) ? E[w.get(We)] : ge.get(We);
                        }), st = st / Be.length, Be.forEach(function(We) {
                          Te.set(We, st);
                        });
                      }
                    });
                    for (var Ye = function() {
                      var He = Xe.shift(), ht = z.get(He);
                      ht.forEach(function(st) {
                        if (Te.get(st.id) < Te.get(He) + st.gap)
                          if (se && se.has(st.id)) {
                            var We = void 0;
                            if (oe == "horizontal" ? We = w.has(st.id) ? T[w.get(st.id)] : ge.get(st.id) : We = w.has(st.id) ? E[w.get(st.id)] : ge.get(st.id), Te.set(st.id, We), We < Te.get(He) + st.gap) {
                              var kt = Te.get(He) + st.gap - We;
                              Ne.get(He).forEach(function(qe) {
                                Te.set(qe, Te.get(qe) - kt);
                              });
                            }
                          } else
                            Te.set(st.id, Te.get(He) + st.gap);
                        Ce.set(st.id, Ce.get(st.id) - 1), Ce.get(st.id) == 0 && Xe.push(st.id), se && Ne.set(st.id, be(Ne.get(He), Ne.get(st.id)));
                      });
                    }; Xe.length != 0; )
                      Ye();
                    if (se) {
                      var Ke = /* @__PURE__ */ new Set();
                      z.forEach(function(Be, He) {
                        Be.length == 0 && Ke.add(He);
                      });
                      var Ze = [];
                      Ne.forEach(function(Be, He) {
                        if (Ke.has(He)) {
                          var ht = !1, st = !0, We = !1, kt = void 0;
                          try {
                            for (var qe = Be[Symbol.iterator](), rt; !(st = (rt = qe.next()).done); st = !0) {
                              var ct = rt.value;
                              se.has(ct) && (ht = !0);
                            }
                          } catch (bt) {
                            We = !0, kt = bt;
                          } finally {
                            try {
                              !st && qe.return && qe.return();
                            } finally {
                              if (We)
                                throw kt;
                            }
                          }
                          if (!ht) {
                            var ut = !1, nt = void 0;
                            Ze.forEach(function(bt, Zt) {
                              bt.has([].concat(h(Be))[0]) && (ut = !0, nt = Zt);
                            }), ut ? Be.forEach(function(bt) {
                              Ze[nt].add(bt);
                            }) : Ze.push(new Set(Be));
                          }
                        }
                      }), Ze.forEach(function(Be, He) {
                        var ht = Number.POSITIVE_INFINITY, st = Number.POSITIVE_INFINITY, We = Number.NEGATIVE_INFINITY, kt = Number.NEGATIVE_INFINITY, qe = !0, rt = !1, ct = void 0;
                        try {
                          for (var ut = Be[Symbol.iterator](), nt; !(qe = (nt = ut.next()).done); qe = !0) {
                            var bt = nt.value, Zt = void 0;
                            oe == "horizontal" ? Zt = w.has(bt) ? T[w.get(bt)] : ge.get(bt) : Zt = w.has(bt) ? E[w.get(bt)] : ge.get(bt);
                            var Ot = Te.get(bt);
                            Zt < ht && (ht = Zt), Zt > We && (We = Zt), Ot < st && (st = Ot), Ot > kt && (kt = Ot);
                          }
                        } catch (Ee) {
                          rt = !0, ct = Ee;
                        } finally {
                          try {
                            !qe && ut.return && ut.return();
                          } finally {
                            if (rt)
                              throw ct;
                          }
                        }
                        var tr = (ht + We) / 2 - (st + kt) / 2, xr = !0, rr = !1, Wt = void 0;
                        try {
                          for (var lr = Be[Symbol.iterator](), an; !(xr = (an = lr.next()).done); xr = !0) {
                            var dt = an.value;
                            Te.set(dt, Te.get(dt) + tr);
                          }
                        } catch (Ee) {
                          rr = !0, Wt = Ee;
                        } finally {
                          try {
                            !xr && lr.return && lr.return();
                          } finally {
                            if (rr)
                              throw Wt;
                          }
                        }
                      });
                    }
                    return Te;
                  }, P = function(z) {
                    var oe = 0, se = 0, ge = 0, de = 0;
                    if (z.forEach(function(Ne) {
                      Ne.left ? T[w.get(Ne.left)] - T[w.get(Ne.right)] >= 0 ? oe++ : se++ : E[w.get(Ne.top)] - E[w.get(Ne.bottom)] >= 0 ? ge++ : de++;
                    }), oe > se && ge > de)
                      for (var be = 0; be < w.size; be++)
                        T[be] = -1 * T[be], E[be] = -1 * E[be];
                    else if (oe > se)
                      for (var Ce = 0; Ce < w.size; Ce++)
                        T[Ce] = -1 * T[Ce];
                    else if (ge > de)
                      for (var Te = 0; Te < w.size; Te++)
                        E[Te] = -1 * E[Te];
                  }, S = function(z) {
                    var oe = [], se = new f(), ge = /* @__PURE__ */ new Set(), de = 0;
                    return z.forEach(function(be, Ce) {
                      if (!ge.has(Ce)) {
                        oe[de] = [];
                        var Te = Ce;
                        for (se.push(Te), ge.add(Te), oe[de].push(Te); se.length != 0; ) {
                          Te = se.shift();
                          var Ne = z.get(Te);
                          Ne.forEach(function(Xe) {
                            ge.has(Xe.id) || (se.push(Xe.id), ge.add(Xe.id), oe[de].push(Xe.id));
                          });
                        }
                        de++;
                      }
                    }), oe;
                  }, R = function(z) {
                    var oe = /* @__PURE__ */ new Map();
                    return z.forEach(function(se, ge) {
                      oe.set(ge, []);
                    }), z.forEach(function(se, ge) {
                      se.forEach(function(de) {
                        oe.get(ge).push(de), oe.get(de.id).push({ id: ge, gap: de.gap, direction: de.direction });
                      });
                    }), oe;
                  }, I = function(z) {
                    var oe = /* @__PURE__ */ new Map();
                    return z.forEach(function(se, ge) {
                      oe.set(ge, []);
                    }), z.forEach(function(se, ge) {
                      se.forEach(function(de) {
                        oe.get(de.id).push({ id: ge, gap: de.gap, direction: de.direction });
                      });
                    }), oe;
                  }, D = [], M = [], B = !1, $ = !1, F = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), ee = [];
                  if (y.fixedNodeConstraint && y.fixedNodeConstraint.forEach(function(ce) {
                    F.add(ce.nodeId);
                  }), y.relativePlacementConstraint && (y.relativePlacementConstraint.forEach(function(ce) {
                    ce.left ? (G.has(ce.left) ? G.get(ce.left).push({ id: ce.right, gap: ce.gap, direction: "horizontal" }) : G.set(ce.left, [{ id: ce.right, gap: ce.gap, direction: "horizontal" }]), G.has(ce.right) || G.set(ce.right, [])) : (G.has(ce.top) ? G.get(ce.top).push({ id: ce.bottom, gap: ce.gap, direction: "vertical" }) : G.set(ce.top, [{ id: ce.bottom, gap: ce.gap, direction: "vertical" }]), G.has(ce.bottom) || G.set(ce.bottom, []));
                  }), H = R(G), ee = S(H)), d.TRANSFORM_ON_CONSTRAINT_HANDLING) {
                    if (y.fixedNodeConstraint && y.fixedNodeConstraint.length > 1)
                      y.fixedNodeConstraint.forEach(function(ce, z) {
                        D[z] = [ce.position.x, ce.position.y], M[z] = [T[w.get(ce.nodeId)], E[w.get(ce.nodeId)]];
                      }), B = !0;
                    else if (y.alignmentConstraint)
                      (function() {
                        var ce = 0;
                        if (y.alignmentConstraint.vertical) {
                          for (var z = y.alignmentConstraint.vertical, oe = function(Te) {
                            var Ne = /* @__PURE__ */ new Set();
                            z[Te].forEach(function(Ke) {
                              Ne.add(Ke);
                            });
                            var Xe = new Set([].concat(h(Ne)).filter(function(Ke) {
                              return F.has(Ke);
                            })), Ye = void 0;
                            Xe.size > 0 ? Ye = T[w.get(Xe.values().next().value)] : Ye = A(Ne).x, z[Te].forEach(function(Ke) {
                              D[ce] = [Ye, E[w.get(Ke)]], M[ce] = [T[w.get(Ke)], E[w.get(Ke)]], ce++;
                            });
                          }, se = 0; se < z.length; se++)
                            oe(se);
                          B = !0;
                        }
                        if (y.alignmentConstraint.horizontal) {
                          for (var ge = y.alignmentConstraint.horizontal, de = function(Te) {
                            var Ne = /* @__PURE__ */ new Set();
                            ge[Te].forEach(function(Ke) {
                              Ne.add(Ke);
                            });
                            var Xe = new Set([].concat(h(Ne)).filter(function(Ke) {
                              return F.has(Ke);
                            })), Ye = void 0;
                            Xe.size > 0 ? Ye = T[w.get(Xe.values().next().value)] : Ye = A(Ne).y, ge[Te].forEach(function(Ke) {
                              D[ce] = [T[w.get(Ke)], Ye], M[ce] = [T[w.get(Ke)], E[w.get(Ke)]], ce++;
                            });
                          }, be = 0; be < ge.length; be++)
                            de(be);
                          B = !0;
                        }
                        y.relativePlacementConstraint && ($ = !0);
                      })();
                    else if (y.relativePlacementConstraint) {
                      for (var Y = 0, re = 0, ne = 0; ne < ee.length; ne++)
                        ee[ne].length > Y && (Y = ee[ne].length, re = ne);
                      if (Y < H.size / 2)
                        P(y.relativePlacementConstraint), B = !1, $ = !1;
                      else {
                        var he = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Z = [];
                        ee[re].forEach(function(ce) {
                          G.get(ce).forEach(function(z) {
                            z.direction == "horizontal" ? (he.has(ce) ? he.get(ce).push(z) : he.set(ce, [z]), he.has(z.id) || he.set(z.id, []), Z.push({ left: ce, right: z.id })) : (K.has(ce) ? K.get(ce).push(z) : K.set(ce, [z]), K.has(z.id) || K.set(z.id, []), Z.push({ top: ce, bottom: z.id }));
                          });
                        }), P(Z), $ = !1;
                        var X = O(he, "horizontal"), q = O(K, "vertical");
                        ee[re].forEach(function(ce, z) {
                          M[z] = [T[w.get(ce)], E[w.get(ce)]], D[z] = [], X.has(ce) ? D[z][0] = X.get(ce) : D[z][0] = T[w.get(ce)], q.has(ce) ? D[z][1] = q.get(ce) : D[z][1] = E[w.get(ce)];
                        }), B = !0;
                      }
                    }
                    if (B) {
                      for (var J = void 0, j = p.transpose(D), pe = p.transpose(M), te = 0; te < j.length; te++)
                        j[te] = p.multGamma(j[te]), pe[te] = p.multGamma(pe[te]);
                      var Ae = p.multMat(j, p.transpose(pe)), W = g.svd(Ae);
                      J = p.multMat(W.V, p.transpose(W.U));
                      for (var Oe = 0; Oe < w.size; Oe++) {
                        var ue = [T[Oe], E[Oe]], Ve = [J[0][0], J[1][0]], Ge = [J[0][1], J[1][1]];
                        T[Oe] = p.dotProduct(ue, Ve), E[Oe] = p.dotProduct(ue, Ge);
                      }
                      $ && P(y.relativePlacementConstraint);
                    }
                  }
                  if (d.ENFORCE_CONSTRAINTS) {
                    if (y.fixedNodeConstraint && y.fixedNodeConstraint.length > 0) {
                      var Ue = { x: 0, y: 0 };
                      y.fixedNodeConstraint.forEach(function(ce, z) {
                        var oe = { x: T[w.get(ce.nodeId)], y: E[w.get(ce.nodeId)] }, se = ce.position, ge = N(se, oe);
                        Ue.x += ge.x, Ue.y += ge.y;
                      }), Ue.x /= y.fixedNodeConstraint.length, Ue.y /= y.fixedNodeConstraint.length, T.forEach(function(ce, z) {
                        T[z] += Ue.x;
                      }), E.forEach(function(ce, z) {
                        E[z] += Ue.y;
                      }), y.fixedNodeConstraint.forEach(function(ce) {
                        T[w.get(ce.nodeId)] = ce.position.x, E[w.get(ce.nodeId)] = ce.position.y;
                      });
                    }
                    if (y.alignmentConstraint) {
                      if (y.alignmentConstraint.vertical)
                        for (var ke = y.alignmentConstraint.vertical, Pe = function(z) {
                          var oe = /* @__PURE__ */ new Set();
                          ke[z].forEach(function(de) {
                            oe.add(de);
                          });
                          var se = new Set([].concat(h(oe)).filter(function(de) {
                            return F.has(de);
                          })), ge = void 0;
                          se.size > 0 ? ge = T[w.get(se.values().next().value)] : ge = A(oe).x, oe.forEach(function(de) {
                            F.has(de) || (T[w.get(de)] = ge);
                          });
                        }, Se = 0; Se < ke.length; Se++)
                          Pe(Se);
                      if (y.alignmentConstraint.horizontal)
                        for (var _e = y.alignmentConstraint.horizontal, ze = function(z) {
                          var oe = /* @__PURE__ */ new Set();
                          _e[z].forEach(function(de) {
                            oe.add(de);
                          });
                          var se = new Set([].concat(h(oe)).filter(function(de) {
                            return F.has(de);
                          })), ge = void 0;
                          se.size > 0 ? ge = E[w.get(se.values().next().value)] : ge = A(oe).y, oe.forEach(function(de) {
                            F.has(de) || (E[w.get(de)] = ge);
                          });
                        }, me = 0; me < _e.length; me++)
                          ze(me);
                    }
                    y.relativePlacementConstraint && function() {
                      var ce = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map(), ge = /* @__PURE__ */ new Map(), de = /* @__PURE__ */ new Map(), be = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Set();
                      if (F.forEach(function(Tt) {
                        be.add(Tt), Ce.add(Tt);
                      }), y.alignmentConstraint) {
                        if (y.alignmentConstraint.vertical)
                          for (var Te = y.alignmentConstraint.vertical, Ne = function(lt) {
                            oe.set("dummy" + lt, []), Te[lt].forEach(function(je) {
                              ce.set(je, "dummy" + lt), oe.get("dummy" + lt).push(je), F.has(je) && be.add("dummy" + lt);
                            }), ge.set("dummy" + lt, T[w.get(Te[lt][0])]);
                          }, Xe = 0; Xe < Te.length; Xe++)
                            Ne(Xe);
                        if (y.alignmentConstraint.horizontal)
                          for (var Ye = y.alignmentConstraint.horizontal, Ke = function(lt) {
                            se.set("dummy" + lt, []), Ye[lt].forEach(function(je) {
                              z.set(je, "dummy" + lt), se.get("dummy" + lt).push(je), F.has(je) && Ce.add("dummy" + lt);
                            }), de.set("dummy" + lt, E[w.get(Ye[lt][0])]);
                          }, Ze = 0; Ze < Ye.length; Ze++)
                            Ke(Ze);
                      }
                      var Be = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map(), ht = function(lt) {
                        G.get(lt).forEach(function(je) {
                          var jt = void 0, fe = void 0;
                          je.direction == "horizontal" ? (jt = ce.get(lt) ? ce.get(lt) : lt, ce.get(je.id) ? fe = { id: ce.get(je.id), gap: je.gap, direction: je.direction } : fe = je, Be.has(jt) ? Be.get(jt).push(fe) : Be.set(jt, [fe]), Be.has(fe.id) || Be.set(fe.id, [])) : (jt = z.get(lt) ? z.get(lt) : lt, z.get(je.id) ? fe = { id: z.get(je.id), gap: je.gap, direction: je.direction } : fe = je, He.has(jt) ? He.get(jt).push(fe) : He.set(jt, [fe]), He.has(fe.id) || He.set(fe.id, []));
                        });
                      }, st = !0, We = !1, kt = void 0;
                      try {
                        for (var qe = G.keys()[Symbol.iterator](), rt; !(st = (rt = qe.next()).done); st = !0) {
                          var ct = rt.value;
                          ht(ct);
                        }
                      } catch (Tt) {
                        We = !0, kt = Tt;
                      } finally {
                        try {
                          !st && qe.return && qe.return();
                        } finally {
                          if (We)
                            throw kt;
                        }
                      }
                      var ut = R(Be), nt = R(He), bt = S(ut), Zt = S(nt), Ot = I(Be), tr = I(He), xr = [], rr = [];
                      bt.forEach(function(Tt, lt) {
                        xr[lt] = [], Tt.forEach(function(je) {
                          Ot.get(je).length == 0 && xr[lt].push(je);
                        });
                      }), Zt.forEach(function(Tt, lt) {
                        rr[lt] = [], Tt.forEach(function(je) {
                          tr.get(je).length == 0 && rr[lt].push(je);
                        });
                      });
                      var Wt = O(Be, "horizontal", be, ge, xr), lr = O(He, "vertical", Ce, de, rr), an = function(lt) {
                        oe.get(lt) ? oe.get(lt).forEach(function(je) {
                          T[w.get(je)] = Wt.get(lt);
                        }) : T[w.get(lt)] = Wt.get(lt);
                      }, dt = !0, Ee = !1, Je = void 0;
                      try {
                        for (var wt = Wt.keys()[Symbol.iterator](), sr; !(dt = (sr = wt.next()).done); dt = !0) {
                          var Ur = sr.value;
                          an(Ur);
                        }
                      } catch (Tt) {
                        Ee = !0, Je = Tt;
                      } finally {
                        try {
                          !dt && wt.return && wt.return();
                        } finally {
                          if (Ee)
                            throw Je;
                        }
                      }
                      var cr = function(lt) {
                        se.get(lt) ? se.get(lt).forEach(function(je) {
                          E[w.get(je)] = lr.get(lt);
                        }) : E[w.get(lt)] = lr.get(lt);
                      }, Yr = !0, pi = !1, xn = void 0;
                      try {
                        for (var bn = lr.keys()[Symbol.iterator](), pt; !(Yr = (pt = bn.next()).done); Yr = !0) {
                          var Ur = pt.value;
                          cr(Ur);
                        }
                      } catch (Tt) {
                        pi = !0, xn = Tt;
                      } finally {
                        try {
                          !Yr && bn.return && bn.return();
                        } finally {
                          if (pi)
                            throw xn;
                        }
                      }
                    }();
                  }
                  for (var Me = 0; Me < C.length; Me++) {
                    var Q = C[Me];
                    Q.getChild() == null && Q.setCenter(T[w.get(Q.id)], E[w.get(Q.id)]);
                  }
                }, o.exports = m;
              }
            ),
            /***/
            551: (
              /***/
              (o) => {
                o.exports = r;
              }
            )
            /******/
          }, i = {};
          function a(o) {
            var l = i[o];
            if (l !== void 0)
              return l.exports;
            var u = i[o] = {
              /******/
              // no module.id needed
              /******/
              // no module.loaded needed
              /******/
              exports: {}
              /******/
            };
            return n[o](u, u.exports, a), u.exports;
          }
          var s = a(45);
          return s;
        })()
      );
    });
  }(z5)), z5.exports;
}
(function(t, e) {
  (function(n, i) {
    t.exports = i(LNe());
  })(ro, function(r) {
    return (
      /******/
      (() => {
        var n = {
          /***/
          658: (
            /***/
            (o) => {
              o.exports = Object.assign != null ? Object.assign.bind(Object) : function(l) {
                for (var u = arguments.length, h = Array(u > 1 ? u - 1 : 0), d = 1; d < u; d++)
                  h[d - 1] = arguments[d];
                return h.forEach(function(f) {
                  Object.keys(f).forEach(function(p) {
                    return l[p] = f[p];
                  });
                }), l;
              };
            }
          ),
          /***/
          548: (
            /***/
            (o, l, u) => {
              var h = /* @__PURE__ */ function() {
                function p(g, m) {
                  var v = [], y = !0, b = !1, w = void 0;
                  try {
                    for (var T = g[Symbol.iterator](), E; !(y = (E = T.next()).done) && (v.push(E.value), !(m && v.length === m)); y = !0)
                      ;
                  } catch (C) {
                    b = !0, w = C;
                  } finally {
                    try {
                      !y && T.return && T.return();
                    } finally {
                      if (b) throw w;
                    }
                  }
                  return v;
                }
                return function(g, m) {
                  if (Array.isArray(g))
                    return g;
                  if (Symbol.iterator in Object(g))
                    return p(g, m);
                  throw new TypeError("Invalid attempt to destructure non-iterable instance");
                };
              }(), d = u(140).layoutBase.LinkedList, f = {};
              f.getTopMostNodes = function(p) {
                for (var g = {}, m = 0; m < p.length; m++)
                  g[p[m].id()] = !0;
                var v = p.filter(function(y, b) {
                  typeof y == "number" && (y = b);
                  for (var w = y.parent()[0]; w != null; ) {
                    if (g[w.id()])
                      return !1;
                    w = w.parent()[0];
                  }
                  return !0;
                });
                return v;
              }, f.connectComponents = function(p, g, m, v) {
                var y = new d(), b = /* @__PURE__ */ new Set(), w = [], T = void 0, E = void 0, C = void 0, k = !1, _ = 1, L = [], N = [], A = function() {
                  var P = p.collection();
                  N.push(P);
                  var S = m[0], R = p.collection();
                  R.merge(S).merge(S.descendants().intersection(g)), w.push(S), R.forEach(function(M) {
                    y.push(M), b.add(M), P.merge(M);
                  });
                  for (var I = function() {
                    S = y.shift();
                    var B = p.collection();
                    S.neighborhood().nodes().forEach(function(H) {
                      g.intersection(S.edgesWith(H)).length > 0 && B.merge(H);
                    });
                    for (var $ = 0; $ < B.length; $++) {
                      var F = B[$];
                      if (T = m.intersection(F.union(F.ancestors())), T != null && !b.has(T[0])) {
                        var G = T.union(T.descendants());
                        G.forEach(function(H) {
                          y.push(H), b.add(H), P.merge(H), m.has(H) && w.push(H);
                        });
                      }
                    }
                  }; y.length != 0; )
                    I();
                  if (P.forEach(function(M) {
                    g.intersection(M.connectedEdges()).forEach(function(B) {
                      P.has(B.source()) && P.has(B.target()) && P.merge(B);
                    });
                  }), w.length == m.length && (k = !0), !k || k && _ > 1) {
                    E = w[0], C = E.connectedEdges().length, w.forEach(function(M) {
                      M.connectedEdges().length < C && (C = M.connectedEdges().length, E = M);
                    }), L.push(E.id());
                    var D = p.collection();
                    D.merge(w[0]), w.forEach(function(M) {
                      D.merge(M);
                    }), w = [], m = m.difference(D), _++;
                  }
                };
                do
                  A();
                while (!k);
                return v && L.length > 0 && v.set("dummy" + (v.size + 1), L), N;
              }, f.relocateComponent = function(p, g, m) {
                if (!m.fixedNodeConstraint) {
                  var v = Number.POSITIVE_INFINITY, y = Number.NEGATIVE_INFINITY, b = Number.POSITIVE_INFINITY, w = Number.NEGATIVE_INFINITY;
                  if (m.quality == "draft") {
                    var T = !0, E = !1, C = void 0;
                    try {
                      for (var k = g.nodeIndexes[Symbol.iterator](), _; !(T = (_ = k.next()).done); T = !0) {
                        var L = _.value, N = h(L, 2), A = N[0], O = N[1], P = m.cy.getElementById(A);
                        if (P) {
                          var S = P.boundingBox(), R = g.xCoords[O] - S.w / 2, I = g.xCoords[O] + S.w / 2, D = g.yCoords[O] - S.h / 2, M = g.yCoords[O] + S.h / 2;
                          R < v && (v = R), I > y && (y = I), D < b && (b = D), M > w && (w = M);
                        }
                      }
                    } catch (H) {
                      E = !0, C = H;
                    } finally {
                      try {
                        !T && k.return && k.return();
                      } finally {
                        if (E)
                          throw C;
                      }
                    }
                    var B = p.x - (y + v) / 2, $ = p.y - (w + b) / 2;
                    g.xCoords = g.xCoords.map(function(H) {
                      return H + B;
                    }), g.yCoords = g.yCoords.map(function(H) {
                      return H + $;
                    });
                  } else {
                    Object.keys(g).forEach(function(H) {
                      var ee = g[H], Y = ee.getRect().x, re = ee.getRect().x + ee.getRect().width, ne = ee.getRect().y, he = ee.getRect().y + ee.getRect().height;
                      Y < v && (v = Y), re > y && (y = re), ne < b && (b = ne), he > w && (w = he);
                    });
                    var F = p.x - (y + v) / 2, G = p.y - (w + b) / 2;
                    Object.keys(g).forEach(function(H) {
                      var ee = g[H];
                      ee.setCenter(ee.getCenterX() + F, ee.getCenterY() + G);
                    });
                  }
                }
              }, f.calcBoundingBox = function(p, g, m, v) {
                for (var y = Number.MAX_SAFE_INTEGER, b = Number.MIN_SAFE_INTEGER, w = Number.MAX_SAFE_INTEGER, T = Number.MIN_SAFE_INTEGER, E = void 0, C = void 0, k = void 0, _ = void 0, L = p.descendants().not(":parent"), N = L.length, A = 0; A < N; A++) {
                  var O = L[A];
                  E = g[v.get(O.id())] - O.width() / 2, C = g[v.get(O.id())] + O.width() / 2, k = m[v.get(O.id())] - O.height() / 2, _ = m[v.get(O.id())] + O.height() / 2, y > E && (y = E), b < C && (b = C), w > k && (w = k), T < _ && (T = _);
                }
                var P = {};
                return P.topLeftX = y, P.topLeftY = w, P.width = b - y, P.height = T - w, P;
              }, f.calcParentsWithoutChildren = function(p, g) {
                var m = p.collection();
                return g.nodes(":parent").forEach(function(v) {
                  var y = !1;
                  v.children().forEach(function(b) {
                    b.css("display") != "none" && (y = !0);
                  }), y || m.merge(v);
                }), m;
              }, o.exports = f;
            }
          ),
          /***/
          816: (
            /***/
            (o, l, u) => {
              var h = u(548), d = u(140).CoSELayout, f = u(140).CoSENode, p = u(140).layoutBase.PointD, g = u(140).layoutBase.DimensionD, m = u(140).layoutBase.LayoutConstants, v = u(140).layoutBase.FDLayoutConstants, y = u(140).CoSEConstants, b = function(T, E) {
                var C = T.cy, k = T.eles, _ = k.nodes(), L = k.edges(), N = void 0, A = void 0, O = void 0, P = {};
                T.randomize && (N = E.nodeIndexes, A = E.xCoords, O = E.yCoords);
                var S = function(H) {
                  return typeof H == "function";
                }, R = function(H, ee) {
                  return S(H) ? H(ee) : H;
                }, I = h.calcParentsWithoutChildren(C, k), D = function G(H, ee, Y, re) {
                  for (var ne = ee.length, he = 0; he < ne; he++) {
                    var K = ee[he], Z = null;
                    K.intersection(I).length == 0 && (Z = K.children());
                    var X = void 0, q = K.layoutDimensions({
                      nodeDimensionsIncludeLabels: re.nodeDimensionsIncludeLabels
                    });
                    if (K.outerWidth() != null && K.outerHeight() != null)
                      if (re.randomize)
                        if (!K.isParent())
                          X = H.add(new f(Y.graphManager, new p(A[N.get(K.id())] - q.w / 2, O[N.get(K.id())] - q.h / 2), new g(parseFloat(q.w), parseFloat(q.h))));
                        else {
                          var J = h.calcBoundingBox(K, A, O, N);
                          K.intersection(I).length == 0 ? X = H.add(new f(Y.graphManager, new p(J.topLeftX, J.topLeftY), new g(J.width, J.height))) : X = H.add(new f(Y.graphManager, new p(J.topLeftX, J.topLeftY), new g(parseFloat(q.w), parseFloat(q.h))));
                        }
                      else
                        X = H.add(new f(Y.graphManager, new p(K.position("x") - q.w / 2, K.position("y") - q.h / 2), new g(parseFloat(q.w), parseFloat(q.h))));
                    else
                      X = H.add(new f(this.graphManager));
                    if (X.id = K.data("id"), X.nodeRepulsion = R(re.nodeRepulsion, K), X.paddingLeft = parseInt(K.css("padding")), X.paddingTop = parseInt(K.css("padding")), X.paddingRight = parseInt(K.css("padding")), X.paddingBottom = parseInt(K.css("padding")), re.nodeDimensionsIncludeLabels && (X.labelWidth = K.boundingBox({ includeLabels: !0, includeNodes: !1, includeOverlays: !1 }).w, X.labelHeight = K.boundingBox({ includeLabels: !0, includeNodes: !1, includeOverlays: !1 }).h, X.labelPosVertical = K.css("text-valign"), X.labelPosHorizontal = K.css("text-halign")), P[K.data("id")] = X, isNaN(X.rect.x) && (X.rect.x = 0), isNaN(X.rect.y) && (X.rect.y = 0), Z != null && Z.length > 0) {
                      var j = void 0;
                      j = Y.getGraphManager().add(Y.newGraph(), X), G(j, Z, Y, re);
                    }
                  }
                }, M = function(H, ee, Y) {
                  for (var re = 0, ne = 0, he = 0; he < Y.length; he++) {
                    var K = Y[he], Z = P[K.data("source")], X = P[K.data("target")];
                    if (Z && X && Z !== X && Z.getEdgesBetween(X).length == 0) {
                      var q = ee.add(H.newEdge(), Z, X);
                      q.id = K.id(), q.idealLength = R(T.idealEdgeLength, K), q.edgeElasticity = R(T.edgeElasticity, K), re += q.idealLength, ne++;
                    }
                  }
                  T.idealEdgeLength != null && (ne > 0 ? y.DEFAULT_EDGE_LENGTH = v.DEFAULT_EDGE_LENGTH = re / ne : S(T.idealEdgeLength) ? y.DEFAULT_EDGE_LENGTH = v.DEFAULT_EDGE_LENGTH = 50 : y.DEFAULT_EDGE_LENGTH = v.DEFAULT_EDGE_LENGTH = T.idealEdgeLength, y.MIN_REPULSION_DIST = v.MIN_REPULSION_DIST = v.DEFAULT_EDGE_LENGTH / 10, y.DEFAULT_RADIAL_SEPARATION = v.DEFAULT_EDGE_LENGTH);
                }, B = function(H, ee) {
                  ee.fixedNodeConstraint && (H.constraints.fixedNodeConstraint = ee.fixedNodeConstraint), ee.alignmentConstraint && (H.constraints.alignmentConstraint = ee.alignmentConstraint), ee.relativePlacementConstraint && (H.constraints.relativePlacementConstraint = ee.relativePlacementConstraint);
                };
                T.nestingFactor != null && (y.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = v.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = T.nestingFactor), T.gravity != null && (y.DEFAULT_GRAVITY_STRENGTH = v.DEFAULT_GRAVITY_STRENGTH = T.gravity), T.numIter != null && (y.MAX_ITERATIONS = v.MAX_ITERATIONS = T.numIter), T.gravityRange != null && (y.DEFAULT_GRAVITY_RANGE_FACTOR = v.DEFAULT_GRAVITY_RANGE_FACTOR = T.gravityRange), T.gravityCompound != null && (y.DEFAULT_COMPOUND_GRAVITY_STRENGTH = v.DEFAULT_COMPOUND_GRAVITY_STRENGTH = T.gravityCompound), T.gravityRangeCompound != null && (y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = v.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = T.gravityRangeCompound), T.initialEnergyOnIncremental != null && (y.DEFAULT_COOLING_FACTOR_INCREMENTAL = v.DEFAULT_COOLING_FACTOR_INCREMENTAL = T.initialEnergyOnIncremental), T.tilingCompareBy != null && (y.TILING_COMPARE_BY = T.tilingCompareBy), T.quality == "proof" ? m.QUALITY = 2 : m.QUALITY = 0, y.NODE_DIMENSIONS_INCLUDE_LABELS = v.NODE_DIMENSIONS_INCLUDE_LABELS = m.NODE_DIMENSIONS_INCLUDE_LABELS = T.nodeDimensionsIncludeLabels, y.DEFAULT_INCREMENTAL = v.DEFAULT_INCREMENTAL = m.DEFAULT_INCREMENTAL = !T.randomize, y.ANIMATE = v.ANIMATE = m.ANIMATE = T.animate, y.TILE = T.tile, y.TILING_PADDING_VERTICAL = typeof T.tilingPaddingVertical == "function" ? T.tilingPaddingVertical.call() : T.tilingPaddingVertical, y.TILING_PADDING_HORIZONTAL = typeof T.tilingPaddingHorizontal == "function" ? T.tilingPaddingHorizontal.call() : T.tilingPaddingHorizontal, y.DEFAULT_INCREMENTAL = v.DEFAULT_INCREMENTAL = m.DEFAULT_INCREMENTAL = !0, y.PURE_INCREMENTAL = !T.randomize, m.DEFAULT_UNIFORM_LEAF_NODE_SIZES = T.uniformNodeDimensions, T.step == "transformed" && (y.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, y.ENFORCE_CONSTRAINTS = !1, y.APPLY_LAYOUT = !1), T.step == "enforced" && (y.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, y.ENFORCE_CONSTRAINTS = !0, y.APPLY_LAYOUT = !1), T.step == "cose" && (y.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, y.ENFORCE_CONSTRAINTS = !1, y.APPLY_LAYOUT = !0), T.step == "all" && (T.randomize ? y.TRANSFORM_ON_CONSTRAINT_HANDLING = !0 : y.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, y.ENFORCE_CONSTRAINTS = !0, y.APPLY_LAYOUT = !0), T.fixedNodeConstraint || T.alignmentConstraint || T.relativePlacementConstraint ? y.TREE_REDUCTION_ON_INCREMENTAL = !1 : y.TREE_REDUCTION_ON_INCREMENTAL = !0;
                var $ = new d(), F = $.newGraphManager();
                return D(F.addRoot(), h.getTopMostNodes(_), $, T), M($, F, L), B($, T), $.runLayout(), P;
              };
              o.exports = { coseLayout: b };
            }
          ),
          /***/
          212: (
            /***/
            (o, l, u) => {
              var h = /* @__PURE__ */ function() {
                function T(E, C) {
                  for (var k = 0; k < C.length; k++) {
                    var _ = C[k];
                    _.enumerable = _.enumerable || !1, _.configurable = !0, "value" in _ && (_.writable = !0), Object.defineProperty(E, _.key, _);
                  }
                }
                return function(E, C, k) {
                  return C && T(E.prototype, C), k && T(E, k), E;
                };
              }();
              function d(T, E) {
                if (!(T instanceof E))
                  throw new TypeError("Cannot call a class as a function");
              }
              var f = u(658), p = u(548), g = u(657), m = g.spectralLayout, v = u(816), y = v.coseLayout, b = Object.freeze({
                // 'draft', 'default' or 'proof' 
                // - 'draft' only applies spectral layout 
                // - 'default' improves the quality with subsequent CoSE layout (fast cooling rate)
                // - 'proof' improves the quality with subsequent CoSE layout (slow cooling rate) 
                quality: "default",
                // Use random node positions at beginning of layout
                // if this is set to false, then quality option must be "proof"
                randomize: !0,
                // Whether or not to animate the layout
                animate: !0,
                // Duration of animation in ms, if enabled
                animationDuration: 1e3,
                // Easing of animation, if enabled
                animationEasing: void 0,
                // Fit the viewport to the repositioned nodes
                fit: !0,
                // Padding around layout
                padding: 30,
                // Whether to include labels in node dimensions. Valid in "proof" quality
                nodeDimensionsIncludeLabels: !1,
                // Whether or not simple nodes (non-compound nodes) are of uniform dimensions
                uniformNodeDimensions: !1,
                // Whether to pack disconnected components - valid only if randomize: true
                packComponents: !0,
                // Layout step - all, transformed, enforced, cose - for debug purpose only
                step: "all",
                /* spectral layout options */
                // False for random, true for greedy
                samplingType: !0,
                // Sample size to construct distance matrix
                sampleSize: 25,
                // Separation amount between nodes
                nodeSeparation: 75,
                // Power iteration tolerance
                piTol: 1e-7,
                /* CoSE layout options */
                // Node repulsion (non overlapping) multiplier
                nodeRepulsion: function(E) {
                  return 4500;
                },
                // Ideal edge (non nested) length
                idealEdgeLength: function(E) {
                  return 50;
                },
                // Divisor to compute edge forces
                edgeElasticity: function(E) {
                  return 0.45;
                },
                // Nesting factor (multiplier) to compute ideal edge length for nested edges
                nestingFactor: 0.1,
                // Gravity force (constant)
                gravity: 0.25,
                // Maximum number of iterations to perform
                numIter: 2500,
                // For enabling tiling
                tile: !0,
                // The function that specifies the criteria for comparing nodes while sorting them during tiling operation.
                // Takes the node id as a parameter and the default tiling operation is perfomed when this option is not set.
                tilingCompareBy: void 0,
                // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
                tilingPaddingVertical: 10,
                // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
                tilingPaddingHorizontal: 10,
                // Gravity range (constant) for compounds
                gravityRangeCompound: 1.5,
                // Gravity force (constant) for compounds
                gravityCompound: 1,
                // Gravity range (constant)
                gravityRange: 3.8,
                // Initial cooling factor for incremental layout  
                initialEnergyOnIncremental: 0.3,
                /* constraint options */
                // Fix required nodes to predefined positions
                // [{nodeId: 'n1', position: {x: 100, y: 200}, {...}]
                fixedNodeConstraint: void 0,
                // Align required nodes in vertical/horizontal direction
                // {vertical: [['n1', 'n2')], ['n3', 'n4']], horizontal: ['n2', 'n4']}
                alignmentConstraint: void 0,
                // Place two nodes relatively in vertical/horizontal direction 
                // [{top: 'n1', bottom: 'n2', gap: 100}, {left: 'n3', right: 'n4', gap: 75}]
                relativePlacementConstraint: void 0,
                /* layout event callbacks */
                ready: function() {
                },
                // on layoutready
                stop: function() {
                }
                // on layoutstop
              }), w = function() {
                function T(E) {
                  d(this, T), this.options = f({}, b, E);
                }
                return h(T, [{
                  key: "run",
                  value: function() {
                    var C = this, k = this.options, _ = k.cy, L = k.eles, N = [], A = [], O = void 0, P = [];
                    k.fixedNodeConstraint && (!Array.isArray(k.fixedNodeConstraint) || k.fixedNodeConstraint.length == 0) && (k.fixedNodeConstraint = void 0), k.alignmentConstraint && (k.alignmentConstraint.vertical && (!Array.isArray(k.alignmentConstraint.vertical) || k.alignmentConstraint.vertical.length == 0) && (k.alignmentConstraint.vertical = void 0), k.alignmentConstraint.horizontal && (!Array.isArray(k.alignmentConstraint.horizontal) || k.alignmentConstraint.horizontal.length == 0) && (k.alignmentConstraint.horizontal = void 0)), k.relativePlacementConstraint && (!Array.isArray(k.relativePlacementConstraint) || k.relativePlacementConstraint.length == 0) && (k.relativePlacementConstraint = void 0);
                    var S = k.fixedNodeConstraint || k.alignmentConstraint || k.relativePlacementConstraint;
                    S && (k.tile = !1, k.packComponents = !1);
                    var R = void 0, I = !1;
                    if (_.layoutUtilities && k.packComponents && (R = _.layoutUtilities("get"), R || (R = _.layoutUtilities()), I = !0), L.nodes().length > 0)
                      if (I) {
                        var B = p.getTopMostNodes(k.eles.nodes());
                        if (O = p.connectComponents(_, k.eles, B), O.forEach(function(Ae) {
                          var W = Ae.boundingBox();
                          P.push({ x: W.x1 + W.w / 2, y: W.y1 + W.h / 2 });
                        }), k.randomize && O.forEach(function(Ae) {
                          k.eles = Ae, N.push(m(k));
                        }), k.quality == "default" || k.quality == "proof") {
                          var $ = _.collection();
                          if (k.tile) {
                            var F = /* @__PURE__ */ new Map(), G = [], H = [], ee = 0, Y = { nodeIndexes: F, xCoords: G, yCoords: H }, re = [];
                            if (O.forEach(function(Ae, W) {
                              Ae.edges().length == 0 && (Ae.nodes().forEach(function(Oe, ue) {
                                $.merge(Ae.nodes()[ue]), Oe.isParent() || (Y.nodeIndexes.set(Ae.nodes()[ue].id(), ee++), Y.xCoords.push(Ae.nodes()[0].position().x), Y.yCoords.push(Ae.nodes()[0].position().y));
                              }), re.push(W));
                            }), $.length > 1) {
                              var ne = $.boundingBox();
                              P.push({ x: ne.x1 + ne.w / 2, y: ne.y1 + ne.h / 2 }), O.push($), N.push(Y);
                              for (var he = re.length - 1; he >= 0; he--)
                                O.splice(re[he], 1), N.splice(re[he], 1), P.splice(re[he], 1);
                            }
                          }
                          O.forEach(function(Ae, W) {
                            k.eles = Ae, A.push(y(k, N[W])), p.relocateComponent(P[W], A[W], k);
                          });
                        } else
                          O.forEach(function(Ae, W) {
                            p.relocateComponent(P[W], N[W], k);
                          });
                        var K = /* @__PURE__ */ new Set();
                        if (O.length > 1) {
                          var Z = [], X = L.filter(function(Ae) {
                            return Ae.css("display") == "none";
                          });
                          O.forEach(function(Ae, W) {
                            var Oe = void 0;
                            if (k.quality == "draft" && (Oe = N[W].nodeIndexes), Ae.nodes().not(X).length > 0) {
                              var ue = {};
                              ue.edges = [], ue.nodes = [];
                              var Ve = void 0;
                              Ae.nodes().not(X).forEach(function(Ge) {
                                if (k.quality == "draft")
                                  if (!Ge.isParent())
                                    Ve = Oe.get(Ge.id()), ue.nodes.push({ x: N[W].xCoords[Ve] - Ge.boundingbox().w / 2, y: N[W].yCoords[Ve] - Ge.boundingbox().h / 2, width: Ge.boundingbox().w, height: Ge.boundingbox().h });
                                  else {
                                    var Ue = p.calcBoundingBox(Ge, N[W].xCoords, N[W].yCoords, Oe);
                                    ue.nodes.push({ x: Ue.topLeftX, y: Ue.topLeftY, width: Ue.width, height: Ue.height });
                                  }
                                else
                                  A[W][Ge.id()] && ue.nodes.push({ x: A[W][Ge.id()].getLeft(), y: A[W][Ge.id()].getTop(), width: A[W][Ge.id()].getWidth(), height: A[W][Ge.id()].getHeight() });
                              }), Ae.edges().forEach(function(Ge) {
                                var Ue = Ge.source(), ke = Ge.target();
                                if (Ue.css("display") != "none" && ke.css("display") != "none")
                                  if (k.quality == "draft") {
                                    var Pe = Oe.get(Ue.id()), Se = Oe.get(ke.id()), _e = [], ze = [];
                                    if (Ue.isParent()) {
                                      var me = p.calcBoundingBox(Ue, N[W].xCoords, N[W].yCoords, Oe);
                                      _e.push(me.topLeftX + me.width / 2), _e.push(me.topLeftY + me.height / 2);
                                    } else
                                      _e.push(N[W].xCoords[Pe]), _e.push(N[W].yCoords[Pe]);
                                    if (ke.isParent()) {
                                      var Me = p.calcBoundingBox(ke, N[W].xCoords, N[W].yCoords, Oe);
                                      ze.push(Me.topLeftX + Me.width / 2), ze.push(Me.topLeftY + Me.height / 2);
                                    } else
                                      ze.push(N[W].xCoords[Se]), ze.push(N[W].yCoords[Se]);
                                    ue.edges.push({ startX: _e[0], startY: _e[1], endX: ze[0], endY: ze[1] });
                                  } else
                                    A[W][Ue.id()] && A[W][ke.id()] && ue.edges.push({ startX: A[W][Ue.id()].getCenterX(), startY: A[W][Ue.id()].getCenterY(), endX: A[W][ke.id()].getCenterX(), endY: A[W][ke.id()].getCenterY() });
                              }), ue.nodes.length > 0 && (Z.push(ue), K.add(W));
                            }
                          });
                          var q = R.packComponents(Z, k.randomize).shifts;
                          if (k.quality == "draft")
                            N.forEach(function(Ae, W) {
                              var Oe = Ae.xCoords.map(function(Ve) {
                                return Ve + q[W].dx;
                              }), ue = Ae.yCoords.map(function(Ve) {
                                return Ve + q[W].dy;
                              });
                              Ae.xCoords = Oe, Ae.yCoords = ue;
                            });
                          else {
                            var J = 0;
                            K.forEach(function(Ae) {
                              Object.keys(A[Ae]).forEach(function(W) {
                                var Oe = A[Ae][W];
                                Oe.setCenter(Oe.getCenterX() + q[J].dx, Oe.getCenterY() + q[J].dy);
                              }), J++;
                            });
                          }
                        }
                      } else {
                        var D = k.eles.boundingBox();
                        if (P.push({ x: D.x1 + D.w / 2, y: D.y1 + D.h / 2 }), k.randomize) {
                          var M = m(k);
                          N.push(M);
                        }
                        k.quality == "default" || k.quality == "proof" ? (A.push(y(k, N[0])), p.relocateComponent(P[0], A[0], k)) : p.relocateComponent(P[0], N[0], k);
                      }
                    var j = function(W, Oe) {
                      if (k.quality == "default" || k.quality == "proof") {
                        typeof W == "number" && (W = Oe);
                        var ue = void 0, Ve = void 0, Ge = W.data("id");
                        return A.forEach(function(ke) {
                          Ge in ke && (ue = { x: ke[Ge].getRect().getCenterX(), y: ke[Ge].getRect().getCenterY() }, Ve = ke[Ge]);
                        }), k.nodeDimensionsIncludeLabels && (Ve.labelWidth && (Ve.labelPosHorizontal == "left" ? ue.x += Ve.labelWidth / 2 : Ve.labelPosHorizontal == "right" && (ue.x -= Ve.labelWidth / 2)), Ve.labelHeight && (Ve.labelPosVertical == "top" ? ue.y += Ve.labelHeight / 2 : Ve.labelPosVertical == "bottom" && (ue.y -= Ve.labelHeight / 2))), ue == null && (ue = { x: W.position("x"), y: W.position("y") }), {
                          x: ue.x,
                          y: ue.y
                        };
                      } else {
                        var Ue = void 0;
                        return N.forEach(function(ke) {
                          var Pe = ke.nodeIndexes.get(W.id());
                          Pe != null && (Ue = { x: ke.xCoords[Pe], y: ke.yCoords[Pe] });
                        }), Ue == null && (Ue = { x: W.position("x"), y: W.position("y") }), {
                          x: Ue.x,
                          y: Ue.y
                        };
                      }
                    };
                    if (k.quality == "default" || k.quality == "proof" || k.randomize) {
                      var pe = p.calcParentsWithoutChildren(_, L), te = L.filter(function(Ae) {
                        return Ae.css("display") == "none";
                      });
                      k.eles = L.not(te), L.nodes().not(":parent").not(te).layoutPositions(C, k, j), pe.length > 0 && pe.forEach(function(Ae) {
                        Ae.position(j(Ae));
                      });
                    } else
                      console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.");
                  }
                }]), T;
              }();
              o.exports = w;
            }
          ),
          /***/
          657: (
            /***/
            (o, l, u) => {
              var h = u(548), d = u(140).layoutBase.Matrix, f = u(140).layoutBase.SVD, p = function(m) {
                var v = m.cy, y = m.eles, b = y.nodes(), w = y.nodes(":parent"), T = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), k = [], _ = [], L = [], N = [], A = [], O = [], P = [], S = [], R = void 0, I = 1e8, D = 1e-9, M = m.piTol, B = m.samplingType, $ = m.nodeSeparation, F = void 0, G = function() {
                  for (var z = 0, oe = 0, se = !1; oe < F; ) {
                    z = Math.floor(Math.random() * R), se = !1;
                    for (var ge = 0; ge < oe; ge++)
                      if (N[ge] == z) {
                        se = !0;
                        break;
                      }
                    if (!se)
                      N[oe] = z, oe++;
                    else
                      continue;
                  }
                }, H = function(z, oe, se) {
                  for (var ge = [], de = 0, be = 0, Ce = 0, Te = void 0, Ne = [], Xe = 0, Ye = 1, Ke = 0; Ke < R; Ke++)
                    Ne[Ke] = I;
                  for (ge[be] = z, Ne[z] = 0; be >= de; ) {
                    Ce = ge[de++];
                    for (var Ze = k[Ce], Be = 0; Be < Ze.length; Be++)
                      Te = E.get(Ze[Be]), Ne[Te] == I && (Ne[Te] = Ne[Ce] + 1, ge[++be] = Te);
                    O[Ce][oe] = Ne[Ce] * $;
                  }
                  if (se) {
                    for (var He = 0; He < R; He++)
                      O[He][oe] < A[He] && (A[He] = O[He][oe]);
                    for (var ht = 0; ht < R; ht++)
                      A[ht] > Xe && (Xe = A[ht], Ye = ht);
                  }
                  return Ye;
                }, ee = function(z) {
                  var oe = void 0;
                  if (z) {
                    oe = Math.floor(Math.random() * R);
                    for (var ge = 0; ge < R; ge++)
                      A[ge] = I;
                    for (var de = 0; de < F; de++)
                      N[de] = oe, oe = H(oe, de, z);
                  } else {
                    G();
                    for (var se = 0; se < F; se++)
                      H(N[se], se, z);
                  }
                  for (var be = 0; be < R; be++)
                    for (var Ce = 0; Ce < F; Ce++)
                      O[be][Ce] *= O[be][Ce];
                  for (var Te = 0; Te < F; Te++)
                    P[Te] = [];
                  for (var Ne = 0; Ne < F; Ne++)
                    for (var Xe = 0; Xe < F; Xe++)
                      P[Ne][Xe] = O[N[Xe]][Ne];
                }, Y = function() {
                  for (var z = f.svd(P), oe = z.S, se = z.U, ge = z.V, de = oe[0] * oe[0] * oe[0], be = [], Ce = 0; Ce < F; Ce++) {
                    be[Ce] = [];
                    for (var Te = 0; Te < F; Te++)
                      be[Ce][Te] = 0, Ce == Te && (be[Ce][Te] = oe[Ce] / (oe[Ce] * oe[Ce] + de / (oe[Ce] * oe[Ce])));
                  }
                  S = d.multMat(d.multMat(ge, be), d.transpose(se));
                }, re = function() {
                  for (var z = void 0, oe = void 0, se = [], ge = [], de = [], be = [], Ce = 0; Ce < R; Ce++)
                    se[Ce] = Math.random(), ge[Ce] = Math.random();
                  se = d.normalize(se), ge = d.normalize(ge);
                  for (var Te = D, Ne = D, Xe = void 0; ; ) {
                    for (var Ye = 0; Ye < R; Ye++)
                      de[Ye] = se[Ye];
                    if (se = d.multGamma(d.multL(d.multGamma(de), O, S)), z = d.dotProduct(de, se), se = d.normalize(se), Te = d.dotProduct(de, se), Xe = Math.abs(Te / Ne), Xe <= 1 + M && Xe >= 1)
                      break;
                    Ne = Te;
                  }
                  for (var Ke = 0; Ke < R; Ke++)
                    de[Ke] = se[Ke];
                  for (Ne = D; ; ) {
                    for (var Ze = 0; Ze < R; Ze++)
                      be[Ze] = ge[Ze];
                    if (be = d.minusOp(be, d.multCons(de, d.dotProduct(de, be))), ge = d.multGamma(d.multL(d.multGamma(be), O, S)), oe = d.dotProduct(be, ge), ge = d.normalize(ge), Te = d.dotProduct(be, ge), Xe = Math.abs(Te / Ne), Xe <= 1 + M && Xe >= 1)
                      break;
                    Ne = Te;
                  }
                  for (var Be = 0; Be < R; Be++)
                    be[Be] = ge[Be];
                  _ = d.multCons(de, Math.sqrt(Math.abs(z))), L = d.multCons(be, Math.sqrt(Math.abs(oe)));
                };
                h.connectComponents(v, y, h.getTopMostNodes(b), T), w.forEach(function(ce) {
                  h.connectComponents(v, y, h.getTopMostNodes(ce.descendants().intersection(y)), T);
                });
                for (var ne = 0, he = 0; he < b.length; he++)
                  b[he].isParent() || E.set(b[he].id(), ne++);
                var K = !0, Z = !1, X = void 0;
                try {
                  for (var q = T.keys()[Symbol.iterator](), J; !(K = (J = q.next()).done); K = !0) {
                    var j = J.value;
                    E.set(j, ne++);
                  }
                } catch (ce) {
                  Z = !0, X = ce;
                } finally {
                  try {
                    !K && q.return && q.return();
                  } finally {
                    if (Z)
                      throw X;
                  }
                }
                for (var pe = 0; pe < E.size; pe++)
                  k[pe] = [];
                w.forEach(function(ce) {
                  for (var z = ce.children().intersection(y); z.nodes(":childless").length == 0; )
                    z = z.nodes()[0].children().intersection(y);
                  var oe = 0, se = z.nodes(":childless")[0].connectedEdges().length;
                  z.nodes(":childless").forEach(function(ge, de) {
                    ge.connectedEdges().length < se && (se = ge.connectedEdges().length, oe = de);
                  }), C.set(ce.id(), z.nodes(":childless")[oe].id());
                }), b.forEach(function(ce) {
                  var z = void 0;
                  ce.isParent() ? z = E.get(C.get(ce.id())) : z = E.get(ce.id()), ce.neighborhood().nodes().forEach(function(oe) {
                    y.intersection(ce.edgesWith(oe)).length > 0 && (oe.isParent() ? k[z].push(C.get(oe.id())) : k[z].push(oe.id()));
                  });
                });
                var te = function(z) {
                  var oe = E.get(z), se = void 0;
                  T.get(z).forEach(function(ge) {
                    v.getElementById(ge).isParent() ? se = C.get(ge) : se = ge, k[oe].push(se), k[E.get(se)].push(z);
                  });
                }, Ae = !0, W = !1, Oe = void 0;
                try {
                  for (var ue = T.keys()[Symbol.iterator](), Ve; !(Ae = (Ve = ue.next()).done); Ae = !0) {
                    var Ge = Ve.value;
                    te(Ge);
                  }
                } catch (ce) {
                  W = !0, Oe = ce;
                } finally {
                  try {
                    !Ae && ue.return && ue.return();
                  } finally {
                    if (W)
                      throw Oe;
                  }
                }
                R = E.size;
                var Ue = void 0;
                if (R > 2) {
                  F = R < m.sampleSize ? R : m.sampleSize;
                  for (var ke = 0; ke < R; ke++)
                    O[ke] = [];
                  for (var Pe = 0; Pe < F; Pe++)
                    S[Pe] = [];
                  return m.quality == "draft" || m.step == "all" ? (ee(B), Y(), re(), Ue = { nodeIndexes: E, xCoords: _, yCoords: L }) : (E.forEach(function(ce, z) {
                    _.push(v.getElementById(z).position("x")), L.push(v.getElementById(z).position("y"));
                  }), Ue = { nodeIndexes: E, xCoords: _, yCoords: L }), Ue;
                } else {
                  var Se = E.keys(), _e = v.getElementById(Se.next().value), ze = _e.position(), me = _e.outerWidth();
                  if (_.push(ze.x), L.push(ze.y), R == 2) {
                    var Me = v.getElementById(Se.next().value), Q = Me.outerWidth();
                    _.push(ze.x + me / 2 + Q / 2 + m.idealEdgeLength), L.push(ze.y);
                  }
                  return Ue = { nodeIndexes: E, xCoords: _, yCoords: L }, Ue;
                }
              };
              o.exports = { spectralLayout: p };
            }
          ),
          /***/
          579: (
            /***/
            (o, l, u) => {
              var h = u(212), d = function(p) {
                p && p("layout", "fcose", h);
              };
              typeof cytoscape < "u" && d(cytoscape), o.exports = d;
            }
          ),
          /***/
          140: (
            /***/
            (o) => {
              o.exports = r;
            }
          )
          /******/
        }, i = {};
        function a(o) {
          var l = i[o];
          if (l !== void 0)
            return l.exports;
          var u = i[o] = {
            /******/
            // no module.id needed
            /******/
            // no module.loaded needed
            /******/
            exports: {}
            /******/
          };
          return n[o](u, u.exports, a), u.exports;
        }
        var s = a(579);
        return s;
      })()
    );
  });
})(OY);
var RNe = OY.exports;
const NNe = /* @__PURE__ */ bf(RNe);
var aM = {
  L: "left",
  R: "right",
  T: "top",
  B: "bottom"
}, sM = {
  L: /* @__PURE__ */ x((t) => `${t},${t / 2} 0,${t} 0,0`, "L"),
  R: /* @__PURE__ */ x((t) => `0,${t / 2} ${t},0 ${t},${t}`, "R"),
  T: /* @__PURE__ */ x((t) => `0,0 ${t},0 ${t / 2},${t}`, "T"),
  B: /* @__PURE__ */ x((t) => `${t / 2},0 ${t},${t} 0,${t}`, "B")
}, Om = {
  L: /* @__PURE__ */ x((t, e) => t - e + 2, "L"),
  R: /* @__PURE__ */ x((t, e) => t - 2, "R"),
  T: /* @__PURE__ */ x((t, e) => t - e + 2, "T"),
  B: /* @__PURE__ */ x((t, e) => t - 2, "B")
}, MNe = /* @__PURE__ */ x(function(t) {
  return Bi(t) ? t === "L" ? "R" : "L" : t === "T" ? "B" : "T";
}, "getOppositeArchitectureDirection"), oM = /* @__PURE__ */ x(function(t) {
  const e = t;
  return e === "L" || e === "R" || e === "T" || e === "B";
}, "isArchitectureDirection"), Bi = /* @__PURE__ */ x(function(t) {
  const e = t;
  return e === "L" || e === "R";
}, "isArchitectureDirectionX"), ec = /* @__PURE__ */ x(function(t) {
  const e = t;
  return e === "T" || e === "B";
}, "isArchitectureDirectionY"), S7 = /* @__PURE__ */ x(function(t, e) {
  const r = Bi(t) && ec(e), n = ec(t) && Bi(e);
  return r || n;
}, "isArchitectureDirectionXY"), DNe = /* @__PURE__ */ x(function(t) {
  const e = t[0], r = t[1], n = Bi(e) && ec(r), i = ec(e) && Bi(r);
  return n || i;
}, "isArchitecturePairXY"), INe = /* @__PURE__ */ x(function(t) {
  return t !== "LL" && t !== "RR" && t !== "TT" && t !== "BB";
}, "isValidArchitectureDirectionPair"), X6 = /* @__PURE__ */ x(function(t, e) {
  const r = `${t}${e}`;
  return INe(r) ? r : void 0;
}, "getArchitectureDirectionPair"), ONe = /* @__PURE__ */ x(function([t, e], r) {
  const n = r[0], i = r[1];
  return Bi(n) ? ec(i) ? [t + (n === "L" ? -1 : 1), e + (i === "T" ? 1 : -1)] : [t + (n === "L" ? -1 : 1), e] : Bi(i) ? [t + (i === "L" ? 1 : -1), e + (n === "T" ? 1 : -1)] : [t, e + (n === "T" ? 1 : -1)];
}, "shiftPositionByArchitectureDirectionPair"), PNe = /* @__PURE__ */ x(function(t) {
  return t === "LT" || t === "TL" ? [1, 1] : t === "BL" || t === "LB" ? [1, -1] : t === "BR" || t === "RB" ? [-1, -1] : [-1, 1];
}, "getArchitectureDirectionXYFactors"), BNe = /* @__PURE__ */ x(function(t, e) {
  return S7(t, e) ? "bend" : Bi(t) ? "horizontal" : "vertical";
}, "getArchitectureDirectionAlignment"), FNe = /* @__PURE__ */ x(function(t) {
  return t.type === "service";
}, "isArchitectureService"), $Ne = /* @__PURE__ */ x(function(t) {
  return t.type === "junction";
}, "isArchitectureJunction"), PY = /* @__PURE__ */ x((t) => t.data(), "edgeData"), Ch = /* @__PURE__ */ x((t) => t.data(), "nodeData"), zNe = hr.architecture, $d, BY = ($d = class {
  constructor() {
    this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.elements = {}, this.setAccTitle = Cn, this.getAccTitle = Vn, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.getAccDescription = Un, this.setAccDescription = Gn, this.clear();
  }
  clear() {
    this.nodes = {}, this.groups = {}, this.edges = [], this.registeredIds = {}, this.dataStructures = void 0, this.elements = {}, _n();
  }
  addService({
    id: e,
    icon: r,
    in: n,
    title: i,
    iconText: a
  }) {
    if (this.registeredIds[e] !== void 0)
      throw new Error(
        `The service id [${e}] is already in use by another ${this.registeredIds[e]}`
      );
    if (n !== void 0) {
      if (e === n)
        throw new Error(`The service [${e}] cannot be placed within itself`);
      if (this.registeredIds[n] === void 0)
        throw new Error(
          `The service [${e}]'s parent does not exist. Please make sure the parent is created before this service`
        );
      if (this.registeredIds[n] === "node")
        throw new Error(`The service [${e}]'s parent is not a group`);
    }
    this.registeredIds[e] = "node", this.nodes[e] = {
      id: e,
      type: "service",
      icon: r,
      iconText: a,
      title: i,
      edges: [],
      in: n
    };
  }
  getServices() {
    return Object.values(this.nodes).filter(FNe);
  }
  addJunction({ id: e, in: r }) {
    this.registeredIds[e] = "node", this.nodes[e] = {
      id: e,
      type: "junction",
      edges: [],
      in: r
    };
  }
  getJunctions() {
    return Object.values(this.nodes).filter($Ne);
  }
  getNodes() {
    return Object.values(this.nodes);
  }
  getNode(e) {
    return this.nodes[e] ?? null;
  }
  addGroup({ id: e, icon: r, in: n, title: i }) {
    var a, s, o;
    if (((a = this.registeredIds) == null ? void 0 : a[e]) !== void 0)
      throw new Error(
        `The group id [${e}] is already in use by another ${this.registeredIds[e]}`
      );
    if (n !== void 0) {
      if (e === n)
        throw new Error(`The group [${e}] cannot be placed within itself`);
      if (((s = this.registeredIds) == null ? void 0 : s[n]) === void 0)
        throw new Error(
          `The group [${e}]'s parent does not exist. Please make sure the parent is created before this group`
        );
      if (((o = this.registeredIds) == null ? void 0 : o[n]) === "node")
        throw new Error(`The group [${e}]'s parent is not a group`);
    }
    this.registeredIds[e] = "group", this.groups[e] = {
      id: e,
      icon: r,
      title: i,
      in: n
    };
  }
  getGroups() {
    return Object.values(this.groups);
  }
  addEdge({
    lhsId: e,
    rhsId: r,
    lhsDir: n,
    rhsDir: i,
    lhsInto: a,
    rhsInto: s,
    lhsGroup: o,
    rhsGroup: l,
    title: u
  }) {
    if (!oM(n))
      throw new Error(
        `Invalid direction given for left hand side of edge ${e}--${r}. Expected (L,R,T,B) got ${String(n)}`
      );
    if (!oM(i))
      throw new Error(
        `Invalid direction given for right hand side of edge ${e}--${r}. Expected (L,R,T,B) got ${String(i)}`
      );
    if (this.nodes[e] === void 0 && this.groups[e] === void 0)
      throw new Error(
        `The left-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`
      );
    if (this.nodes[r] === void 0 && this.groups[r] === void 0)
      throw new Error(
        `The right-hand id [${r}] does not yet exist. Please create the service/group before declaring an edge to it.`
      );
    const h = this.nodes[e].in, d = this.nodes[r].in;
    if (o && h && d && h == d)
      throw new Error(
        `The left-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
      );
    if (l && h && d && h == d)
      throw new Error(
        `The right-hand id [${r}] is modified to traverse the group boundary, but the edge does not pass through two groups.`
      );
    const f = {
      lhsId: e,
      lhsDir: n,
      lhsInto: a,
      lhsGroup: o,
      rhsId: r,
      rhsDir: i,
      rhsInto: s,
      rhsGroup: l,
      title: u
    };
    this.edges.push(f), this.nodes[e] && this.nodes[r] && (this.nodes[e].edges.push(this.edges[this.edges.length - 1]), this.nodes[r].edges.push(this.edges[this.edges.length - 1]));
  }
  getEdges() {
    return this.edges;
  }
  /**
   * Returns the current diagram's adjacency list, spatial map, & group alignments.
   * If they have not been created, run the algorithms to generate them.
   * @returns
   */
  getDataStructures() {
    if (this.dataStructures === void 0) {
      const e = {}, r = Object.entries(this.nodes).reduce((l, [u, h]) => (l[u] = h.edges.reduce((d, f) => {
        var m, v;
        const p = (m = this.getNode(f.lhsId)) == null ? void 0 : m.in, g = (v = this.getNode(f.rhsId)) == null ? void 0 : v.in;
        if (p && g && p !== g) {
          const y = BNe(f.lhsDir, f.rhsDir);
          y !== "bend" && (e[p] ?? (e[p] = {}), e[p][g] = y, e[g] ?? (e[g] = {}), e[g][p] = y);
        }
        if (f.lhsId === u) {
          const y = X6(f.lhsDir, f.rhsDir);
          y && (d[y] = f.rhsId);
        } else {
          const y = X6(f.rhsDir, f.lhsDir);
          y && (d[y] = f.lhsId);
        }
        return d;
      }, {}), l), {}), n = Object.keys(r)[0], i = { [n]: 1 }, a = Object.keys(r).reduce(
        (l, u) => u === n ? l : { ...l, [u]: 1 },
        {}
      ), s = /* @__PURE__ */ x((l) => {
        const u = { [l]: [0, 0] }, h = [l];
        for (; h.length > 0; ) {
          const d = h.shift();
          if (d) {
            i[d] = 1, delete a[d];
            const f = r[d], [p, g] = u[d];
            Object.entries(f).forEach(([m, v]) => {
              i[v] || (u[v] = ONe(
                [p, g],
                m
              ), h.push(v));
            });
          }
        }
        return u;
      }, "BFS"), o = [s(n)];
      for (; Object.keys(a).length > 0; )
        o.push(s(Object.keys(a)[0]));
      this.dataStructures = {
        adjList: r,
        spatialMaps: o,
        groupAlignments: e
      };
    }
    return this.dataStructures;
  }
  setElementForId(e, r) {
    this.elements[e] = r;
  }
  getElementById(e) {
    return this.elements[e];
  }
  getConfig() {
    return qi({
      ...zNe,
      ...gr().architecture
    });
  }
  getConfigField(e) {
    return this.getConfig()[e];
  }
}, x($d, "ArchitectureDB"), $d), VNe = /* @__PURE__ */ x((t, e) => {
  Vu(t, e), t.groups.map((r) => e.addGroup(r)), t.services.map((r) => e.addService({ ...r, type: "service" })), t.junctions.map((r) => e.addJunction({ ...r, type: "junction" })), t.edges.map((r) => e.addEdge(r));
}, "populateDb"), FY = {
  parser: {
    // @ts-expect-error - ArchitectureDB is not assignable to DiagramDB
    yy: void 0
  },
  parse: /* @__PURE__ */ x(async (t) => {
    var n;
    const e = await yc("architecture", t);
    ae.debug(e);
    const r = (n = FY.parser) == null ? void 0 : n.yy;
    if (!(r instanceof BY))
      throw new Error(
        "parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
      );
    VNe(e, r);
  }, "parse")
}, GNe = /* @__PURE__ */ x((t) => `
  .edge {
    stroke-width: ${t.archEdgeWidth};
    stroke: ${t.archEdgeColor};
    fill: none;
  }

  .arrow {
    fill: ${t.archEdgeArrowColor};
  }

  .node-bkg {
    fill: none;
    stroke: ${t.archGroupBorderColor};
    stroke-width: ${t.archGroupBorderWidth};
    stroke-dasharray: 8;
  }
  .node-icon-text {
    display: flex; 
    align-items: center;
  }
  
  .node-icon-text > div {
    color: #fff;
    margin: 1px;
    height: fit-content;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }
`, "getStyles"), UNe = GNe, ch = /* @__PURE__ */ x((t) => `<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${t}</g>`, "wrapIcon"), Cg = {
  prefix: "mermaid-architecture",
  height: 80,
  width: 80,
  icons: {
    database: {
      body: ch(
        '<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
      )
    },
    server: {
      body: ch(
        '<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>'
      )
    },
    disk: {
      body: ch(
        '<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>'
      )
    },
    internet: {
      body: ch(
        '<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
      )
    },
    cloud: {
      body: ch(
        '<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>'
      )
    },
    unknown: bP,
    blank: {
      body: ch("")
    }
  }
}, WNe = /* @__PURE__ */ x(async function(t, e, r) {
  const n = r.getConfigField("padding"), i = r.getConfigField("iconSize"), a = i / 2, s = i / 6, o = s / 2;
  await Promise.all(
    e.edges().map(async (l) => {
      var L, N;
      const {
        source: u,
        sourceDir: h,
        sourceArrow: d,
        sourceGroup: f,
        target: p,
        targetDir: g,
        targetArrow: m,
        targetGroup: v,
        label: y
      } = PY(l);
      let { x: b, y: w } = l[0].sourceEndpoint();
      const { x: T, y: E } = l[0].midpoint();
      let { x: C, y: k } = l[0].targetEndpoint();
      const _ = n + 4;
      if (f && (Bi(h) ? b += h === "L" ? -_ : _ : w += h === "T" ? -_ : _ + 18), v && (Bi(g) ? C += g === "L" ? -_ : _ : k += g === "T" ? -_ : _ + 18), !f && ((L = r.getNode(u)) == null ? void 0 : L.type) === "junction" && (Bi(h) ? b += h === "L" ? a : -a : w += h === "T" ? a : -a), !v && ((N = r.getNode(p)) == null ? void 0 : N.type) === "junction" && (Bi(g) ? C += g === "L" ? a : -a : k += g === "T" ? a : -a), l[0]._private.rscratch) {
        const A = t.insert("g");
        if (A.insert("path").attr("d", `M ${b},${w} L ${T},${E} L${C},${k} `).attr("class", "edge").attr("id", Nh(u, p, { prefix: "L" })), d) {
          const O = Bi(h) ? Om[h](b, s) : b - o, P = ec(h) ? Om[h](w, s) : w - o;
          A.insert("polygon").attr("points", sM[h](s)).attr("transform", `translate(${O},${P})`).attr("class", "arrow");
        }
        if (m) {
          const O = Bi(g) ? Om[g](C, s) : C - o, P = ec(g) ? Om[g](k, s) : k - o;
          A.insert("polygon").attr("points", sM[g](s)).attr("transform", `translate(${O},${P})`).attr("class", "arrow");
        }
        if (y) {
          const O = S7(h, g) ? "XY" : Bi(h) ? "X" : "Y";
          let P = 0;
          O === "X" ? P = Math.abs(b - C) : O === "Y" ? P = Math.abs(w - k) / 1.5 : P = Math.abs(b - C) / 2;
          const S = A.append("g");
          if (await Ma(
            S,
            y,
            {
              useHtmlLabels: !1,
              width: P,
              classes: "architecture-service-label"
            },
            we()
          ), S.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), O === "X")
            S.attr("transform", "translate(" + T + ", " + E + ")");
          else if (O === "Y")
            S.attr("transform", "translate(" + T + ", " + E + ") rotate(-90)");
          else if (O === "XY") {
            const R = X6(h, g);
            if (R && DNe(R)) {
              const I = S.node().getBoundingClientRect(), [D, M] = PNe(R);
              S.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * D * M * 45})`);
              const B = S.node().getBoundingClientRect();
              S.attr(
                "transform",
                `
                translate(${T}, ${E - I.height / 2})
                translate(${D * B.width / 2}, ${M * B.height / 2})
                rotate(${-1 * D * M * 45}, 0, ${I.height / 2})
              `
              );
            }
          }
        }
      }
    })
  );
}, "drawEdges"), HNe = /* @__PURE__ */ x(async function(t, e, r) {
  const i = r.getConfigField("padding") * 0.75, a = r.getConfigField("fontSize"), o = r.getConfigField("iconSize") / 2;
  await Promise.all(
    e.nodes().map(async (l) => {
      const u = Ch(l);
      if (u.type === "group") {
        const { h, w: d, x1: f, y1: p } = l.boundingBox(), g = t.append("rect");
        g.attr("id", `group-${u.id}`).attr("x", f + o).attr("y", p + o).attr("width", d).attr("height", h).attr("class", "node-bkg");
        const m = t.append("g");
        let v = f, y = p;
        if (u.icon) {
          const b = m.append("g");
          b.html(
            `<g>${await Pl(u.icon, { height: i, width: i, fallbackPrefix: Cg.prefix })}</g>`
          ), b.attr(
            "transform",
            "translate(" + (v + o + 1) + ", " + (y + o + 1) + ")"
          ), v += i, y += a / 2 - 1 - 2;
        }
        if (u.label) {
          const b = m.append("g");
          await Ma(
            b,
            u.label,
            {
              useHtmlLabels: !1,
              width: d,
              classes: "architecture-service-label"
            },
            we()
          ), b.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), b.attr(
            "transform",
            "translate(" + (v + o + 4) + ", " + (y + o + 2) + ")"
          );
        }
        r.setElementForId(u.id, g);
      }
    })
  );
}, "drawGroups"), qNe = /* @__PURE__ */ x(async function(t, e, r) {
  const n = we();
  for (const i of r) {
    const a = e.append("g"), s = t.getConfigField("iconSize");
    if (i.title) {
      const h = a.append("g");
      await Ma(
        h,
        i.title,
        {
          useHtmlLabels: !1,
          width: s * 1.5,
          classes: "architecture-service-label"
        },
        n
      ), h.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), h.attr("transform", "translate(" + s / 2 + ", " + s + ")");
    }
    const o = a.append("g");
    if (i.icon)
      o.html(
        `<g>${await Pl(i.icon, { height: s, width: s, fallbackPrefix: Cg.prefix })}</g>`
      );
    else if (i.iconText) {
      o.html(
        `<g>${await Pl("blank", { height: s, width: s, fallbackPrefix: Cg.prefix })}</g>`
      );
      const f = o.append("g").append("foreignObject").attr("width", s).attr("height", s).append("div").attr("class", "node-icon-text").attr("style", `height: ${s}px;`).append("div").html(fr(i.iconText, n)), p = parseInt(
        window.getComputedStyle(f.node(), null).getPropertyValue("font-size").replace(/\D/g, "")
      ) ?? 16;
      f.attr("style", `-webkit-line-clamp: ${Math.floor((s - 2) / p)};`);
    } else
      o.append("path").attr("class", "node-bkg").attr("id", "node-" + i.id).attr(
        "d",
        `M0 ${s} v${-s} q0,-5 5,-5 h${s} q5,0 5,5 v${s} H0 Z`
      );
    a.attr("id", `service-${i.id}`).attr("class", "architecture-service");
    const { width: l, height: u } = a.node().getBBox();
    i.width = l, i.height = u, t.setElementForId(i.id, a);
  }
  return 0;
}, "drawServices"), YNe = /* @__PURE__ */ x(function(t, e, r) {
  r.forEach((n) => {
    const i = e.append("g"), a = t.getConfigField("iconSize");
    i.append("g").append("rect").attr("id", "node-" + n.id).attr("fill-opacity", "0").attr("width", a).attr("height", a), i.attr("class", "architecture-junction");
    const { width: o, height: l } = i._groups[0][0].getBBox();
    i.width = o, i.height = l, t.setElementForId(n.id, i);
  });
}, "drawJunctions");
TP([
  {
    name: Cg.prefix,
    icons: Cg
  }
]);
eo.use(NNe);
function $Y(t, e, r) {
  t.forEach((n) => {
    e.add({
      group: "nodes",
      data: {
        type: "service",
        id: n.id,
        icon: n.icon,
        label: n.title,
        parent: n.in,
        width: r.getConfigField("iconSize"),
        height: r.getConfigField("iconSize")
      },
      classes: "node-service"
    });
  });
}
x($Y, "addServices");
function zY(t, e, r) {
  t.forEach((n) => {
    e.add({
      group: "nodes",
      data: {
        type: "junction",
        id: n.id,
        parent: n.in,
        width: r.getConfigField("iconSize"),
        height: r.getConfigField("iconSize")
      },
      classes: "node-junction"
    });
  });
}
x(zY, "addJunctions");
function VY(t, e) {
  e.nodes().map((r) => {
    const n = Ch(r);
    if (n.type === "group")
      return;
    n.x = r.position().x, n.y = r.position().y, t.getElementById(n.id).attr("transform", "translate(" + (n.x || 0) + "," + (n.y || 0) + ")");
  });
}
x(VY, "positionNodes");
function GY(t, e) {
  t.forEach((r) => {
    e.add({
      group: "nodes",
      data: {
        type: "group",
        id: r.id,
        icon: r.icon,
        label: r.title,
        parent: r.in
      },
      classes: "node-group"
    });
  });
}
x(GY, "addGroups");
function UY(t, e) {
  t.forEach((r) => {
    const { lhsId: n, rhsId: i, lhsInto: a, lhsGroup: s, rhsInto: o, lhsDir: l, rhsDir: u, rhsGroup: h, title: d } = r, f = S7(r.lhsDir, r.rhsDir) ? "segments" : "straight", p = {
      id: `${n}-${i}`,
      label: d,
      source: n,
      sourceDir: l,
      sourceArrow: a,
      sourceGroup: s,
      sourceEndpoint: l === "L" ? "0 50%" : l === "R" ? "100% 50%" : l === "T" ? "50% 0" : "50% 100%",
      target: i,
      targetDir: u,
      targetArrow: o,
      targetGroup: h,
      targetEndpoint: u === "L" ? "0 50%" : u === "R" ? "100% 50%" : u === "T" ? "50% 0" : "50% 100%"
    };
    e.add({
      group: "edges",
      data: p,
      classes: f
    });
  });
}
x(UY, "addEdges");
function WY(t, e, r) {
  const n = /* @__PURE__ */ x((o, l) => Object.entries(o).reduce(
    (u, [h, d]) => {
      var g;
      let f = 0;
      const p = Object.entries(d);
      if (p.length === 1)
        return u[h] = p[0][1], u;
      for (let m = 0; m < p.length - 1; m++)
        for (let v = m + 1; v < p.length; v++) {
          const [y, b] = p[m], [w, T] = p[v];
          if (((g = r[y]) == null ? void 0 : g[w]) === l)
            u[h] ?? (u[h] = []), u[h] = [...u[h], ...b, ...T];
          else if (y === "default" || w === "default")
            u[h] ?? (u[h] = []), u[h] = [...u[h], ...b, ...T];
          else {
            const C = `${h}-${f++}`;
            u[C] = b;
            const k = `${h}-${f++}`;
            u[k] = T;
          }
        }
      return u;
    },
    {}
  ), "flattenAlignments"), i = e.map((o) => {
    const l = {}, u = {};
    return Object.entries(o).forEach(([h, [d, f]]) => {
      var g, m, v;
      const p = ((g = t.getNode(h)) == null ? void 0 : g.in) ?? "default";
      l[f] ?? (l[f] = {}), (m = l[f])[p] ?? (m[p] = []), l[f][p].push(h), u[d] ?? (u[d] = {}), (v = u[d])[p] ?? (v[p] = []), u[d][p].push(h);
    }), {
      horiz: Object.values(n(l, "horizontal")).filter(
        (h) => h.length > 1
      ),
      vert: Object.values(n(u, "vertical")).filter(
        (h) => h.length > 1
      )
    };
  }), [a, s] = i.reduce(
    ([o, l], { horiz: u, vert: h }) => [
      [...o, ...u],
      [...l, ...h]
    ],
    [[], []]
  );
  return {
    horizontal: a,
    vertical: s
  };
}
x(WY, "getAlignments");
function HY(t, e) {
  const r = [], n = /* @__PURE__ */ x((a) => `${a[0]},${a[1]}`, "posToStr"), i = /* @__PURE__ */ x((a) => a.split(",").map((s) => parseInt(s)), "strToPos");
  return t.forEach((a) => {
    const s = Object.fromEntries(
      Object.entries(a).map(([h, d]) => [n(d), h])
    ), o = [n([0, 0])], l = {}, u = {
      L: [-1, 0],
      R: [1, 0],
      T: [0, 1],
      B: [0, -1]
    };
    for (; o.length > 0; ) {
      const h = o.shift();
      if (h) {
        l[h] = 1;
        const d = s[h];
        if (d) {
          const f = i(h);
          Object.entries(u).forEach(([p, g]) => {
            const m = n([f[0] + g[0], f[1] + g[1]]), v = s[m];
            v && !l[m] && (o.push(m), r.push({
              [aM[p]]: v,
              [aM[MNe(p)]]: d,
              gap: 1.5 * e.getConfigField("iconSize")
            }));
          });
        }
      }
    }
  }), r;
}
x(HY, "getRelativeConstraints");
function qY(t, e, r, n, i, { spatialMaps: a, groupAlignments: s }) {
  return new Promise((o) => {
    const l = Qe("body").append("div").attr("id", "cy").attr("style", "display:none"), u = eo({
      container: document.getElementById("cy"),
      style: [
        {
          selector: "edge",
          style: {
            "curve-style": "straight",
            label: "data(label)",
            "source-endpoint": "data(sourceEndpoint)",
            "target-endpoint": "data(targetEndpoint)"
          }
        },
        {
          selector: "edge.segments",
          style: {
            "curve-style": "segments",
            "segment-weights": "0",
            "segment-distances": [0.5],
            // @ts-ignore Incorrect library types
            "edge-distances": "endpoints",
            "source-endpoint": "data(sourceEndpoint)",
            "target-endpoint": "data(targetEndpoint)"
          }
        },
        {
          selector: "node",
          style: {
            // @ts-ignore Incorrect library types
            "compound-sizing-wrt-labels": "include"
          }
        },
        {
          selector: "node[label]",
          style: {
            "text-valign": "bottom",
            "text-halign": "center",
            "font-size": `${i.getConfigField("fontSize")}px`
          }
        },
        {
          selector: ".node-service",
          style: {
            label: "data(label)",
            width: "data(width)",
            height: "data(height)"
          }
        },
        {
          selector: ".node-junction",
          style: {
            width: "data(width)",
            height: "data(height)"
          }
        },
        {
          selector: ".node-group",
          style: {
            // @ts-ignore Incorrect library types
            padding: `${i.getConfigField("padding")}px`
          }
        }
      ],
      layout: {
        name: "grid",
        boundingBox: {
          x1: 0,
          x2: 100,
          y1: 0,
          y2: 100
        }
      }
    });
    l.remove(), GY(r, u), $Y(t, u, i), zY(e, u, i), UY(n, u);
    const h = WY(i, a, s), d = HY(a, i), f = u.layout({
      name: "fcose",
      quality: "proof",
      styleEnabled: !1,
      animate: !1,
      nodeDimensionsIncludeLabels: !1,
      // Adjust the edge parameters if it passes through the border of a group
      // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67
      idealEdgeLength(p) {
        const [g, m] = p.connectedNodes(), { parent: v } = Ch(g), { parent: y } = Ch(m);
        return v === y ? 1.5 * i.getConfigField("iconSize") : 0.5 * i.getConfigField("iconSize");
      },
      edgeElasticity(p) {
        const [g, m] = p.connectedNodes(), { parent: v } = Ch(g), { parent: y } = Ch(m);
        return v === y ? 0.45 : 1e-3;
      },
      alignmentConstraint: h,
      relativePlacementConstraint: d
    });
    f.one("layoutstop", () => {
      var g;
      function p(m, v, y, b) {
        let w, T;
        const { x: E, y: C } = m, { x: k, y: _ } = v;
        T = (b - C + (E - y) * (C - _) / (E - k)) / Math.sqrt(1 + Math.pow((C - _) / (E - k), 2)), w = Math.sqrt(Math.pow(b - C, 2) + Math.pow(y - E, 2) - Math.pow(T, 2));
        const L = Math.sqrt(Math.pow(k - E, 2) + Math.pow(_ - C, 2));
        w = w / L;
        let N = (k - E) * (b - C) - (_ - C) * (y - E);
        switch (!0) {
          case N >= 0:
            N = 1;
            break;
          case N < 0:
            N = -1;
            break;
        }
        let A = (k - E) * (y - E) + (_ - C) * (b - C);
        switch (!0) {
          case A >= 0:
            A = 1;
            break;
          case A < 0:
            A = -1;
            break;
        }
        return T = Math.abs(T) * N, w = w * A, {
          distances: T,
          weights: w
        };
      }
      x(p, "getSegmentWeights"), u.startBatch();
      for (const m of Object.values(u.edges()))
        if ((g = m.data) != null && g.call(m)) {
          const { x: v, y } = m.source().position(), { x: b, y: w } = m.target().position();
          if (v !== b && y !== w) {
            const T = m.sourceEndpoint(), E = m.targetEndpoint(), { sourceDir: C } = PY(m), [k, _] = ec(C) ? [T.x, E.y] : [E.x, T.y], { weights: L, distances: N } = p(T, E, k, _);
            m.style("segment-distances", N), m.style("segment-weights", L);
          }
        }
      u.endBatch(), f.run();
    }), f.run(), u.ready((p) => {
      ae.info("Ready", p), o(u);
    });
  });
}
x(qY, "layoutArchitecture");
var XNe = /* @__PURE__ */ x(async (t, e, r, n) => {
  const i = n.db, a = i.getServices(), s = i.getJunctions(), o = i.getGroups(), l = i.getEdges(), u = i.getDataStructures(), h = tl(e), d = h.append("g");
  d.attr("class", "architecture-edges");
  const f = h.append("g");
  f.attr("class", "architecture-services");
  const p = h.append("g");
  p.attr("class", "architecture-groups"), await qNe(i, f, a), YNe(i, f, s);
  const g = await qY(a, s, o, l, i, u);
  await WNe(d, g, i), await HNe(p, g, i), VY(i, g), Lg(void 0, h, i.getConfigField("padding"), i.getConfigField("useMaxWidth"));
}, "draw"), jNe = { draw: XNe }, KNe = {
  parser: FY,
  get db() {
    return new BY();
  },
  renderer: jNe,
  styles: UNe
};
const ZNe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: KNe
}, Symbol.toStringTag, { value: "Module" }));
var zd, YY = (zd = class {
  constructor() {
    this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = Cn, this.getAccTitle = Vn, this.setDiagramTitle = Qn, this.getDiagramTitle = Ln, this.getAccDescription = Un, this.setAccDescription = Gn;
  }
  getNodes() {
    return this.nodes;
  }
  getConfig() {
    const e = hr, r = gr();
    return qi({
      ...e.treemap,
      ...r.treemap ?? {}
    });
  }
  addNode(e, r) {
    this.nodes.push(e), this.levels.set(e, r), r === 0 && (this.outerNodes.push(e), this.root ?? (this.root = e));
  }
  getRoot() {
    return { name: "", children: this.outerNodes };
  }
  addClass(e, r) {
    const n = this.classes.get(e) ?? { id: e, styles: [], textStyles: [] }, i = r.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
    i && i.forEach((a) => {
      CE(a) && (n != null && n.textStyles ? n.textStyles.push(a) : n.textStyles = [a]), n != null && n.styles ? n.styles.push(a) : n.styles = [a];
    }), this.classes.set(e, n);
  }
  getClasses() {
    return this.classes;
  }
  getStylesForClass(e) {
    var r;
    return ((r = this.classes.get(e)) == null ? void 0 : r.styles) ?? [];
  }
  clear() {
    _n(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
  }
}, x(zd, "TreeMapDB"), zd);
function XY(t) {
  if (!t.length)
    return [];
  const e = [], r = [];
  return t.forEach((n) => {
    const i = {
      name: n.name,
      children: n.type === "Leaf" ? void 0 : []
    };
    for (i.classSelector = n == null ? void 0 : n.classSelector, n != null && n.cssCompiledStyles && (i.cssCompiledStyles = [n.cssCompiledStyles]), n.type === "Leaf" && n.value !== void 0 && (i.value = n.value); r.length > 0 && r[r.length - 1].level >= n.level; )
      r.pop();
    if (r.length === 0)
      e.push(i);
    else {
      const a = r[r.length - 1].node;
      a.children ? a.children.push(i) : a.children = [i];
    }
    n.type !== "Leaf" && r.push({ node: i, level: n.level });
  }), e;
}
x(XY, "buildHierarchy");
var QNe = /* @__PURE__ */ x((t, e) => {
  Vu(t, e);
  const r = [];
  for (const a of t.TreemapRows ?? [])
    a.$type === "ClassDefStatement" && e.addClass(a.className ?? "", a.styleText ?? "");
  for (const a of t.TreemapRows ?? []) {
    const s = a.item;
    if (!s)
      continue;
    const o = a.indent ? parseInt(a.indent) : 0, l = JNe(s), u = s.classSelector ? e.getStylesForClass(s.classSelector) : [], h = u.length > 0 ? u.join(";") : void 0, d = {
      level: o,
      name: l,
      type: s.$type,
      value: s.value,
      classSelector: s.classSelector,
      cssCompiledStyles: h
    };
    r.push(d);
  }
  const n = XY(r), i = /* @__PURE__ */ x((a, s) => {
    for (const o of a)
      e.addNode(o, s), o.children && o.children.length > 0 && i(o.children, s + 1);
  }, "addNodesRecursively");
  i(n, 0);
}, "populate"), JNe = /* @__PURE__ */ x((t) => t.name ? String(t.name) : "", "getItemName"), jY = {
  // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
  parser: { yy: void 0 },
  parse: /* @__PURE__ */ x(async (t) => {
    var e;
    try {
      const n = await yc("treemap", t);
      ae.debug("Treemap AST:", n);
      const i = (e = jY.parser) == null ? void 0 : e.yy;
      if (!(i instanceof YY))
        throw new Error(
          "parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
        );
      QNe(n, i);
    } catch (r) {
      throw ae.error("Error parsing treemap:", r), r;
    }
  }, "parse")
}, eMe = 10, uh = 10, m0 = 25, tMe = /* @__PURE__ */ x((t, e, r, n) => {
  const i = n.db, a = i.getConfig(), s = a.padding ?? eMe, o = i.getDiagramTitle(), l = i.getRoot(), { themeVariables: u } = gr();
  if (!l)
    return;
  const h = o ? 30 : 0, d = tl(e), f = a.nodeWidth ? a.nodeWidth * uh : 960, p = a.nodeHeight ? a.nodeHeight * uh : 500, g = f, m = p + h;
  d.attr("viewBox", `0 0 ${g} ${m}`), Ki(d, m, g, a.useMaxWidth);
  let v;
  try {
    const S = a.valueFormat || ",";
    if (S === "$0,0")
      v = /* @__PURE__ */ x((R) => "$" + Pc(",")(R), "valueFormat");
    else if (S.startsWith("$") && S.includes(",")) {
      const R = /\.\d+/.exec(S), I = R ? R[0] : "";
      v = /* @__PURE__ */ x((D) => "$" + Pc("," + I)(D), "valueFormat");
    } else if (S.startsWith("$")) {
      const R = S.substring(1);
      v = /* @__PURE__ */ x((I) => "$" + Pc(R || "")(I), "valueFormat");
    } else
      v = Pc(S);
  } catch (S) {
    ae.error("Error creating format function:", S), v = Pc(",");
  }
  const y = Qc().range([
    "transparent",
    u.cScale0,
    u.cScale1,
    u.cScale2,
    u.cScale3,
    u.cScale4,
    u.cScale5,
    u.cScale6,
    u.cScale7,
    u.cScale8,
    u.cScale9,
    u.cScale10,
    u.cScale11
  ]), b = Qc().range([
    "transparent",
    u.cScalePeer0,
    u.cScalePeer1,
    u.cScalePeer2,
    u.cScalePeer3,
    u.cScalePeer4,
    u.cScalePeer5,
    u.cScalePeer6,
    u.cScalePeer7,
    u.cScalePeer8,
    u.cScalePeer9,
    u.cScalePeer10,
    u.cScalePeer11
  ]), w = Qc().range([
    u.cScaleLabel0,
    u.cScaleLabel1,
    u.cScaleLabel2,
    u.cScaleLabel3,
    u.cScaleLabel4,
    u.cScaleLabel5,
    u.cScaleLabel6,
    u.cScaleLabel7,
    u.cScaleLabel8,
    u.cScaleLabel9,
    u.cScaleLabel10,
    u.cScaleLabel11
  ]);
  o && d.append("text").attr("x", g / 2).attr("y", h / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(o);
  const T = d.append("g").attr("transform", `translate(0, ${h})`).attr("class", "treemapContainer"), E = dE(l).sum((S) => S.value ?? 0).sort((S, R) => (R.value ?? 0) - (S.value ?? 0)), k = ZJ().size([f, p]).paddingTop(
    (S) => S.children && S.children.length > 0 ? m0 + uh : 0
  ).paddingInner(s).paddingLeft((S) => S.children && S.children.length > 0 ? uh : 0).paddingRight((S) => S.children && S.children.length > 0 ? uh : 0).paddingBottom((S) => S.children && S.children.length > 0 ? uh : 0).round(!0)(E), _ = k.descendants().filter((S) => S.children && S.children.length > 0), L = T.selectAll(".treemapSection").data(_).enter().append("g").attr("class", "treemapSection").attr("transform", (S) => `translate(${S.x0},${S.y0})`);
  L.append("rect").attr("width", (S) => S.x1 - S.x0).attr("height", m0).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (S) => S.depth === 0 ? "display: none;" : ""), L.append("clipPath").attr("id", (S, R) => `clip-section-${e}-${R}`).append("rect").attr("width", (S) => Math.max(0, S.x1 - S.x0 - 12)).attr("height", m0), L.append("rect").attr("width", (S) => S.x1 - S.x0).attr("height", (S) => S.y1 - S.y0).attr("class", (S, R) => `treemapSection section${R}`).attr("fill", (S) => y(S.data.name)).attr("fill-opacity", 0.6).attr("stroke", (S) => b(S.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (S) => {
    if (S.depth === 0)
      return "display: none;";
    const R = Ct({ cssCompiledStyles: S.data.cssCompiledStyles });
    return R.nodeStyles + ";" + R.borderStyles.join(";");
  }), L.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", m0 / 2).attr("dominant-baseline", "middle").text((S) => S.depth === 0 ? "" : S.data.name).attr("font-weight", "bold").attr("style", (S) => {
    if (S.depth === 0)
      return "display: none;";
    const R = "dominant-baseline: middle; font-size: 12px; fill:" + w(S.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", I = Ct({ cssCompiledStyles: S.data.cssCompiledStyles });
    return R + I.labelStyles.replace("color:", "fill:");
  }).each(function(S) {
    if (S.depth === 0)
      return;
    const R = Qe(this), I = S.data.name;
    R.text(I);
    const D = S.x1 - S.x0, M = 6;
    let B;
    a.showValues !== !1 && S.value ? B = D - 10 - 30 - 10 - M : B = D - M - 6;
    const F = Math.max(15, B), G = R.node();
    if (G.getComputedTextLength() > F) {
      const ee = "...";
      let Y = I;
      for (; Y.length > 0; ) {
        if (Y = I.substring(0, Y.length - 1), Y.length === 0) {
          R.text(ee), G.getComputedTextLength() > F && R.text("");
          break;
        }
        if (R.text(Y + ee), G.getComputedTextLength() <= F)
          break;
      }
    }
  }), a.showValues !== !1 && L.append("text").attr("class", "treemapSectionValue").attr("x", (S) => S.x1 - S.x0 - 10).attr("y", m0 / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((S) => S.value ? v(S.value) : "").attr("font-style", "italic").attr("style", (S) => {
    if (S.depth === 0)
      return "display: none;";
    const R = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + w(S.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", I = Ct({ cssCompiledStyles: S.data.cssCompiledStyles });
    return R + I.labelStyles.replace("color:", "fill:");
  });
  const N = k.leaves(), A = T.selectAll(".treemapLeafGroup").data(N).enter().append("g").attr("class", (S, R) => `treemapNode treemapLeafGroup leaf${R}${S.data.classSelector ? ` ${S.data.classSelector}` : ""}x`).attr("transform", (S) => `translate(${S.x0},${S.y0})`);
  A.append("rect").attr("width", (S) => S.x1 - S.x0).attr("height", (S) => S.y1 - S.y0).attr("class", "treemapLeaf").attr("fill", (S) => S.parent ? y(S.parent.data.name) : y(S.data.name)).attr("style", (S) => Ct({ cssCompiledStyles: S.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (S) => S.parent ? y(S.parent.data.name) : y(S.data.name)).attr("stroke-width", 3), A.append("clipPath").attr("id", (S, R) => `clip-${e}-${R}`).append("rect").attr("width", (S) => Math.max(0, S.x1 - S.x0 - 4)).attr("height", (S) => Math.max(0, S.y1 - S.y0 - 4)), A.append("text").attr("class", "treemapLabel").attr("x", (S) => (S.x1 - S.x0) / 2).attr("y", (S) => (S.y1 - S.y0) / 2).attr("style", (S) => {
    const R = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + w(S.data.name) + ";", I = Ct({ cssCompiledStyles: S.data.cssCompiledStyles });
    return R + I.labelStyles.replace("color:", "fill:");
  }).attr("clip-path", (S, R) => `url(#clip-${e}-${R})`).text((S) => S.data.name).each(function(S) {
    const R = Qe(this), I = S.x1 - S.x0, D = S.y1 - S.y0, M = R.node(), B = 4, $ = I - 2 * B, F = D - 2 * B;
    if ($ < 10 || F < 10) {
      R.style("display", "none");
      return;
    }
    let G = parseInt(R.style("font-size"), 10);
    const H = 8, ee = 28, Y = 0.6, re = 6, ne = 2;
    for (; M.getComputedTextLength() > $ && G > H; )
      G--, R.style("font-size", `${G}px`);
    let he = Math.max(
      re,
      Math.min(ee, Math.round(G * Y))
    ), K = G + ne + he;
    for (; K > F && G > H && (G--, he = Math.max(
      re,
      Math.min(ee, Math.round(G * Y))
    ), !(he < re && G === H)); )
      R.style("font-size", `${G}px`), K = G + ne + he;
    R.style("font-size", `${G}px`), (M.getComputedTextLength() > $ || G < H || F < G) && R.style("display", "none");
  }), a.showValues !== !1 && A.append("text").attr("class", "treemapValue").attr("x", (R) => (R.x1 - R.x0) / 2).attr("y", function(R) {
    return (R.y1 - R.y0) / 2;
  }).attr("style", (R) => {
    const I = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + w(R.data.name) + ";", D = Ct({ cssCompiledStyles: R.data.cssCompiledStyles });
    return I + D.labelStyles.replace("color:", "fill:");
  }).attr("clip-path", (R, I) => `url(#clip-${e}-${I})`).text((R) => R.value ? v(R.value) : "").each(function(R) {
    const I = Qe(this), D = this.parentNode;
    if (!D) {
      I.style("display", "none");
      return;
    }
    const M = Qe(D).select(".treemapLabel");
    if (M.empty() || M.style("display") === "none") {
      I.style("display", "none");
      return;
    }
    const B = parseFloat(M.style("font-size")), $ = 28, F = 0.6, G = 6, H = 2, ee = Math.max(
      G,
      Math.min($, Math.round(B * F))
    );
    I.style("font-size", `${ee}px`);
    const re = (R.y1 - R.y0) / 2 + B / 2 + H;
    I.attr("y", re);
    const ne = R.x1 - R.x0, Z = R.y1 - R.y0 - 4, X = ne - 2 * 4;
    I.node().getComputedTextLength() > X || re + ee > Z || ee < G ? I.style("display", "none") : I.style("display", null);
  });
  const P = a.diagramPadding ?? 8;
  zu(d, P, "flowchart", (a == null ? void 0 : a.useMaxWidth) || !1);
}, "draw"), rMe = /* @__PURE__ */ x(function(t, e) {
  return e.db.getClasses();
}, "getClasses"), nMe = { draw: tMe, getClasses: rMe }, iMe = {
  sectionStrokeColor: "black",
  sectionStrokeWidth: "1",
  sectionFillColor: "#efefef",
  leafStrokeColor: "black",
  leafStrokeWidth: "1",
  leafFillColor: "#efefef",
  labelColor: "black",
  labelFontSize: "12px",
  valueFontSize: "10px",
  valueColor: "black",
  titleColor: "black",
  titleFontSize: "14px"
}, aMe = /* @__PURE__ */ x(({
  treemap: t
} = {}) => {
  const e = qi(iMe, t);
  return `
  .treemapNode.section {
    stroke: ${e.sectionStrokeColor};
    stroke-width: ${e.sectionStrokeWidth};
    fill: ${e.sectionFillColor};
  }
  .treemapNode.leaf {
    stroke: ${e.leafStrokeColor};
    stroke-width: ${e.leafStrokeWidth};
    fill: ${e.leafFillColor};
  }
  .treemapLabel {
    fill: ${e.labelColor};
    font-size: ${e.labelFontSize};
  }
  .treemapValue {
    fill: ${e.valueColor};
    font-size: ${e.valueFontSize};
  }
  .treemapTitle {
    fill: ${e.titleColor};
    font-size: ${e.titleFontSize};
  }
  `;
}, "getStyles"), sMe = aMe, oMe = {
  parser: jY,
  get db() {
    return new YY();
  },
  renderer: nMe,
  styles: sMe
};
const lMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: oMe
}, Symbol.toStringTag, { value: "Module" })), cMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  InfoModule: eH,
  createInfoServices: tH
}, Symbol.toStringTag, { value: "Module" })), uMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  PacketModule: rH,
  createPacketServices: nH
}, Symbol.toStringTag, { value: "Module" })), hMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  PieModule: iH,
  createPieServices: aH
}, Symbol.toStringTag, { value: "Module" })), dMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ArchitectureModule: sH,
  createArchitectureServices: oH
}, Symbol.toStringTag, { value: "Module" })), fMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  GitGraphModule: QW,
  createGitGraphServices: JW
}, Symbol.toStringTag, { value: "Module" })), pMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  RadarModule: lH,
  createRadarServices: cH
}, Symbol.toStringTag, { value: "Module" })), gMe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  TreemapModule: hH,
  createTreemapServices: dH
}, Symbol.toStringTag, { value: "Module" }));
export {
  AMe as default
};
