function _mergeNamespaces(n, e) {
  for (var t = 0; t < e.length; t++) {
    const r = e[t];
    if (typeof r != "string" && !Array.isArray(r)) {
      for (const a in r)
        if (a !== "default" && !(a in n)) {
          const s = Object.getOwnPropertyDescriptor(r, a);
          s && Object.defineProperty(n, a, s.get ? s : {
            enumerable: !0,
            get: () => r[a]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
}
const {
  SvelteComponent: SvelteComponent$i,
  assign: assign$1,
  children: children$g,
  claim_element: claim_element$e,
  create_slot: create_slot$3,
  detach: detach$i,
  element: element$e,
  get_all_dirty_from_scope: get_all_dirty_from_scope$3,
  get_slot_changes: get_slot_changes$3,
  get_spread_update: get_spread_update$1,
  init: init$i,
  insert_hydration: insert_hydration$i,
  safe_not_equal: safe_not_equal$j,
  set_dynamic_element_data,
  set_style: set_style$5,
  toggle_class: toggle_class$9,
  transition_in: transition_in$8,
  transition_out: transition_out$8,
  update_slot_base: update_slot_base$3
} = window.__gradio__svelte__internal;
function create_dynamic_element(n) {
  let e, t, r;
  const a = (
    /*#slots*/
    n[22].default
  ), s = create_slot$3(
    a,
    n,
    /*$$scope*/
    n[21],
    null
  );
  let h = [
    { "data-testid": (
      /*test_id*/
      n[10]
    ) },
    { id: (
      /*elem_id*/
      n[5]
    ) },
    {
      class: t = "block " + /*elem_classes*/
      n[6].join(" ") + " svelte-dbzldu"
    }
  ], o = {};
  for (let d = 0; d < h.length; d += 1)
    o = assign$1(o, h[d]);
  return {
    c() {
      e = element$e(
        /*tag*/
        n[18]
      ), s && s.c(), this.h();
    },
    l(d) {
      e = claim_element$e(
        d,
        /*tag*/
        (n[18] || "null").toUpperCase(),
        {
          "data-testid": !0,
          id: !0,
          class: !0
        }
      );
      var v = children$g(e);
      s && s.l(v), v.forEach(detach$i), this.h();
    },
    h() {
      set_dynamic_element_data(
        /*tag*/
        n[18]
      )(e, o), toggle_class$9(
        e,
        "hidden",
        /*visible*/
        n[13] === !1
      ), toggle_class$9(
        e,
        "padded",
        /*padding*/
        n[9]
      ), toggle_class$9(
        e,
        "flex",
        /*flex*/
        n[0]
      ), toggle_class$9(
        e,
        "border_focus",
        /*border_mode*/
        n[8] === "focus"
      ), toggle_class$9(
        e,
        "border_contrast",
        /*border_mode*/
        n[8] === "contrast"
      ), toggle_class$9(e, "hide-container", !/*explicit_call*/
      n[11] && !/*container*/
      n[12]), toggle_class$9(
        e,
        "auto-margin",
        /*scale*/
        n[16] === null
      ), set_style$5(
        e,
        "height",
        /*get_dimension*/
        n[19](
          /*height*/
          n[1]
        )
      ), set_style$5(
        e,
        "min-height",
        /*get_dimension*/
        n[19](
          /*min_height*/
          n[2]
        )
      ), set_style$5(
        e,
        "max-height",
        /*get_dimension*/
        n[19](
          /*max_height*/
          n[3]
        )
      ), set_style$5(e, "width", typeof /*width*/
      n[4] == "number" ? `calc(min(${/*width*/
      n[4]}px, 100%))` : (
        /*get_dimension*/
        n[19](
          /*width*/
          n[4]
        )
      )), set_style$5(
        e,
        "border-style",
        /*variant*/
        n[7]
      ), set_style$5(
        e,
        "overflow",
        /*allow_overflow*/
        n[14] ? (
          /*overflow_behavior*/
          n[15]
        ) : "hidden"
      ), set_style$5(
        e,
        "flex-grow",
        /*scale*/
        n[16]
      ), set_style$5(e, "min-width", `calc(min(${/*min_width*/
      n[17]}px, 100%))`), set_style$5(e, "border-width", "var(--block-border-width)");
    },
    m(d, v) {
      insert_hydration$i(d, e, v), s && s.m(e, null), r = !0;
    },
    p(d, v) {
      s && s.p && (!r || v & /*$$scope*/
      2097152) && update_slot_base$3(
        s,
        a,
        d,
        /*$$scope*/
        d[21],
        r ? get_slot_changes$3(
          a,
          /*$$scope*/
          d[21],
          v,
          null
        ) : get_all_dirty_from_scope$3(
          /*$$scope*/
          d[21]
        ),
        null
      ), set_dynamic_element_data(
        /*tag*/
        d[18]
      )(e, o = get_spread_update$1(h, [
        (!r || v & /*test_id*/
        1024) && { "data-testid": (
          /*test_id*/
          d[10]
        ) },
        (!r || v & /*elem_id*/
        32) && { id: (
          /*elem_id*/
          d[5]
        ) },
        (!r || v & /*elem_classes*/
        64 && t !== (t = "block " + /*elem_classes*/
        d[6].join(" ") + " svelte-dbzldu")) && { class: t }
      ])), toggle_class$9(
        e,
        "hidden",
        /*visible*/
        d[13] === !1
      ), toggle_class$9(
        e,
        "padded",
        /*padding*/
        d[9]
      ), toggle_class$9(
        e,
        "flex",
        /*flex*/
        d[0]
      ), toggle_class$9(
        e,
        "border_focus",
        /*border_mode*/
        d[8] === "focus"
      ), toggle_class$9(
        e,
        "border_contrast",
        /*border_mode*/
        d[8] === "contrast"
      ), toggle_class$9(e, "hide-container", !/*explicit_call*/
      d[11] && !/*container*/
      d[12]), toggle_class$9(
        e,
        "auto-margin",
        /*scale*/
        d[16] === null
      ), v & /*height*/
      2 && set_style$5(
        e,
        "height",
        /*get_dimension*/
        d[19](
          /*height*/
          d[1]
        )
      ), v & /*min_height*/
      4 && set_style$5(
        e,
        "min-height",
        /*get_dimension*/
        d[19](
          /*min_height*/
          d[2]
        )
      ), v & /*max_height*/
      8 && set_style$5(
        e,
        "max-height",
        /*get_dimension*/
        d[19](
          /*max_height*/
          d[3]
        )
      ), v & /*width*/
      16 && set_style$5(e, "width", typeof /*width*/
      d[4] == "number" ? `calc(min(${/*width*/
      d[4]}px, 100%))` : (
        /*get_dimension*/
        d[19](
          /*width*/
          d[4]
        )
      )), v & /*variant*/
      128 && set_style$5(
        e,
        "border-style",
        /*variant*/
        d[7]
      ), v & /*allow_overflow, overflow_behavior*/
      49152 && set_style$5(
        e,
        "overflow",
        /*allow_overflow*/
        d[14] ? (
          /*overflow_behavior*/
          d[15]
        ) : "hidden"
      ), v & /*scale*/
      65536 && set_style$5(
        e,
        "flex-grow",
        /*scale*/
        d[16]
      ), v & /*min_width*/
      131072 && set_style$5(e, "min-width", `calc(min(${/*min_width*/
      d[17]}px, 100%))`);
    },
    i(d) {
      r || (transition_in$8(s, d), r = !0);
    },
    o(d) {
      transition_out$8(s, d), r = !1;
    },
    d(d) {
      d && detach$i(e), s && s.d(d);
    }
  };
}
function create_fragment$i(n) {
  let e, t = (
    /*tag*/
    n[18] && create_dynamic_element(n)
  );
  return {
    c() {
      t && t.c();
    },
    l(r) {
      t && t.l(r);
    },
    m(r, a) {
      t && t.m(r, a), e = !0;
    },
    p(r, [a]) {
      /*tag*/
      r[18] && t.p(r, a);
    },
    i(r) {
      e || (transition_in$8(t, r), e = !0);
    },
    o(r) {
      transition_out$8(t, r), e = !1;
    },
    d(r) {
      t && t.d(r);
    }
  };
}
function instance$f(n, e, t) {
  let { $$slots: r = {}, $$scope: a } = e, { height: s = void 0 } = e, { min_height: h = void 0 } = e, { max_height: o = void 0 } = e, { width: d = void 0 } = e, { elem_id: v = "" } = e, { elem_classes: f = [] } = e, { variant: y = "solid" } = e, { border_mode: A = "base" } = e, { padding: x = !0 } = e, { type: M = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: l = !1 } = e, { container: u = !0 } = e, { visible: p = !0 } = e, { allow_overflow: g = !0 } = e, { overflow_behavior: b = "auto" } = e, { scale: c = null } = e, { min_width: _ = 0 } = e, { flex: E = !1 } = e;
  p || (E = !1);
  let w = M === "fieldset" ? "fieldset" : "div";
  const k = ($) => {
    if ($ !== void 0) {
      if (typeof $ == "number")
        return $ + "px";
      if (typeof $ == "string")
        return $;
    }
  };
  return n.$$set = ($) => {
    "height" in $ && t(1, s = $.height), "min_height" in $ && t(2, h = $.min_height), "max_height" in $ && t(3, o = $.max_height), "width" in $ && t(4, d = $.width), "elem_id" in $ && t(5, v = $.elem_id), "elem_classes" in $ && t(6, f = $.elem_classes), "variant" in $ && t(7, y = $.variant), "border_mode" in $ && t(8, A = $.border_mode), "padding" in $ && t(9, x = $.padding), "type" in $ && t(20, M = $.type), "test_id" in $ && t(10, m = $.test_id), "explicit_call" in $ && t(11, l = $.explicit_call), "container" in $ && t(12, u = $.container), "visible" in $ && t(13, p = $.visible), "allow_overflow" in $ && t(14, g = $.allow_overflow), "overflow_behavior" in $ && t(15, b = $.overflow_behavior), "scale" in $ && t(16, c = $.scale), "min_width" in $ && t(17, _ = $.min_width), "flex" in $ && t(0, E = $.flex), "$$scope" in $ && t(21, a = $.$$scope);
  }, [
    E,
    s,
    h,
    o,
    d,
    v,
    f,
    y,
    A,
    x,
    m,
    l,
    u,
    p,
    g,
    b,
    c,
    _,
    w,
    k,
    M,
    a,
    r
  ];
}
class Block extends SvelteComponent$i {
  constructor(e) {
    super(), init$i(this, e, instance$f, create_fragment$i, safe_not_equal$j, {
      height: 1,
      min_height: 2,
      max_height: 3,
      width: 4,
      elem_id: 5,
      elem_classes: 6,
      variant: 7,
      border_mode: 8,
      padding: 9,
      type: 20,
      test_id: 10,
      explicit_call: 11,
      container: 12,
      visible: 13,
      allow_overflow: 14,
      overflow_behavior: 15,
      scale: 16,
      min_width: 17,
      flex: 0
    });
  }
}
class SourceLocation {
  // 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, t, r) {
    this.lexer = void 0, this.start = void 0, this.end = void 0, this.lexer = e, this.start = t, this.end = r;
  }
  /**
   * 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, t) {
    return t ? !e || !e.loc || !t.loc || e.loc.lexer !== t.loc.lexer ? null : new SourceLocation(e.loc.lexer, e.loc.start, t.loc.end) : e && e.loc;
  }
}
class Token {
  // don't expand the token
  // used in \noexpand
  constructor(e, t) {
    this.text = void 0, this.loc = void 0, this.noexpand = void 0, this.treatAsRelax = void 0, this.text = e, this.loc = t;
  }
  /**
   * Given a pair of tokens (this and endToken), compute a `Token` encompassing
   * the whole input range enclosed by these two.
   */
  range(e, t) {
    return new Token(t, SourceLocation.range(this, e));
  }
}
class ParseError {
  // 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, t) {
    this.name = void 0, this.position = void 0, this.length = void 0, this.rawMessage = void 0;
    var r = "KaTeX parse error: " + e, a, s, h = t && t.loc;
    if (h && h.start <= h.end) {
      var o = h.lexer.input;
      a = h.start, s = h.end, a === o.length ? r += " at end of input: " : r += " at position " + (a + 1) + ": ";
      var d = o.slice(a, s).replace(/[^]/g, "$&̲"), v;
      a > 15 ? v = "…" + o.slice(a - 15, a) : v = o.slice(0, a);
      var f;
      s + 15 < o.length ? f = o.slice(s, s + 15) + "…" : f = o.slice(s), r += v + d + f;
    }
    var y = new Error(r);
    return y.name = "ParseError", y.__proto__ = ParseError.prototype, y.position = a, a != null && s != null && (y.length = s - a), y.rawMessage = e, y;
  }
}
ParseError.prototype.__proto__ = Error.prototype;
var contains = function(e, t) {
  return e.indexOf(t) !== -1;
}, deflt = function(e, t) {
  return e === void 0 ? t : e;
}, uppercase = /([A-Z])/g, hyphenate = function(e) {
  return e.replace(uppercase, "-$1").toLowerCase();
}, ESCAPE_LOOKUP = {
  "&": "&amp;",
  ">": "&gt;",
  "<": "&lt;",
  '"': "&quot;",
  "'": "&#x27;"
}, ESCAPE_REGEX = /[&><"']/g;
function escape$3(n) {
  return String(n).replace(ESCAPE_REGEX, (e) => ESCAPE_LOOKUP[e]);
}
var getBaseElem = function n(e) {
  return e.type === "ordgroup" || e.type === "color" ? e.body.length === 1 ? n(e.body[0]) : e : e.type === "font" ? n(e.body) : e;
}, isCharacterBox = function(e) {
  var t = getBaseElem(e);
  return t.type === "mathord" || t.type === "textord" || t.type === "atom";
}, assert = function(e) {
  if (!e)
    throw new Error("Expected non-null, but got " + String(e));
  return e;
}, protocolFromUrl = function(e) {
  var t = /^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);
  return t ? t[2] !== ":" || !/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1]) ? null : t[1].toLowerCase() : "_relative";
}, utils = {
  contains,
  deflt,
  escape: escape$3,
  hyphenate,
  getBaseElem,
  isCharacterBox,
  protocolFromUrl
}, SETTINGS_SCHEMA = {
  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: (n) => "#" + n
  },
  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: (n, e) => (e.push(n), 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: (n) => Math.max(0, n),
    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: (n) => Math.max(0, n),
    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: (n) => Math.max(0, n),
    cli: "-e, --max-expand <n>",
    cliProcessor: (n) => n === "Infinity" ? 1 / 0 : parseInt(n)
  },
  globalGroup: {
    type: "boolean",
    cli: !1
  }
};
function getDefaultValue(n) {
  if (n.default)
    return n.default;
  var e = n.type, t = Array.isArray(e) ? e[0] : e;
  if (typeof t != "string")
    return t.enum[0];
  switch (t) {
    case "boolean":
      return !1;
    case "string":
      return "";
    case "number":
      return 0;
    case "object":
      return {};
  }
}
class Settings {
  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 t in SETTINGS_SCHEMA)
      if (SETTINGS_SCHEMA.hasOwnProperty(t)) {
        var r = SETTINGS_SCHEMA[t];
        this[t] = e[t] !== void 0 ? r.processor ? r.processor(e[t]) : e[t] : getDefaultValue(r);
      }
  }
  /**
   * Report nonstrict (non-LaTeX-compatible) input.
   * Can safely not be called if `this.strict` is false in JavaScript.
   */
  reportNonstrict(e, t, r) {
    var a = this.strict;
    if (typeof a == "function" && (a = a(e, t, r)), !(!a || a === "ignore")) {
      if (a === !0 || a === "error")
        throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (t + " [" + e + "]"), r);
      a === "warn" ? typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (t + " [" + e + "]")) : typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + a + "': " + t + " [" + 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, t, r) {
    var a = this.strict;
    if (typeof a == "function")
      try {
        a = a(e, t, r);
      } catch {
        a = "error";
      }
    return !a || a === "ignore" ? !1 : a === !0 || a === "error" ? !0 : a === "warn" ? (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (t + " [" + e + "]")), !1) : (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + a + "': " + t + " [" + 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 t = utils.protocolFromUrl(e.url);
      if (t == null)
        return !1;
      e.protocol = t;
    }
    var r = typeof this.trust == "function" ? this.trust(e) : this.trust;
    return !!r;
  }
}
class Style {
  constructor(e, t, r) {
    this.id = void 0, this.size = void 0, this.cramped = void 0, this.id = e, this.size = t, this.cramped = r;
  }
  /**
   * Get the style of a superscript given a base in the current style.
   */
  sup() {
    return styles[sup[this.id]];
  }
  /**
   * Get the style of a subscript given a base in the current style.
   */
  sub() {
    return styles[sub[this.id]];
  }
  /**
   * Get the style of a fraction numerator given the fraction in the current
   * style.
   */
  fracNum() {
    return styles[fracNum[this.id]];
  }
  /**
   * Get the style of a fraction denominator given the fraction in the current
   * style.
   */
  fracDen() {
    return styles[fracDen[this.id]];
  }
  /**
   * Get the cramped version of a style (in particular, cramping a cramped style
   * doesn't change the style).
   */
  cramp() {
    return styles[cramp[this.id]];
  }
  /**
   * Get a text or display version of this style.
   */
  text() {
    return styles[text$1$1[this.id]];
  }
  /**
   * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
   */
  isTight() {
    return this.size >= 2;
  }
}
var D = 0, Dc = 1, T = 2, Tc = 3, S = 4, Sc = 5, SS = 6, SSc = 7, styles = [new Style(D, 0, !1), new Style(Dc, 0, !0), new Style(T, 1, !1), new Style(Tc, 1, !0), new Style(S, 2, !1), new Style(Sc, 2, !0), new Style(SS, 3, !1), new Style(SSc, 3, !0)], sup = [S, Sc, S, Sc, SS, SSc, SS, SSc], sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc], fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc], fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc], cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc], text$1$1 = [D, Dc, T, Tc, T, Tc, T, Tc], Style$1 = {
  DISPLAY: styles[D],
  TEXT: styles[T],
  SCRIPT: styles[S],
  SCRIPTSCRIPT: styles[SS]
}, scriptData = [{
  // 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 scriptFromCodepoint(n) {
  for (var e = 0; e < scriptData.length; e++)
    for (var t = scriptData[e], r = 0; r < t.blocks.length; r++) {
      var a = t.blocks[r];
      if (n >= a[0] && n <= a[1])
        return t.name;
    }
  return null;
}
var allBlocks = [];
scriptData.forEach((n) => n.blocks.forEach((e) => allBlocks.push(...e)));
function supportedCodepoint(n) {
  for (var e = 0; e < allBlocks.length; e += 2)
    if (n >= allBlocks[e] && n <= allBlocks[e + 1])
      return !0;
  return !1;
}
var hLinePad = 80, sqrtMain = function(e, t) {
  return "M95," + (622 + e + t) + `
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) + " " + t + "h400000v" + (40 + e) + "h-400000z";
}, sqrtSize1 = function(e, t) {
  return "M263," + (601 + e + t) + `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) + " " + t + "h400000v" + (40 + e) + "h-400000z";
}, sqrtSize2 = function(e, t) {
  return "M983 " + (10 + e + t) + `
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) + " " + t + "h400000v" + (40 + e) + "h-400000z";
}, sqrtSize3 = function(e, t) {
  return "M424," + (2398 + e + t) + `
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) + " " + t + `
h400000v` + (40 + e) + "h-400000z";
}, sqrtSize4 = function(e, t) {
  return "M473," + (2713 + e + t) + `
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) + " " + t + "h400000v" + (40 + e) + "H1017.7z";
}, phasePath = function(e) {
  var t = e / 2;
  return "M400000 " + e + " H0 L" + t + " 0 l65 45 L145 " + (e - 80) + " H400000z";
}, sqrtTall = function(e, t, r) {
  var a = r - 54 - t - e;
  return "M702 " + (e + t) + "H400000" + (40 + e) + `
H742v` + a + `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 ` + t + "H400000v" + (40 + e) + "H742z";
}, sqrtPath = function(e, t, r) {
  t = 1e3 * t;
  var a = "";
  switch (e) {
    case "sqrtMain":
      a = sqrtMain(t, hLinePad);
      break;
    case "sqrtSize1":
      a = sqrtSize1(t, hLinePad);
      break;
    case "sqrtSize2":
      a = sqrtSize2(t, hLinePad);
      break;
    case "sqrtSize3":
      a = sqrtSize3(t, hLinePad);
      break;
    case "sqrtSize4":
      a = sqrtSize4(t, hLinePad);
      break;
    case "sqrtTall":
      a = sqrtTall(t, hLinePad, r);
  }
  return a;
}, innerPath = function(e, t) {
  switch (e) {
    case "⎜":
      return "M291 0 H417 V" + t + " H291z M291 0 H417 V" + t + " H291z";
    case "∣":
      return "M145 0 H188 V" + t + " H145z M145 0 H188 V" + t + " H145z";
    case "∥":
      return "M145 0 H188 V" + t + " H145z M145 0 H188 V" + t + " H145z" + ("M367 0 H410 V" + t + " H367z M367 0 H410 V" + t + " H367z");
    case "⎟":
      return "M457 0 H583 V" + t + " H457z M457 0 H583 V" + t + " H457z";
    case "⎢":
      return "M319 0 H403 V" + t + " H319z M319 0 H403 V" + t + " H319z";
    case "⎥":
      return "M263 0 H347 V" + t + " H263z M263 0 H347 V" + t + " H263z";
    case "⎪":
      return "M384 0 H504 V" + t + " H384z M384 0 H504 V" + t + " H384z";
    case "⏐":
      return "M312 0 H355 V" + t + " H312z M312 0 H355 V" + t + " H312z";
    case "‖":
      return "M257 0 H300 V" + t + " H257z M257 0 H300 V" + t + " H257z" + ("M478 0 H521 V" + t + " H478z M478 0 H521 V" + t + " H478z");
    default:
      return "";
  }
}, path = {
  // 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`
}, tallDelim = function(e, t) {
  switch (e) {
    case "lbrack":
      return "M403 1759 V84 H666 V0 H319 V1759 v" + t + ` v1759 h347 v-84
H403z M403 1759 V0 H319 V1759 v` + t + " v1759 h84z";
    case "rbrack":
      return "M347 1759 V0 H0 V84 H263 V1759 v" + t + ` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v` + t + " v1759 h84z";
    case "vert":
      return "M145 15 v585 v" + t + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + t + " v585 h43z";
    case "doublevert":
      return "M145 15 v585 v" + t + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + t + ` v585 h43z
M367 15 v585 v` + t + ` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v` + t + " v585 h43z";
    case "lfloor":
      return "M319 602 V0 H403 V602 v" + t + ` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v` + t + " v1715 H319z";
    case "rfloor":
      return "M319 602 V0 H403 V602 v" + t + ` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v` + t + " v1715 H319z";
    case "lceil":
      return "M403 1759 V84 H666 V0 H319 V1759 v" + t + ` v602 h84z
M403 1759 V0 H319 V1759 v` + t + " v602 h84z";
    case "rceil":
      return "M347 1759 V0 H0 V84 H263 V1759 v" + t + ` v602 h84z
M347 1759 V0 h-84 V1759 v` + t + " 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,` + (t + 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,-` + (t + 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,` + (t + 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,-` + (t + 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 DocumentFragment {
  // HtmlDomNode
  // 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 utils.contains(this.classes, e);
  }
  /** Convert the fragment into a node. */
  toNode() {
    for (var e = document.createDocumentFragment(), t = 0; t < this.children.length; t++)
      e.appendChild(this.children[t].toNode());
    return e;
  }
  /** Convert the fragment into HTML markup. */
  toMarkup() {
    for (var e = "", t = 0; t < this.children.length; t++)
      e += this.children[t].toMarkup();
    return e;
  }
  /**
   * Converts the math node into a string, similar to innerText. Applies to
   * MathDomNode's only.
   */
  toText() {
    var e = (t) => t.toText();
    return this.children.map(e).join("");
  }
}
var fontMetricsData = {
  "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]
  }
}, sigmasAndXis = {
  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
}, extraCharacterMap = {
  // 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 setFontMetrics(n, e) {
  fontMetricsData[n] = e;
}
function getCharacterMetrics(n, e, t) {
  if (!fontMetricsData[e])
    throw new Error("Font metrics not found for font: " + e + ".");
  var r = n.charCodeAt(0), a = fontMetricsData[e][r];
  if (!a && n[0] in extraCharacterMap && (r = extraCharacterMap[n[0]].charCodeAt(0), a = fontMetricsData[e][r]), !a && t === "text" && supportedCodepoint(r) && (a = fontMetricsData[e][77]), a)
    return {
      depth: a[0],
      height: a[1],
      italic: a[2],
      skew: a[3],
      width: a[4]
    };
}
var fontMetricsBySizeIndex = {};
function getGlobalMetrics(n) {
  var e;
  if (n >= 5 ? e = 0 : n >= 3 ? e = 1 : e = 2, !fontMetricsBySizeIndex[e]) {
    var t = fontMetricsBySizeIndex[e] = {
      cssEmPerMu: sigmasAndXis.quad[e] / 18
    };
    for (var r in sigmasAndXis)
      sigmasAndXis.hasOwnProperty(r) && (t[r] = sigmasAndXis[r][e]);
  }
  return fontMetricsBySizeIndex[e];
}
var sizeStyleMap = [
  // 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
], sizeMultipliers = [
  // 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
], sizeAtStyle = function(e, t) {
  return t.size < 2 ? e : sizeStyleMap[e - 1][t.size - 1];
};
class Options {
  // 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 || Options.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 = sizeMultipliers[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 t = {
      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 r in e)
      e.hasOwnProperty(r) && (t[r] = e[r]);
    return new Options(t);
  }
  /**
   * 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: sizeAtStyle(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: sizeMultipliers[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 t = sizeAtStyle(Options.BASESIZE, e);
    return this.size === t && this.textSize === Options.BASESIZE && this.style === e ? this : this.extend({
      style: e,
      size: t
    });
  }
  /**
   * 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 !== Options.BASESIZE ? ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE] : [];
  }
  /**
   * Return the font metrics for this size.
   */
  fontMetrics() {
    return this._fontMetrics || (this._fontMetrics = getGlobalMetrics(this.size)), this._fontMetrics;
  }
  /**
   * Gets the CSS color of the current options object
   */
  getColor() {
    return this.phantom ? "transparent" : this.color;
  }
}
Options.BASESIZE = 6;
var ptPerUnit = {
  // 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
}, relativeUnit = {
  ex: !0,
  em: !0,
  mu: !0
}, validUnit = function(e) {
  return typeof e != "string" && (e = e.unit), e in ptPerUnit || e in relativeUnit || e === "ex";
}, calculateSize = function(e, t) {
  var r;
  if (e.unit in ptPerUnit)
    r = ptPerUnit[e.unit] / t.fontMetrics().ptPerEm / t.sizeMultiplier;
  else if (e.unit === "mu")
    r = t.fontMetrics().cssEmPerMu;
  else {
    var a;
    if (t.style.isTight() ? a = t.havingStyle(t.style.text()) : a = t, e.unit === "ex")
      r = a.fontMetrics().xHeight;
    else if (e.unit === "em")
      r = a.fontMetrics().quad;
    else
      throw new ParseError("Invalid unit: '" + e.unit + "'");
    a !== t && (r *= a.sizeMultiplier / t.sizeMultiplier);
  }
  return Math.min(e.number * r, t.maxSize);
}, makeEm = function(e) {
  return +e.toFixed(4) + "em";
}, createClass = function(e) {
  return e.filter((t) => t).join(" ");
}, initNode = function(e, t, r) {
  if (this.classes = e || [], this.attributes = {}, this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = r || {}, t) {
    t.style.isTight() && this.classes.push("mtight");
    var a = t.getColor();
    a && (this.style.color = a);
  }
}, toNode = function(e) {
  var t = document.createElement(e);
  t.className = createClass(this.classes);
  for (var r in this.style)
    this.style.hasOwnProperty(r) && (t.style[r] = this.style[r]);
  for (var a in this.attributes)
    this.attributes.hasOwnProperty(a) && t.setAttribute(a, this.attributes[a]);
  for (var s = 0; s < this.children.length; s++)
    t.appendChild(this.children[s].toNode());
  return t;
}, toMarkup = function(e) {
  var t = "<" + e;
  this.classes.length && (t += ' class="' + utils.escape(createClass(this.classes)) + '"');
  var r = "";
  for (var a in this.style)
    this.style.hasOwnProperty(a) && (r += utils.hyphenate(a) + ":" + this.style[a] + ";");
  r && (t += ' style="' + utils.escape(r) + '"');
  for (var s in this.attributes)
    this.attributes.hasOwnProperty(s) && (t += " " + s + '="' + utils.escape(this.attributes[s]) + '"');
  t += ">";
  for (var h = 0; h < this.children.length; h++)
    t += this.children[h].toMarkup();
  return t += "</" + e + ">", t;
};
class Span {
  constructor(e, t, r, a) {
    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, initNode.call(this, e, r, a), this.children = t || [];
  }
  /**
   * 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, t) {
    this.attributes[e] = t;
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  toNode() {
    return toNode.call(this, "span");
  }
  toMarkup() {
    return toMarkup.call(this, "span");
  }
}
class Anchor {
  constructor(e, t, r, a) {
    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, initNode.call(this, t, a), this.children = r || [], this.setAttribute("href", e);
  }
  setAttribute(e, t) {
    this.attributes[e] = t;
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  toNode() {
    return toNode.call(this, "a");
  }
  toMarkup() {
    return toMarkup.call(this, "a");
  }
}
class Img {
  constructor(e, t, r) {
    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 = t, this.src = e, this.classes = ["mord"], this.style = r;
  }
  hasClass(e) {
    return utils.contains(this.classes, e);
  }
  toNode() {
    var e = document.createElement("img");
    e.src = this.src, e.alt = this.alt, e.className = "mord";
    for (var t in this.style)
      this.style.hasOwnProperty(t) && (e.style[t] = this.style[t]);
    return e;
  }
  toMarkup() {
    var e = '<img src="' + utils.escape(this.src) + '"' + (' alt="' + utils.escape(this.alt) + '"'), t = "";
    for (var r in this.style)
      this.style.hasOwnProperty(r) && (t += utils.hyphenate(r) + ":" + this.style[r] + ";");
    return t && (e += ' style="' + utils.escape(t) + '"'), e += "'/>", e;
  }
}
var iCombinations = {
  î: "ı̂",
  ï: "ı̈",
  í: "ı́",
  // 'ī': '\u0131\u0304', // enable when we add Extended Latin
  ì: "ı̀"
};
class SymbolNode {
  constructor(e, t, r, a, s, h, o, d) {
    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 = t || 0, this.depth = r || 0, this.italic = a || 0, this.skew = s || 0, this.width = h || 0, this.classes = o || [], this.style = d || {}, this.maxFontSize = 0;
    var v = scriptFromCodepoint(this.text.charCodeAt(0));
    v && this.classes.push(v + "_fallback"), /[îïíì]/.test(this.text) && (this.text = iCombinations[this.text]);
  }
  hasClass(e) {
    return utils.contains(this.classes, 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), t = null;
    this.italic > 0 && (t = document.createElement("span"), t.style.marginRight = makeEm(this.italic)), this.classes.length > 0 && (t = t || document.createElement("span"), t.className = createClass(this.classes));
    for (var r in this.style)
      this.style.hasOwnProperty(r) && (t = t || document.createElement("span"), t.style[r] = this.style[r]);
    return t ? (t.appendChild(e), t) : e;
  }
  /**
   * Creates markup for a symbol node.
   */
  toMarkup() {
    var e = !1, t = "<span";
    this.classes.length && (e = !0, t += ' class="', t += utils.escape(createClass(this.classes)), t += '"');
    var r = "";
    this.italic > 0 && (r += "margin-right:" + this.italic + "em;");
    for (var a in this.style)
      this.style.hasOwnProperty(a) && (r += utils.hyphenate(a) + ":" + this.style[a] + ";");
    r && (e = !0, t += ' style="' + utils.escape(r) + '"');
    var s = utils.escape(this.text);
    return e ? (t += ">", t += s, t += "</span>", t) : s;
  }
}
class SvgNode {
  constructor(e, t) {
    this.children = void 0, this.attributes = void 0, this.children = e || [], this.attributes = t || {};
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && t.setAttribute(r, this.attributes[r]);
    for (var a = 0; a < this.children.length; a++)
      t.appendChild(this.children[a].toNode());
    return t;
  }
  toMarkup() {
    var e = '<svg xmlns="http://www.w3.org/2000/svg"';
    for (var t in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, t) && (e += " " + t + '="' + utils.escape(this.attributes[t]) + '"');
    e += ">";
    for (var r = 0; r < this.children.length; r++)
      e += this.children[r].toMarkup();
    return e += "</svg>", e;
  }
}
class PathNode {
  constructor(e, t) {
    this.pathName = void 0, this.alternate = void 0, this.pathName = e, this.alternate = t;
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "path");
    return this.alternate ? t.setAttribute("d", this.alternate) : t.setAttribute("d", path[this.pathName]), t;
  }
  toMarkup() {
    return this.alternate ? '<path d="' + utils.escape(this.alternate) + '"/>' : '<path d="' + utils.escape(path[this.pathName]) + '"/>';
  }
}
class LineNode {
  constructor(e) {
    this.attributes = void 0, this.attributes = e || {};
  }
  toNode() {
    var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "line");
    for (var r in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, r) && t.setAttribute(r, this.attributes[r]);
    return t;
  }
  toMarkup() {
    var e = "<line";
    for (var t in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, t) && (e += " " + t + '="' + utils.escape(this.attributes[t]) + '"');
    return e += "/>", e;
  }
}
function assertSymbolDomNode(n) {
  if (n instanceof SymbolNode)
    return n;
  throw new Error("Expected symbolNode but got " + String(n) + ".");
}
function assertSpan(n) {
  if (n instanceof Span)
    return n;
  throw new Error("Expected span<HtmlDomNode> but got " + String(n) + ".");
}
var ATOMS = {
  bin: 1,
  close: 1,
  inner: 1,
  open: 1,
  punct: 1,
  rel: 1
}, NON_ATOMS = {
  "accent-token": 1,
  mathord: 1,
  "op-token": 1,
  spacing: 1,
  textord: 1
}, symbols = {
  math: {},
  text: {}
};
function defineSymbol(n, e, t, r, a, s) {
  symbols[n][a] = {
    font: e,
    group: t,
    replace: r
  }, s && r && (symbols[n][r] = symbols[n][a]);
}
var math = "math", text$a = "text", main = "main", ams = "ams", accent = "accent-token", bin = "bin", close = "close", inner = "inner", mathord = "mathord", op = "op-token", open = "open", punct = "punct", rel = "rel", spacing = "spacing", textord = "textord";
defineSymbol(math, main, rel, "≡", "\\equiv", !0);
defineSymbol(math, main, rel, "≺", "\\prec", !0);
defineSymbol(math, main, rel, "≻", "\\succ", !0);
defineSymbol(math, main, rel, "∼", "\\sim", !0);
defineSymbol(math, main, rel, "⊥", "\\perp");
defineSymbol(math, main, rel, "⪯", "\\preceq", !0);
defineSymbol(math, main, rel, "⪰", "\\succeq", !0);
defineSymbol(math, main, rel, "≃", "\\simeq", !0);
defineSymbol(math, main, rel, "∣", "\\mid", !0);
defineSymbol(math, main, rel, "≪", "\\ll", !0);
defineSymbol(math, main, rel, "≫", "\\gg", !0);
defineSymbol(math, main, rel, "≍", "\\asymp", !0);
defineSymbol(math, main, rel, "∥", "\\parallel");
defineSymbol(math, main, rel, "⋈", "\\bowtie", !0);
defineSymbol(math, main, rel, "⌣", "\\smile", !0);
defineSymbol(math, main, rel, "⊑", "\\sqsubseteq", !0);
defineSymbol(math, main, rel, "⊒", "\\sqsupseteq", !0);
defineSymbol(math, main, rel, "≐", "\\doteq", !0);
defineSymbol(math, main, rel, "⌢", "\\frown", !0);
defineSymbol(math, main, rel, "∋", "\\ni", !0);
defineSymbol(math, main, rel, "∝", "\\propto", !0);
defineSymbol(math, main, rel, "⊢", "\\vdash", !0);
defineSymbol(math, main, rel, "⊣", "\\dashv", !0);
defineSymbol(math, main, rel, "∋", "\\owns");
defineSymbol(math, main, punct, ".", "\\ldotp");
defineSymbol(math, main, punct, "⋅", "\\cdotp");
defineSymbol(math, main, textord, "#", "\\#");
defineSymbol(text$a, main, textord, "#", "\\#");
defineSymbol(math, main, textord, "&", "\\&");
defineSymbol(text$a, main, textord, "&", "\\&");
defineSymbol(math, main, textord, "ℵ", "\\aleph", !0);
defineSymbol(math, main, textord, "∀", "\\forall", !0);
defineSymbol(math, main, textord, "ℏ", "\\hbar", !0);
defineSymbol(math, main, textord, "∃", "\\exists", !0);
defineSymbol(math, main, textord, "∇", "\\nabla", !0);
defineSymbol(math, main, textord, "♭", "\\flat", !0);
defineSymbol(math, main, textord, "ℓ", "\\ell", !0);
defineSymbol(math, main, textord, "♮", "\\natural", !0);
defineSymbol(math, main, textord, "♣", "\\clubsuit", !0);
defineSymbol(math, main, textord, "℘", "\\wp", !0);
defineSymbol(math, main, textord, "♯", "\\sharp", !0);
defineSymbol(math, main, textord, "♢", "\\diamondsuit", !0);
defineSymbol(math, main, textord, "ℜ", "\\Re", !0);
defineSymbol(math, main, textord, "♡", "\\heartsuit", !0);
defineSymbol(math, main, textord, "ℑ", "\\Im", !0);
defineSymbol(math, main, textord, "♠", "\\spadesuit", !0);
defineSymbol(math, main, textord, "§", "\\S", !0);
defineSymbol(text$a, main, textord, "§", "\\S");
defineSymbol(math, main, textord, "¶", "\\P", !0);
defineSymbol(text$a, main, textord, "¶", "\\P");
defineSymbol(math, main, textord, "†", "\\dag");
defineSymbol(text$a, main, textord, "†", "\\dag");
defineSymbol(text$a, main, textord, "†", "\\textdagger");
defineSymbol(math, main, textord, "‡", "\\ddag");
defineSymbol(text$a, main, textord, "‡", "\\ddag");
defineSymbol(text$a, main, textord, "‡", "\\textdaggerdbl");
defineSymbol(math, main, close, "⎱", "\\rmoustache", !0);
defineSymbol(math, main, open, "⎰", "\\lmoustache", !0);
defineSymbol(math, main, close, "⟯", "\\rgroup", !0);
defineSymbol(math, main, open, "⟮", "\\lgroup", !0);
defineSymbol(math, main, bin, "∓", "\\mp", !0);
defineSymbol(math, main, bin, "⊖", "\\ominus", !0);
defineSymbol(math, main, bin, "⊎", "\\uplus", !0);
defineSymbol(math, main, bin, "⊓", "\\sqcap", !0);
defineSymbol(math, main, bin, "∗", "\\ast");
defineSymbol(math, main, bin, "⊔", "\\sqcup", !0);
defineSymbol(math, main, bin, "◯", "\\bigcirc", !0);
defineSymbol(math, main, bin, "∙", "\\bullet", !0);
defineSymbol(math, main, bin, "‡", "\\ddagger");
defineSymbol(math, main, bin, "≀", "\\wr", !0);
defineSymbol(math, main, bin, "⨿", "\\amalg");
defineSymbol(math, main, bin, "&", "\\And");
defineSymbol(math, main, rel, "⟵", "\\longleftarrow", !0);
defineSymbol(math, main, rel, "⇐", "\\Leftarrow", !0);
defineSymbol(math, main, rel, "⟸", "\\Longleftarrow", !0);
defineSymbol(math, main, rel, "⟶", "\\longrightarrow", !0);
defineSymbol(math, main, rel, "⇒", "\\Rightarrow", !0);
defineSymbol(math, main, rel, "⟹", "\\Longrightarrow", !0);
defineSymbol(math, main, rel, "↔", "\\leftrightarrow", !0);
defineSymbol(math, main, rel, "⟷", "\\longleftrightarrow", !0);
defineSymbol(math, main, rel, "⇔", "\\Leftrightarrow", !0);
defineSymbol(math, main, rel, "⟺", "\\Longleftrightarrow", !0);
defineSymbol(math, main, rel, "↦", "\\mapsto", !0);
defineSymbol(math, main, rel, "⟼", "\\longmapsto", !0);
defineSymbol(math, main, rel, "↗", "\\nearrow", !0);
defineSymbol(math, main, rel, "↩", "\\hookleftarrow", !0);
defineSymbol(math, main, rel, "↪", "\\hookrightarrow", !0);
defineSymbol(math, main, rel, "↘", "\\searrow", !0);
defineSymbol(math, main, rel, "↼", "\\leftharpoonup", !0);
defineSymbol(math, main, rel, "⇀", "\\rightharpoonup", !0);
defineSymbol(math, main, rel, "↙", "\\swarrow", !0);
defineSymbol(math, main, rel, "↽", "\\leftharpoondown", !0);
defineSymbol(math, main, rel, "⇁", "\\rightharpoondown", !0);
defineSymbol(math, main, rel, "↖", "\\nwarrow", !0);
defineSymbol(math, main, rel, "⇌", "\\rightleftharpoons", !0);
defineSymbol(math, ams, rel, "≮", "\\nless", !0);
defineSymbol(math, ams, rel, "", "\\@nleqslant");
defineSymbol(math, ams, rel, "", "\\@nleqq");
defineSymbol(math, ams, rel, "⪇", "\\lneq", !0);
defineSymbol(math, ams, rel, "≨", "\\lneqq", !0);
defineSymbol(math, ams, rel, "", "\\@lvertneqq");
defineSymbol(math, ams, rel, "⋦", "\\lnsim", !0);
defineSymbol(math, ams, rel, "⪉", "\\lnapprox", !0);
defineSymbol(math, ams, rel, "⊀", "\\nprec", !0);
defineSymbol(math, ams, rel, "⋠", "\\npreceq", !0);
defineSymbol(math, ams, rel, "⋨", "\\precnsim", !0);
defineSymbol(math, ams, rel, "⪹", "\\precnapprox", !0);
defineSymbol(math, ams, rel, "≁", "\\nsim", !0);
defineSymbol(math, ams, rel, "", "\\@nshortmid");
defineSymbol(math, ams, rel, "∤", "\\nmid", !0);
defineSymbol(math, ams, rel, "⊬", "\\nvdash", !0);
defineSymbol(math, ams, rel, "⊭", "\\nvDash", !0);
defineSymbol(math, ams, rel, "⋪", "\\ntriangleleft");
defineSymbol(math, ams, rel, "⋬", "\\ntrianglelefteq", !0);
defineSymbol(math, ams, rel, "⊊", "\\subsetneq", !0);
defineSymbol(math, ams, rel, "", "\\@varsubsetneq");
defineSymbol(math, ams, rel, "⫋", "\\subsetneqq", !0);
defineSymbol(math, ams, rel, "", "\\@varsubsetneqq");
defineSymbol(math, ams, rel, "≯", "\\ngtr", !0);
defineSymbol(math, ams, rel, "", "\\@ngeqslant");
defineSymbol(math, ams, rel, "", "\\@ngeqq");
defineSymbol(math, ams, rel, "⪈", "\\gneq", !0);
defineSymbol(math, ams, rel, "≩", "\\gneqq", !0);
defineSymbol(math, ams, rel, "", "\\@gvertneqq");
defineSymbol(math, ams, rel, "⋧", "\\gnsim", !0);
defineSymbol(math, ams, rel, "⪊", "\\gnapprox", !0);
defineSymbol(math, ams, rel, "⊁", "\\nsucc", !0);
defineSymbol(math, ams, rel, "⋡", "\\nsucceq", !0);
defineSymbol(math, ams, rel, "⋩", "\\succnsim", !0);
defineSymbol(math, ams, rel, "⪺", "\\succnapprox", !0);
defineSymbol(math, ams, rel, "≆", "\\ncong", !0);
defineSymbol(math, ams, rel, "", "\\@nshortparallel");
defineSymbol(math, ams, rel, "∦", "\\nparallel", !0);
defineSymbol(math, ams, rel, "⊯", "\\nVDash", !0);
defineSymbol(math, ams, rel, "⋫", "\\ntriangleright");
defineSymbol(math, ams, rel, "⋭", "\\ntrianglerighteq", !0);
defineSymbol(math, ams, rel, "", "\\@nsupseteqq");
defineSymbol(math, ams, rel, "⊋", "\\supsetneq", !0);
defineSymbol(math, ams, rel, "", "\\@varsupsetneq");
defineSymbol(math, ams, rel, "⫌", "\\supsetneqq", !0);
defineSymbol(math, ams, rel, "", "\\@varsupsetneqq");
defineSymbol(math, ams, rel, "⊮", "\\nVdash", !0);
defineSymbol(math, ams, rel, "⪵", "\\precneqq", !0);
defineSymbol(math, ams, rel, "⪶", "\\succneqq", !0);
defineSymbol(math, ams, rel, "", "\\@nsubseteqq");
defineSymbol(math, ams, bin, "⊴", "\\unlhd");
defineSymbol(math, ams, bin, "⊵", "\\unrhd");
defineSymbol(math, ams, rel, "↚", "\\nleftarrow", !0);
defineSymbol(math, ams, rel, "↛", "\\nrightarrow", !0);
defineSymbol(math, ams, rel, "⇍", "\\nLeftarrow", !0);
defineSymbol(math, ams, rel, "⇏", "\\nRightarrow", !0);
defineSymbol(math, ams, rel, "↮", "\\nleftrightarrow", !0);
defineSymbol(math, ams, rel, "⇎", "\\nLeftrightarrow", !0);
defineSymbol(math, ams, rel, "△", "\\vartriangle");
defineSymbol(math, ams, textord, "ℏ", "\\hslash");
defineSymbol(math, ams, textord, "▽", "\\triangledown");
defineSymbol(math, ams, textord, "◊", "\\lozenge");
defineSymbol(math, ams, textord, "Ⓢ", "\\circledS");
defineSymbol(math, ams, textord, "®", "\\circledR");
defineSymbol(text$a, ams, textord, "®", "\\circledR");
defineSymbol(math, ams, textord, "∡", "\\measuredangle", !0);
defineSymbol(math, ams, textord, "∄", "\\nexists");
defineSymbol(math, ams, textord, "℧", "\\mho");
defineSymbol(math, ams, textord, "Ⅎ", "\\Finv", !0);
defineSymbol(math, ams, textord, "⅁", "\\Game", !0);
defineSymbol(math, ams, textord, "‵", "\\backprime");
defineSymbol(math, ams, textord, "▲", "\\blacktriangle");
defineSymbol(math, ams, textord, "▼", "\\blacktriangledown");
defineSymbol(math, ams, textord, "■", "\\blacksquare");
defineSymbol(math, ams, textord, "⧫", "\\blacklozenge");
defineSymbol(math, ams, textord, "★", "\\bigstar");
defineSymbol(math, ams, textord, "∢", "\\sphericalangle", !0);
defineSymbol(math, ams, textord, "∁", "\\complement", !0);
defineSymbol(math, ams, textord, "ð", "\\eth", !0);
defineSymbol(text$a, main, textord, "ð", "ð");
defineSymbol(math, ams, textord, "╱", "\\diagup");
defineSymbol(math, ams, textord, "╲", "\\diagdown");
defineSymbol(math, ams, textord, "□", "\\square");
defineSymbol(math, ams, textord, "□", "\\Box");
defineSymbol(math, ams, textord, "◊", "\\Diamond");
defineSymbol(math, ams, textord, "¥", "\\yen", !0);
defineSymbol(text$a, ams, textord, "¥", "\\yen", !0);
defineSymbol(math, ams, textord, "✓", "\\checkmark", !0);
defineSymbol(text$a, ams, textord, "✓", "\\checkmark");
defineSymbol(math, ams, textord, "ℶ", "\\beth", !0);
defineSymbol(math, ams, textord, "ℸ", "\\daleth", !0);
defineSymbol(math, ams, textord, "ℷ", "\\gimel", !0);
defineSymbol(math, ams, textord, "ϝ", "\\digamma", !0);
defineSymbol(math, ams, textord, "ϰ", "\\varkappa");
defineSymbol(math, ams, open, "┌", "\\@ulcorner", !0);
defineSymbol(math, ams, close, "┐", "\\@urcorner", !0);
defineSymbol(math, ams, open, "└", "\\@llcorner", !0);
defineSymbol(math, ams, close, "┘", "\\@lrcorner", !0);
defineSymbol(math, ams, rel, "≦", "\\leqq", !0);
defineSymbol(math, ams, rel, "⩽", "\\leqslant", !0);
defineSymbol(math, ams, rel, "⪕", "\\eqslantless", !0);
defineSymbol(math, ams, rel, "≲", "\\lesssim", !0);
defineSymbol(math, ams, rel, "⪅", "\\lessapprox", !0);
defineSymbol(math, ams, rel, "≊", "\\approxeq", !0);
defineSymbol(math, ams, bin, "⋖", "\\lessdot");
defineSymbol(math, ams, rel, "⋘", "\\lll", !0);
defineSymbol(math, ams, rel, "≶", "\\lessgtr", !0);
defineSymbol(math, ams, rel, "⋚", "\\lesseqgtr", !0);
defineSymbol(math, ams, rel, "⪋", "\\lesseqqgtr", !0);
defineSymbol(math, ams, rel, "≑", "\\doteqdot");
defineSymbol(math, ams, rel, "≓", "\\risingdotseq", !0);
defineSymbol(math, ams, rel, "≒", "\\fallingdotseq", !0);
defineSymbol(math, ams, rel, "∽", "\\backsim", !0);
defineSymbol(math, ams, rel, "⋍", "\\backsimeq", !0);
defineSymbol(math, ams, rel, "⫅", "\\subseteqq", !0);
defineSymbol(math, ams, rel, "⋐", "\\Subset", !0);
defineSymbol(math, ams, rel, "⊏", "\\sqsubset", !0);
defineSymbol(math, ams, rel, "≼", "\\preccurlyeq", !0);
defineSymbol(math, ams, rel, "⋞", "\\curlyeqprec", !0);
defineSymbol(math, ams, rel, "≾", "\\precsim", !0);
defineSymbol(math, ams, rel, "⪷", "\\precapprox", !0);
defineSymbol(math, ams, rel, "⊲", "\\vartriangleleft");
defineSymbol(math, ams, rel, "⊴", "\\trianglelefteq");
defineSymbol(math, ams, rel, "⊨", "\\vDash", !0);
defineSymbol(math, ams, rel, "⊪", "\\Vvdash", !0);
defineSymbol(math, ams, rel, "⌣", "\\smallsmile");
defineSymbol(math, ams, rel, "⌢", "\\smallfrown");
defineSymbol(math, ams, rel, "≏", "\\bumpeq", !0);
defineSymbol(math, ams, rel, "≎", "\\Bumpeq", !0);
defineSymbol(math, ams, rel, "≧", "\\geqq", !0);
defineSymbol(math, ams, rel, "⩾", "\\geqslant", !0);
defineSymbol(math, ams, rel, "⪖", "\\eqslantgtr", !0);
defineSymbol(math, ams, rel, "≳", "\\gtrsim", !0);
defineSymbol(math, ams, rel, "⪆", "\\gtrapprox", !0);
defineSymbol(math, ams, bin, "⋗", "\\gtrdot");
defineSymbol(math, ams, rel, "⋙", "\\ggg", !0);
defineSymbol(math, ams, rel, "≷", "\\gtrless", !0);
defineSymbol(math, ams, rel, "⋛", "\\gtreqless", !0);
defineSymbol(math, ams, rel, "⪌", "\\gtreqqless", !0);
defineSymbol(math, ams, rel, "≖", "\\eqcirc", !0);
defineSymbol(math, ams, rel, "≗", "\\circeq", !0);
defineSymbol(math, ams, rel, "≜", "\\triangleq", !0);
defineSymbol(math, ams, rel, "∼", "\\thicksim");
defineSymbol(math, ams, rel, "≈", "\\thickapprox");
defineSymbol(math, ams, rel, "⫆", "\\supseteqq", !0);
defineSymbol(math, ams, rel, "⋑", "\\Supset", !0);
defineSymbol(math, ams, rel, "⊐", "\\sqsupset", !0);
defineSymbol(math, ams, rel, "≽", "\\succcurlyeq", !0);
defineSymbol(math, ams, rel, "⋟", "\\curlyeqsucc", !0);
defineSymbol(math, ams, rel, "≿", "\\succsim", !0);
defineSymbol(math, ams, rel, "⪸", "\\succapprox", !0);
defineSymbol(math, ams, rel, "⊳", "\\vartriangleright");
defineSymbol(math, ams, rel, "⊵", "\\trianglerighteq");
defineSymbol(math, ams, rel, "⊩", "\\Vdash", !0);
defineSymbol(math, ams, rel, "∣", "\\shortmid");
defineSymbol(math, ams, rel, "∥", "\\shortparallel");
defineSymbol(math, ams, rel, "≬", "\\between", !0);
defineSymbol(math, ams, rel, "⋔", "\\pitchfork", !0);
defineSymbol(math, ams, rel, "∝", "\\varpropto");
defineSymbol(math, ams, rel, "◀", "\\blacktriangleleft");
defineSymbol(math, ams, rel, "∴", "\\therefore", !0);
defineSymbol(math, ams, rel, "∍", "\\backepsilon");
defineSymbol(math, ams, rel, "▶", "\\blacktriangleright");
defineSymbol(math, ams, rel, "∵", "\\because", !0);
defineSymbol(math, ams, rel, "⋘", "\\llless");
defineSymbol(math, ams, rel, "⋙", "\\gggtr");
defineSymbol(math, ams, bin, "⊲", "\\lhd");
defineSymbol(math, ams, bin, "⊳", "\\rhd");
defineSymbol(math, ams, rel, "≂", "\\eqsim", !0);
defineSymbol(math, main, rel, "⋈", "\\Join");
defineSymbol(math, ams, rel, "≑", "\\Doteq", !0);
defineSymbol(math, ams, bin, "∔", "\\dotplus", !0);
defineSymbol(math, ams, bin, "∖", "\\smallsetminus");
defineSymbol(math, ams, bin, "⋒", "\\Cap", !0);
defineSymbol(math, ams, bin, "⋓", "\\Cup", !0);
defineSymbol(math, ams, bin, "⩞", "\\doublebarwedge", !0);
defineSymbol(math, ams, bin, "⊟", "\\boxminus", !0);
defineSymbol(math, ams, bin, "⊞", "\\boxplus", !0);
defineSymbol(math, ams, bin, "⋇", "\\divideontimes", !0);
defineSymbol(math, ams, bin, "⋉", "\\ltimes", !0);
defineSymbol(math, ams, bin, "⋊", "\\rtimes", !0);
defineSymbol(math, ams, bin, "⋋", "\\leftthreetimes", !0);
defineSymbol(math, ams, bin, "⋌", "\\rightthreetimes", !0);
defineSymbol(math, ams, bin, "⋏", "\\curlywedge", !0);
defineSymbol(math, ams, bin, "⋎", "\\curlyvee", !0);
defineSymbol(math, ams, bin, "⊝", "\\circleddash", !0);
defineSymbol(math, ams, bin, "⊛", "\\circledast", !0);
defineSymbol(math, ams, bin, "⋅", "\\centerdot");
defineSymbol(math, ams, bin, "⊺", "\\intercal", !0);
defineSymbol(math, ams, bin, "⋒", "\\doublecap");
defineSymbol(math, ams, bin, "⋓", "\\doublecup");
defineSymbol(math, ams, bin, "⊠", "\\boxtimes", !0);
defineSymbol(math, ams, rel, "⇢", "\\dashrightarrow", !0);
defineSymbol(math, ams, rel, "⇠", "\\dashleftarrow", !0);
defineSymbol(math, ams, rel, "⇇", "\\leftleftarrows", !0);
defineSymbol(math, ams, rel, "⇆", "\\leftrightarrows", !0);
defineSymbol(math, ams, rel, "⇚", "\\Lleftarrow", !0);
defineSymbol(math, ams, rel, "↞", "\\twoheadleftarrow", !0);
defineSymbol(math, ams, rel, "↢", "\\leftarrowtail", !0);
defineSymbol(math, ams, rel, "↫", "\\looparrowleft", !0);
defineSymbol(math, ams, rel, "⇋", "\\leftrightharpoons", !0);
defineSymbol(math, ams, rel, "↶", "\\curvearrowleft", !0);
defineSymbol(math, ams, rel, "↺", "\\circlearrowleft", !0);
defineSymbol(math, ams, rel, "↰", "\\Lsh", !0);
defineSymbol(math, ams, rel, "⇈", "\\upuparrows", !0);
defineSymbol(math, ams, rel, "↿", "\\upharpoonleft", !0);
defineSymbol(math, ams, rel, "⇃", "\\downharpoonleft", !0);
defineSymbol(math, main, rel, "⊶", "\\origof", !0);
defineSymbol(math, main, rel, "⊷", "\\imageof", !0);
defineSymbol(math, ams, rel, "⊸", "\\multimap", !0);
defineSymbol(math, ams, rel, "↭", "\\leftrightsquigarrow", !0);
defineSymbol(math, ams, rel, "⇉", "\\rightrightarrows", !0);
defineSymbol(math, ams, rel, "⇄", "\\rightleftarrows", !0);
defineSymbol(math, ams, rel, "↠", "\\twoheadrightarrow", !0);
defineSymbol(math, ams, rel, "↣", "\\rightarrowtail", !0);
defineSymbol(math, ams, rel, "↬", "\\looparrowright", !0);
defineSymbol(math, ams, rel, "↷", "\\curvearrowright", !0);
defineSymbol(math, ams, rel, "↻", "\\circlearrowright", !0);
defineSymbol(math, ams, rel, "↱", "\\Rsh", !0);
defineSymbol(math, ams, rel, "⇊", "\\downdownarrows", !0);
defineSymbol(math, ams, rel, "↾", "\\upharpoonright", !0);
defineSymbol(math, ams, rel, "⇂", "\\downharpoonright", !0);
defineSymbol(math, ams, rel, "⇝", "\\rightsquigarrow", !0);
defineSymbol(math, ams, rel, "⇝", "\\leadsto");
defineSymbol(math, ams, rel, "⇛", "\\Rrightarrow", !0);
defineSymbol(math, ams, rel, "↾", "\\restriction");
defineSymbol(math, main, textord, "‘", "`");
defineSymbol(math, main, textord, "$", "\\$");
defineSymbol(text$a, main, textord, "$", "\\$");
defineSymbol(text$a, main, textord, "$", "\\textdollar");
defineSymbol(math, main, textord, "%", "\\%");
defineSymbol(text$a, main, textord, "%", "\\%");
defineSymbol(math, main, textord, "_", "\\_");
defineSymbol(text$a, main, textord, "_", "\\_");
defineSymbol(text$a, main, textord, "_", "\\textunderscore");
defineSymbol(math, main, textord, "∠", "\\angle", !0);
defineSymbol(math, main, textord, "∞", "\\infty", !0);
defineSymbol(math, main, textord, "′", "\\prime");
defineSymbol(math, main, textord, "△", "\\triangle");
defineSymbol(math, main, textord, "Γ", "\\Gamma", !0);
defineSymbol(math, main, textord, "Δ", "\\Delta", !0);
defineSymbol(math, main, textord, "Θ", "\\Theta", !0);
defineSymbol(math, main, textord, "Λ", "\\Lambda", !0);
defineSymbol(math, main, textord, "Ξ", "\\Xi", !0);
defineSymbol(math, main, textord, "Π", "\\Pi", !0);
defineSymbol(math, main, textord, "Σ", "\\Sigma", !0);
defineSymbol(math, main, textord, "Υ", "\\Upsilon", !0);
defineSymbol(math, main, textord, "Φ", "\\Phi", !0);
defineSymbol(math, main, textord, "Ψ", "\\Psi", !0);
defineSymbol(math, main, textord, "Ω", "\\Omega", !0);
defineSymbol(math, main, textord, "A", "Α");
defineSymbol(math, main, textord, "B", "Β");
defineSymbol(math, main, textord, "E", "Ε");
defineSymbol(math, main, textord, "Z", "Ζ");
defineSymbol(math, main, textord, "H", "Η");
defineSymbol(math, main, textord, "I", "Ι");
defineSymbol(math, main, textord, "K", "Κ");
defineSymbol(math, main, textord, "M", "Μ");
defineSymbol(math, main, textord, "N", "Ν");
defineSymbol(math, main, textord, "O", "Ο");
defineSymbol(math, main, textord, "P", "Ρ");
defineSymbol(math, main, textord, "T", "Τ");
defineSymbol(math, main, textord, "X", "Χ");
defineSymbol(math, main, textord, "¬", "\\neg", !0);
defineSymbol(math, main, textord, "¬", "\\lnot");
defineSymbol(math, main, textord, "⊤", "\\top");
defineSymbol(math, main, textord, "⊥", "\\bot");
defineSymbol(math, main, textord, "∅", "\\emptyset");
defineSymbol(math, ams, textord, "∅", "\\varnothing");
defineSymbol(math, main, mathord, "α", "\\alpha", !0);
defineSymbol(math, main, mathord, "β", "\\beta", !0);
defineSymbol(math, main, mathord, "γ", "\\gamma", !0);
defineSymbol(math, main, mathord, "δ", "\\delta", !0);
defineSymbol(math, main, mathord, "ϵ", "\\epsilon", !0);
defineSymbol(math, main, mathord, "ζ", "\\zeta", !0);
defineSymbol(math, main, mathord, "η", "\\eta", !0);
defineSymbol(math, main, mathord, "θ", "\\theta", !0);
defineSymbol(math, main, mathord, "ι", "\\iota", !0);
defineSymbol(math, main, mathord, "κ", "\\kappa", !0);
defineSymbol(math, main, mathord, "λ", "\\lambda", !0);
defineSymbol(math, main, mathord, "μ", "\\mu", !0);
defineSymbol(math, main, mathord, "ν", "\\nu", !0);
defineSymbol(math, main, mathord, "ξ", "\\xi", !0);
defineSymbol(math, main, mathord, "ο", "\\omicron", !0);
defineSymbol(math, main, mathord, "π", "\\pi", !0);
defineSymbol(math, main, mathord, "ρ", "\\rho", !0);
defineSymbol(math, main, mathord, "σ", "\\sigma", !0);
defineSymbol(math, main, mathord, "τ", "\\tau", !0);
defineSymbol(math, main, mathord, "υ", "\\upsilon", !0);
defineSymbol(math, main, mathord, "ϕ", "\\phi", !0);
defineSymbol(math, main, mathord, "χ", "\\chi", !0);
defineSymbol(math, main, mathord, "ψ", "\\psi", !0);
defineSymbol(math, main, mathord, "ω", "\\omega", !0);
defineSymbol(math, main, mathord, "ε", "\\varepsilon", !0);
defineSymbol(math, main, mathord, "ϑ", "\\vartheta", !0);
defineSymbol(math, main, mathord, "ϖ", "\\varpi", !0);
defineSymbol(math, main, mathord, "ϱ", "\\varrho", !0);
defineSymbol(math, main, mathord, "ς", "\\varsigma", !0);
defineSymbol(math, main, mathord, "φ", "\\varphi", !0);
defineSymbol(math, main, bin, "∗", "*", !0);
defineSymbol(math, main, bin, "+", "+");
defineSymbol(math, main, bin, "−", "-", !0);
defineSymbol(math, main, bin, "⋅", "\\cdot", !0);
defineSymbol(math, main, bin, "∘", "\\circ", !0);
defineSymbol(math, main, bin, "÷", "\\div", !0);
defineSymbol(math, main, bin, "±", "\\pm", !0);
defineSymbol(math, main, bin, "×", "\\times", !0);
defineSymbol(math, main, bin, "∩", "\\cap", !0);
defineSymbol(math, main, bin, "∪", "\\cup", !0);
defineSymbol(math, main, bin, "∖", "\\setminus", !0);
defineSymbol(math, main, bin, "∧", "\\land");
defineSymbol(math, main, bin, "∨", "\\lor");
defineSymbol(math, main, bin, "∧", "\\wedge", !0);
defineSymbol(math, main, bin, "∨", "\\vee", !0);
defineSymbol(math, main, textord, "√", "\\surd");
defineSymbol(math, main, open, "⟨", "\\langle", !0);
defineSymbol(math, main, open, "∣", "\\lvert");
defineSymbol(math, main, open, "∥", "\\lVert");
defineSymbol(math, main, close, "?", "?");
defineSymbol(math, main, close, "!", "!");
defineSymbol(math, main, close, "⟩", "\\rangle", !0);
defineSymbol(math, main, close, "∣", "\\rvert");
defineSymbol(math, main, close, "∥", "\\rVert");
defineSymbol(math, main, rel, "=", "=");
defineSymbol(math, main, rel, ":", ":");
defineSymbol(math, main, rel, "≈", "\\approx", !0);
defineSymbol(math, main, rel, "≅", "\\cong", !0);
defineSymbol(math, main, rel, "≥", "\\ge");
defineSymbol(math, main, rel, "≥", "\\geq", !0);
defineSymbol(math, main, rel, "←", "\\gets");
defineSymbol(math, main, rel, ">", "\\gt", !0);
defineSymbol(math, main, rel, "∈", "\\in", !0);
defineSymbol(math, main, rel, "", "\\@not");
defineSymbol(math, main, rel, "⊂", "\\subset", !0);
defineSymbol(math, main, rel, "⊃", "\\supset", !0);
defineSymbol(math, main, rel, "⊆", "\\subseteq", !0);
defineSymbol(math, main, rel, "⊇", "\\supseteq", !0);
defineSymbol(math, ams, rel, "⊈", "\\nsubseteq", !0);
defineSymbol(math, ams, rel, "⊉", "\\nsupseteq", !0);
defineSymbol(math, main, rel, "⊨", "\\models");
defineSymbol(math, main, rel, "←", "\\leftarrow", !0);
defineSymbol(math, main, rel, "≤", "\\le");
defineSymbol(math, main, rel, "≤", "\\leq", !0);
defineSymbol(math, main, rel, "<", "\\lt", !0);
defineSymbol(math, main, rel, "→", "\\rightarrow", !0);
defineSymbol(math, main, rel, "→", "\\to");
defineSymbol(math, ams, rel, "≱", "\\ngeq", !0);
defineSymbol(math, ams, rel, "≰", "\\nleq", !0);
defineSymbol(math, main, spacing, " ", "\\ ");
defineSymbol(math, main, spacing, " ", "\\space");
defineSymbol(math, main, spacing, " ", "\\nobreakspace");
defineSymbol(text$a, main, spacing, " ", "\\ ");
defineSymbol(text$a, main, spacing, " ", " ");
defineSymbol(text$a, main, spacing, " ", "\\space");
defineSymbol(text$a, main, spacing, " ", "\\nobreakspace");
defineSymbol(math, main, spacing, null, "\\nobreak");
defineSymbol(math, main, spacing, null, "\\allowbreak");
defineSymbol(math, main, punct, ",", ",");
defineSymbol(math, main, punct, ";", ";");
defineSymbol(math, ams, bin, "⊼", "\\barwedge", !0);
defineSymbol(math, ams, bin, "⊻", "\\veebar", !0);
defineSymbol(math, main, bin, "⊙", "\\odot", !0);
defineSymbol(math, main, bin, "⊕", "\\oplus", !0);
defineSymbol(math, main, bin, "⊗", "\\otimes", !0);
defineSymbol(math, main, textord, "∂", "\\partial", !0);
defineSymbol(math, main, bin, "⊘", "\\oslash", !0);
defineSymbol(math, ams, bin, "⊚", "\\circledcirc", !0);
defineSymbol(math, ams, bin, "⊡", "\\boxdot", !0);
defineSymbol(math, main, bin, "△", "\\bigtriangleup");
defineSymbol(math, main, bin, "▽", "\\bigtriangledown");
defineSymbol(math, main, bin, "†", "\\dagger");
defineSymbol(math, main, bin, "⋄", "\\diamond");
defineSymbol(math, main, bin, "⋆", "\\star");
defineSymbol(math, main, bin, "◃", "\\triangleleft");
defineSymbol(math, main, bin, "▹", "\\triangleright");
defineSymbol(math, main, open, "{", "\\{");
defineSymbol(text$a, main, textord, "{", "\\{");
defineSymbol(text$a, main, textord, "{", "\\textbraceleft");
defineSymbol(math, main, close, "}", "\\}");
defineSymbol(text$a, main, textord, "}", "\\}");
defineSymbol(text$a, main, textord, "}", "\\textbraceright");
defineSymbol(math, main, open, "{", "\\lbrace");
defineSymbol(math, main, close, "}", "\\rbrace");
defineSymbol(math, main, open, "[", "\\lbrack", !0);
defineSymbol(text$a, main, textord, "[", "\\lbrack", !0);
defineSymbol(math, main, close, "]", "\\rbrack", !0);
defineSymbol(text$a, main, textord, "]", "\\rbrack", !0);
defineSymbol(math, main, open, "(", "\\lparen", !0);
defineSymbol(math, main, close, ")", "\\rparen", !0);
defineSymbol(text$a, main, textord, "<", "\\textless", !0);
defineSymbol(text$a, main, textord, ">", "\\textgreater", !0);
defineSymbol(math, main, open, "⌊", "\\lfloor", !0);
defineSymbol(math, main, close, "⌋", "\\rfloor", !0);
defineSymbol(math, main, open, "⌈", "\\lceil", !0);
defineSymbol(math, main, close, "⌉", "\\rceil", !0);
defineSymbol(math, main, textord, "\\", "\\backslash");
defineSymbol(math, main, textord, "∣", "|");
defineSymbol(math, main, textord, "∣", "\\vert");
defineSymbol(text$a, main, textord, "|", "\\textbar", !0);
defineSymbol(math, main, textord, "∥", "\\|");
defineSymbol(math, main, textord, "∥", "\\Vert");
defineSymbol(text$a, main, textord, "∥", "\\textbardbl");
defineSymbol(text$a, main, textord, "~", "\\textasciitilde");
defineSymbol(text$a, main, textord, "\\", "\\textbackslash");
defineSymbol(text$a, main, textord, "^", "\\textasciicircum");
defineSymbol(math, main, rel, "↑", "\\uparrow", !0);
defineSymbol(math, main, rel, "⇑", "\\Uparrow", !0);
defineSymbol(math, main, rel, "↓", "\\downarrow", !0);
defineSymbol(math, main, rel, "⇓", "\\Downarrow", !0);
defineSymbol(math, main, rel, "↕", "\\updownarrow", !0);
defineSymbol(math, main, rel, "⇕", "\\Updownarrow", !0);
defineSymbol(math, main, op, "∐", "\\coprod");
defineSymbol(math, main, op, "⋁", "\\bigvee");
defineSymbol(math, main, op, "⋀", "\\bigwedge");
defineSymbol(math, main, op, "⨄", "\\biguplus");
defineSymbol(math, main, op, "⋂", "\\bigcap");
defineSymbol(math, main, op, "⋃", "\\bigcup");
defineSymbol(math, main, op, "∫", "\\int");
defineSymbol(math, main, op, "∫", "\\intop");
defineSymbol(math, main, op, "∬", "\\iint");
defineSymbol(math, main, op, "∭", "\\iiint");
defineSymbol(math, main, op, "∏", "\\prod");
defineSymbol(math, main, op, "∑", "\\sum");
defineSymbol(math, main, op, "⨂", "\\bigotimes");
defineSymbol(math, main, op, "⨁", "\\bigoplus");
defineSymbol(math, main, op, "⨀", "\\bigodot");
defineSymbol(math, main, op, "∮", "\\oint");
defineSymbol(math, main, op, "∯", "\\oiint");
defineSymbol(math, main, op, "∰", "\\oiiint");
defineSymbol(math, main, op, "⨆", "\\bigsqcup");
defineSymbol(math, main, op, "∫", "\\smallint");
defineSymbol(text$a, main, inner, "…", "\\textellipsis");
defineSymbol(math, main, inner, "…", "\\mathellipsis");
defineSymbol(text$a, main, inner, "…", "\\ldots", !0);
defineSymbol(math, main, inner, "…", "\\ldots", !0);
defineSymbol(math, main, inner, "⋯", "\\@cdots", !0);
defineSymbol(math, main, inner, "⋱", "\\ddots", !0);
defineSymbol(math, main, textord, "⋮", "\\varvdots");
defineSymbol(math, main, accent, "ˊ", "\\acute");
defineSymbol(math, main, accent, "ˋ", "\\grave");
defineSymbol(math, main, accent, "¨", "\\ddot");
defineSymbol(math, main, accent, "~", "\\tilde");
defineSymbol(math, main, accent, "ˉ", "\\bar");
defineSymbol(math, main, accent, "˘", "\\breve");
defineSymbol(math, main, accent, "ˇ", "\\check");
defineSymbol(math, main, accent, "^", "\\hat");
defineSymbol(math, main, accent, "⃗", "\\vec");
defineSymbol(math, main, accent, "˙", "\\dot");
defineSymbol(math, main, accent, "˚", "\\mathring");
defineSymbol(math, main, mathord, "", "\\@imath");
defineSymbol(math, main, mathord, "", "\\@jmath");
defineSymbol(math, main, textord, "ı", "ı");
defineSymbol(math, main, textord, "ȷ", "ȷ");
defineSymbol(text$a, main, textord, "ı", "\\i", !0);
defineSymbol(text$a, main, textord, "ȷ", "\\j", !0);
defineSymbol(text$a, main, textord, "ß", "\\ss", !0);
defineSymbol(text$a, main, textord, "æ", "\\ae", !0);
defineSymbol(text$a, main, textord, "œ", "\\oe", !0);
defineSymbol(text$a, main, textord, "ø", "\\o", !0);
defineSymbol(text$a, main, textord, "Æ", "\\AE", !0);
defineSymbol(text$a, main, textord, "Œ", "\\OE", !0);
defineSymbol(text$a, main, textord, "Ø", "\\O", !0);
defineSymbol(text$a, main, accent, "ˊ", "\\'");
defineSymbol(text$a, main, accent, "ˋ", "\\`");
defineSymbol(text$a, main, accent, "ˆ", "\\^");
defineSymbol(text$a, main, accent, "˜", "\\~");
defineSymbol(text$a, main, accent, "ˉ", "\\=");
defineSymbol(text$a, main, accent, "˘", "\\u");
defineSymbol(text$a, main, accent, "˙", "\\.");
defineSymbol(text$a, main, accent, "¸", "\\c");
defineSymbol(text$a, main, accent, "˚", "\\r");
defineSymbol(text$a, main, accent, "ˇ", "\\v");
defineSymbol(text$a, main, accent, "¨", '\\"');
defineSymbol(text$a, main, accent, "˝", "\\H");
defineSymbol(text$a, main, accent, "◯", "\\textcircled");
var ligatures = {
  "--": !0,
  "---": !0,
  "``": !0,
  "''": !0
};
defineSymbol(text$a, main, textord, "–", "--", !0);
defineSymbol(text$a, main, textord, "–", "\\textendash");
defineSymbol(text$a, main, textord, "—", "---", !0);
defineSymbol(text$a, main, textord, "—", "\\textemdash");
defineSymbol(text$a, main, textord, "‘", "`", !0);
defineSymbol(text$a, main, textord, "‘", "\\textquoteleft");
defineSymbol(text$a, main, textord, "’", "'", !0);
defineSymbol(text$a, main, textord, "’", "\\textquoteright");
defineSymbol(text$a, main, textord, "“", "``", !0);
defineSymbol(text$a, main, textord, "“", "\\textquotedblleft");
defineSymbol(text$a, main, textord, "”", "''", !0);
defineSymbol(text$a, main, textord, "”", "\\textquotedblright");
defineSymbol(math, main, textord, "°", "\\degree", !0);
defineSymbol(text$a, main, textord, "°", "\\degree");
defineSymbol(text$a, main, textord, "°", "\\textdegree", !0);
defineSymbol(math, main, textord, "£", "\\pounds");
defineSymbol(math, main, textord, "£", "\\mathsterling", !0);
defineSymbol(text$a, main, textord, "£", "\\pounds");
defineSymbol(text$a, main, textord, "£", "\\textsterling", !0);
defineSymbol(math, ams, textord, "✠", "\\maltese");
defineSymbol(text$a, ams, textord, "✠", "\\maltese");
var mathTextSymbols = '0123456789/@."';
for (var i = 0; i < mathTextSymbols.length; i++) {
  var ch = mathTextSymbols.charAt(i);
  defineSymbol(math, main, textord, ch, ch);
}
var textSymbols = '0123456789!@*()-=+";:?/.,';
for (var _i = 0; _i < textSymbols.length; _i++) {
  var _ch = textSymbols.charAt(_i);
  defineSymbol(text$a, main, textord, _ch, _ch);
}
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (var _i2 = 0; _i2 < letters.length; _i2++) {
  var _ch2 = letters.charAt(_i2);
  defineSymbol(math, main, mathord, _ch2, _ch2), defineSymbol(text$a, main, textord, _ch2, _ch2);
}
defineSymbol(math, ams, textord, "C", "ℂ");
defineSymbol(text$a, ams, textord, "C", "ℂ");
defineSymbol(math, ams, textord, "H", "ℍ");
defineSymbol(text$a, ams, textord, "H", "ℍ");
defineSymbol(math, ams, textord, "N", "ℕ");
defineSymbol(text$a, ams, textord, "N", "ℕ");
defineSymbol(math, ams, textord, "P", "ℙ");
defineSymbol(text$a, ams, textord, "P", "ℙ");
defineSymbol(math, ams, textord, "Q", "ℚ");
defineSymbol(text$a, ams, textord, "Q", "ℚ");
defineSymbol(math, ams, textord, "R", "ℝ");
defineSymbol(text$a, ams, textord, "R", "ℝ");
defineSymbol(math, ams, textord, "Z", "ℤ");
defineSymbol(text$a, ams, textord, "Z", "ℤ");
defineSymbol(math, main, mathord, "h", "ℎ");
defineSymbol(text$a, main, mathord, "h", "ℎ");
var wideChar = "";
for (var _i3 = 0; _i3 < letters.length; _i3++) {
  var _ch3 = letters.charAt(_i3);
  wideChar = String.fromCharCode(55349, 56320 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56372 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56424 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56580 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56684 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56736 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56788 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56840 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56944 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), _i3 < 26 && (wideChar = String.fromCharCode(55349, 56632 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56476 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar));
}
wideChar = "𝕜";
defineSymbol(math, main, mathord, "k", wideChar);
defineSymbol(text$a, main, textord, "k", wideChar);
for (var _i4 = 0; _i4 < 10; _i4++) {
  var _ch4 = _i4.toString();
  wideChar = String.fromCharCode(55349, 57294 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57314 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57324 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57334 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar);
}
var extraLatin = "ÐÞþ";
for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
  var _ch5 = extraLatin.charAt(_i5);
  defineSymbol(math, main, mathord, _ch5, _ch5), defineSymbol(text$a, main, textord, _ch5, _ch5);
}
var wideLatinLetterData = [
  ["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
], wideNumeralData = [
  ["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
], wideCharacterFont = function(e, t) {
  var r = e.charCodeAt(0), a = e.charCodeAt(1), s = (r - 55296) * 1024 + (a - 56320) + 65536, h = t === "math" ? 0 : 1;
  if (119808 <= s && s < 120484) {
    var o = Math.floor((s - 119808) / 26);
    return [wideLatinLetterData[o][2], wideLatinLetterData[o][h]];
  } else if (120782 <= s && s <= 120831) {
    var d = Math.floor((s - 120782) / 10);
    return [wideNumeralData[d][2], wideNumeralData[d][h]];
  } else {
    if (s === 120485 || s === 120486)
      return [wideLatinLetterData[0][2], wideLatinLetterData[0][h]];
    if (120486 < s && s < 120782)
      return ["", ""];
    throw new ParseError("Unsupported character: " + e);
  }
}, lookupSymbol = function(e, t, r) {
  return symbols[r][e] && symbols[r][e].replace && (e = symbols[r][e].replace), {
    value: e,
    metrics: getCharacterMetrics(e, t, r)
  };
}, makeSymbol = function(e, t, r, a, s) {
  var h = lookupSymbol(e, t, r), o = h.metrics;
  e = h.value;
  var d;
  if (o) {
    var v = o.italic;
    (r === "text" || a && a.font === "mathit") && (v = 0), d = new SymbolNode(e, o.height, o.depth, v, o.skew, o.width, s);
  } else
    typeof console < "u" && console.warn("No character metrics " + ("for '" + e + "' in style '" + t + "' and mode '" + r + "'")), d = new SymbolNode(e, 0, 0, 0, 0, 0, s);
  if (a) {
    d.maxFontSize = a.sizeMultiplier, a.style.isTight() && d.classes.push("mtight");
    var f = a.getColor();
    f && (d.style.color = f);
  }
  return d;
}, mathsym = function(e, t, r, a) {
  return a === void 0 && (a = []), r.font === "boldsymbol" && lookupSymbol(e, "Main-Bold", t).metrics ? makeSymbol(e, "Main-Bold", t, r, a.concat(["mathbf"])) : e === "\\" || symbols[t][e].font === "main" ? makeSymbol(e, "Main-Regular", t, r, a) : makeSymbol(e, "AMS-Regular", t, r, a.concat(["amsrm"]));
}, boldsymbol = function(e, t, r, a, s) {
  return s !== "textord" && lookupSymbol(e, "Math-BoldItalic", t).metrics ? {
    fontName: "Math-BoldItalic",
    fontClass: "boldsymbol"
  } : {
    fontName: "Main-Bold",
    fontClass: "mathbf"
  };
}, makeOrd = function(e, t, r) {
  var a = e.mode, s = e.text, h = ["mord"], o = a === "math" || a === "text" && t.font, d = o ? t.font : t.fontFamily, v = "", f = "";
  if (s.charCodeAt(0) === 55349 && ([v, f] = wideCharacterFont(s, a)), v.length > 0)
    return makeSymbol(s, v, a, t, h.concat(f));
  if (d) {
    var y, A;
    if (d === "boldsymbol") {
      var x = boldsymbol(s, a, t, h, r);
      y = x.fontName, A = [x.fontClass];
    } else o ? (y = fontMap[d].fontName, A = [d]) : (y = retrieveTextFontName(d, t.fontWeight, t.fontShape), A = [d, t.fontWeight, t.fontShape]);
    if (lookupSymbol(s, y, a).metrics)
      return makeSymbol(s, y, a, t, h.concat(A));
    if (ligatures.hasOwnProperty(s) && y.slice(0, 10) === "Typewriter") {
      for (var M = [], m = 0; m < s.length; m++)
        M.push(makeSymbol(s[m], y, a, t, h.concat(A)));
      return makeFragment(M);
    }
  }
  if (r === "mathord")
    return makeSymbol(s, "Math-Italic", a, t, h.concat(["mathnormal"]));
  if (r === "textord") {
    var l = symbols[a][s] && symbols[a][s].font;
    if (l === "ams") {
      var u = retrieveTextFontName("amsrm", t.fontWeight, t.fontShape);
      return makeSymbol(s, u, a, t, h.concat("amsrm", t.fontWeight, t.fontShape));
    } else if (l === "main" || !l) {
      var p = retrieveTextFontName("textrm", t.fontWeight, t.fontShape);
      return makeSymbol(s, p, a, t, h.concat(t.fontWeight, t.fontShape));
    } else {
      var g = retrieveTextFontName(l, t.fontWeight, t.fontShape);
      return makeSymbol(s, g, a, t, h.concat(g, t.fontWeight, t.fontShape));
    }
  } else
    throw new Error("unexpected type: " + r + " in makeOrd");
}, canCombine = (n, e) => {
  if (createClass(n.classes) !== createClass(e.classes) || n.skew !== e.skew || n.maxFontSize !== e.maxFontSize)
    return !1;
  if (n.classes.length === 1) {
    var t = n.classes[0];
    if (t === "mbin" || t === "mord")
      return !1;
  }
  for (var r in n.style)
    if (n.style.hasOwnProperty(r) && n.style[r] !== e.style[r])
      return !1;
  for (var a in e.style)
    if (e.style.hasOwnProperty(a) && n.style[a] !== e.style[a])
      return !1;
  return !0;
}, tryCombineChars = (n) => {
  for (var e = 0; e < n.length - 1; e++) {
    var t = n[e], r = n[e + 1];
    t instanceof SymbolNode && r instanceof SymbolNode && canCombine(t, r) && (t.text += r.text, t.height = Math.max(t.height, r.height), t.depth = Math.max(t.depth, r.depth), t.italic = r.italic, n.splice(e + 1, 1), e--);
  }
  return n;
}, sizeElementFromChildren = function(e) {
  for (var t = 0, r = 0, a = 0, s = 0; s < e.children.length; s++) {
    var h = e.children[s];
    h.height > t && (t = h.height), h.depth > r && (r = h.depth), h.maxFontSize > a && (a = h.maxFontSize);
  }
  e.height = t, e.depth = r, e.maxFontSize = a;
}, makeSpan$2 = function(e, t, r, a) {
  var s = new Span(e, t, r, a);
  return sizeElementFromChildren(s), s;
}, makeSvgSpan = (n, e, t, r) => new Span(n, e, t, r), makeLineSpan = function(e, t, r) {
  var a = makeSpan$2([e], [], t);
  return a.height = Math.max(r || t.fontMetrics().defaultRuleThickness, t.minRuleThickness), a.style.borderBottomWidth = makeEm(a.height), a.maxFontSize = 1, a;
}, makeAnchor = function(e, t, r, a) {
  var s = new Anchor(e, t, r, a);
  return sizeElementFromChildren(s), s;
}, makeFragment = function(e) {
  var t = new DocumentFragment(e);
  return sizeElementFromChildren(t), t;
}, wrapFragment = function(e, t) {
  return e instanceof DocumentFragment ? makeSpan$2([], [e], t) : e;
}, getVListChildrenAndDepth = function(e) {
  if (e.positionType === "individualShift") {
    for (var t = e.children, r = [t[0]], a = -t[0].shift - t[0].elem.depth, s = a, h = 1; h < t.length; h++) {
      var o = -t[h].shift - s - t[h].elem.depth, d = o - (t[h - 1].elem.height + t[h - 1].elem.depth);
      s = s + o, r.push({
        type: "kern",
        size: d
      }), r.push(t[h]);
    }
    return {
      children: r,
      depth: a
    };
  }
  var v;
  if (e.positionType === "top") {
    for (var f = e.positionData, y = 0; y < e.children.length; y++) {
      var A = e.children[y];
      f -= A.type === "kern" ? A.size : A.elem.height + A.elem.depth;
    }
    v = f;
  } else if (e.positionType === "bottom")
    v = -e.positionData;
  else {
    var x = e.children[0];
    if (x.type !== "elem")
      throw new Error('First child must have type "elem".');
    if (e.positionType === "shift")
      v = -x.elem.depth - e.positionData;
    else if (e.positionType === "firstBaseline")
      v = -x.elem.depth;
    else
      throw new Error("Invalid positionType " + e.positionType + ".");
  }
  return {
    children: e.children,
    depth: v
  };
}, makeVList = function(e, t) {
  for (var {
    children: r,
    depth: a
  } = getVListChildrenAndDepth(e), s = 0, h = 0; h < r.length; h++) {
    var o = r[h];
    if (o.type === "elem") {
      var d = o.elem;
      s = Math.max(s, d.maxFontSize, d.height);
    }
  }
  s += 2;
  var v = makeSpan$2(["pstrut"], []);
  v.style.height = makeEm(s);
  for (var f = [], y = a, A = a, x = a, M = 0; M < r.length; M++) {
    var m = r[M];
    if (m.type === "kern")
      x += m.size;
    else {
      var l = m.elem, u = m.wrapperClasses || [], p = m.wrapperStyle || {}, g = makeSpan$2(u, [v, l], void 0, p);
      g.style.top = makeEm(-s - x - l.depth), m.marginLeft && (g.style.marginLeft = m.marginLeft), m.marginRight && (g.style.marginRight = m.marginRight), f.push(g), x += l.height + l.depth;
    }
    y = Math.min(y, x), A = Math.max(A, x);
  }
  var b = makeSpan$2(["vlist"], f);
  b.style.height = makeEm(A);
  var c;
  if (y < 0) {
    var _ = makeSpan$2([], []), E = makeSpan$2(["vlist"], [_]);
    E.style.height = makeEm(-y);
    var w = makeSpan$2(["vlist-s"], [new SymbolNode("​")]);
    c = [makeSpan$2(["vlist-r"], [b, w]), makeSpan$2(["vlist-r"], [E])];
  } else
    c = [makeSpan$2(["vlist-r"], [b])];
  var k = makeSpan$2(["vlist-t"], c);
  return c.length === 2 && k.classes.push("vlist-t2"), k.height = A, k.depth = -y, k;
}, makeGlue = (n, e) => {
  var t = makeSpan$2(["mspace"], [], e), r = calculateSize(n, e);
  return t.style.marginRight = makeEm(r), t;
}, retrieveTextFontName = function(e, t, r) {
  var a = "";
  switch (e) {
    case "amsrm":
      a = "AMS";
      break;
    case "textrm":
      a = "Main";
      break;
    case "textsf":
      a = "SansSerif";
      break;
    case "texttt":
      a = "Typewriter";
      break;
    default:
      a = e;
  }
  var s;
  return t === "textbf" && r === "textit" ? s = "BoldItalic" : t === "textbf" ? s = "Bold" : t === "textit" ? s = "Italic" : s = "Regular", a + "-" + s;
}, fontMap = {
  // 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"
  },
  // "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"
  }
}, svgData = {
  //   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]
}, staticSvg = function(e, t) {
  var [r, a, s] = svgData[e], h = new PathNode(r), o = new SvgNode([h], {
    width: makeEm(a),
    height: makeEm(s),
    // Override CSS rule `.katex svg { width: 100% }`
    style: "width:" + makeEm(a),
    viewBox: "0 0 " + 1e3 * a + " " + 1e3 * s,
    preserveAspectRatio: "xMinYMin"
  }), d = makeSvgSpan(["overlay"], [o], t);
  return d.height = s, d.style.height = makeEm(s), d.style.width = makeEm(a), d;
}, buildCommon = {
  fontMap,
  makeSymbol,
  mathsym,
  makeSpan: makeSpan$2,
  makeSvgSpan,
  makeLineSpan,
  makeAnchor,
  makeFragment,
  wrapFragment,
  makeVList,
  makeOrd,
  makeGlue,
  staticSvg,
  svgData,
  tryCombineChars
}, thinspace = {
  number: 3,
  unit: "mu"
}, mediumspace = {
  number: 4,
  unit: "mu"
}, thickspace = {
  number: 5,
  unit: "mu"
}, spacings = {
  mord: {
    mop: thinspace,
    mbin: mediumspace,
    mrel: thickspace,
    minner: thinspace
  },
  mop: {
    mord: thinspace,
    mop: thinspace,
    mrel: thickspace,
    minner: thinspace
  },
  mbin: {
    mord: mediumspace,
    mop: mediumspace,
    mopen: mediumspace,
    minner: mediumspace
  },
  mrel: {
    mord: thickspace,
    mop: thickspace,
    mopen: thickspace,
    minner: thickspace
  },
  mopen: {},
  mclose: {
    mop: thinspace,
    mbin: mediumspace,
    mrel: thickspace,
    minner: thinspace
  },
  mpunct: {
    mord: thinspace,
    mop: thinspace,
    mrel: thickspace,
    mopen: thinspace,
    mclose: thinspace,
    mpunct: thinspace,
    minner: thinspace
  },
  minner: {
    mord: thinspace,
    mop: thinspace,
    mbin: mediumspace,
    mrel: thickspace,
    mopen: thinspace,
    mpunct: thinspace,
    minner: thinspace
  }
}, tightSpacings = {
  mord: {
    mop: thinspace
  },
  mop: {
    mord: thinspace,
    mop: thinspace
  },
  mbin: {},
  mrel: {},
  mopen: {},
  mclose: {
    mop: thinspace
  },
  mpunct: {},
  minner: {
    mop: thinspace
  }
}, _functions = {}, _htmlGroupBuilders = {}, _mathmlGroupBuilders = {};
function defineFunction(n) {
  for (var {
    type: e,
    names: t,
    props: r,
    handler: a,
    htmlBuilder: s,
    mathmlBuilder: h
  } = n, o = {
    type: e,
    numArgs: r.numArgs,
    argTypes: r.argTypes,
    allowedInArgument: !!r.allowedInArgument,
    allowedInText: !!r.allowedInText,
    allowedInMath: r.allowedInMath === void 0 ? !0 : r.allowedInMath,
    numOptionalArgs: r.numOptionalArgs || 0,
    infix: !!r.infix,
    primitive: !!r.primitive,
    handler: a
  }, d = 0; d < t.length; ++d)
    _functions[t[d]] = o;
  e && (s && (_htmlGroupBuilders[e] = s), h && (_mathmlGroupBuilders[e] = h));
}
function defineFunctionBuilders(n) {
  var {
    type: e,
    htmlBuilder: t,
    mathmlBuilder: r
  } = n;
  defineFunction({
    type: e,
    names: [],
    props: {
      numArgs: 0
    },
    handler() {
      throw new Error("Should never be called.");
    },
    htmlBuilder: t,
    mathmlBuilder: r
  });
}
var normalizeArgument = function(e) {
  return e.type === "ordgroup" && e.body.length === 1 ? e.body[0] : e;
}, ordargument = function(e) {
  return e.type === "ordgroup" ? e.body : [e];
}, makeSpan$1 = buildCommon.makeSpan, binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"], binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"], styleMap$1 = {
  display: Style$1.DISPLAY,
  text: Style$1.TEXT,
  script: Style$1.SCRIPT,
  scriptscript: Style$1.SCRIPTSCRIPT
}, DomEnum = {
  mord: "mord",
  mop: "mop",
  mbin: "mbin",
  mrel: "mrel",
  mopen: "mopen",
  mclose: "mclose",
  mpunct: "mpunct",
  minner: "minner"
}, buildExpression$1 = function(e, t, r, a) {
  a === void 0 && (a = [null, null]);
  for (var s = [], h = 0; h < e.length; h++) {
    var o = buildGroup$1(e[h], t);
    if (o instanceof DocumentFragment) {
      var d = o.children;
      s.push(...d);
    } else
      s.push(o);
  }
  if (buildCommon.tryCombineChars(s), !r)
    return s;
  var v = t;
  if (e.length === 1) {
    var f = e[0];
    f.type === "sizing" ? v = t.havingSize(f.size) : f.type === "styling" && (v = t.havingStyle(styleMap$1[f.style]));
  }
  var y = makeSpan$1([a[0] || "leftmost"], [], t), A = makeSpan$1([a[1] || "rightmost"], [], t), x = r === "root";
  return traverseNonSpaceNodes(s, (M, m) => {
    var l = m.classes[0], u = M.classes[0];
    l === "mbin" && utils.contains(binRightCanceller, u) ? m.classes[0] = "mord" : u === "mbin" && utils.contains(binLeftCanceller, l) && (M.classes[0] = "mord");
  }, {
    node: y
  }, A, x), traverseNonSpaceNodes(s, (M, m) => {
    var l = getTypeOfDomTree(m), u = getTypeOfDomTree(M), p = l && u ? M.hasClass("mtight") ? tightSpacings[l][u] : spacings[l][u] : null;
    if (p)
      return buildCommon.makeGlue(p, v);
  }, {
    node: y
  }, A, x), s;
}, traverseNonSpaceNodes = function n(e, t, r, a, s) {
  a && e.push(a);
  for (var h = 0; h < e.length; h++) {
    var o = e[h], d = checkPartialGroup(o);
    if (d) {
      n(d.children, t, r, null, s);
      continue;
    }
    var v = !o.hasClass("mspace");
    if (v) {
      var f = t(o, r.node);
      f && (r.insertAfter ? r.insertAfter(f) : (e.unshift(f), h++));
    }
    v ? r.node = o : s && o.hasClass("newline") && (r.node = makeSpan$1(["leftmost"])), r.insertAfter = /* @__PURE__ */ ((y) => (A) => {
      e.splice(y + 1, 0, A), h++;
    })(h);
  }
  a && e.pop();
}, checkPartialGroup = function(e) {
  return e instanceof DocumentFragment || e instanceof Anchor || e instanceof Span && e.hasClass("enclosing") ? e : null;
}, getOutermostNode = function n(e, t) {
  var r = checkPartialGroup(e);
  if (r) {
    var a = r.children;
    if (a.length) {
      if (t === "right")
        return n(a[a.length - 1], "right");
      if (t === "left")
        return n(a[0], "left");
    }
  }
  return e;
}, getTypeOfDomTree = function(e, t) {
  return e ? (t && (e = getOutermostNode(e, t)), DomEnum[e.classes[0]] || null) : null;
}, makeNullDelimiter = function(e, t) {
  var r = ["nulldelimiter"].concat(e.baseSizingClasses());
  return makeSpan$1(t.concat(r));
}, buildGroup$1 = function(e, t, r) {
  if (!e)
    return makeSpan$1();
  if (_htmlGroupBuilders[e.type]) {
    var a = _htmlGroupBuilders[e.type](e, t);
    if (r && t.size !== r.size) {
      a = makeSpan$1(t.sizingClasses(r), [a], t);
      var s = t.sizeMultiplier / r.sizeMultiplier;
      a.height *= s, a.depth *= s;
    }
    return a;
  } else
    throw new ParseError("Got group of unknown type: '" + e.type + "'");
};
function buildHTMLUnbreakable(n, e) {
  var t = makeSpan$1(["base"], n, e), r = makeSpan$1(["strut"]);
  return r.style.height = makeEm(t.height + t.depth), t.depth && (r.style.verticalAlign = makeEm(-t.depth)), t.children.unshift(r), t;
}
function buildHTML(n, e) {
  var t = null;
  n.length === 1 && n[0].type === "tag" && (t = n[0].tag, n = n[0].body);
  var r = buildExpression$1(n, e, "root"), a;
  r.length === 2 && r[1].hasClass("tag") && (a = r.pop());
  for (var s = [], h = [], o = 0; o < r.length; o++)
    if (h.push(r[o]), r[o].hasClass("mbin") || r[o].hasClass("mrel") || r[o].hasClass("allowbreak")) {
      for (var d = !1; o < r.length - 1 && r[o + 1].hasClass("mspace") && !r[o + 1].hasClass("newline"); )
        o++, h.push(r[o]), r[o].hasClass("nobreak") && (d = !0);
      d || (s.push(buildHTMLUnbreakable(h, e)), h = []);
    } else r[o].hasClass("newline") && (h.pop(), h.length > 0 && (s.push(buildHTMLUnbreakable(h, e)), h = []), s.push(r[o]));
  h.length > 0 && s.push(buildHTMLUnbreakable(h, e));
  var v;
  t ? (v = buildHTMLUnbreakable(buildExpression$1(t, e, !0)), v.classes = ["tag"], s.push(v)) : a && s.push(a);
  var f = makeSpan$1(["katex-html"], s);
  if (f.setAttribute("aria-hidden", "true"), v) {
    var y = v.children[0];
    y.style.height = makeEm(f.height + f.depth), f.depth && (y.style.verticalAlign = makeEm(-f.depth));
  }
  return f;
}
function newDocumentFragment(n) {
  return new DocumentFragment(n);
}
class MathNode {
  constructor(e, t, r) {
    this.type = void 0, this.attributes = void 0, this.children = void 0, this.classes = void 0, this.type = e, this.attributes = {}, this.children = t || [], this.classes = r || [];
  }
  /**
   * Sets an attribute on a MathML node. MathML depends on attributes to convey a
   * semantic content, so this is used heavily.
   */
  setAttribute(e, t) {
    this.attributes[e] = t;
  }
  /**
   * 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 t in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, t) && e.setAttribute(t, this.attributes[t]);
    this.classes.length > 0 && (e.className = createClass(this.classes));
    for (var r = 0; r < this.children.length; r++)
      e.appendChild(this.children[r].toNode());
    return e;
  }
  /**
   * Converts the math node into an HTML markup string.
   */
  toMarkup() {
    var e = "<" + this.type;
    for (var t in this.attributes)
      Object.prototype.hasOwnProperty.call(this.attributes, t) && (e += " " + t + '="', e += utils.escape(this.attributes[t]), e += '"');
    this.classes.length > 0 && (e += ' class ="' + utils.escape(createClass(this.classes)) + '"'), e += ">";
    for (var r = 0; r < this.children.length; r++)
      e += this.children[r].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 TextNode {
  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 utils.escape(this.toText());
  }
  /**
   * Converts the text node into a string
   * (representing the text itself).
   */
  toText() {
    return this.text;
  }
}
class SpaceNode {
  /**
   * 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", makeEm(this.width)), e;
  }
  /**
   * Converts the math node into an HTML markup string.
   */
  toMarkup() {
    return this.character ? "<mtext>" + this.character + "</mtext>" : '<mspace width="' + makeEm(this.width) + '"/>';
  }
  /**
   * Converts the math node into a string, similar to innerText.
   */
  toText() {
    return this.character ? this.character : " ";
  }
}
var mathMLTree = {
  MathNode,
  TextNode,
  SpaceNode,
  newDocumentFragment
}, makeText = function(e, t, r) {
  return symbols[t][e] && symbols[t][e].replace && e.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(e) && r && (r.fontFamily && r.fontFamily.slice(4, 6) === "tt" || r.font && r.font.slice(4, 6) === "tt")) && (e = symbols[t][e].replace), new mathMLTree.TextNode(e);
}, makeRow = function(e) {
  return e.length === 1 ? e[0] : new mathMLTree.MathNode("mrow", e);
}, getVariant = function(e, t) {
  if (t.fontFamily === "texttt")
    return "monospace";
  if (t.fontFamily === "textsf")
    return t.fontShape === "textit" && t.fontWeight === "textbf" ? "sans-serif-bold-italic" : t.fontShape === "textit" ? "sans-serif-italic" : t.fontWeight === "textbf" ? "bold-sans-serif" : "sans-serif";
  if (t.fontShape === "textit" && t.fontWeight === "textbf")
    return "bold-italic";
  if (t.fontShape === "textit")
    return "italic";
  if (t.fontWeight === "textbf")
    return "bold";
  var r = t.font;
  if (!r || r === "mathnormal")
    return null;
  var a = e.mode;
  if (r === "mathit")
    return "italic";
  if (r === "boldsymbol")
    return e.type === "textord" ? "bold" : "bold-italic";
  if (r === "mathbf")
    return "bold";
  if (r === "mathbb")
    return "double-struck";
  if (r === "mathfrak")
    return "fraktur";
  if (r === "mathscr" || r === "mathcal")
    return "script";
  if (r === "mathsf")
    return "sans-serif";
  if (r === "mathtt")
    return "monospace";
  var s = e.text;
  if (utils.contains(["\\imath", "\\jmath"], s))
    return null;
  symbols[a][s] && symbols[a][s].replace && (s = symbols[a][s].replace);
  var h = buildCommon.fontMap[r].fontName;
  return getCharacterMetrics(s, h, a) ? buildCommon.fontMap[r].variant : null;
}, buildExpression = function(e, t, r) {
  if (e.length === 1) {
    var a = buildGroup(e[0], t);
    return r && a instanceof MathNode && a.type === "mo" && (a.setAttribute("lspace", "0em"), a.setAttribute("rspace", "0em")), [a];
  }
  for (var s = [], h, o = 0; o < e.length; o++) {
    var d = buildGroup(e[o], t);
    if (d instanceof MathNode && h instanceof MathNode) {
      if (d.type === "mtext" && h.type === "mtext" && d.getAttribute("mathvariant") === h.getAttribute("mathvariant")) {
        h.children.push(...d.children);
        continue;
      } else if (d.type === "mn" && h.type === "mn") {
        h.children.push(...d.children);
        continue;
      } else if (d.type === "mi" && d.children.length === 1 && h.type === "mn") {
        var v = d.children[0];
        if (v instanceof TextNode && v.text === ".") {
          h.children.push(...d.children);
          continue;
        }
      } else if (h.type === "mi" && h.children.length === 1) {
        var f = h.children[0];
        if (f instanceof TextNode && f.text === "̸" && (d.type === "mo" || d.type === "mi" || d.type === "mn")) {
          var y = d.children[0];
          y instanceof TextNode && y.text.length > 0 && (y.text = y.text.slice(0, 1) + "̸" + y.text.slice(1), s.pop());
        }
      }
    }
    s.push(d), h = d;
  }
  return s;
}, buildExpressionRow = function(e, t, r) {
  return makeRow(buildExpression(e, t, r));
}, buildGroup = function(e, t) {
  if (!e)
    return new mathMLTree.MathNode("mrow");
  if (_mathmlGroupBuilders[e.type]) {
    var r = _mathmlGroupBuilders[e.type](e, t);
    return r;
  } else
    throw new ParseError("Got group of unknown type: '" + e.type + "'");
};
function buildMathML(n, e, t, r, a) {
  var s = buildExpression(n, t), h;
  s.length === 1 && s[0] instanceof MathNode && utils.contains(["mrow", "mtable"], s[0].type) ? h = s[0] : h = new mathMLTree.MathNode("mrow", s);
  var o = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(e)]);
  o.setAttribute("encoding", "application/x-tex");
  var d = new mathMLTree.MathNode("semantics", [h, o]), v = new mathMLTree.MathNode("math", [d]);
  v.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"), r && v.setAttribute("display", "block");
  var f = a ? "katex" : "katex-mathml";
  return buildCommon.makeSpan([f], [v]);
}
var optionsFromSettings = function(e) {
  return new Options({
    style: e.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
    maxSize: e.maxSize,
    minRuleThickness: e.minRuleThickness
  });
}, displayWrap = function(e, t) {
  if (t.displayMode) {
    var r = ["katex-display"];
    t.leqno && r.push("leqno"), t.fleqn && r.push("fleqn"), e = buildCommon.makeSpan(r, [e]);
  }
  return e;
}, buildTree = function(e, t, r) {
  var a = optionsFromSettings(r), s;
  if (r.output === "mathml")
    return buildMathML(e, t, a, r.displayMode, !0);
  if (r.output === "html") {
    var h = buildHTML(e, a);
    s = buildCommon.makeSpan(["katex"], [h]);
  } else {
    var o = buildMathML(e, t, a, r.displayMode, !1), d = buildHTML(e, a);
    s = buildCommon.makeSpan(["katex"], [o, d]);
  }
  return displayWrap(s, r);
}, buildHTMLTree = function(e, t, r) {
  var a = optionsFromSettings(r), s = buildHTML(e, a), h = buildCommon.makeSpan(["katex"], [s]);
  return displayWrap(h, r);
}, stretchyCodePoint = {
  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": "="
}, mathMLnode = function(e) {
  var t = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[e.replace(/^\\/, "")])]);
  return t.setAttribute("stretchy", "true"), t;
}, katexImagesData = {
  //   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]
}, groupLength = function(e) {
  return e.type === "ordgroup" ? e.body.length : 1;
}, svgSpan = function(e, t) {
  function r() {
    var o = 4e5, d = e.label.slice(1);
    if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], d)) {
      var v = e, f = groupLength(v.base), y, A, x;
      if (f > 5)
        d === "widehat" || d === "widecheck" ? (y = 420, o = 2364, x = 0.42, A = d + "4") : (y = 312, o = 2340, x = 0.34, A = "tilde4");
      else {
        var M = [1, 1, 2, 2, 3, 3][f];
        d === "widehat" || d === "widecheck" ? (o = [0, 1062, 2364, 2364, 2364][M], y = [0, 239, 300, 360, 420][M], x = [0, 0.24, 0.3, 0.3, 0.36, 0.42][M], A = d + M) : (o = [0, 600, 1033, 2339, 2340][M], y = [0, 260, 286, 306, 312][M], x = [0, 0.26, 0.286, 0.3, 0.306, 0.34][M], A = "tilde" + M);
      }
      var m = new PathNode(A), l = new SvgNode([m], {
        width: "100%",
        height: makeEm(x),
        viewBox: "0 0 " + o + " " + y,
        preserveAspectRatio: "none"
      });
      return {
        span: buildCommon.makeSvgSpan([], [l], t),
        minWidth: 0,
        height: x
      };
    } else {
      var u = [], p = katexImagesData[d], [g, b, c] = p, _ = c / 1e3, E = g.length, w, k;
      if (E === 1) {
        var $ = p[3];
        w = ["hide-tail"], k = [$];
      } else if (E === 2)
        w = ["halfarrow-left", "halfarrow-right"], k = ["xMinYMin", "xMaxYMin"];
      else if (E === 3)
        w = ["brace-left", "brace-center", "brace-right"], k = ["xMinYMin", "xMidYMin", "xMaxYMin"];
      else
        throw new Error(`Correct katexImagesData or update code here to support
                    ` + E + " children.");
      for (var L = 0; L < E; L++) {
        var z = new PathNode(g[L]), F = new SvgNode([z], {
          width: "400em",
          height: makeEm(_),
          viewBox: "0 0 " + o + " " + c,
          preserveAspectRatio: k[L] + " slice"
        }), R = buildCommon.makeSvgSpan([w[L]], [F], t);
        if (E === 1)
          return {
            span: R,
            minWidth: b,
            height: _
          };
        R.style.height = makeEm(_), u.push(R);
      }
      return {
        span: buildCommon.makeSpan(["stretchy"], u, t),
        minWidth: b,
        height: _
      };
    }
  }
  var {
    span: a,
    minWidth: s,
    height: h
  } = r();
  return a.height = h, a.style.height = makeEm(h), s > 0 && (a.style.minWidth = makeEm(s)), a;
}, encloseSpan = function(e, t, r, a, s) {
  var h, o = e.height + e.depth + r + a;
  if (/fbox|color|angl/.test(t)) {
    if (h = buildCommon.makeSpan(["stretchy", t], [], s), t === "fbox") {
      var d = s.color && s.getColor();
      d && (h.style.borderColor = d);
    }
  } else {
    var v = [];
    /^[bx]cancel$/.test(t) && v.push(new LineNode({
      x1: "0",
      y1: "0",
      x2: "100%",
      y2: "100%",
      "stroke-width": "0.046em"
    })), /^x?cancel$/.test(t) && v.push(new LineNode({
      x1: "0",
      y1: "100%",
      x2: "100%",
      y2: "0",
      "stroke-width": "0.046em"
    }));
    var f = new SvgNode(v, {
      width: "100%",
      height: makeEm(o)
    });
    h = buildCommon.makeSvgSpan([], [f], s);
  }
  return h.height = o, h.style.height = makeEm(o), h;
}, stretchy = {
  encloseSpan,
  mathMLnode,
  svgSpan
};
function assertNodeType(n, e) {
  if (!n || n.type !== e)
    throw new Error("Expected node of type " + e + ", but got " + (n ? "node of type " + n.type : String(n)));
  return n;
}
function assertSymbolNodeType(n) {
  var e = checkSymbolNodeType(n);
  if (!e)
    throw new Error("Expected node of symbol group type, but got " + (n ? "node of type " + n.type : String(n)));
  return e;
}
function checkSymbolNodeType(n) {
  return n && (n.type === "atom" || NON_ATOMS.hasOwnProperty(n.type)) ? n : null;
}
var htmlBuilder$a = (n, e) => {
  var t, r, a;
  n && n.type === "supsub" ? (r = assertNodeType(n.base, "accent"), t = r.base, n.base = t, a = assertSpan(buildGroup$1(n, e)), n.base = r) : (r = assertNodeType(n, "accent"), t = r.base);
  var s = buildGroup$1(t, e.havingCrampedStyle()), h = r.isShifty && utils.isCharacterBox(t), o = 0;
  if (h) {
    var d = utils.getBaseElem(t), v = buildGroup$1(d, e.havingCrampedStyle());
    o = assertSymbolDomNode(v).skew;
  }
  var f = r.label === "\\c", y = f ? s.height + s.depth : Math.min(s.height, e.fontMetrics().xHeight), A;
  if (r.isStretchy)
    A = stretchy.svgSpan(r, e), A = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: s
      }, {
        type: "elem",
        elem: A,
        wrapperClasses: ["svg-align"],
        wrapperStyle: o > 0 ? {
          width: "calc(100% - " + makeEm(2 * o) + ")",
          marginLeft: makeEm(2 * o)
        } : void 0
      }]
    }, e);
  else {
    var x, M;
    r.label === "\\vec" ? (x = buildCommon.staticSvg("vec", e), M = buildCommon.svgData.vec[1]) : (x = buildCommon.makeOrd({
      mode: r.mode,
      text: r.label
    }, e, "textord"), x = assertSymbolDomNode(x), x.italic = 0, M = x.width, f && (y += x.depth)), A = buildCommon.makeSpan(["accent-body"], [x]);
    var m = r.label === "\\textcircled";
    m && (A.classes.push("accent-full"), y = s.height);
    var l = o;
    m || (l -= M / 2), A.style.left = makeEm(l), r.label === "\\textcircled" && (A.style.top = ".2em"), A = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: s
      }, {
        type: "kern",
        size: -y
      }, {
        type: "elem",
        elem: A
      }]
    }, e);
  }
  var u = buildCommon.makeSpan(["mord", "accent"], [A], e);
  return a ? (a.children[0] = u, a.height = Math.max(u.height, a.height), a.classes[0] = "mord", a) : u;
}, mathmlBuilder$9 = (n, e) => {
  var t = n.isStretchy ? stretchy.mathMLnode(n.label) : new mathMLTree.MathNode("mo", [makeText(n.label, n.mode)]), r = new mathMLTree.MathNode("mover", [buildGroup(n.base, e), t]);
  return r.setAttribute("accent", "true"), r;
}, NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((n) => "\\" + n).join("|"));
defineFunction({
  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: (n, e) => {
    var t = normalizeArgument(e[0]), r = !NON_STRETCHY_ACCENT_REGEX.test(n.funcName), a = !r || n.funcName === "\\widehat" || n.funcName === "\\widetilde" || n.funcName === "\\widecheck";
    return {
      type: "accent",
      mode: n.parser.mode,
      label: n.funcName,
      isStretchy: r,
      isShifty: a,
      base: t
    };
  },
  htmlBuilder: htmlBuilder$a,
  mathmlBuilder: mathmlBuilder$9
});
defineFunction({
  type: "accent",
  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
  props: {
    numArgs: 1,
    allowedInText: !0,
    allowedInMath: !0,
    // unless in strict mode
    argTypes: ["primitive"]
  },
  handler: (n, e) => {
    var t = e[0], r = n.parser.mode;
    return r === "math" && (n.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + n.funcName + " works only in text mode"), r = "text"), {
      type: "accent",
      mode: r,
      label: n.funcName,
      isStretchy: !1,
      isShifty: !0,
      base: t
    };
  },
  htmlBuilder: htmlBuilder$a,
  mathmlBuilder: mathmlBuilder$9
});
defineFunction({
  type: "accentUnder",
  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
  props: {
    numArgs: 1
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    return {
      type: "accentUnder",
      mode: t.mode,
      label: r,
      base: a
    };
  },
  htmlBuilder: (n, e) => {
    var t = buildGroup$1(n.base, e), r = stretchy.svgSpan(n, e), a = n.label === "\\utilde" ? 0.12 : 0, s = buildCommon.makeVList({
      positionType: "top",
      positionData: t.height,
      children: [{
        type: "elem",
        elem: r,
        wrapperClasses: ["svg-align"]
      }, {
        type: "kern",
        size: a
      }, {
        type: "elem",
        elem: t
      }]
    }, e);
    return buildCommon.makeSpan(["mord", "accentunder"], [s], e);
  },
  mathmlBuilder: (n, e) => {
    var t = stretchy.mathMLnode(n.label), r = new mathMLTree.MathNode("munder", [buildGroup(n.base, e), t]);
    return r.setAttribute("accentunder", "true"), r;
  }
});
var paddedNode = (n) => {
  var e = new mathMLTree.MathNode("mpadded", n ? [n] : []);
  return e.setAttribute("width", "+0.6em"), e.setAttribute("lspace", "0.3em"), e;
};
defineFunction({
  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(n, e, t) {
    var {
      parser: r,
      funcName: a
    } = n;
    return {
      type: "xArrow",
      mode: r.mode,
      label: a,
      body: e[0],
      below: t[0]
    };
  },
  // Flow is unable to correctly infer the type of `group`, even though it's
  // unambiguously determined from the passed-in `type` above.
  htmlBuilder(n, e) {
    var t = e.style, r = e.havingStyle(t.sup()), a = buildCommon.wrapFragment(buildGroup$1(n.body, r, e), e), s = n.label.slice(0, 2) === "\\x" ? "x" : "cd";
    a.classes.push(s + "-arrow-pad");
    var h;
    n.below && (r = e.havingStyle(t.sub()), h = buildCommon.wrapFragment(buildGroup$1(n.below, r, e), e), h.classes.push(s + "-arrow-pad"));
    var o = stretchy.svgSpan(n, e), d = -e.fontMetrics().axisHeight + 0.5 * o.height, v = -e.fontMetrics().axisHeight - 0.5 * o.height - 0.111;
    (a.depth > 0.25 || n.label === "\\xleftequilibrium") && (v -= a.depth);
    var f;
    if (h) {
      var y = -e.fontMetrics().axisHeight + h.height + 0.5 * o.height + 0.111;
      f = buildCommon.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: a,
          shift: v
        }, {
          type: "elem",
          elem: o,
          shift: d
        }, {
          type: "elem",
          elem: h,
          shift: y
        }]
      }, e);
    } else
      f = buildCommon.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: a,
          shift: v
        }, {
          type: "elem",
          elem: o,
          shift: d
        }]
      }, e);
    return f.children[0].children[0].children[1].classes.push("svg-align"), buildCommon.makeSpan(["mrel", "x-arrow"], [f], e);
  },
  mathmlBuilder(n, e) {
    var t = stretchy.mathMLnode(n.label);
    t.setAttribute("minsize", n.label.charAt(0) === "x" ? "1.75em" : "3.0em");
    var r;
    if (n.body) {
      var a = paddedNode(buildGroup(n.body, e));
      if (n.below) {
        var s = paddedNode(buildGroup(n.below, e));
        r = new mathMLTree.MathNode("munderover", [t, s, a]);
      } else
        r = new mathMLTree.MathNode("mover", [t, a]);
    } else if (n.below) {
      var h = paddedNode(buildGroup(n.below, e));
      r = new mathMLTree.MathNode("munder", [t, h]);
    } else
      r = paddedNode(), r = new mathMLTree.MathNode("mover", [t, r]);
    return r;
  }
});
var makeSpan = buildCommon.makeSpan;
function htmlBuilder$9(n, e) {
  var t = buildExpression$1(n.body, e, !0);
  return makeSpan([n.mclass], t, e);
}
function mathmlBuilder$8(n, e) {
  var t, r = buildExpression(n.body, e);
  return n.mclass === "minner" ? t = new mathMLTree.MathNode("mpadded", r) : n.mclass === "mord" ? n.isCharacterBox ? (t = r[0], t.type = "mi") : t = new mathMLTree.MathNode("mi", r) : (n.isCharacterBox ? (t = r[0], t.type = "mo") : t = new mathMLTree.MathNode("mo", r), n.mclass === "mbin" ? (t.attributes.lspace = "0.22em", t.attributes.rspace = "0.22em") : n.mclass === "mpunct" ? (t.attributes.lspace = "0em", t.attributes.rspace = "0.17em") : n.mclass === "mopen" || n.mclass === "mclose" ? (t.attributes.lspace = "0em", t.attributes.rspace = "0em") : n.mclass === "minner" && (t.attributes.lspace = "0.0556em", t.attributes.width = "+0.1111em")), t;
}
defineFunction({
  type: "mclass",
  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    return {
      type: "mclass",
      mode: t.mode,
      mclass: "m" + r.slice(5),
      // TODO(kevinb): don't prefix with 'm'
      body: ordargument(a),
      isCharacterBox: utils.isCharacterBox(a)
    };
  },
  htmlBuilder: htmlBuilder$9,
  mathmlBuilder: mathmlBuilder$8
});
var binrelClass = (n) => {
  var e = n.type === "ordgroup" && n.body.length ? n.body[0] : n;
  return e.type === "atom" && (e.family === "bin" || e.family === "rel") ? "m" + e.family : "mord";
};
defineFunction({
  type: "mclass",
  names: ["\\@binrel"],
  props: {
    numArgs: 2
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "mclass",
      mode: t.mode,
      mclass: binrelClass(e[0]),
      body: ordargument(e[1]),
      isCharacterBox: utils.isCharacterBox(e[1])
    };
  }
});
defineFunction({
  type: "mclass",
  names: ["\\stackrel", "\\overset", "\\underset"],
  props: {
    numArgs: 2
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n, a = e[1], s = e[0], h;
    r !== "\\stackrel" ? h = binrelClass(a) : h = "mrel";
    var o = {
      type: "op",
      mode: a.mode,
      limits: !0,
      alwaysHandleSupSub: !0,
      parentIsSupSub: !1,
      symbol: !1,
      suppressBaseShift: r !== "\\stackrel",
      body: ordargument(a)
    }, d = {
      type: "supsub",
      mode: s.mode,
      base: o,
      sup: r === "\\underset" ? null : s,
      sub: r === "\\underset" ? s : null
    };
    return {
      type: "mclass",
      mode: t.mode,
      mclass: h,
      body: [d],
      isCharacterBox: utils.isCharacterBox(d)
    };
  },
  htmlBuilder: htmlBuilder$9,
  mathmlBuilder: mathmlBuilder$8
});
defineFunction({
  type: "pmb",
  names: ["\\pmb"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "pmb",
      mode: t.mode,
      mclass: binrelClass(e[0]),
      body: ordargument(e[0])
    };
  },
  htmlBuilder(n, e) {
    var t = buildExpression$1(n.body, e, !0), r = buildCommon.makeSpan([n.mclass], t, e);
    return r.style.textShadow = "0.02em 0.01em 0.04px", r;
  },
  mathmlBuilder(n, e) {
    var t = buildExpression(n.body, e), r = new mathMLTree.MathNode("mstyle", t);
    return r.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"), r;
  }
});
var cdArrowFunctionName = {
  ">": "\\\\cdrightarrow",
  "<": "\\\\cdleftarrow",
  "=": "\\\\cdlongequal",
  A: "\\uparrow",
  V: "\\downarrow",
  "|": "\\Vert",
  ".": "no arrow"
}, newCell = () => ({
  type: "styling",
  body: [],
  mode: "math",
  style: "display"
}), isStartOfArrow = (n) => n.type === "textord" && n.text === "@", isLabelEnd = (n, e) => (n.type === "mathord" || n.type === "atom") && n.text === e;
function cdArrow(n, e, t) {
  var r = cdArrowFunctionName[n];
  switch (r) {
    case "\\\\cdrightarrow":
    case "\\\\cdleftarrow":
      return t.callFunction(r, [e[0]], [e[1]]);
    case "\\uparrow":
    case "\\downarrow": {
      var a = t.callFunction("\\\\cdleft", [e[0]], []), s = {
        type: "atom",
        text: r,
        mode: "math",
        family: "rel"
      }, h = t.callFunction("\\Big", [s], []), o = t.callFunction("\\\\cdright", [e[1]], []), d = {
        type: "ordgroup",
        mode: "math",
        body: [a, h, o]
      };
      return t.callFunction("\\\\cdparent", [d], []);
    }
    case "\\\\cdlongequal":
      return t.callFunction("\\\\cdlongequal", [], []);
    case "\\Vert": {
      var v = {
        type: "textord",
        text: "\\Vert",
        mode: "math"
      };
      return t.callFunction("\\Big", [v], []);
    }
    default:
      return {
        type: "textord",
        text: " ",
        mode: "math"
      };
  }
}
function parseCD(n) {
  var e = [];
  for (n.gullet.beginGroup(), n.gullet.macros.set("\\cr", "\\\\\\relax"), n.gullet.beginGroup(); ; ) {
    e.push(n.parseExpression(!1, "\\\\")), n.gullet.endGroup(), n.gullet.beginGroup();
    var t = n.fetch().text;
    if (t === "&" || t === "\\\\")
      n.consume();
    else if (t === "\\end") {
      e[e.length - 1].length === 0 && e.pop();
      break;
    } else
      throw new ParseError("Expected \\\\ or \\cr or \\end", n.nextToken);
  }
  for (var r = [], a = [r], s = 0; s < e.length; s++) {
    for (var h = e[s], o = newCell(), d = 0; d < h.length; d++)
      if (!isStartOfArrow(h[d]))
        o.body.push(h[d]);
      else {
        r.push(o), d += 1;
        var v = assertSymbolNodeType(h[d]).text, f = new Array(2);
        if (f[0] = {
          type: "ordgroup",
          mode: "math",
          body: []
        }, f[1] = {
          type: "ordgroup",
          mode: "math",
          body: []
        }, !("=|.".indexOf(v) > -1)) if ("<>AV".indexOf(v) > -1)
          for (var y = 0; y < 2; y++) {
            for (var A = !0, x = d + 1; x < h.length; x++) {
              if (isLabelEnd(h[x], v)) {
                A = !1, d = x;
                break;
              }
              if (isStartOfArrow(h[x]))
                throw new ParseError("Missing a " + v + " character to complete a CD arrow.", h[x]);
              f[y].body.push(h[x]);
            }
            if (A)
              throw new ParseError("Missing a " + v + " character to complete a CD arrow.", h[d]);
          }
        else
          throw new ParseError('Expected one of "<>AV=|." after @', h[d]);
        var M = cdArrow(v, f, n), m = {
          type: "styling",
          body: [M],
          mode: "math",
          style: "display"
          // CD is always displaystyle.
        };
        r.push(m), o = newCell();
      }
    s % 2 === 0 ? r.push(o) : r.shift(), r = [], a.push(r);
  }
  n.gullet.endGroup(), n.gullet.endGroup();
  var l = new Array(a[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: a,
    arraystretch: 1,
    addJot: !0,
    rowGaps: [null],
    cols: l,
    colSeparationType: "CD",
    hLinesBeforeRow: new Array(a.length + 1).fill([])
  };
}
defineFunction({
  type: "cdlabel",
  names: ["\\\\cdleft", "\\\\cdright"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n;
    return {
      type: "cdlabel",
      mode: t.mode,
      side: r.slice(4),
      label: e[0]
    };
  },
  htmlBuilder(n, e) {
    var t = e.havingStyle(e.style.sup()), r = buildCommon.wrapFragment(buildGroup$1(n.label, t, e), e);
    return r.classes.push("cd-label-" + n.side), r.style.bottom = makeEm(0.8 - r.depth), r.height = 0, r.depth = 0, r;
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mrow", [buildGroup(n.label, e)]);
    return t = new mathMLTree.MathNode("mpadded", [t]), t.setAttribute("width", "0"), n.side === "left" && t.setAttribute("lspace", "-1width"), t.setAttribute("voffset", "0.7em"), t = new mathMLTree.MathNode("mstyle", [t]), t.setAttribute("displaystyle", "false"), t.setAttribute("scriptlevel", "1"), t;
  }
});
defineFunction({
  type: "cdlabelparent",
  names: ["\\\\cdparent"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "cdlabelparent",
      mode: t.mode,
      fragment: e[0]
    };
  },
  htmlBuilder(n, e) {
    var t = buildCommon.wrapFragment(buildGroup$1(n.fragment, e), e);
    return t.classes.push("cd-vert-arrow"), t;
  },
  mathmlBuilder(n, e) {
    return new mathMLTree.MathNode("mrow", [buildGroup(n.fragment, e)]);
  }
});
defineFunction({
  type: "textord",
  names: ["\\@char"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(n, e) {
    for (var {
      parser: t
    } = n, r = assertNodeType(e[0], "ordgroup"), a = r.body, s = "", h = 0; h < a.length; h++) {
      var o = assertNodeType(a[h], "textord");
      s += o.text;
    }
    var d = parseInt(s), v;
    if (isNaN(d))
      throw new ParseError("\\@char has non-numeric argument " + s);
    if (d < 0 || d >= 1114111)
      throw new ParseError("\\@char with invalid code point " + s);
    return d <= 65535 ? v = String.fromCharCode(d) : (d -= 65536, v = String.fromCharCode((d >> 10) + 55296, (d & 1023) + 56320)), {
      type: "textord",
      mode: t.mode,
      text: v
    };
  }
});
var htmlBuilder$8 = (n, e) => {
  var t = buildExpression$1(n.body, e.withColor(n.color), !1);
  return buildCommon.makeFragment(t);
}, mathmlBuilder$7 = (n, e) => {
  var t = buildExpression(n.body, e.withColor(n.color)), r = new mathMLTree.MathNode("mstyle", t);
  return r.setAttribute("mathcolor", n.color), r;
};
defineFunction({
  type: "color",
  names: ["\\textcolor"],
  props: {
    numArgs: 2,
    allowedInText: !0,
    argTypes: ["color", "original"]
  },
  handler(n, e) {
    var {
      parser: t
    } = n, r = assertNodeType(e[0], "color-token").color, a = e[1];
    return {
      type: "color",
      mode: t.mode,
      color: r,
      body: ordargument(a)
    };
  },
  htmlBuilder: htmlBuilder$8,
  mathmlBuilder: mathmlBuilder$7
});
defineFunction({
  type: "color",
  names: ["\\color"],
  props: {
    numArgs: 1,
    allowedInText: !0,
    argTypes: ["color"]
  },
  handler(n, e) {
    var {
      parser: t,
      breakOnTokenText: r
    } = n, a = assertNodeType(e[0], "color-token").color;
    t.gullet.macros.set("\\current@color", a);
    var s = t.parseExpression(!0, r);
    return {
      type: "color",
      mode: t.mode,
      color: a,
      body: s
    };
  },
  htmlBuilder: htmlBuilder$8,
  mathmlBuilder: mathmlBuilder$7
});
defineFunction({
  type: "cr",
  names: ["\\\\"],
  props: {
    numArgs: 0,
    numOptionalArgs: 0,
    allowedInText: !0
  },
  handler(n, e, t) {
    var {
      parser: r
    } = n, a = r.gullet.future().text === "[" ? r.parseSizeGroup(!0) : null, s = !r.settings.displayMode || !r.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
    return {
      type: "cr",
      mode: r.mode,
      newLine: s,
      size: a && assertNodeType(a, "size").value
    };
  },
  // The following builders are called only at the top level,
  // not within tabular/array environments.
  htmlBuilder(n, e) {
    var t = buildCommon.makeSpan(["mspace"], [], e);
    return n.newLine && (t.classes.push("newline"), n.size && (t.style.marginTop = makeEm(calculateSize(n.size, e)))), t;
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mspace");
    return n.newLine && (t.setAttribute("linebreak", "newline"), n.size && t.setAttribute("height", makeEm(calculateSize(n.size, e)))), t;
  }
});
var globalMap = {
  "\\global": "\\global",
  "\\long": "\\\\globallong",
  "\\\\globallong": "\\\\globallong",
  "\\def": "\\gdef",
  "\\gdef": "\\gdef",
  "\\edef": "\\xdef",
  "\\xdef": "\\xdef",
  "\\let": "\\\\globallet",
  "\\futurelet": "\\\\globalfuture"
}, checkControlSequence = (n) => {
  var e = n.text;
  if (/^(?:[\\{}$&#^_]|EOF)$/.test(e))
    throw new ParseError("Expected a control sequence", n);
  return e;
}, getRHS = (n) => {
  var e = n.gullet.popToken();
  return e.text === "=" && (e = n.gullet.popToken(), e.text === " " && (e = n.gullet.popToken())), e;
}, letCommand = (n, e, t, r) => {
  var a = n.gullet.macros.get(t.text);
  a == null && (t.noexpand = !0, a = {
    tokens: [t],
    numArgs: 0,
    // reproduce the same behavior in expansion
    unexpandable: !n.gullet.isExpandable(t.text)
  }), n.gullet.macros.set(e, a, r);
};
defineFunction({
  type: "internal",
  names: [
    "\\global",
    "\\long",
    "\\\\globallong"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t
    } = n;
    e.consumeSpaces();
    var r = e.fetch();
    if (globalMap[r.text])
      return (t === "\\global" || t === "\\\\globallong") && (r.text = globalMap[r.text]), assertNodeType(e.parseFunction(), "internal");
    throw new ParseError("Invalid token after macro prefix", r);
  }
});
defineFunction({
  type: "internal",
  names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t
    } = n, r = e.gullet.popToken(), a = r.text;
    if (/^(?:[\\{}$&#^_]|EOF)$/.test(a))
      throw new ParseError("Expected a control sequence", r);
    for (var s = 0, h, o = [[]]; e.gullet.future().text !== "{"; )
      if (r = e.gullet.popToken(), r.text === "#") {
        if (e.gullet.future().text === "{") {
          h = e.gullet.future(), o[s].push("{");
          break;
        }
        if (r = e.gullet.popToken(), !/^[1-9]$/.test(r.text))
          throw new ParseError('Invalid argument number "' + r.text + '"');
        if (parseInt(r.text) !== s + 1)
          throw new ParseError('Argument number "' + r.text + '" out of order');
        s++, o.push([]);
      } else {
        if (r.text === "EOF")
          throw new ParseError("Expected a macro definition");
        o[s].push(r.text);
      }
    var {
      tokens: d
    } = e.gullet.consumeArg();
    return h && d.unshift(h), (t === "\\edef" || t === "\\xdef") && (d = e.gullet.expandTokens(d), d.reverse()), e.gullet.macros.set(a, {
      tokens: d,
      numArgs: s,
      delimiters: o
    }, t === globalMap[t]), {
      type: "internal",
      mode: e.mode
    };
  }
});
defineFunction({
  type: "internal",
  names: [
    "\\let",
    "\\\\globallet"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t
    } = n, r = checkControlSequence(e.gullet.popToken());
    e.gullet.consumeSpaces();
    var a = getRHS(e);
    return letCommand(e, r, a, t === "\\\\globallet"), {
      type: "internal",
      mode: e.mode
    };
  }
});
defineFunction({
  type: "internal",
  names: [
    "\\futurelet",
    "\\\\globalfuture"
    // can’t be entered directly
  ],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t
    } = n, r = checkControlSequence(e.gullet.popToken()), a = e.gullet.popToken(), s = e.gullet.popToken();
    return letCommand(e, r, s, t === "\\\\globalfuture"), e.gullet.pushToken(s), e.gullet.pushToken(a), {
      type: "internal",
      mode: e.mode
    };
  }
});
var getMetrics = function(e, t, r) {
  var a = symbols.math[e] && symbols.math[e].replace, s = getCharacterMetrics(a || e, t, r);
  if (!s)
    throw new Error("Unsupported symbol " + e + " and font size " + t + ".");
  return s;
}, styleWrap = function(e, t, r, a) {
  var s = r.havingBaseStyle(t), h = buildCommon.makeSpan(a.concat(s.sizingClasses(r)), [e], r), o = s.sizeMultiplier / r.sizeMultiplier;
  return h.height *= o, h.depth *= o, h.maxFontSize = s.sizeMultiplier, h;
}, centerSpan = function(e, t, r) {
  var a = t.havingBaseStyle(r), s = (1 - t.sizeMultiplier / a.sizeMultiplier) * t.fontMetrics().axisHeight;
  e.classes.push("delimcenter"), e.style.top = makeEm(s), e.height -= s, e.depth += s;
}, makeSmallDelim = function(e, t, r, a, s, h) {
  var o = buildCommon.makeSymbol(e, "Main-Regular", s, a), d = styleWrap(o, t, a, h);
  return r && centerSpan(d, a, t), d;
}, mathrmSize = function(e, t, r, a) {
  return buildCommon.makeSymbol(e, "Size" + t + "-Regular", r, a);
}, makeLargeDelim = function(e, t, r, a, s, h) {
  var o = mathrmSize(e, t, s, a), d = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + t], [o], a), Style$1.TEXT, a, h);
  return r && centerSpan(d, a, Style$1.TEXT), d;
}, makeGlyphSpan = function(e, t, r) {
  var a;
  t === "Size1-Regular" ? a = "delim-size1" : a = "delim-size4";
  var s = buildCommon.makeSpan(["delimsizinginner", a], [buildCommon.makeSpan([], [buildCommon.makeSymbol(e, t, r)])]);
  return {
    type: "elem",
    elem: s
  };
}, makeInner = function(e, t, r) {
  var a = fontMetricsData["Size4-Regular"][e.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][e.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][e.charCodeAt(0)][4], s = new PathNode("inner", innerPath(e, Math.round(1e3 * t))), h = new SvgNode([s], {
    width: makeEm(a),
    height: makeEm(t),
    // Override CSS rule `.katex svg { width: 100% }`
    style: "width:" + makeEm(a),
    viewBox: "0 0 " + 1e3 * a + " " + Math.round(1e3 * t),
    preserveAspectRatio: "xMinYMin"
  }), o = buildCommon.makeSvgSpan([], [h], r);
  return o.height = t, o.style.height = makeEm(t), o.style.width = makeEm(a), {
    type: "elem",
    elem: o
  };
}, lapInEms = 8e-3, lap = {
  type: "kern",
  size: -1 * lapInEms
}, verts = ["|", "\\lvert", "\\rvert", "\\vert"], doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"], makeStackedDelim = function(e, t, r, a, s, h) {
  var o, d, v, f, y = "", A = 0;
  o = v = f = e, d = null;
  var x = "Size1-Regular";
  e === "\\uparrow" ? v = f = "⏐" : e === "\\Uparrow" ? v = f = "‖" : e === "\\downarrow" ? o = v = "⏐" : e === "\\Downarrow" ? o = v = "‖" : e === "\\updownarrow" ? (o = "\\uparrow", v = "⏐", f = "\\downarrow") : e === "\\Updownarrow" ? (o = "\\Uparrow", v = "‖", f = "\\Downarrow") : utils.contains(verts, e) ? (v = "∣", y = "vert", A = 333) : utils.contains(doubleVerts, e) ? (v = "∥", y = "doublevert", A = 556) : e === "[" || e === "\\lbrack" ? (o = "⎡", v = "⎢", f = "⎣", x = "Size4-Regular", y = "lbrack", A = 667) : e === "]" || e === "\\rbrack" ? (o = "⎤", v = "⎥", f = "⎦", x = "Size4-Regular", y = "rbrack", A = 667) : e === "\\lfloor" || e === "⌊" ? (v = o = "⎢", f = "⎣", x = "Size4-Regular", y = "lfloor", A = 667) : e === "\\lceil" || e === "⌈" ? (o = "⎡", v = f = "⎢", x = "Size4-Regular", y = "lceil", A = 667) : e === "\\rfloor" || e === "⌋" ? (v = o = "⎥", f = "⎦", x = "Size4-Regular", y = "rfloor", A = 667) : e === "\\rceil" || e === "⌉" ? (o = "⎤", v = f = "⎥", x = "Size4-Regular", y = "rceil", A = 667) : e === "(" || e === "\\lparen" ? (o = "⎛", v = "⎜", f = "⎝", x = "Size4-Regular", y = "lparen", A = 875) : e === ")" || e === "\\rparen" ? (o = "⎞", v = "⎟", f = "⎠", x = "Size4-Regular", y = "rparen", A = 875) : e === "\\{" || e === "\\lbrace" ? (o = "⎧", d = "⎨", f = "⎩", v = "⎪", x = "Size4-Regular") : e === "\\}" || e === "\\rbrace" ? (o = "⎫", d = "⎬", f = "⎭", v = "⎪", x = "Size4-Regular") : e === "\\lgroup" || e === "⟮" ? (o = "⎧", f = "⎩", v = "⎪", x = "Size4-Regular") : e === "\\rgroup" || e === "⟯" ? (o = "⎫", f = "⎭", v = "⎪", x = "Size4-Regular") : e === "\\lmoustache" || e === "⎰" ? (o = "⎧", f = "⎭", v = "⎪", x = "Size4-Regular") : (e === "\\rmoustache" || e === "⎱") && (o = "⎫", f = "⎩", v = "⎪", x = "Size4-Regular");
  var M = getMetrics(o, x, s), m = M.height + M.depth, l = getMetrics(v, x, s), u = l.height + l.depth, p = getMetrics(f, x, s), g = p.height + p.depth, b = 0, c = 1;
  if (d !== null) {
    var _ = getMetrics(d, x, s);
    b = _.height + _.depth, c = 2;
  }
  var E = m + g + b, w = Math.max(0, Math.ceil((t - E) / (c * u))), k = E + w * c * u, $ = a.fontMetrics().axisHeight;
  r && ($ *= a.sizeMultiplier);
  var L = k / 2 - $, z = [];
  if (y.length > 0) {
    var F = k - m - g, R = Math.round(k * 1e3), P = tallDelim(y, Math.round(F * 1e3)), U = new PathNode(y, P), N = (A / 1e3).toFixed(3) + "em", B = (R / 1e3).toFixed(3) + "em", W = new SvgNode([U], {
      width: N,
      height: B,
      viewBox: "0 0 " + A + " " + R
    }), V = buildCommon.makeSvgSpan([], [W], a);
    V.height = R / 1e3, V.style.width = N, V.style.height = B, z.push({
      type: "elem",
      elem: V
    });
  } else {
    if (z.push(makeGlyphSpan(f, x, s)), z.push(lap), d === null) {
      var G = k - m - g + 2 * lapInEms;
      z.push(makeInner(v, G, a));
    } else {
      var H = (k - m - g - b) / 2 + 2 * lapInEms;
      z.push(makeInner(v, H, a)), z.push(lap), z.push(makeGlyphSpan(d, x, s)), z.push(lap), z.push(makeInner(v, H, a));
    }
    z.push(lap), z.push(makeGlyphSpan(o, x, s));
  }
  var Q = a.havingBaseStyle(Style$1.TEXT), te = buildCommon.makeVList({
    positionType: "bottom",
    positionData: L,
    children: z
  }, Q);
  return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [te], Q), Style$1.TEXT, a, h);
}, vbPad = 80, emPad = 0.08, sqrtSvg = function(e, t, r, a, s) {
  var h = sqrtPath(e, a, r), o = new PathNode(e, h), d = new SvgNode([o], {
    // Note: 1000:1 ratio of viewBox to document em width.
    width: "400em",
    height: makeEm(t),
    viewBox: "0 0 400000 " + r,
    preserveAspectRatio: "xMinYMin slice"
  });
  return buildCommon.makeSvgSpan(["hide-tail"], [d], s);
}, makeSqrtImage = function(e, t) {
  var r = t.havingBaseSizing(), a = traverseSequence("\\surd", e * r.sizeMultiplier, stackLargeDelimiterSequence, r), s = r.sizeMultiplier, h = Math.max(0, t.minRuleThickness - t.fontMetrics().sqrtRuleThickness), o, d = 0, v = 0, f = 0, y;
  return a.type === "small" ? (f = 1e3 + 1e3 * h + vbPad, e < 1 ? s = 1 : e < 1.4 && (s = 0.7), d = (1 + h + emPad) / s, v = (1 + h) / s, o = sqrtSvg("sqrtMain", d, f, h, t), o.style.minWidth = "0.853em", y = 0.833 / s) : a.type === "large" ? (f = (1e3 + vbPad) * sizeToMaxHeight[a.size], v = (sizeToMaxHeight[a.size] + h) / s, d = (sizeToMaxHeight[a.size] + h + emPad) / s, o = sqrtSvg("sqrtSize" + a.size, d, f, h, t), o.style.minWidth = "1.02em", y = 1 / s) : (d = e + h + emPad, v = e + h, f = Math.floor(1e3 * e + h) + vbPad, o = sqrtSvg("sqrtTall", d, f, h, t), o.style.minWidth = "0.742em", y = 1.056), o.height = v, o.style.height = makeEm(d), {
    span: o,
    advanceWidth: y,
    // 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: (t.fontMetrics().sqrtRuleThickness + h) * s
  };
}, stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"], stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"], stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"], sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3], makeSizedDelim = function(e, t, r, a, s) {
  if (e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"), utils.contains(stackLargeDelimiters, e) || utils.contains(stackNeverDelimiters, e))
    return makeLargeDelim(e, t, !1, r, a, s);
  if (utils.contains(stackAlwaysDelimiters, e))
    return makeStackedDelim(e, sizeToMaxHeight[t], !1, r, a, s);
  throw new ParseError("Illegal delimiter: '" + e + "'");
}, stackNeverDelimiterSequence = [{
  type: "small",
  style: Style$1.SCRIPTSCRIPT
}, {
  type: "small",
  style: Style$1.SCRIPT
}, {
  type: "small",
  style: Style$1.TEXT
}, {
  type: "large",
  size: 1
}, {
  type: "large",
  size: 2
}, {
  type: "large",
  size: 3
}, {
  type: "large",
  size: 4
}], stackAlwaysDelimiterSequence = [{
  type: "small",
  style: Style$1.SCRIPTSCRIPT
}, {
  type: "small",
  style: Style$1.SCRIPT
}, {
  type: "small",
  style: Style$1.TEXT
}, {
  type: "stack"
}], stackLargeDelimiterSequence = [{
  type: "small",
  style: Style$1.SCRIPTSCRIPT
}, {
  type: "small",
  style: Style$1.SCRIPT
}, {
  type: "small",
  style: Style$1.TEXT
}, {
  type: "large",
  size: 1
}, {
  type: "large",
  size: 2
}, {
  type: "large",
  size: 3
}, {
  type: "large",
  size: 4
}, {
  type: "stack"
}], delimTypeToFont = 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.");
}, traverseSequence = function(e, t, r, a) {
  for (var s = Math.min(2, 3 - a.style.size), h = s; h < r.length && r[h].type !== "stack"; h++) {
    var o = getMetrics(e, delimTypeToFont(r[h]), "math"), d = o.height + o.depth;
    if (r[h].type === "small") {
      var v = a.havingBaseStyle(r[h].style);
      d *= v.sizeMultiplier;
    }
    if (d > t)
      return r[h];
  }
  return r[r.length - 1];
}, makeCustomSizedDelim = function(e, t, r, a, s, h) {
  e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle");
  var o;
  utils.contains(stackNeverDelimiters, e) ? o = stackNeverDelimiterSequence : utils.contains(stackLargeDelimiters, e) ? o = stackLargeDelimiterSequence : o = stackAlwaysDelimiterSequence;
  var d = traverseSequence(e, t, o, a);
  return d.type === "small" ? makeSmallDelim(e, d.style, r, a, s, h) : d.type === "large" ? makeLargeDelim(e, d.size, r, a, s, h) : makeStackedDelim(e, t, r, a, s, h);
}, makeLeftRightDelim = function(e, t, r, a, s, h) {
  var o = a.fontMetrics().axisHeight * a.sizeMultiplier, d = 901, v = 5 / a.fontMetrics().ptPerEm, f = Math.max(t - o, r + o), y = 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)
    f / 500 * d,
    2 * f - v
  );
  return makeCustomSizedDelim(e, y, !0, a, s, h);
}, delimiter = {
  sqrtImage: makeSqrtImage,
  sizedDelim: makeSizedDelim,
  sizeToMaxHeight,
  customSizedDelim: makeCustomSizedDelim,
  leftRightDelim: makeLeftRightDelim
}, delimiterSizes = {
  "\\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
  }
}, delimiters = ["(", "\\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 checkDelimiter(n, e) {
  var t = checkSymbolNodeType(n);
  if (t && utils.contains(delimiters, t.text))
    return t;
  throw t ? new ParseError("Invalid delimiter '" + t.text + "' after '" + e.funcName + "'", n) : new ParseError("Invalid delimiter type '" + n.type + "'", n);
}
defineFunction({
  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: (n, e) => {
    var t = checkDelimiter(e[0], n);
    return {
      type: "delimsizing",
      mode: n.parser.mode,
      size: delimiterSizes[n.funcName].size,
      mclass: delimiterSizes[n.funcName].mclass,
      delim: t.text
    };
  },
  htmlBuilder: (n, e) => n.delim === "." ? buildCommon.makeSpan([n.mclass]) : delimiter.sizedDelim(n.delim, n.size, e, n.mode, [n.mclass]),
  mathmlBuilder: (n) => {
    var e = [];
    n.delim !== "." && e.push(makeText(n.delim, n.mode));
    var t = new mathMLTree.MathNode("mo", e);
    n.mclass === "mopen" || n.mclass === "mclose" ? t.setAttribute("fence", "true") : t.setAttribute("fence", "false"), t.setAttribute("stretchy", "true");
    var r = makeEm(delimiter.sizeToMaxHeight[n.size]);
    return t.setAttribute("minsize", r), t.setAttribute("maxsize", r), t;
  }
});
function assertParsed(n) {
  if (!n.body)
    throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
}
defineFunction({
  type: "leftright-right",
  names: ["\\right"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (n, e) => {
    var t = n.parser.gullet.macros.get("\\current@color");
    if (t && typeof t != "string")
      throw new ParseError("\\current@color set to non-string in \\right");
    return {
      type: "leftright-right",
      mode: n.parser.mode,
      delim: checkDelimiter(e[0], n).text,
      color: t
      // undefined if not set via \color
    };
  }
});
defineFunction({
  type: "leftright",
  names: ["\\left"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (n, e) => {
    var t = checkDelimiter(e[0], n), r = n.parser;
    ++r.leftrightDepth;
    var a = r.parseExpression(!1);
    --r.leftrightDepth, r.expect("\\right", !1);
    var s = assertNodeType(r.parseFunction(), "leftright-right");
    return {
      type: "leftright",
      mode: r.mode,
      body: a,
      left: t.text,
      right: s.delim,
      rightColor: s.color
    };
  },
  htmlBuilder: (n, e) => {
    assertParsed(n);
    for (var t = buildExpression$1(n.body, e, !0, ["mopen", "mclose"]), r = 0, a = 0, s = !1, h = 0; h < t.length; h++)
      t[h].isMiddle ? s = !0 : (r = Math.max(t[h].height, r), a = Math.max(t[h].depth, a));
    r *= e.sizeMultiplier, a *= e.sizeMultiplier;
    var o;
    if (n.left === "." ? o = makeNullDelimiter(e, ["mopen"]) : o = delimiter.leftRightDelim(n.left, r, a, e, n.mode, ["mopen"]), t.unshift(o), s)
      for (var d = 1; d < t.length; d++) {
        var v = t[d], f = v.isMiddle;
        f && (t[d] = delimiter.leftRightDelim(f.delim, r, a, f.options, n.mode, []));
      }
    var y;
    if (n.right === ".")
      y = makeNullDelimiter(e, ["mclose"]);
    else {
      var A = n.rightColor ? e.withColor(n.rightColor) : e;
      y = delimiter.leftRightDelim(n.right, r, a, A, n.mode, ["mclose"]);
    }
    return t.push(y), buildCommon.makeSpan(["minner"], t, e);
  },
  mathmlBuilder: (n, e) => {
    assertParsed(n);
    var t = buildExpression(n.body, e);
    if (n.left !== ".") {
      var r = new mathMLTree.MathNode("mo", [makeText(n.left, n.mode)]);
      r.setAttribute("fence", "true"), t.unshift(r);
    }
    if (n.right !== ".") {
      var a = new mathMLTree.MathNode("mo", [makeText(n.right, n.mode)]);
      a.setAttribute("fence", "true"), n.rightColor && a.setAttribute("mathcolor", n.rightColor), t.push(a);
    }
    return makeRow(t);
  }
});
defineFunction({
  type: "middle",
  names: ["\\middle"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (n, e) => {
    var t = checkDelimiter(e[0], n);
    if (!n.parser.leftrightDepth)
      throw new ParseError("\\middle without preceding \\left", t);
    return {
      type: "middle",
      mode: n.parser.mode,
      delim: t.text
    };
  },
  htmlBuilder: (n, e) => {
    var t;
    if (n.delim === ".")
      t = makeNullDelimiter(e, []);
    else {
      t = delimiter.sizedDelim(n.delim, 1, e, n.mode, []);
      var r = {
        delim: n.delim,
        options: e
      };
      t.isMiddle = r;
    }
    return t;
  },
  mathmlBuilder: (n, e) => {
    var t = n.delim === "\\vert" || n.delim === "|" ? makeText("|", "text") : makeText(n.delim, n.mode), r = new mathMLTree.MathNode("mo", [t]);
    return r.setAttribute("fence", "true"), r.setAttribute("lspace", "0.05em"), r.setAttribute("rspace", "0.05em"), r;
  }
});
var htmlBuilder$7 = (n, e) => {
  var t = buildCommon.wrapFragment(buildGroup$1(n.body, e), e), r = n.label.slice(1), a = e.sizeMultiplier, s, h = 0, o = utils.isCharacterBox(n.body);
  if (r === "sout")
    s = buildCommon.makeSpan(["stretchy", "sout"]), s.height = e.fontMetrics().defaultRuleThickness / a, h = -0.5 * e.fontMetrics().xHeight;
  else if (r === "phase") {
    var d = calculateSize({
      number: 0.6,
      unit: "pt"
    }, e), v = calculateSize({
      number: 0.35,
      unit: "ex"
    }, e), f = e.havingBaseSizing();
    a = a / f.sizeMultiplier;
    var y = t.height + t.depth + d + v;
    t.style.paddingLeft = makeEm(y / 2 + d);
    var A = Math.floor(1e3 * y * a), x = phasePath(A), M = new SvgNode([new PathNode("phase", x)], {
      width: "400em",
      height: makeEm(A / 1e3),
      viewBox: "0 0 400000 " + A,
      preserveAspectRatio: "xMinYMin slice"
    });
    s = buildCommon.makeSvgSpan(["hide-tail"], [M], e), s.style.height = makeEm(y), h = t.depth + d + v;
  } else {
    /cancel/.test(r) ? o || t.classes.push("cancel-pad") : r === "angl" ? t.classes.push("anglpad") : t.classes.push("boxpad");
    var m = 0, l = 0, u = 0;
    /box/.test(r) ? (u = Math.max(
      e.fontMetrics().fboxrule,
      // default
      e.minRuleThickness
      // User override.
    ), m = e.fontMetrics().fboxsep + (r === "colorbox" ? 0 : u), l = m) : r === "angl" ? (u = Math.max(e.fontMetrics().defaultRuleThickness, e.minRuleThickness), m = 4 * u, l = Math.max(0, 0.25 - t.depth)) : (m = o ? 0.2 : 0, l = m), s = stretchy.encloseSpan(t, r, m, l, e), /fbox|boxed|fcolorbox/.test(r) ? (s.style.borderStyle = "solid", s.style.borderWidth = makeEm(u)) : r === "angl" && u !== 0.049 && (s.style.borderTopWidth = makeEm(u), s.style.borderRightWidth = makeEm(u)), h = t.depth + l, n.backgroundColor && (s.style.backgroundColor = n.backgroundColor, n.borderColor && (s.style.borderColor = n.borderColor));
  }
  var p;
  if (n.backgroundColor)
    p = buildCommon.makeVList({
      positionType: "individualShift",
      children: [
        // Put the color background behind inner;
        {
          type: "elem",
          elem: s,
          shift: h
        },
        {
          type: "elem",
          elem: t,
          shift: 0
        }
      ]
    }, e);
  else {
    var g = /cancel|phase/.test(r) ? ["svg-align"] : [];
    p = buildCommon.makeVList({
      positionType: "individualShift",
      children: [
        // Write the \cancel stroke on top of inner.
        {
          type: "elem",
          elem: t,
          shift: 0
        },
        {
          type: "elem",
          elem: s,
          shift: h,
          wrapperClasses: g
        }
      ]
    }, e);
  }
  return /cancel/.test(r) && (p.height = t.height, p.depth = t.depth), /cancel/.test(r) && !o ? buildCommon.makeSpan(["mord", "cancel-lap"], [p], e) : buildCommon.makeSpan(["mord"], [p], e);
}, mathmlBuilder$6 = (n, e) => {
  var t = 0, r = new mathMLTree.MathNode(n.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup(n.body, e)]);
  switch (n.label) {
    case "\\cancel":
      r.setAttribute("notation", "updiagonalstrike");
      break;
    case "\\bcancel":
      r.setAttribute("notation", "downdiagonalstrike");
      break;
    case "\\phase":
      r.setAttribute("notation", "phasorangle");
      break;
    case "\\sout":
      r.setAttribute("notation", "horizontalstrike");
      break;
    case "\\fbox":
      r.setAttribute("notation", "box");
      break;
    case "\\angl":
      r.setAttribute("notation", "actuarial");
      break;
    case "\\fcolorbox":
    case "\\colorbox":
      if (t = e.fontMetrics().fboxsep * e.fontMetrics().ptPerEm, r.setAttribute("width", "+" + 2 * t + "pt"), r.setAttribute("height", "+" + 2 * t + "pt"), r.setAttribute("lspace", t + "pt"), r.setAttribute("voffset", t + "pt"), n.label === "\\fcolorbox") {
        var a = Math.max(
          e.fontMetrics().fboxrule,
          // default
          e.minRuleThickness
          // user override
        );
        r.setAttribute("style", "border: " + a + "em solid " + String(n.borderColor));
      }
      break;
    case "\\xcancel":
      r.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
      break;
  }
  return n.backgroundColor && r.setAttribute("mathbackground", n.backgroundColor), r;
};
defineFunction({
  type: "enclose",
  names: ["\\colorbox"],
  props: {
    numArgs: 2,
    allowedInText: !0,
    argTypes: ["color", "text"]
  },
  handler(n, e, t) {
    var {
      parser: r,
      funcName: a
    } = n, s = assertNodeType(e[0], "color-token").color, h = e[1];
    return {
      type: "enclose",
      mode: r.mode,
      label: a,
      backgroundColor: s,
      body: h
    };
  },
  htmlBuilder: htmlBuilder$7,
  mathmlBuilder: mathmlBuilder$6
});
defineFunction({
  type: "enclose",
  names: ["\\fcolorbox"],
  props: {
    numArgs: 3,
    allowedInText: !0,
    argTypes: ["color", "color", "text"]
  },
  handler(n, e, t) {
    var {
      parser: r,
      funcName: a
    } = n, s = assertNodeType(e[0], "color-token").color, h = assertNodeType(e[1], "color-token").color, o = e[2];
    return {
      type: "enclose",
      mode: r.mode,
      label: a,
      backgroundColor: h,
      borderColor: s,
      body: o
    };
  },
  htmlBuilder: htmlBuilder$7,
  mathmlBuilder: mathmlBuilder$6
});
defineFunction({
  type: "enclose",
  names: ["\\fbox"],
  props: {
    numArgs: 1,
    argTypes: ["hbox"],
    allowedInText: !0
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "enclose",
      mode: t.mode,
      label: "\\fbox",
      body: e[0]
    };
  }
});
defineFunction({
  type: "enclose",
  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    return {
      type: "enclose",
      mode: t.mode,
      label: r,
      body: a
    };
  },
  htmlBuilder: htmlBuilder$7,
  mathmlBuilder: mathmlBuilder$6
});
defineFunction({
  type: "enclose",
  names: ["\\angl"],
  props: {
    numArgs: 1,
    argTypes: ["hbox"],
    allowedInText: !1
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "enclose",
      mode: t.mode,
      label: "\\angl",
      body: e[0]
    };
  }
});
var _environments = {};
function defineEnvironment(n) {
  for (var {
    type: e,
    names: t,
    props: r,
    handler: a,
    htmlBuilder: s,
    mathmlBuilder: h
  } = n, o = {
    type: e,
    numArgs: r.numArgs || 0,
    allowedInText: !1,
    numOptionalArgs: 0,
    handler: a
  }, d = 0; d < t.length; ++d)
    _environments[t[d]] = o;
  s && (_htmlGroupBuilders[e] = s), h && (_mathmlGroupBuilders[e] = h);
}
var _macros = {};
function defineMacro(n, e) {
  _macros[n] = e;
}
function getHLines(n) {
  var e = [];
  n.consumeSpaces();
  var t = n.fetch().text;
  for (t === "\\relax" && (n.consume(), n.consumeSpaces(), t = n.fetch().text); t === "\\hline" || t === "\\hdashline"; )
    n.consume(), e.push(t === "\\hdashline"), n.consumeSpaces(), t = n.fetch().text;
  return e;
}
var validateAmsEnvironmentContext = (n) => {
  var e = n.parser.settings;
  if (!e.displayMode)
    throw new ParseError("{" + n.envName + "} can be used only in display mode.");
};
function getAutoTag(n) {
  if (n.indexOf("ed") === -1)
    return n.indexOf("*") === -1;
}
function parseArray(n, e, t) {
  var {
    hskipBeforeAndAfter: r,
    addJot: a,
    cols: s,
    arraystretch: h,
    colSeparationType: o,
    autoTag: d,
    singleRow: v,
    emptySingleRow: f,
    maxNumCols: y,
    leqno: A
  } = e;
  if (n.gullet.beginGroup(), v || n.gullet.macros.set("\\cr", "\\\\\\relax"), !h) {
    var x = n.gullet.expandMacroAsText("\\arraystretch");
    if (x == null)
      h = 1;
    else if (h = parseFloat(x), !h || h < 0)
      throw new ParseError("Invalid \\arraystretch: " + x);
  }
  n.gullet.beginGroup();
  var M = [], m = [M], l = [], u = [], p = d != null ? [] : void 0;
  function g() {
    d && n.gullet.macros.set("\\@eqnsw", "1", !0);
  }
  function b() {
    p && (n.gullet.macros.get("\\df@tag") ? (p.push(n.subparse([new Token("\\df@tag")])), n.gullet.macros.set("\\df@tag", void 0, !0)) : p.push(!!d && n.gullet.macros.get("\\@eqnsw") === "1"));
  }
  for (g(), u.push(getHLines(n)); ; ) {
    var c = n.parseExpression(!1, v ? "\\end" : "\\\\");
    n.gullet.endGroup(), n.gullet.beginGroup(), c = {
      type: "ordgroup",
      mode: n.mode,
      body: c
    }, t && (c = {
      type: "styling",
      mode: n.mode,
      style: t,
      body: [c]
    }), M.push(c);
    var _ = n.fetch().text;
    if (_ === "&") {
      if (y && M.length === y) {
        if (v || o)
          throw new ParseError("Too many tab characters: &", n.nextToken);
        n.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
      }
      n.consume();
    } else if (_ === "\\end") {
      b(), M.length === 1 && c.type === "styling" && c.body[0].body.length === 0 && (m.length > 1 || !f) && m.pop(), u.length < m.length + 1 && u.push([]);
      break;
    } else if (_ === "\\\\") {
      n.consume();
      var E = void 0;
      n.gullet.future().text !== " " && (E = n.parseSizeGroup(!0)), l.push(E ? E.value : null), b(), u.push(getHLines(n)), M = [], m.push(M), g();
    } else
      throw new ParseError("Expected & or \\\\ or \\cr or \\end", n.nextToken);
  }
  return n.gullet.endGroup(), n.gullet.endGroup(), {
    type: "array",
    mode: n.mode,
    addJot: a,
    arraystretch: h,
    body: m,
    cols: s,
    rowGaps: l,
    hskipBeforeAndAfter: r,
    hLinesBeforeRow: u,
    colSeparationType: o,
    tags: p,
    leqno: A
  };
}
function dCellStyle(n) {
  return n.slice(0, 1) === "d" ? "display" : "text";
}
var htmlBuilder$6 = function(e, t) {
  var r, a, s = e.body.length, h = e.hLinesBeforeRow, o = 0, d = new Array(s), v = [], f = Math.max(
    // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
    t.fontMetrics().arrayRuleWidth,
    t.minRuleThickness
    // User override.
  ), y = 1 / t.fontMetrics().ptPerEm, A = 5 * y;
  if (e.colSeparationType && e.colSeparationType === "small") {
    var x = t.havingStyle(Style$1.SCRIPT).sizeMultiplier;
    A = 0.2778 * (x / t.sizeMultiplier);
  }
  var M = e.colSeparationType === "CD" ? calculateSize({
    number: 3,
    unit: "ex"
  }, t) : 12 * y, m = 3 * y, l = e.arraystretch * M, u = 0.7 * l, p = 0.3 * l, g = 0;
  function b(Be) {
    for (var Ue = 0; Ue < Be.length; ++Ue)
      Ue > 0 && (g += 0.25), v.push({
        pos: g,
        isDashed: Be[Ue]
      });
  }
  for (b(h[0]), r = 0; r < e.body.length; ++r) {
    var c = e.body[r], _ = u, E = p;
    o < c.length && (o = c.length);
    var w = new Array(c.length);
    for (a = 0; a < c.length; ++a) {
      var k = buildGroup$1(c[a], t);
      E < k.depth && (E = k.depth), _ < k.height && (_ = k.height), w[a] = k;
    }
    var $ = e.rowGaps[r], L = 0;
    $ && (L = calculateSize($, t), L > 0 && (L += p, E < L && (E = L), L = 0)), e.addJot && (E += m), w.height = _, w.depth = E, g += _, w.pos = g, g += E + L, d[r] = w, b(h[r + 1]);
  }
  var z = g / 2 + t.fontMetrics().axisHeight, F = e.cols || [], R = [], P, U, N = [];
  if (e.tags && e.tags.some((Be) => Be))
    for (r = 0; r < s; ++r) {
      var B = d[r], W = B.pos - z, V = e.tags[r], G = void 0;
      V === !0 ? G = buildCommon.makeSpan(["eqn-num"], [], t) : V === !1 ? G = buildCommon.makeSpan([], [], t) : G = buildCommon.makeSpan([], buildExpression$1(V, t, !0), t), G.depth = B.depth, G.height = B.height, N.push({
        type: "elem",
        elem: G,
        shift: W
      });
    }
  for (
    a = 0, U = 0;
    // Continue while either there are more columns or more column
    // descriptions, so trailing separators don't get lost.
    a < o || U < F.length;
    ++a, ++U
  ) {
    for (var H = F[U] || {}, Q = !0; H.type === "separator"; ) {
      if (Q || (P = buildCommon.makeSpan(["arraycolsep"], []), P.style.width = makeEm(t.fontMetrics().doubleRuleSep), R.push(P)), H.separator === "|" || H.separator === ":") {
        var te = H.separator === "|" ? "solid" : "dashed", ee = buildCommon.makeSpan(["vertical-separator"], [], t);
        ee.style.height = makeEm(g), ee.style.borderRightWidth = makeEm(f), ee.style.borderRightStyle = te, ee.style.margin = "0 " + makeEm(-f / 2);
        var ce = g - z;
        ce && (ee.style.verticalAlign = makeEm(-ce)), R.push(ee);
      } else
        throw new ParseError("Invalid separator type: " + H.separator);
      U++, H = F[U] || {}, Q = !1;
    }
    if (!(a >= o)) {
      var fe = void 0;
      (a > 0 || e.hskipBeforeAndAfter) && (fe = utils.deflt(H.pregap, A), fe !== 0 && (P = buildCommon.makeSpan(["arraycolsep"], []), P.style.width = makeEm(fe), R.push(P)));
      var oe = [];
      for (r = 0; r < s; ++r) {
        var he = d[r], Ae = he[a];
        if (Ae) {
          var Se = he.pos - z;
          Ae.depth = he.depth, Ae.height = he.height, oe.push({
            type: "elem",
            elem: Ae,
            shift: Se
          });
        }
      }
      oe = buildCommon.makeVList({
        positionType: "individualShift",
        children: oe
      }, t), oe = buildCommon.makeSpan(["col-align-" + (H.align || "c")], [oe]), R.push(oe), (a < o - 1 || e.hskipBeforeAndAfter) && (fe = utils.deflt(H.postgap, A), fe !== 0 && (P = buildCommon.makeSpan(["arraycolsep"], []), P.style.width = makeEm(fe), R.push(P)));
    }
  }
  if (d = buildCommon.makeSpan(["mtable"], R), v.length > 0) {
    for (var Ie = buildCommon.makeLineSpan("hline", t, f), pe = buildCommon.makeLineSpan("hdashline", t, f), le = [{
      type: "elem",
      elem: d,
      shift: 0
    }]; v.length > 0; ) {
      var ne = v.pop(), Te = ne.pos - z;
      ne.isDashed ? le.push({
        type: "elem",
        elem: pe,
        shift: Te
      }) : le.push({
        type: "elem",
        elem: Ie,
        shift: Te
      });
    }
    d = buildCommon.makeVList({
      positionType: "individualShift",
      children: le
    }, t);
  }
  if (N.length === 0)
    return buildCommon.makeSpan(["mord"], [d], t);
  var Oe = buildCommon.makeVList({
    positionType: "individualShift",
    children: N
  }, t);
  return Oe = buildCommon.makeSpan(["tag"], [Oe], t), buildCommon.makeFragment([d, Oe]);
}, alignMap = {
  c: "center ",
  l: "left ",
  r: "right "
}, mathmlBuilder$5 = function(e, t) {
  for (var r = [], a = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]), s = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]), h = 0; h < e.body.length; h++) {
    for (var o = e.body[h], d = [], v = 0; v < o.length; v++)
      d.push(new mathMLTree.MathNode("mtd", [buildGroup(o[v], t)]));
    e.tags && e.tags[h] && (d.unshift(a), d.push(a), e.leqno ? d.unshift(s) : d.push(s)), r.push(new mathMLTree.MathNode("mtr", d));
  }
  var f = new mathMLTree.MathNode("mtable", r), y = e.arraystretch === 0.5 ? 0.1 : 0.16 + e.arraystretch - 1 + (e.addJot ? 0.09 : 0);
  f.setAttribute("rowspacing", makeEm(y));
  var A = "", x = "";
  if (e.cols && e.cols.length > 0) {
    var M = e.cols, m = "", l = !1, u = 0, p = M.length;
    M[0].type === "separator" && (A += "top ", u = 1), M[M.length - 1].type === "separator" && (A += "bottom ", p -= 1);
    for (var g = u; g < p; g++)
      M[g].type === "align" ? (x += alignMap[M[g].align], l && (m += "none "), l = !0) : M[g].type === "separator" && l && (m += M[g].separator === "|" ? "solid " : "dashed ", l = !1);
    f.setAttribute("columnalign", x.trim()), /[sd]/.test(m) && f.setAttribute("columnlines", m.trim());
  }
  if (e.colSeparationType === "align") {
    for (var b = e.cols || [], c = "", _ = 1; _ < b.length; _++)
      c += _ % 2 ? "0em " : "1em ";
    f.setAttribute("columnspacing", c.trim());
  } else e.colSeparationType === "alignat" || e.colSeparationType === "gather" ? f.setAttribute("columnspacing", "0em") : e.colSeparationType === "small" ? f.setAttribute("columnspacing", "0.2778em") : e.colSeparationType === "CD" ? f.setAttribute("columnspacing", "0.5em") : f.setAttribute("columnspacing", "1em");
  var E = "", w = e.hLinesBeforeRow;
  A += w[0].length > 0 ? "left " : "", A += w[w.length - 1].length > 0 ? "right " : "";
  for (var k = 1; k < w.length - 1; k++)
    E += w[k].length === 0 ? "none " : w[k][0] ? "dashed " : "solid ";
  return /[sd]/.test(E) && f.setAttribute("rowlines", E.trim()), A !== "" && (f = new mathMLTree.MathNode("menclose", [f]), f.setAttribute("notation", A.trim())), e.arraystretch && e.arraystretch < 1 && (f = new mathMLTree.MathNode("mstyle", [f]), f.setAttribute("scriptlevel", "1")), f;
}, alignedHandler = function(e, t) {
  e.envName.indexOf("ed") === -1 && validateAmsEnvironmentContext(e);
  var r = [], a = e.envName.indexOf("at") > -1 ? "alignat" : "align", s = e.envName === "split", h = parseArray(e.parser, {
    cols: r,
    addJot: !0,
    autoTag: s ? void 0 : getAutoTag(e.envName),
    emptySingleRow: !0,
    colSeparationType: a,
    maxNumCols: s ? 2 : void 0,
    leqno: e.parser.settings.leqno
  }, "display"), o, d = 0, v = {
    type: "ordgroup",
    mode: e.mode,
    body: []
  };
  if (t[0] && t[0].type === "ordgroup") {
    for (var f = "", y = 0; y < t[0].body.length; y++) {
      var A = assertNodeType(t[0].body[y], "textord");
      f += A.text;
    }
    o = Number(f), d = o * 2;
  }
  var x = !d;
  h.body.forEach(function(u) {
    for (var p = 1; p < u.length; p += 2) {
      var g = assertNodeType(u[p], "styling"), b = assertNodeType(g.body[0], "ordgroup");
      b.body.unshift(v);
    }
    if (x)
      d < u.length && (d = u.length);
    else {
      var c = u.length / 2;
      if (o < c)
        throw new ParseError("Too many math in a row: " + ("expected " + o + ", but got " + c), u[0]);
    }
  });
  for (var M = 0; M < d; ++M) {
    var m = "r", l = 0;
    M % 2 === 1 ? m = "l" : M > 0 && x && (l = 1), r[M] = {
      type: "align",
      align: m,
      pregap: l,
      postgap: 0
    };
  }
  return h.colSeparationType = x ? "align" : "alignat", h;
};
defineEnvironment({
  type: "array",
  names: ["array", "darray"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var t = checkSymbolNodeType(e[0]), r = t ? [e[0]] : assertNodeType(e[0], "ordgroup").body, a = r.map(function(h) {
      var o = assertSymbolNodeType(h), d = o.text;
      if ("lcr".indexOf(d) !== -1)
        return {
          type: "align",
          align: d
        };
      if (d === "|")
        return {
          type: "separator",
          separator: "|"
        };
      if (d === ":")
        return {
          type: "separator",
          separator: ":"
        };
      throw new ParseError("Unknown column alignment: " + d, h);
    }), s = {
      cols: a,
      hskipBeforeAndAfter: !0,
      // \@preamble in lttab.dtx
      maxNumCols: a.length
    };
    return parseArray(n.parser, s, dCellStyle(n.envName));
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
  props: {
    numArgs: 0
  },
  handler(n) {
    var e = {
      matrix: null,
      pmatrix: ["(", ")"],
      bmatrix: ["[", "]"],
      Bmatrix: ["\\{", "\\}"],
      vmatrix: ["|", "|"],
      Vmatrix: ["\\Vert", "\\Vert"]
    }[n.envName.replace("*", "")], t = "c", r = {
      hskipBeforeAndAfter: !1,
      cols: [{
        type: "align",
        align: t
      }]
    };
    if (n.envName.charAt(n.envName.length - 1) === "*") {
      var a = n.parser;
      if (a.consumeSpaces(), a.fetch().text === "[") {
        if (a.consume(), a.consumeSpaces(), t = a.fetch().text, "lcr".indexOf(t) === -1)
          throw new ParseError("Expected l or c or r", a.nextToken);
        a.consume(), a.consumeSpaces(), a.expect("]"), a.consume(), r.cols = [{
          type: "align",
          align: t
        }];
      }
    }
    var s = parseArray(n.parser, r, dCellStyle(n.envName)), h = Math.max(0, ...s.body.map((o) => o.length));
    return s.cols = new Array(h).fill({
      type: "align",
      align: t
    }), e ? {
      type: "leftright",
      mode: n.mode,
      body: [s],
      left: e[0],
      right: e[1],
      rightColor: void 0
      // \right uninfluenced by \color in array
    } : s;
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["smallmatrix"],
  props: {
    numArgs: 0
  },
  handler(n) {
    var e = {
      arraystretch: 0.5
    }, t = parseArray(n.parser, e, "script");
    return t.colSeparationType = "small", t;
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["subarray"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var t = checkSymbolNodeType(e[0]), r = t ? [e[0]] : assertNodeType(e[0], "ordgroup").body, a = r.map(function(h) {
      var o = assertSymbolNodeType(h), d = o.text;
      if ("lc".indexOf(d) !== -1)
        return {
          type: "align",
          align: d
        };
      throw new ParseError("Unknown column alignment: " + d, h);
    });
    if (a.length > 1)
      throw new ParseError("{subarray} can contain only one column");
    var s = {
      cols: a,
      hskipBeforeAndAfter: !1,
      arraystretch: 0.5
    };
    if (s = parseArray(n.parser, s, "script"), s.body.length > 0 && s.body[0].length > 1)
      throw new ParseError("{subarray} can contain only one column");
    return s;
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["cases", "dcases", "rcases", "drcases"],
  props: {
    numArgs: 0
  },
  handler(n) {
    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
      }]
    }, t = parseArray(n.parser, e, dCellStyle(n.envName));
    return {
      type: "leftright",
      mode: n.mode,
      body: [t],
      left: n.envName.indexOf("r") > -1 ? "." : "\\{",
      right: n.envName.indexOf("r") > -1 ? "\\}" : ".",
      rightColor: void 0
    };
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["align", "align*", "aligned", "split"],
  props: {
    numArgs: 0
  },
  handler: alignedHandler,
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["gathered", "gather", "gather*"],
  props: {
    numArgs: 0
  },
  handler(n) {
    utils.contains(["gather", "gather*"], n.envName) && validateAmsEnvironmentContext(n);
    var e = {
      cols: [{
        type: "align",
        align: "c"
      }],
      addJot: !0,
      colSeparationType: "gather",
      autoTag: getAutoTag(n.envName),
      emptySingleRow: !0,
      leqno: n.parser.settings.leqno
    };
    return parseArray(n.parser, e, "display");
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["alignat", "alignat*", "alignedat"],
  props: {
    numArgs: 1
  },
  handler: alignedHandler,
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["equation", "equation*"],
  props: {
    numArgs: 0
  },
  handler(n) {
    validateAmsEnvironmentContext(n);
    var e = {
      autoTag: getAutoTag(n.envName),
      emptySingleRow: !0,
      singleRow: !0,
      maxNumCols: 1,
      leqno: n.parser.settings.leqno
    };
    return parseArray(n.parser, e, "display");
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineEnvironment({
  type: "array",
  names: ["CD"],
  props: {
    numArgs: 0
  },
  handler(n) {
    return validateAmsEnvironmentContext(n), parseCD(n.parser);
  },
  htmlBuilder: htmlBuilder$6,
  mathmlBuilder: mathmlBuilder$5
});
defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
defineMacro("\\notag", "\\nonumber");
defineFunction({
  type: "text",
  // Doesn't matter what this is.
  names: ["\\hline", "\\hdashline"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !0
  },
  handler(n, e) {
    throw new ParseError(n.funcName + " valid only within array environment");
  }
});
var environments = _environments;
defineFunction({
  type: "environment",
  names: ["\\begin", "\\end"],
  props: {
    numArgs: 1,
    argTypes: ["text"]
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    if (a.type !== "ordgroup")
      throw new ParseError("Invalid environment name", a);
    for (var s = "", h = 0; h < a.body.length; ++h)
      s += assertNodeType(a.body[h], "textord").text;
    if (r === "\\begin") {
      if (!environments.hasOwnProperty(s))
        throw new ParseError("No such environment: " + s, a);
      var o = environments[s], {
        args: d,
        optArgs: v
      } = t.parseArguments("\\begin{" + s + "}", o), f = {
        mode: t.mode,
        envName: s,
        parser: t
      }, y = o.handler(f, d, v);
      t.expect("\\end", !1);
      var A = t.nextToken, x = assertNodeType(t.parseFunction(), "environment");
      if (x.name !== s)
        throw new ParseError("Mismatch: \\begin{" + s + "} matched by \\end{" + x.name + "}", A);
      return y;
    }
    return {
      type: "environment",
      mode: t.mode,
      name: s,
      nameGroup: a
    };
  }
});
var htmlBuilder$5 = (n, e) => {
  var t = n.font, r = e.withFont(t);
  return buildGroup$1(n.body, r);
}, mathmlBuilder$4 = (n, e) => {
  var t = n.font, r = e.withFont(t);
  return buildGroup(n.body, r);
}, fontAliases = {
  "\\Bbb": "\\mathbb",
  "\\bold": "\\mathbf",
  "\\frak": "\\mathfrak",
  "\\bm": "\\boldsymbol"
};
defineFunction({
  type: "font",
  names: [
    // styles, except \boldsymbol defined below
    "\\mathrm",
    "\\mathit",
    "\\mathbf",
    "\\mathnormal",
    // families
    "\\mathbb",
    "\\mathcal",
    "\\mathfrak",
    "\\mathscr",
    "\\mathsf",
    "\\mathtt",
    // aliases, except \bm defined below
    "\\Bbb",
    "\\bold",
    "\\frak"
  ],
  props: {
    numArgs: 1,
    allowedInArgument: !0
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = normalizeArgument(e[0]), s = r;
    return s in fontAliases && (s = fontAliases[s]), {
      type: "font",
      mode: t.mode,
      font: s.slice(1),
      body: a
    };
  },
  htmlBuilder: htmlBuilder$5,
  mathmlBuilder: mathmlBuilder$4
});
defineFunction({
  type: "mclass",
  names: ["\\boldsymbol", "\\bm"],
  props: {
    numArgs: 1
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = e[0], a = utils.isCharacterBox(r);
    return {
      type: "mclass",
      mode: t.mode,
      mclass: binrelClass(r),
      body: [{
        type: "font",
        mode: t.mode,
        font: "boldsymbol",
        body: r
      }],
      isCharacterBox: a
    };
  }
});
defineFunction({
  type: "font",
  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r,
      breakOnTokenText: a
    } = n, {
      mode: s
    } = t, h = t.parseExpression(!0, a), o = "math" + r.slice(1);
    return {
      type: "font",
      mode: s,
      font: o,
      body: {
        type: "ordgroup",
        mode: t.mode,
        body: h
      }
    };
  },
  htmlBuilder: htmlBuilder$5,
  mathmlBuilder: mathmlBuilder$4
});
var adjustStyle = (n, e) => {
  var t = e;
  return n === "display" ? t = t.id >= Style$1.SCRIPT.id ? t.text() : Style$1.DISPLAY : n === "text" && t.size === Style$1.DISPLAY.size ? t = Style$1.TEXT : n === "script" ? t = Style$1.SCRIPT : n === "scriptscript" && (t = Style$1.SCRIPTSCRIPT), t;
}, htmlBuilder$4 = (n, e) => {
  var t = adjustStyle(n.size, e.style), r = t.fracNum(), a = t.fracDen(), s;
  s = e.havingStyle(r);
  var h = buildGroup$1(n.numer, s, e);
  if (n.continued) {
    var o = 8.5 / e.fontMetrics().ptPerEm, d = 3.5 / e.fontMetrics().ptPerEm;
    h.height = h.height < o ? o : h.height, h.depth = h.depth < d ? d : h.depth;
  }
  s = e.havingStyle(a);
  var v = buildGroup$1(n.denom, s, e), f, y, A;
  n.hasBarLine ? (n.barSize ? (y = calculateSize(n.barSize, e), f = buildCommon.makeLineSpan("frac-line", e, y)) : f = buildCommon.makeLineSpan("frac-line", e), y = f.height, A = f.height) : (f = null, y = 0, A = e.fontMetrics().defaultRuleThickness);
  var x, M, m;
  t.size === Style$1.DISPLAY.size || n.size === "display" ? (x = e.fontMetrics().num1, y > 0 ? M = 3 * A : M = 7 * A, m = e.fontMetrics().denom1) : (y > 0 ? (x = e.fontMetrics().num2, M = A) : (x = e.fontMetrics().num3, M = 3 * A), m = e.fontMetrics().denom2);
  var l;
  if (f) {
    var p = e.fontMetrics().axisHeight;
    x - h.depth - (p + 0.5 * y) < M && (x += M - (x - h.depth - (p + 0.5 * y))), p - 0.5 * y - (v.height - m) < M && (m += M - (p - 0.5 * y - (v.height - m)));
    var g = -(p - 0.5 * y);
    l = buildCommon.makeVList({
      positionType: "individualShift",
      children: [{
        type: "elem",
        elem: v,
        shift: m
      }, {
        type: "elem",
        elem: f,
        shift: g
      }, {
        type: "elem",
        elem: h,
        shift: -x
      }]
    }, e);
  } else {
    var u = x - h.depth - (v.height - m);
    u < M && (x += 0.5 * (M - u), m += 0.5 * (M - u)), l = buildCommon.makeVList({
      positionType: "individualShift",
      children: [{
        type: "elem",
        elem: v,
        shift: m
      }, {
        type: "elem",
        elem: h,
        shift: -x
      }]
    }, e);
  }
  s = e.havingStyle(t), l.height *= s.sizeMultiplier / e.sizeMultiplier, l.depth *= s.sizeMultiplier / e.sizeMultiplier;
  var b;
  t.size === Style$1.DISPLAY.size ? b = e.fontMetrics().delim1 : t.size === Style$1.SCRIPTSCRIPT.size ? b = e.havingStyle(Style$1.SCRIPT).fontMetrics().delim2 : b = e.fontMetrics().delim2;
  var c, _;
  return n.leftDelim == null ? c = makeNullDelimiter(e, ["mopen"]) : c = delimiter.customSizedDelim(n.leftDelim, b, !0, e.havingStyle(t), n.mode, ["mopen"]), n.continued ? _ = buildCommon.makeSpan([]) : n.rightDelim == null ? _ = makeNullDelimiter(e, ["mclose"]) : _ = delimiter.customSizedDelim(n.rightDelim, b, !0, e.havingStyle(t), n.mode, ["mclose"]), buildCommon.makeSpan(["mord"].concat(s.sizingClasses(e)), [c, buildCommon.makeSpan(["mfrac"], [l]), _], e);
}, mathmlBuilder$3 = (n, e) => {
  var t = new mathMLTree.MathNode("mfrac", [buildGroup(n.numer, e), buildGroup(n.denom, e)]);
  if (!n.hasBarLine)
    t.setAttribute("linethickness", "0px");
  else if (n.barSize) {
    var r = calculateSize(n.barSize, e);
    t.setAttribute("linethickness", makeEm(r));
  }
  var a = adjustStyle(n.size, e.style);
  if (a.size !== e.style.size) {
    t = new mathMLTree.MathNode("mstyle", [t]);
    var s = a.size === Style$1.DISPLAY.size ? "true" : "false";
    t.setAttribute("displaystyle", s), t.setAttribute("scriptlevel", "0");
  }
  if (n.leftDelim != null || n.rightDelim != null) {
    var h = [];
    if (n.leftDelim != null) {
      var o = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(n.leftDelim.replace("\\", ""))]);
      o.setAttribute("fence", "true"), h.push(o);
    }
    if (h.push(t), n.rightDelim != null) {
      var d = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(n.rightDelim.replace("\\", ""))]);
      d.setAttribute("fence", "true"), h.push(d);
    }
    return makeRow(h);
  }
  return t;
};
defineFunction({
  type: "genfrac",
  names: [
    "\\dfrac",
    "\\frac",
    "\\tfrac",
    "\\dbinom",
    "\\binom",
    "\\tbinom",
    "\\\\atopfrac",
    // can’t be entered directly
    "\\\\bracefrac",
    "\\\\brackfrac"
    // ditto
  ],
  props: {
    numArgs: 2,
    allowedInArgument: !0
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0], s = e[1], h, o = null, d = null, v = "auto";
    switch (r) {
      case "\\dfrac":
      case "\\frac":
      case "\\tfrac":
        h = !0;
        break;
      case "\\\\atopfrac":
        h = !1;
        break;
      case "\\dbinom":
      case "\\binom":
      case "\\tbinom":
        h = !1, o = "(", d = ")";
        break;
      case "\\\\bracefrac":
        h = !1, o = "\\{", d = "\\}";
        break;
      case "\\\\brackfrac":
        h = !1, o = "[", d = "]";
        break;
      default:
        throw new Error("Unrecognized genfrac command");
    }
    switch (r) {
      case "\\dfrac":
      case "\\dbinom":
        v = "display";
        break;
      case "\\tfrac":
      case "\\tbinom":
        v = "text";
        break;
    }
    return {
      type: "genfrac",
      mode: t.mode,
      continued: !1,
      numer: a,
      denom: s,
      hasBarLine: h,
      leftDelim: o,
      rightDelim: d,
      size: v,
      barSize: null
    };
  },
  htmlBuilder: htmlBuilder$4,
  mathmlBuilder: mathmlBuilder$3
});
defineFunction({
  type: "genfrac",
  names: ["\\cfrac"],
  props: {
    numArgs: 2
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0], s = e[1];
    return {
      type: "genfrac",
      mode: t.mode,
      continued: !0,
      numer: a,
      denom: s,
      hasBarLine: !0,
      leftDelim: null,
      rightDelim: null,
      size: "display",
      barSize: null
    };
  }
});
defineFunction({
  type: "infix",
  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
  props: {
    numArgs: 0,
    infix: !0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t,
      token: r
    } = n, a;
    switch (t) {
      case "\\over":
        a = "\\frac";
        break;
      case "\\choose":
        a = "\\binom";
        break;
      case "\\atop":
        a = "\\\\atopfrac";
        break;
      case "\\brace":
        a = "\\\\bracefrac";
        break;
      case "\\brack":
        a = "\\\\brackfrac";
        break;
      default:
        throw new Error("Unrecognized infix genfrac command");
    }
    return {
      type: "infix",
      mode: e.mode,
      replaceWith: a,
      token: r
    };
  }
});
var stylArray = ["display", "text", "script", "scriptscript"], delimFromValue = function(e) {
  var t = null;
  return e.length > 0 && (t = e, t = t === "." ? null : t), t;
};
defineFunction({
  type: "genfrac",
  names: ["\\genfrac"],
  props: {
    numArgs: 6,
    allowedInArgument: !0,
    argTypes: ["math", "math", "size", "text", "math", "math"]
  },
  handler(n, e) {
    var {
      parser: t
    } = n, r = e[4], a = e[5], s = normalizeArgument(e[0]), h = s.type === "atom" && s.family === "open" ? delimFromValue(s.text) : null, o = normalizeArgument(e[1]), d = o.type === "atom" && o.family === "close" ? delimFromValue(o.text) : null, v = assertNodeType(e[2], "size"), f, y = null;
    v.isBlank ? f = !0 : (y = v.value, f = y.number > 0);
    var A = "auto", x = e[3];
    if (x.type === "ordgroup") {
      if (x.body.length > 0) {
        var M = assertNodeType(x.body[0], "textord");
        A = stylArray[Number(M.text)];
      }
    } else
      x = assertNodeType(x, "textord"), A = stylArray[Number(x.text)];
    return {
      type: "genfrac",
      mode: t.mode,
      numer: r,
      denom: a,
      continued: !1,
      hasBarLine: f,
      barSize: y,
      leftDelim: h,
      rightDelim: d,
      size: A
    };
  },
  htmlBuilder: htmlBuilder$4,
  mathmlBuilder: mathmlBuilder$3
});
defineFunction({
  type: "infix",
  names: ["\\above"],
  props: {
    numArgs: 1,
    argTypes: ["size"],
    infix: !0
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r,
      token: a
    } = n;
    return {
      type: "infix",
      mode: t.mode,
      replaceWith: "\\\\abovefrac",
      size: assertNodeType(e[0], "size").value,
      token: a
    };
  }
});
defineFunction({
  type: "genfrac",
  names: ["\\\\abovefrac"],
  props: {
    numArgs: 3,
    argTypes: ["math", "size", "math"]
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0], s = assert(assertNodeType(e[1], "infix").size), h = e[2], o = s.number > 0;
    return {
      type: "genfrac",
      mode: t.mode,
      numer: a,
      denom: h,
      continued: !1,
      hasBarLine: o,
      barSize: s,
      leftDelim: null,
      rightDelim: null,
      size: "auto"
    };
  },
  htmlBuilder: htmlBuilder$4,
  mathmlBuilder: mathmlBuilder$3
});
var htmlBuilder$3 = (n, e) => {
  var t = e.style, r, a;
  n.type === "supsub" ? (r = n.sup ? buildGroup$1(n.sup, e.havingStyle(t.sup()), e) : buildGroup$1(n.sub, e.havingStyle(t.sub()), e), a = assertNodeType(n.base, "horizBrace")) : a = assertNodeType(n, "horizBrace");
  var s = buildGroup$1(a.base, e.havingBaseStyle(Style$1.DISPLAY)), h = stretchy.svgSpan(a, e), o;
  if (a.isOver ? (o = buildCommon.makeVList({
    positionType: "firstBaseline",
    children: [{
      type: "elem",
      elem: s
    }, {
      type: "kern",
      size: 0.1
    }, {
      type: "elem",
      elem: h
    }]
  }, e), o.children[0].children[0].children[1].classes.push("svg-align")) : (o = buildCommon.makeVList({
    positionType: "bottom",
    positionData: s.depth + 0.1 + h.height,
    children: [{
      type: "elem",
      elem: h
    }, {
      type: "kern",
      size: 0.1
    }, {
      type: "elem",
      elem: s
    }]
  }, e), o.children[0].children[0].children[0].classes.push("svg-align")), r) {
    var d = buildCommon.makeSpan(["mord", a.isOver ? "mover" : "munder"], [o], e);
    a.isOver ? o = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: d
      }, {
        type: "kern",
        size: 0.2
      }, {
        type: "elem",
        elem: r
      }]
    }, e) : o = buildCommon.makeVList({
      positionType: "bottom",
      positionData: d.depth + 0.2 + r.height + r.depth,
      children: [{
        type: "elem",
        elem: r
      }, {
        type: "kern",
        size: 0.2
      }, {
        type: "elem",
        elem: d
      }]
    }, e);
  }
  return buildCommon.makeSpan(["mord", a.isOver ? "mover" : "munder"], [o], e);
}, mathmlBuilder$2 = (n, e) => {
  var t = stretchy.mathMLnode(n.label);
  return new mathMLTree.MathNode(n.isOver ? "mover" : "munder", [buildGroup(n.base, e), t]);
};
defineFunction({
  type: "horizBrace",
  names: ["\\overbrace", "\\underbrace"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n;
    return {
      type: "horizBrace",
      mode: t.mode,
      label: r,
      isOver: /^\\over/.test(r),
      base: e[0]
    };
  },
  htmlBuilder: htmlBuilder$3,
  mathmlBuilder: mathmlBuilder$2
});
defineFunction({
  type: "href",
  names: ["\\href"],
  props: {
    numArgs: 2,
    argTypes: ["url", "original"],
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = e[1], a = assertNodeType(e[0], "url").url;
    return t.settings.isTrusted({
      command: "\\href",
      url: a
    }) ? {
      type: "href",
      mode: t.mode,
      href: a,
      body: ordargument(r)
    } : t.formatUnsupportedCmd("\\href");
  },
  htmlBuilder: (n, e) => {
    var t = buildExpression$1(n.body, e, !1);
    return buildCommon.makeAnchor(n.href, [], t, e);
  },
  mathmlBuilder: (n, e) => {
    var t = buildExpressionRow(n.body, e);
    return t instanceof MathNode || (t = new MathNode("mrow", [t])), t.setAttribute("href", n.href), t;
  }
});
defineFunction({
  type: "href",
  names: ["\\url"],
  props: {
    numArgs: 1,
    argTypes: ["url"],
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = assertNodeType(e[0], "url").url;
    if (!t.settings.isTrusted({
      command: "\\url",
      url: r
    }))
      return t.formatUnsupportedCmd("\\url");
    for (var a = [], s = 0; s < r.length; s++) {
      var h = r[s];
      h === "~" && (h = "\\textasciitilde"), a.push({
        type: "textord",
        mode: "text",
        text: h
      });
    }
    var o = {
      type: "text",
      mode: t.mode,
      font: "\\texttt",
      body: a
    };
    return {
      type: "href",
      mode: t.mode,
      href: r,
      body: ordargument(o)
    };
  }
});
defineFunction({
  type: "hbox",
  names: ["\\hbox"],
  props: {
    numArgs: 1,
    argTypes: ["text"],
    allowedInText: !0,
    primitive: !0
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "hbox",
      mode: t.mode,
      body: ordargument(e[0])
    };
  },
  htmlBuilder(n, e) {
    var t = buildExpression$1(n.body, e, !1);
    return buildCommon.makeFragment(t);
  },
  mathmlBuilder(n, e) {
    return new mathMLTree.MathNode("mrow", buildExpression(n.body, e));
  }
});
defineFunction({
  type: "html",
  names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
  props: {
    numArgs: 2,
    argTypes: ["raw", "original"],
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r,
      token: a
    } = n, s = assertNodeType(e[0], "raw").string, h = e[1];
    t.settings.strict && t.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
    var o, d = {};
    switch (r) {
      case "\\htmlClass":
        d.class = s, o = {
          command: "\\htmlClass",
          class: s
        };
        break;
      case "\\htmlId":
        d.id = s, o = {
          command: "\\htmlId",
          id: s
        };
        break;
      case "\\htmlStyle":
        d.style = s, o = {
          command: "\\htmlStyle",
          style: s
        };
        break;
      case "\\htmlData": {
        for (var v = s.split(","), f = 0; f < v.length; f++) {
          var y = v[f].split("=");
          if (y.length !== 2)
            throw new ParseError("Error parsing key-value for \\htmlData");
          d["data-" + y[0].trim()] = y[1].trim();
        }
        o = {
          command: "\\htmlData",
          attributes: d
        };
        break;
      }
      default:
        throw new Error("Unrecognized html command");
    }
    return t.settings.isTrusted(o) ? {
      type: "html",
      mode: t.mode,
      attributes: d,
      body: ordargument(h)
    } : t.formatUnsupportedCmd(r);
  },
  htmlBuilder: (n, e) => {
    var t = buildExpression$1(n.body, e, !1), r = ["enclosing"];
    n.attributes.class && r.push(...n.attributes.class.trim().split(/\s+/));
    var a = buildCommon.makeSpan(r, t, e);
    for (var s in n.attributes)
      s !== "class" && n.attributes.hasOwnProperty(s) && a.setAttribute(s, n.attributes[s]);
    return a;
  },
  mathmlBuilder: (n, e) => buildExpressionRow(n.body, e)
});
defineFunction({
  type: "htmlmathml",
  names: ["\\html@mathml"],
  props: {
    numArgs: 2,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n;
    return {
      type: "htmlmathml",
      mode: t.mode,
      html: ordargument(e[0]),
      mathml: ordargument(e[1])
    };
  },
  htmlBuilder: (n, e) => {
    var t = buildExpression$1(n.html, e, !1);
    return buildCommon.makeFragment(t);
  },
  mathmlBuilder: (n, e) => buildExpressionRow(n.mathml, e)
});
var sizeData = function(e) {
  if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))
    return {
      number: +e,
      unit: "bp"
    };
  var t = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);
  if (!t)
    throw new ParseError("Invalid size: '" + e + "' in \\includegraphics");
  var r = {
    number: +(t[1] + t[2]),
    // sign + magnitude, cast to number
    unit: t[3]
  };
  if (!validUnit(r))
    throw new ParseError("Invalid unit: '" + r.unit + "' in \\includegraphics.");
  return r;
};
defineFunction({
  type: "includegraphics",
  names: ["\\includegraphics"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1,
    argTypes: ["raw", "url"],
    allowedInText: !1
  },
  handler: (n, e, t) => {
    var {
      parser: r
    } = n, a = {
      number: 0,
      unit: "em"
    }, s = {
      number: 0.9,
      unit: "em"
    }, h = {
      number: 0,
      unit: "em"
    }, o = "";
    if (t[0])
      for (var d = assertNodeType(t[0], "raw").string, v = d.split(","), f = 0; f < v.length; f++) {
        var y = v[f].split("=");
        if (y.length === 2) {
          var A = y[1].trim();
          switch (y[0].trim()) {
            case "alt":
              o = A;
              break;
            case "width":
              a = sizeData(A);
              break;
            case "height":
              s = sizeData(A);
              break;
            case "totalheight":
              h = sizeData(A);
              break;
            default:
              throw new ParseError("Invalid key: '" + y[0] + "' in \\includegraphics.");
          }
        }
      }
    var x = assertNodeType(e[0], "url").url;
    return o === "" && (o = x, o = o.replace(/^.*[\\/]/, ""), o = o.substring(0, o.lastIndexOf("."))), r.settings.isTrusted({
      command: "\\includegraphics",
      url: x
    }) ? {
      type: "includegraphics",
      mode: r.mode,
      alt: o,
      width: a,
      height: s,
      totalheight: h,
      src: x
    } : r.formatUnsupportedCmd("\\includegraphics");
  },
  htmlBuilder: (n, e) => {
    var t = calculateSize(n.height, e), r = 0;
    n.totalheight.number > 0 && (r = calculateSize(n.totalheight, e) - t);
    var a = 0;
    n.width.number > 0 && (a = calculateSize(n.width, e));
    var s = {
      height: makeEm(t + r)
    };
    a > 0 && (s.width = makeEm(a)), r > 0 && (s.verticalAlign = makeEm(-r));
    var h = new Img(n.src, n.alt, s);
    return h.height = t, h.depth = r, h;
  },
  mathmlBuilder: (n, e) => {
    var t = new mathMLTree.MathNode("mglyph", []);
    t.setAttribute("alt", n.alt);
    var r = calculateSize(n.height, e), a = 0;
    if (n.totalheight.number > 0 && (a = calculateSize(n.totalheight, e) - r, t.setAttribute("valign", makeEm(-a))), t.setAttribute("height", makeEm(r + a)), n.width.number > 0) {
      var s = calculateSize(n.width, e);
      t.setAttribute("width", makeEm(s));
    }
    return t.setAttribute("src", n.src), t;
  }
});
defineFunction({
  type: "kern",
  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
  props: {
    numArgs: 1,
    argTypes: ["size"],
    primitive: !0,
    allowedInText: !0
  },
  handler(n, e) {
    var {
      parser: t,
      funcName: r
    } = n, a = assertNodeType(e[0], "size");
    if (t.settings.strict) {
      var s = r[1] === "m", h = a.value.unit === "mu";
      s ? (h || t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " supports only mu units, " + ("not " + a.value.unit + " units")), t.mode !== "math" && t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " works only in math mode")) : h && t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " doesn't support mu units");
    }
    return {
      type: "kern",
      mode: t.mode,
      dimension: a.value
    };
  },
  htmlBuilder(n, e) {
    return buildCommon.makeGlue(n.dimension, e);
  },
  mathmlBuilder(n, e) {
    var t = calculateSize(n.dimension, e);
    return new mathMLTree.SpaceNode(t);
  }
});
defineFunction({
  type: "lap",
  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    return {
      type: "lap",
      mode: t.mode,
      alignment: r.slice(5),
      body: a
    };
  },
  htmlBuilder: (n, e) => {
    var t;
    n.alignment === "clap" ? (t = buildCommon.makeSpan([], [buildGroup$1(n.body, e)]), t = buildCommon.makeSpan(["inner"], [t], e)) : t = buildCommon.makeSpan(["inner"], [buildGroup$1(n.body, e)]);
    var r = buildCommon.makeSpan(["fix"], []), a = buildCommon.makeSpan([n.alignment], [t, r], e), s = buildCommon.makeSpan(["strut"]);
    return s.style.height = makeEm(a.height + a.depth), a.depth && (s.style.verticalAlign = makeEm(-a.depth)), a.children.unshift(s), a = buildCommon.makeSpan(["thinbox"], [a], e), buildCommon.makeSpan(["mord", "vbox"], [a], e);
  },
  mathmlBuilder: (n, e) => {
    var t = new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)]);
    if (n.alignment !== "rlap") {
      var r = n.alignment === "llap" ? "-1" : "-0.5";
      t.setAttribute("lspace", r + "width");
    }
    return t.setAttribute("width", "0px"), t;
  }
});
defineFunction({
  type: "styling",
  names: ["\\(", "$"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !1
  },
  handler(n, e) {
    var {
      funcName: t,
      parser: r
    } = n, a = r.mode;
    r.switchMode("math");
    var s = t === "\\(" ? "\\)" : "$", h = r.parseExpression(!1, s);
    return r.expect(s), r.switchMode(a), {
      type: "styling",
      mode: r.mode,
      style: "text",
      body: h
    };
  }
});
defineFunction({
  type: "text",
  // Doesn't matter what this is.
  names: ["\\)", "\\]"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    allowedInMath: !1
  },
  handler(n, e) {
    throw new ParseError("Mismatched " + n.funcName);
  }
});
var chooseMathStyle = (n, e) => {
  switch (e.style.size) {
    case Style$1.DISPLAY.size:
      return n.display;
    case Style$1.TEXT.size:
      return n.text;
    case Style$1.SCRIPT.size:
      return n.script;
    case Style$1.SCRIPTSCRIPT.size:
      return n.scriptscript;
    default:
      return n.text;
  }
};
defineFunction({
  type: "mathchoice",
  names: ["\\mathchoice"],
  props: {
    numArgs: 4,
    primitive: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n;
    return {
      type: "mathchoice",
      mode: t.mode,
      display: ordargument(e[0]),
      text: ordargument(e[1]),
      script: ordargument(e[2]),
      scriptscript: ordargument(e[3])
    };
  },
  htmlBuilder: (n, e) => {
    var t = chooseMathStyle(n, e), r = buildExpression$1(t, e, !1);
    return buildCommon.makeFragment(r);
  },
  mathmlBuilder: (n, e) => {
    var t = chooseMathStyle(n, e);
    return buildExpressionRow(t, e);
  }
});
var assembleSupSub = (n, e, t, r, a, s, h) => {
  n = buildCommon.makeSpan([], [n]);
  var o = t && utils.isCharacterBox(t), d, v;
  if (e) {
    var f = buildGroup$1(e, r.havingStyle(a.sup()), r);
    v = {
      elem: f,
      kern: Math.max(r.fontMetrics().bigOpSpacing1, r.fontMetrics().bigOpSpacing3 - f.depth)
    };
  }
  if (t) {
    var y = buildGroup$1(t, r.havingStyle(a.sub()), r);
    d = {
      elem: y,
      kern: Math.max(r.fontMetrics().bigOpSpacing2, r.fontMetrics().bigOpSpacing4 - y.height)
    };
  }
  var A;
  if (v && d) {
    var x = r.fontMetrics().bigOpSpacing5 + d.elem.height + d.elem.depth + d.kern + n.depth + h;
    A = buildCommon.makeVList({
      positionType: "bottom",
      positionData: x,
      children: [{
        type: "kern",
        size: r.fontMetrics().bigOpSpacing5
      }, {
        type: "elem",
        elem: d.elem,
        marginLeft: makeEm(-s)
      }, {
        type: "kern",
        size: d.kern
      }, {
        type: "elem",
        elem: n
      }, {
        type: "kern",
        size: v.kern
      }, {
        type: "elem",
        elem: v.elem,
        marginLeft: makeEm(s)
      }, {
        type: "kern",
        size: r.fontMetrics().bigOpSpacing5
      }]
    }, r);
  } else if (d) {
    var M = n.height - h;
    A = buildCommon.makeVList({
      positionType: "top",
      positionData: M,
      children: [{
        type: "kern",
        size: r.fontMetrics().bigOpSpacing5
      }, {
        type: "elem",
        elem: d.elem,
        marginLeft: makeEm(-s)
      }, {
        type: "kern",
        size: d.kern
      }, {
        type: "elem",
        elem: n
      }]
    }, r);
  } else if (v) {
    var m = n.depth + h;
    A = buildCommon.makeVList({
      positionType: "bottom",
      positionData: m,
      children: [{
        type: "elem",
        elem: n
      }, {
        type: "kern",
        size: v.kern
      }, {
        type: "elem",
        elem: v.elem,
        marginLeft: makeEm(s)
      }, {
        type: "kern",
        size: r.fontMetrics().bigOpSpacing5
      }]
    }, r);
  } else
    return n;
  var l = [A];
  if (d && s !== 0 && !o) {
    var u = buildCommon.makeSpan(["mspace"], [], r);
    u.style.marginRight = makeEm(s), l.unshift(u);
  }
  return buildCommon.makeSpan(["mop", "op-limits"], l, r);
}, noSuccessor = ["\\smallint"], htmlBuilder$2 = (n, e) => {
  var t, r, a = !1, s;
  n.type === "supsub" ? (t = n.sup, r = n.sub, s = assertNodeType(n.base, "op"), a = !0) : s = assertNodeType(n, "op");
  var h = e.style, o = !1;
  h.size === Style$1.DISPLAY.size && s.symbol && !utils.contains(noSuccessor, s.name) && (o = !0);
  var d;
  if (s.symbol) {
    var v = o ? "Size2-Regular" : "Size1-Regular", f = "";
    if ((s.name === "\\oiint" || s.name === "\\oiiint") && (f = s.name.slice(1), s.name = f === "oiint" ? "\\iint" : "\\iiint"), d = buildCommon.makeSymbol(s.name, v, "math", e, ["mop", "op-symbol", o ? "large-op" : "small-op"]), f.length > 0) {
      var y = d.italic, A = buildCommon.staticSvg(f + "Size" + (o ? "2" : "1"), e);
      d = buildCommon.makeVList({
        positionType: "individualShift",
        children: [{
          type: "elem",
          elem: d,
          shift: 0
        }, {
          type: "elem",
          elem: A,
          shift: o ? 0.08 : 0
        }]
      }, e), s.name = "\\" + f, d.classes.unshift("mop"), d.italic = y;
    }
  } else if (s.body) {
    var x = buildExpression$1(s.body, e, !0);
    x.length === 1 && x[0] instanceof SymbolNode ? (d = x[0], d.classes[0] = "mop") : d = buildCommon.makeSpan(["mop"], x, e);
  } else {
    for (var M = [], m = 1; m < s.name.length; m++)
      M.push(buildCommon.mathsym(s.name[m], s.mode, e));
    d = buildCommon.makeSpan(["mop"], M, e);
  }
  var l = 0, u = 0;
  return (d instanceof SymbolNode || s.name === "\\oiint" || s.name === "\\oiiint") && !s.suppressBaseShift && (l = (d.height - d.depth) / 2 - e.fontMetrics().axisHeight, u = d.italic), a ? assembleSupSub(d, t, r, e, h, u, l) : (l && (d.style.position = "relative", d.style.top = makeEm(l)), d);
}, mathmlBuilder$1 = (n, e) => {
  var t;
  if (n.symbol)
    t = new MathNode("mo", [makeText(n.name, n.mode)]), utils.contains(noSuccessor, n.name) && t.setAttribute("largeop", "false");
  else if (n.body)
    t = new MathNode("mo", buildExpression(n.body, e));
  else {
    t = new MathNode("mi", [new TextNode(n.name.slice(1))]);
    var r = new MathNode("mo", [makeText("⁡", "text")]);
    n.parentIsSupSub ? t = new MathNode("mrow", [t, r]) : t = newDocumentFragment([t, r]);
  }
  return t;
}, singleCharBigOps = {
  "∏": "\\prod",
  "∐": "\\coprod",
  "∑": "\\sum",
  "⋀": "\\bigwedge",
  "⋁": "\\bigvee",
  "⋂": "\\bigcap",
  "⋃": "\\bigcup",
  "⨀": "\\bigodot",
  "⨁": "\\bigoplus",
  "⨂": "\\bigotimes",
  "⨄": "\\biguplus",
  "⨆": "\\bigsqcup"
};
defineFunction({
  type: "op",
  names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"],
  props: {
    numArgs: 0
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = r;
    return a.length === 1 && (a = singleCharBigOps[a]), {
      type: "op",
      mode: t.mode,
      limits: !0,
      parentIsSupSub: !1,
      symbol: !0,
      name: a
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
defineFunction({
  type: "op",
  names: ["\\mathop"],
  props: {
    numArgs: 1,
    primitive: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = e[0];
    return {
      type: "op",
      mode: t.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !1,
      body: ordargument(r)
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
var singleCharIntegrals = {
  "∫": "\\int",
  "∬": "\\iint",
  "∭": "\\iiint",
  "∮": "\\oint",
  "∯": "\\oiint",
  "∰": "\\oiiint"
};
defineFunction({
  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(n) {
    var {
      parser: e,
      funcName: t
    } = n;
    return {
      type: "op",
      mode: e.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !1,
      name: t
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
defineFunction({
  type: "op",
  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
  props: {
    numArgs: 0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t
    } = n;
    return {
      type: "op",
      mode: e.mode,
      limits: !0,
      parentIsSupSub: !1,
      symbol: !1,
      name: t
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
defineFunction({
  type: "op",
  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"],
  props: {
    numArgs: 0
  },
  handler(n) {
    var {
      parser: e,
      funcName: t
    } = n, r = t;
    return r.length === 1 && (r = singleCharIntegrals[r]), {
      type: "op",
      mode: e.mode,
      limits: !1,
      parentIsSupSub: !1,
      symbol: !0,
      name: r
    };
  },
  htmlBuilder: htmlBuilder$2,
  mathmlBuilder: mathmlBuilder$1
});
var htmlBuilder$1 = (n, e) => {
  var t, r, a = !1, s;
  n.type === "supsub" ? (t = n.sup, r = n.sub, s = assertNodeType(n.base, "operatorname"), a = !0) : s = assertNodeType(n, "operatorname");
  var h;
  if (s.body.length > 0) {
    for (var o = s.body.map((y) => {
      var A = y.text;
      return typeof A == "string" ? {
        type: "textord",
        mode: y.mode,
        text: A
      } : y;
    }), d = buildExpression$1(o, e.withFont("mathrm"), !0), v = 0; v < d.length; v++) {
      var f = d[v];
      f instanceof SymbolNode && (f.text = f.text.replace(/\u2212/, "-").replace(/\u2217/, "*"));
    }
    h = buildCommon.makeSpan(["mop"], d, e);
  } else
    h = buildCommon.makeSpan(["mop"], [], e);
  return a ? assembleSupSub(h, t, r, e, e.style, 0, 0) : h;
}, mathmlBuilder = (n, e) => {
  for (var t = buildExpression(n.body, e.withFont("mathrm")), r = !0, a = 0; a < t.length; a++) {
    var s = t[a];
    if (!(s instanceof mathMLTree.SpaceNode)) if (s instanceof mathMLTree.MathNode)
      switch (s.type) {
        case "mi":
        case "mn":
        case "ms":
        case "mspace":
        case "mtext":
          break;
        case "mo": {
          var h = s.children[0];
          s.children.length === 1 && h instanceof mathMLTree.TextNode ? h.text = h.text.replace(/\u2212/, "-").replace(/\u2217/, "*") : r = !1;
          break;
        }
        default:
          r = !1;
      }
    else
      r = !1;
  }
  if (r) {
    var o = t.map((f) => f.toText()).join("");
    t = [new mathMLTree.TextNode(o)];
  }
  var d = new mathMLTree.MathNode("mi", t);
  d.setAttribute("mathvariant", "normal");
  var v = new mathMLTree.MathNode("mo", [makeText("⁡", "text")]);
  return n.parentIsSupSub ? new mathMLTree.MathNode("mrow", [d, v]) : mathMLTree.newDocumentFragment([d, v]);
};
defineFunction({
  type: "operatorname",
  names: ["\\operatorname@", "\\operatornamewithlimits"],
  props: {
    numArgs: 1
  },
  handler: (n, e) => {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    return {
      type: "operatorname",
      mode: t.mode,
      body: ordargument(a),
      alwaysHandleSupSub: r === "\\operatornamewithlimits",
      limits: !1,
      parentIsSupSub: !1
    };
  },
  htmlBuilder: htmlBuilder$1,
  mathmlBuilder
});
defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
defineFunctionBuilders({
  type: "ordgroup",
  htmlBuilder(n, e) {
    return n.semisimple ? buildCommon.makeFragment(buildExpression$1(n.body, e, !1)) : buildCommon.makeSpan(["mord"], buildExpression$1(n.body, e, !0), e);
  },
  mathmlBuilder(n, e) {
    return buildExpressionRow(n.body, e, !0);
  }
});
defineFunction({
  type: "overline",
  names: ["\\overline"],
  props: {
    numArgs: 1
  },
  handler(n, e) {
    var {
      parser: t
    } = n, r = e[0];
    return {
      type: "overline",
      mode: t.mode,
      body: r
    };
  },
  htmlBuilder(n, e) {
    var t = buildGroup$1(n.body, e.havingCrampedStyle()), r = buildCommon.makeLineSpan("overline-line", e), a = e.fontMetrics().defaultRuleThickness, s = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: t
      }, {
        type: "kern",
        size: 3 * a
      }, {
        type: "elem",
        elem: r
      }, {
        type: "kern",
        size: a
      }]
    }, e);
    return buildCommon.makeSpan(["mord", "overline"], [s], e);
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]);
    t.setAttribute("stretchy", "true");
    var r = new mathMLTree.MathNode("mover", [buildGroup(n.body, e), t]);
    return r.setAttribute("accent", "true"), r;
  }
});
defineFunction({
  type: "phantom",
  names: ["\\phantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = e[0];
    return {
      type: "phantom",
      mode: t.mode,
      body: ordargument(r)
    };
  },
  htmlBuilder: (n, e) => {
    var t = buildExpression$1(n.body, e.withPhantom(), !1);
    return buildCommon.makeFragment(t);
  },
  mathmlBuilder: (n, e) => {
    var t = buildExpression(n.body, e);
    return new mathMLTree.MathNode("mphantom", t);
  }
});
defineFunction({
  type: "hphantom",
  names: ["\\hphantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = e[0];
    return {
      type: "hphantom",
      mode: t.mode,
      body: r
    };
  },
  htmlBuilder: (n, e) => {
    var t = buildCommon.makeSpan([], [buildGroup$1(n.body, e.withPhantom())]);
    if (t.height = 0, t.depth = 0, t.children)
      for (var r = 0; r < t.children.length; r++)
        t.children[r].height = 0, t.children[r].depth = 0;
    return t = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: t
      }]
    }, e), buildCommon.makeSpan(["mord"], [t], e);
  },
  mathmlBuilder: (n, e) => {
    var t = buildExpression(ordargument(n.body), e), r = new mathMLTree.MathNode("mphantom", t), a = new mathMLTree.MathNode("mpadded", [r]);
    return a.setAttribute("height", "0px"), a.setAttribute("depth", "0px"), a;
  }
});
defineFunction({
  type: "vphantom",
  names: ["\\vphantom"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      parser: t
    } = n, r = e[0];
    return {
      type: "vphantom",
      mode: t.mode,
      body: r
    };
  },
  htmlBuilder: (n, e) => {
    var t = buildCommon.makeSpan(["inner"], [buildGroup$1(n.body, e.withPhantom())]), r = buildCommon.makeSpan(["fix"], []);
    return buildCommon.makeSpan(["mord", "rlap"], [t, r], e);
  },
  mathmlBuilder: (n, e) => {
    var t = buildExpression(ordargument(n.body), e), r = new mathMLTree.MathNode("mphantom", t), a = new mathMLTree.MathNode("mpadded", [r]);
    return a.setAttribute("width", "0px"), a;
  }
});
defineFunction({
  type: "raisebox",
  names: ["\\raisebox"],
  props: {
    numArgs: 2,
    argTypes: ["size", "hbox"],
    allowedInText: !0
  },
  handler(n, e) {
    var {
      parser: t
    } = n, r = assertNodeType(e[0], "size").value, a = e[1];
    return {
      type: "raisebox",
      mode: t.mode,
      dy: r,
      body: a
    };
  },
  htmlBuilder(n, e) {
    var t = buildGroup$1(n.body, e), r = calculateSize(n.dy, e);
    return buildCommon.makeVList({
      positionType: "shift",
      positionData: -r,
      children: [{
        type: "elem",
        elem: t
      }]
    }, e);
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)]), r = n.dy.number + n.dy.unit;
    return t.setAttribute("voffset", r), t;
  }
});
defineFunction({
  type: "internal",
  names: ["\\relax"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(n) {
    var {
      parser: e
    } = n;
    return {
      type: "internal",
      mode: e.mode
    };
  }
});
defineFunction({
  type: "rule",
  names: ["\\rule"],
  props: {
    numArgs: 2,
    numOptionalArgs: 1,
    argTypes: ["size", "size", "size"]
  },
  handler(n, e, t) {
    var {
      parser: r
    } = n, a = t[0], s = assertNodeType(e[0], "size"), h = assertNodeType(e[1], "size");
    return {
      type: "rule",
      mode: r.mode,
      shift: a && assertNodeType(a, "size").value,
      width: s.value,
      height: h.value
    };
  },
  htmlBuilder(n, e) {
    var t = buildCommon.makeSpan(["mord", "rule"], [], e), r = calculateSize(n.width, e), a = calculateSize(n.height, e), s = n.shift ? calculateSize(n.shift, e) : 0;
    return t.style.borderRightWidth = makeEm(r), t.style.borderTopWidth = makeEm(a), t.style.bottom = makeEm(s), t.width = r, t.height = a + s, t.depth = -s, t.maxFontSize = a * 1.125 * e.sizeMultiplier, t;
  },
  mathmlBuilder(n, e) {
    var t = calculateSize(n.width, e), r = calculateSize(n.height, e), a = n.shift ? calculateSize(n.shift, e) : 0, s = e.color && e.getColor() || "black", h = new mathMLTree.MathNode("mspace");
    h.setAttribute("mathbackground", s), h.setAttribute("width", makeEm(t)), h.setAttribute("height", makeEm(r));
    var o = new mathMLTree.MathNode("mpadded", [h]);
    return a >= 0 ? o.setAttribute("height", makeEm(a)) : (o.setAttribute("height", makeEm(a)), o.setAttribute("depth", makeEm(-a))), o.setAttribute("voffset", makeEm(a)), o;
  }
});
function sizingGroup(n, e, t) {
  for (var r = buildExpression$1(n, e, !1), a = e.sizeMultiplier / t.sizeMultiplier, s = 0; s < r.length; s++) {
    var h = r[s].classes.indexOf("sizing");
    h < 0 ? Array.prototype.push.apply(r[s].classes, e.sizingClasses(t)) : r[s].classes[h + 1] === "reset-size" + e.size && (r[s].classes[h + 1] = "reset-size" + t.size), r[s].height *= a, r[s].depth *= a;
  }
  return buildCommon.makeFragment(r);
}
var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], htmlBuilder = (n, e) => {
  var t = e.havingSize(n.size);
  return sizingGroup(n.body, t, e);
};
defineFunction({
  type: "sizing",
  names: sizeFuncs,
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler: (n, e) => {
    var {
      breakOnTokenText: t,
      funcName: r,
      parser: a
    } = n, s = a.parseExpression(!1, t);
    return {
      type: "sizing",
      mode: a.mode,
      // Figure out what size to use based on the list of functions above
      size: sizeFuncs.indexOf(r) + 1,
      body: s
    };
  },
  htmlBuilder,
  mathmlBuilder: (n, e) => {
    var t = e.havingSize(n.size), r = buildExpression(n.body, t), a = new mathMLTree.MathNode("mstyle", r);
    return a.setAttribute("mathsize", makeEm(t.sizeMultiplier)), a;
  }
});
defineFunction({
  type: "smash",
  names: ["\\smash"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1,
    allowedInText: !0
  },
  handler: (n, e, t) => {
    var {
      parser: r
    } = n, a = !1, s = !1, h = t[0] && assertNodeType(t[0], "ordgroup");
    if (h)
      for (var o = "", d = 0; d < h.body.length; ++d) {
        var v = h.body[d];
        if (o = v.text, o === "t")
          a = !0;
        else if (o === "b")
          s = !0;
        else {
          a = !1, s = !1;
          break;
        }
      }
    else
      a = !0, s = !0;
    var f = e[0];
    return {
      type: "smash",
      mode: r.mode,
      body: f,
      smashHeight: a,
      smashDepth: s
    };
  },
  htmlBuilder: (n, e) => {
    var t = buildCommon.makeSpan([], [buildGroup$1(n.body, e)]);
    if (!n.smashHeight && !n.smashDepth)
      return t;
    if (n.smashHeight && (t.height = 0, t.children))
      for (var r = 0; r < t.children.length; r++)
        t.children[r].height = 0;
    if (n.smashDepth && (t.depth = 0, t.children))
      for (var a = 0; a < t.children.length; a++)
        t.children[a].depth = 0;
    var s = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: t
      }]
    }, e);
    return buildCommon.makeSpan(["mord"], [s], e);
  },
  mathmlBuilder: (n, e) => {
    var t = new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)]);
    return n.smashHeight && t.setAttribute("height", "0px"), n.smashDepth && t.setAttribute("depth", "0px"), t;
  }
});
defineFunction({
  type: "sqrt",
  names: ["\\sqrt"],
  props: {
    numArgs: 1,
    numOptionalArgs: 1
  },
  handler(n, e, t) {
    var {
      parser: r
    } = n, a = t[0], s = e[0];
    return {
      type: "sqrt",
      mode: r.mode,
      body: s,
      index: a
    };
  },
  htmlBuilder(n, e) {
    var t = buildGroup$1(n.body, e.havingCrampedStyle());
    t.height === 0 && (t.height = e.fontMetrics().xHeight), t = buildCommon.wrapFragment(t, e);
    var r = e.fontMetrics(), a = r.defaultRuleThickness, s = a;
    e.style.id < Style$1.TEXT.id && (s = e.fontMetrics().xHeight);
    var h = a + s / 4, o = t.height + t.depth + h + a, {
      span: d,
      ruleWidth: v,
      advanceWidth: f
    } = delimiter.sqrtImage(o, e), y = d.height - v;
    y > t.height + t.depth + h && (h = (h + y - t.height - t.depth) / 2);
    var A = d.height - t.height - h - v;
    t.style.paddingLeft = makeEm(f);
    var x = buildCommon.makeVList({
      positionType: "firstBaseline",
      children: [{
        type: "elem",
        elem: t,
        wrapperClasses: ["svg-align"]
      }, {
        type: "kern",
        size: -(t.height + A)
      }, {
        type: "elem",
        elem: d
      }, {
        type: "kern",
        size: v
      }]
    }, e);
    if (n.index) {
      var M = e.havingStyle(Style$1.SCRIPTSCRIPT), m = buildGroup$1(n.index, M, e), l = 0.6 * (x.height - x.depth), u = buildCommon.makeVList({
        positionType: "shift",
        positionData: -l,
        children: [{
          type: "elem",
          elem: m
        }]
      }, e), p = buildCommon.makeSpan(["root"], [u]);
      return buildCommon.makeSpan(["mord", "sqrt"], [p, x], e);
    } else
      return buildCommon.makeSpan(["mord", "sqrt"], [x], e);
  },
  mathmlBuilder(n, e) {
    var {
      body: t,
      index: r
    } = n;
    return r ? new mathMLTree.MathNode("mroot", [buildGroup(t, e), buildGroup(r, e)]) : new mathMLTree.MathNode("msqrt", [buildGroup(t, e)]);
  }
});
var styleMap = {
  display: Style$1.DISPLAY,
  text: Style$1.TEXT,
  script: Style$1.SCRIPT,
  scriptscript: Style$1.SCRIPTSCRIPT
};
defineFunction({
  type: "styling",
  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
  props: {
    numArgs: 0,
    allowedInText: !0,
    primitive: !0
  },
  handler(n, e) {
    var {
      breakOnTokenText: t,
      funcName: r,
      parser: a
    } = n, s = a.parseExpression(!0, t), h = r.slice(1, r.length - 5);
    return {
      type: "styling",
      mode: a.mode,
      // Figure out what style to use by pulling out the style from
      // the function name
      style: h,
      body: s
    };
  },
  htmlBuilder(n, e) {
    var t = styleMap[n.style], r = e.havingStyle(t).withFont("");
    return sizingGroup(n.body, r, e);
  },
  mathmlBuilder(n, e) {
    var t = styleMap[n.style], r = e.havingStyle(t), a = buildExpression(n.body, r), s = new mathMLTree.MathNode("mstyle", a), h = {
      display: ["0", "true"],
      text: ["0", "false"],
      script: ["1", "false"],
      scriptscript: ["2", "false"]
    }, o = h[n.style];
    return s.setAttribute("scriptlevel", o[0]), s.setAttribute("displaystyle", o[1]), s;
  }
});
var htmlBuilderDelegate = function(e, t) {
  var r = e.base;
  if (r)
    if (r.type === "op") {
      var a = r.limits && (t.style.size === Style$1.DISPLAY.size || r.alwaysHandleSupSub);
      return a ? htmlBuilder$2 : null;
    } else if (r.type === "operatorname") {
      var s = r.alwaysHandleSupSub && (t.style.size === Style$1.DISPLAY.size || r.limits);
      return s ? htmlBuilder$1 : null;
    } else {
      if (r.type === "accent")
        return utils.isCharacterBox(r.base) ? htmlBuilder$a : null;
      if (r.type === "horizBrace") {
        var h = !e.sub;
        return h === r.isOver ? htmlBuilder$3 : null;
      } else
        return null;
    }
  else return null;
};
defineFunctionBuilders({
  type: "supsub",
  htmlBuilder(n, e) {
    var t = htmlBuilderDelegate(n, e);
    if (t)
      return t(n, e);
    var {
      base: r,
      sup: a,
      sub: s
    } = n, h = buildGroup$1(r, e), o, d, v = e.fontMetrics(), f = 0, y = 0, A = r && utils.isCharacterBox(r);
    if (a) {
      var x = e.havingStyle(e.style.sup());
      o = buildGroup$1(a, x, e), A || (f = h.height - x.fontMetrics().supDrop * x.sizeMultiplier / e.sizeMultiplier);
    }
    if (s) {
      var M = e.havingStyle(e.style.sub());
      d = buildGroup$1(s, M, e), A || (y = h.depth + M.fontMetrics().subDrop * M.sizeMultiplier / e.sizeMultiplier);
    }
    var m;
    e.style === Style$1.DISPLAY ? m = v.sup1 : e.style.cramped ? m = v.sup3 : m = v.sup2;
    var l = e.sizeMultiplier, u = makeEm(0.5 / v.ptPerEm / l), p = null;
    if (d) {
      var g = n.base && n.base.type === "op" && n.base.name && (n.base.name === "\\oiint" || n.base.name === "\\oiiint");
      (h instanceof SymbolNode || g) && (p = makeEm(-h.italic));
    }
    var b;
    if (o && d) {
      f = Math.max(f, m, o.depth + 0.25 * v.xHeight), y = Math.max(y, v.sub2);
      var c = v.defaultRuleThickness, _ = 4 * c;
      if (f - o.depth - (d.height - y) < _) {
        y = _ - (f - o.depth) + d.height;
        var E = 0.8 * v.xHeight - (f - o.depth);
        E > 0 && (f += E, y -= E);
      }
      var w = [{
        type: "elem",
        elem: d,
        shift: y,
        marginRight: u,
        marginLeft: p
      }, {
        type: "elem",
        elem: o,
        shift: -f,
        marginRight: u
      }];
      b = buildCommon.makeVList({
        positionType: "individualShift",
        children: w
      }, e);
    } else if (d) {
      y = Math.max(y, v.sub1, d.height - 0.8 * v.xHeight);
      var k = [{
        type: "elem",
        elem: d,
        marginLeft: p,
        marginRight: u
      }];
      b = buildCommon.makeVList({
        positionType: "shift",
        positionData: y,
        children: k
      }, e);
    } else if (o)
      f = Math.max(f, m, o.depth + 0.25 * v.xHeight), b = buildCommon.makeVList({
        positionType: "shift",
        positionData: -f,
        children: [{
          type: "elem",
          elem: o,
          marginRight: u
        }]
      }, e);
    else
      throw new Error("supsub must have either sup or sub.");
    var $ = getTypeOfDomTree(h, "right") || "mord";
    return buildCommon.makeSpan([$], [h, buildCommon.makeSpan(["msupsub"], [b])], e);
  },
  mathmlBuilder(n, e) {
    var t = !1, r, a;
    n.base && n.base.type === "horizBrace" && (a = !!n.sup, a === n.base.isOver && (t = !0, r = n.base.isOver)), n.base && (n.base.type === "op" || n.base.type === "operatorname") && (n.base.parentIsSupSub = !0);
    var s = [buildGroup(n.base, e)];
    n.sub && s.push(buildGroup(n.sub, e)), n.sup && s.push(buildGroup(n.sup, e));
    var h;
    if (t)
      h = r ? "mover" : "munder";
    else if (n.sub)
      if (n.sup) {
        var v = n.base;
        v && v.type === "op" && v.limits && e.style === Style$1.DISPLAY || v && v.type === "operatorname" && v.alwaysHandleSupSub && (e.style === Style$1.DISPLAY || v.limits) ? h = "munderover" : h = "msubsup";
      } else {
        var d = n.base;
        d && d.type === "op" && d.limits && (e.style === Style$1.DISPLAY || d.alwaysHandleSupSub) || d && d.type === "operatorname" && d.alwaysHandleSupSub && (d.limits || e.style === Style$1.DISPLAY) ? h = "munder" : h = "msub";
      }
    else {
      var o = n.base;
      o && o.type === "op" && o.limits && (e.style === Style$1.DISPLAY || o.alwaysHandleSupSub) || o && o.type === "operatorname" && o.alwaysHandleSupSub && (o.limits || e.style === Style$1.DISPLAY) ? h = "mover" : h = "msup";
    }
    return new mathMLTree.MathNode(h, s);
  }
});
defineFunctionBuilders({
  type: "atom",
  htmlBuilder(n, e) {
    return buildCommon.mathsym(n.text, n.mode, e, ["m" + n.family]);
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mo", [makeText(n.text, n.mode)]);
    if (n.family === "bin") {
      var r = getVariant(n, e);
      r === "bold-italic" && t.setAttribute("mathvariant", r);
    } else n.family === "punct" ? t.setAttribute("separator", "true") : (n.family === "open" || n.family === "close") && t.setAttribute("stretchy", "false");
    return t;
  }
});
var defaultVariant = {
  mi: "italic",
  mn: "normal",
  mtext: "normal"
};
defineFunctionBuilders({
  type: "mathord",
  htmlBuilder(n, e) {
    return buildCommon.makeOrd(n, e, "mathord");
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mi", [makeText(n.text, n.mode, e)]), r = getVariant(n, e) || "italic";
    return r !== defaultVariant[t.type] && t.setAttribute("mathvariant", r), t;
  }
});
defineFunctionBuilders({
  type: "textord",
  htmlBuilder(n, e) {
    return buildCommon.makeOrd(n, e, "textord");
  },
  mathmlBuilder(n, e) {
    var t = makeText(n.text, n.mode, e), r = getVariant(n, e) || "normal", a;
    return n.mode === "text" ? a = new mathMLTree.MathNode("mtext", [t]) : /[0-9]/.test(n.text) ? a = new mathMLTree.MathNode("mn", [t]) : n.text === "\\prime" ? a = new mathMLTree.MathNode("mo", [t]) : a = new mathMLTree.MathNode("mi", [t]), r !== defaultVariant[a.type] && a.setAttribute("mathvariant", r), a;
  }
});
var cssSpace = {
  "\\nobreak": "nobreak",
  "\\allowbreak": "allowbreak"
}, regularSpace = {
  " ": {},
  "\\ ": {},
  "~": {
    className: "nobreak"
  },
  "\\space": {},
  "\\nobreakspace": {
    className: "nobreak"
  }
};
defineFunctionBuilders({
  type: "spacing",
  htmlBuilder(n, e) {
    if (regularSpace.hasOwnProperty(n.text)) {
      var t = regularSpace[n.text].className || "";
      if (n.mode === "text") {
        var r = buildCommon.makeOrd(n, e, "textord");
        return r.classes.push(t), r;
      } else
        return buildCommon.makeSpan(["mspace", t], [buildCommon.mathsym(n.text, n.mode, e)], e);
    } else {
      if (cssSpace.hasOwnProperty(n.text))
        return buildCommon.makeSpan(["mspace", cssSpace[n.text]], [], e);
      throw new ParseError('Unknown type of space "' + n.text + '"');
    }
  },
  mathmlBuilder(n, e) {
    var t;
    if (regularSpace.hasOwnProperty(n.text))
      t = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode(" ")]);
    else {
      if (cssSpace.hasOwnProperty(n.text))
        return new mathMLTree.MathNode("mspace");
      throw new ParseError('Unknown type of space "' + n.text + '"');
    }
    return t;
  }
});
var pad = () => {
  var n = new mathMLTree.MathNode("mtd", []);
  return n.setAttribute("width", "50%"), n;
};
defineFunctionBuilders({
  type: "tag",
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(n.body, e)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(n.tag, e)])])]);
    return t.setAttribute("width", "100%"), t;
  }
});
var textFontFamilies = {
  "\\text": void 0,
  "\\textrm": "textrm",
  "\\textsf": "textsf",
  "\\texttt": "texttt",
  "\\textnormal": "textrm"
}, textFontWeights = {
  "\\textbf": "textbf",
  "\\textmd": "textmd"
}, textFontShapes = {
  "\\textit": "textit",
  "\\textup": "textup"
}, optionsWithFont = (n, e) => {
  var t = n.font;
  if (t) {
    if (textFontFamilies[t])
      return e.withTextFontFamily(textFontFamilies[t]);
    if (textFontWeights[t])
      return e.withTextFontWeight(textFontWeights[t]);
    if (t === "\\emph")
      return e.fontShape === "textit" ? e.withTextFontShape("textup") : e.withTextFontShape("textit");
  } else return e;
  return e.withTextFontShape(textFontShapes[t]);
};
defineFunction({
  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(n, e) {
    var {
      parser: t,
      funcName: r
    } = n, a = e[0];
    return {
      type: "text",
      mode: t.mode,
      body: ordargument(a),
      font: r
    };
  },
  htmlBuilder(n, e) {
    var t = optionsWithFont(n, e), r = buildExpression$1(n.body, t, !0);
    return buildCommon.makeSpan(["mord", "text"], r, t);
  },
  mathmlBuilder(n, e) {
    var t = optionsWithFont(n, e);
    return buildExpressionRow(n.body, t);
  }
});
defineFunction({
  type: "underline",
  names: ["\\underline"],
  props: {
    numArgs: 1,
    allowedInText: !0
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "underline",
      mode: t.mode,
      body: e[0]
    };
  },
  htmlBuilder(n, e) {
    var t = buildGroup$1(n.body, e), r = buildCommon.makeLineSpan("underline-line", e), a = e.fontMetrics().defaultRuleThickness, s = buildCommon.makeVList({
      positionType: "top",
      positionData: t.height,
      children: [{
        type: "kern",
        size: a
      }, {
        type: "elem",
        elem: r
      }, {
        type: "kern",
        size: 3 * a
      }, {
        type: "elem",
        elem: t
      }]
    }, e);
    return buildCommon.makeSpan(["mord", "underline"], [s], e);
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]);
    t.setAttribute("stretchy", "true");
    var r = new mathMLTree.MathNode("munder", [buildGroup(n.body, e), t]);
    return r.setAttribute("accentunder", "true"), r;
  }
});
defineFunction({
  type: "vcenter",
  names: ["\\vcenter"],
  props: {
    numArgs: 1,
    argTypes: ["original"],
    // In LaTeX, \vcenter can act only on a box.
    allowedInText: !1
  },
  handler(n, e) {
    var {
      parser: t
    } = n;
    return {
      type: "vcenter",
      mode: t.mode,
      body: e[0]
    };
  },
  htmlBuilder(n, e) {
    var t = buildGroup$1(n.body, e), r = e.fontMetrics().axisHeight, a = 0.5 * (t.height - r - (t.depth + r));
    return buildCommon.makeVList({
      positionType: "shift",
      positionData: a,
      children: [{
        type: "elem",
        elem: t
      }]
    }, e);
  },
  mathmlBuilder(n, e) {
    return new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)], ["vcenter"]);
  }
});
defineFunction({
  type: "verb",
  names: ["\\verb"],
  props: {
    numArgs: 0,
    allowedInText: !0
  },
  handler(n, e, t) {
    throw new ParseError("\\verb ended by end of line instead of matching delimiter");
  },
  htmlBuilder(n, e) {
    for (var t = makeVerb(n), r = [], a = e.havingStyle(e.style.text()), s = 0; s < t.length; s++) {
      var h = t[s];
      h === "~" && (h = "\\textasciitilde"), r.push(buildCommon.makeSymbol(h, "Typewriter-Regular", n.mode, a, ["mord", "texttt"]));
    }
    return buildCommon.makeSpan(["mord", "text"].concat(a.sizingClasses(e)), buildCommon.tryCombineChars(r), a);
  },
  mathmlBuilder(n, e) {
    var t = new mathMLTree.TextNode(makeVerb(n)), r = new mathMLTree.MathNode("mtext", [t]);
    return r.setAttribute("mathvariant", "monospace"), r;
  }
});
var makeVerb = (n) => n.body.replace(/ /g, n.star ? "␣" : " "), functions = _functions, spaceRegexString = `[ \r
	]`, controlWordRegexString = "\\\\[a-zA-Z@]+", controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]", controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*", controlSpaceRegexString = `\\\\(
|[ \r	]+
?)[ \r	]*`, combiningDiacriticalMarkString = "[̀-ͯ]", combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"), tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
(controlSpaceRegexString + "|") + // \whitespace
"([!-\\[\\]-‧‪-퟿豈-]" + // single codepoint
(combiningDiacriticalMarkString + "*") + // ...plus accents
"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair
(combiningDiacriticalMarkString + "*") + // ...plus accents
"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred
("|" + controlWordWhitespaceRegexString) + // \macroName + spaces
("|" + controlSymbolRegexString + ")");
class Lexer {
  // Category codes. The lexer only supports comment characters (14) for now.
  // MacroExpander additionally distinguishes active (13).
  constructor(e, t) {
    this.input = void 0, this.settings = void 0, this.tokenRegex = void 0, this.catcodes = void 0, this.input = e, this.settings = t, this.tokenRegex = new RegExp(tokenRegexString, "g"), this.catcodes = {
      "%": 14,
      // comment character
      "~": 13
      // active character
    };
  }
  setCatcode(e, t) {
    this.catcodes[e] = t;
  }
  /**
   * This function lexes a single token.
   */
  lex() {
    var e = this.input, t = this.tokenRegex.lastIndex;
    if (t === e.length)
      return new Token("EOF", new SourceLocation(this, t, t));
    var r = this.tokenRegex.exec(e);
    if (r === null || r.index !== t)
      throw new ParseError("Unexpected character: '" + e[t] + "'", new Token(e[t], new SourceLocation(this, t, t + 1)));
    var a = r[6] || r[3] || (r[2] ? "\\ " : " ");
    if (this.catcodes[a] === 14) {
      var s = e.indexOf(`
`, this.tokenRegex.lastIndex);
      return s === -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 = s + 1, this.lex();
    }
    return new Token(a, new SourceLocation(this, t, this.tokenRegex.lastIndex));
  }
}
class Namespace {
  /**
   * 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, t) {
    e === void 0 && (e = {}), t === void 0 && (t = {}), this.current = void 0, this.builtins = void 0, this.undefStack = void 0, this.current = t, 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 ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
    var e = this.undefStack.pop();
    for (var t in e)
      e.hasOwnProperty(t) && (e[t] == null ? delete this.current[t] : this.current[t] = e[t]);
  }
  /**
   * 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, t, r) {
    if (r === void 0 && (r = !1), r) {
      for (var a = 0; a < this.undefStack.length; a++)
        delete this.undefStack[a][e];
      this.undefStack.length > 0 && (this.undefStack[this.undefStack.length - 1][e] = t);
    } else {
      var s = this.undefStack[this.undefStack.length - 1];
      s && !s.hasOwnProperty(e) && (s[e] = this.current[e]);
    }
    t == null ? delete this.current[e] : this.current[e] = t;
  }
}
var macros = _macros;
defineMacro("\\noexpand", function(n) {
  var e = n.popToken();
  return n.isExpandable(e.text) && (e.noexpand = !0, e.treatAsRelax = !0), {
    tokens: [e],
    numArgs: 0
  };
});
defineMacro("\\expandafter", function(n) {
  var e = n.popToken();
  return n.expandOnce(!0), {
    tokens: [e],
    numArgs: 0
  };
});
defineMacro("\\@firstoftwo", function(n) {
  var e = n.consumeArgs(2);
  return {
    tokens: e[0],
    numArgs: 0
  };
});
defineMacro("\\@secondoftwo", function(n) {
  var e = n.consumeArgs(2);
  return {
    tokens: e[1],
    numArgs: 0
  };
});
defineMacro("\\@ifnextchar", function(n) {
  var e = n.consumeArgs(3);
  n.consumeSpaces();
  var t = n.future();
  return e[0].length === 1 && e[0][0].text === t.text ? {
    tokens: e[1],
    numArgs: 0
  } : {
    tokens: e[2],
    numArgs: 0
  };
});
defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}");
defineMacro("\\TextOrMath", function(n) {
  var e = n.consumeArgs(2);
  return n.mode === "text" ? {
    tokens: e[0],
    numArgs: 0
  } : {
    tokens: e[1],
    numArgs: 0
  };
});
var digitToNumber = {
  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
};
defineMacro("\\char", function(n) {
  var e = n.popToken(), t, r = "";
  if (e.text === "'")
    t = 8, e = n.popToken();
  else if (e.text === '"')
    t = 16, e = n.popToken();
  else if (e.text === "`")
    if (e = n.popToken(), e.text[0] === "\\")
      r = e.text.charCodeAt(1);
    else {
      if (e.text === "EOF")
        throw new ParseError("\\char` missing argument");
      r = e.text.charCodeAt(0);
    }
  else
    t = 10;
  if (t) {
    if (r = digitToNumber[e.text], r == null || r >= t)
      throw new ParseError("Invalid base-" + t + " digit " + e.text);
    for (var a; (a = digitToNumber[n.future().text]) != null && a < t; )
      r *= t, r += a, n.popToken();
  }
  return "\\@char{" + r + "}";
});
var newcommand = (n, e, t) => {
  var r = n.consumeArg().tokens;
  if (r.length !== 1)
    throw new ParseError("\\newcommand's first argument must be a macro name");
  var a = r[0].text, s = n.isDefined(a);
  if (s && !e)
    throw new ParseError("\\newcommand{" + a + "} attempting to redefine " + (a + "; use \\renewcommand"));
  if (!s && !t)
    throw new ParseError("\\renewcommand{" + a + "} when command " + a + " does not yet exist; use \\newcommand");
  var h = 0;
  if (r = n.consumeArg().tokens, r.length === 1 && r[0].text === "[") {
    for (var o = "", d = n.expandNextToken(); d.text !== "]" && d.text !== "EOF"; )
      o += d.text, d = n.expandNextToken();
    if (!o.match(/^\s*[0-9]+\s*$/))
      throw new ParseError("Invalid number of arguments: " + o);
    h = parseInt(o), r = n.consumeArg().tokens;
  }
  return n.macros.set(a, {
    tokens: r,
    numArgs: h
  }), "";
};
defineMacro("\\newcommand", (n) => newcommand(n, !1, !0));
defineMacro("\\renewcommand", (n) => newcommand(n, !0, !1));
defineMacro("\\providecommand", (n) => newcommand(n, !0, !0));
defineMacro("\\message", (n) => {
  var e = n.consumeArgs(1)[0];
  return console.log(e.reverse().map((t) => t.text).join("")), "";
});
defineMacro("\\errmessage", (n) => {
  var e = n.consumeArgs(1)[0];
  return console.error(e.reverse().map((t) => t.text).join("")), "";
});
defineMacro("\\show", (n) => {
  var e = n.popToken(), t = e.text;
  return console.log(e, n.macros.get(t), functions[t], symbols.math[t], symbols.text[t]), "";
});
defineMacro("\\bgroup", "{");
defineMacro("\\egroup", "}");
defineMacro("~", "\\nobreakspace");
defineMacro("\\lq", "`");
defineMacro("\\rq", "'");
defineMacro("\\aa", "\\r a");
defineMacro("\\AA", "\\r A");
defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");
defineMacro("ℬ", "\\mathscr{B}");
defineMacro("ℰ", "\\mathscr{E}");
defineMacro("ℱ", "\\mathscr{F}");
defineMacro("ℋ", "\\mathscr{H}");
defineMacro("ℐ", "\\mathscr{I}");
defineMacro("ℒ", "\\mathscr{L}");
defineMacro("ℳ", "\\mathscr{M}");
defineMacro("ℛ", "\\mathscr{R}");
defineMacro("ℭ", "\\mathfrak{C}");
defineMacro("ℌ", "\\mathfrak{H}");
defineMacro("ℨ", "\\mathfrak{Z}");
defineMacro("\\Bbbk", "\\Bbb{k}");
defineMacro("·", "\\cdotp");
defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
defineMacro("\\mathstrut", "\\vphantom{(}");
defineMacro("\\underbar", "\\underline{\\text{#1}}");
defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');
defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
defineMacro("\\ne", "\\neq");
defineMacro("≠", "\\neq");
defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");
defineMacro("∉", "\\notin");
defineMacro("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");
defineMacro("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");
defineMacro("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");
defineMacro("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");
defineMacro("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");
defineMacro("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");
defineMacro("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");
defineMacro("⟂", "\\perp");
defineMacro("‼", "\\mathclose{!\\mkern-0.8mu!}");
defineMacro("∌", "\\notni");
defineMacro("⌜", "\\ulcorner");
defineMacro("⌝", "\\urcorner");
defineMacro("⌞", "\\llcorner");
defineMacro("⌟", "\\lrcorner");
defineMacro("©", "\\copyright");
defineMacro("®", "\\textregistered");
defineMacro("️", "\\textregistered");
defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');
defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');
defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');
defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');
defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}");
defineMacro("⋮", "\\vdots");
defineMacro("\\varGamma", "\\mathit{\\Gamma}");
defineMacro("\\varDelta", "\\mathit{\\Delta}");
defineMacro("\\varTheta", "\\mathit{\\Theta}");
defineMacro("\\varLambda", "\\mathit{\\Lambda}");
defineMacro("\\varXi", "\\mathit{\\Xi}");
defineMacro("\\varPi", "\\mathit{\\Pi}");
defineMacro("\\varSigma", "\\mathit{\\Sigma}");
defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
defineMacro("\\varPhi", "\\mathit{\\Phi}");
defineMacro("\\varPsi", "\\mathit{\\Psi}");
defineMacro("\\varOmega", "\\mathit{\\Omega}");
defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}");
defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");
defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}");
defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;");
var dotsByToken = {
  ",": "\\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"
};
defineMacro("\\dots", function(n) {
  var e = "\\dotso", t = n.expandAfterFuture().text;
  return t in dotsByToken ? e = dotsByToken[t] : (t.slice(0, 4) === "\\not" || t in symbols.math && utils.contains(["bin", "rel"], symbols.math[t].group)) && (e = "\\dotsb"), e;
});
var spaceAfterDots = {
  // \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
};
defineMacro("\\dotso", function(n) {
  var e = n.future().text;
  return e in spaceAfterDots ? "\\ldots\\," : "\\ldots";
});
defineMacro("\\dotsc", function(n) {
  var e = n.future().text;
  return e in spaceAfterDots && e !== "," ? "\\ldots\\," : "\\ldots";
});
defineMacro("\\cdots", function(n) {
  var e = n.future().text;
  return e in spaceAfterDots ? "\\@cdots\\," : "\\@cdots";
});
defineMacro("\\dotsb", "\\cdots");
defineMacro("\\dotsm", "\\cdots");
defineMacro("\\dotsi", "\\!\\cdots");
defineMacro("\\dotsx", "\\ldots\\,");
defineMacro("\\DOTSI", "\\relax");
defineMacro("\\DOTSB", "\\relax");
defineMacro("\\DOTSX", "\\relax");
defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
defineMacro("\\,", "\\tmspace+{3mu}{.1667em}");
defineMacro("\\thinspace", "\\,");
defineMacro("\\>", "\\mskip{4mu}");
defineMacro("\\:", "\\tmspace+{4mu}{.2222em}");
defineMacro("\\medspace", "\\:");
defineMacro("\\;", "\\tmspace+{5mu}{.2777em}");
defineMacro("\\thickspace", "\\;");
defineMacro("\\!", "\\tmspace-{3mu}{.1667em}");
defineMacro("\\negthinspace", "\\!");
defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}");
defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}");
defineMacro("\\enspace", "\\kern.5em ");
defineMacro("\\enskip", "\\hskip.5em\\relax");
defineMacro("\\quad", "\\hskip1em\\relax");
defineMacro("\\qquad", "\\hskip2em\\relax");
defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
defineMacro("\\tag@literal", (n) => {
  if (n.macros.get("\\df@tag"))
    throw new ParseError("Multiple \\tag");
  return "\\gdef\\df@tag{\\text{#1}}";
});
defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");
defineMacro("\\newline", "\\\\\\relax");
defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");
var latexRaiseA = makeEm(fontMetricsData["Main-Regular"][84][1] - 0.7 * fontMetricsData["Main-Regular"][65][1]);
defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}");
defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}");
defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
defineMacro("\\@hspace", "\\hskip #1\\relax");
defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax");
defineMacro("\\ordinarycolon", ":");
defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}");
defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');
defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');
defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');
defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');
defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');
defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');
defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');
defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');
defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');
defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');
defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');
defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');
defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');
defineMacro("∷", "\\dblcolon");
defineMacro("∹", "\\eqcolon");
defineMacro("≔", "\\coloneqq");
defineMacro("≕", "\\eqqcolon");
defineMacro("⩴", "\\Coloneqq");
defineMacro("\\ratio", "\\vcentcolon");
defineMacro("\\coloncolon", "\\dblcolon");
defineMacro("\\colonequals", "\\coloneqq");
defineMacro("\\coloncolonequals", "\\Coloneqq");
defineMacro("\\equalscolon", "\\eqqcolon");
defineMacro("\\equalscoloncolon", "\\Eqqcolon");
defineMacro("\\colonminus", "\\coloneq");
defineMacro("\\coloncolonminus", "\\Coloneq");
defineMacro("\\minuscolon", "\\eqcolon");
defineMacro("\\minuscoloncolon", "\\Eqcolon");
defineMacro("\\coloncolonapprox", "\\Colonapprox");
defineMacro("\\coloncolonsim", "\\Colonsim");
defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");
defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");
defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}");
defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}");
defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}");
defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}");
defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}");
defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{≰}");
defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}");
defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}");
defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}");
defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
defineMacro("\\imath", "\\html@mathml{\\@imath}{ı}");
defineMacro("\\jmath", "\\html@mathml{\\@jmath}{ȷ}");
defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");
defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");
defineMacro("⟦", "\\llbracket");
defineMacro("⟧", "\\rrbracket");
defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");
defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");
defineMacro("⦃", "\\lBrace");
defineMacro("⦄", "\\rBrace");
defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");
defineMacro("⦵", "\\minuso");
defineMacro("\\darr", "\\downarrow");
defineMacro("\\dArr", "\\Downarrow");
defineMacro("\\Darr", "\\Downarrow");
defineMacro("\\lang", "\\langle");
defineMacro("\\rang", "\\rangle");
defineMacro("\\uarr", "\\uparrow");
defineMacro("\\uArr", "\\Uparrow");
defineMacro("\\Uarr", "\\Uparrow");
defineMacro("\\N", "\\mathbb{N}");
defineMacro("\\R", "\\mathbb{R}");
defineMacro("\\Z", "\\mathbb{Z}");
defineMacro("\\alef", "\\aleph");
defineMacro("\\alefsym", "\\aleph");
defineMacro("\\Alpha", "\\mathrm{A}");
defineMacro("\\Beta", "\\mathrm{B}");
defineMacro("\\bull", "\\bullet");
defineMacro("\\Chi", "\\mathrm{X}");
defineMacro("\\clubs", "\\clubsuit");
defineMacro("\\cnums", "\\mathbb{C}");
defineMacro("\\Complex", "\\mathbb{C}");
defineMacro("\\Dagger", "\\ddagger");
defineMacro("\\diamonds", "\\diamondsuit");
defineMacro("\\empty", "\\emptyset");
defineMacro("\\Epsilon", "\\mathrm{E}");
defineMacro("\\Eta", "\\mathrm{H}");
defineMacro("\\exist", "\\exists");
defineMacro("\\harr", "\\leftrightarrow");
defineMacro("\\hArr", "\\Leftrightarrow");
defineMacro("\\Harr", "\\Leftrightarrow");
defineMacro("\\hearts", "\\heartsuit");
defineMacro("\\image", "\\Im");
defineMacro("\\infin", "\\infty");
defineMacro("\\Iota", "\\mathrm{I}");
defineMacro("\\isin", "\\in");
defineMacro("\\Kappa", "\\mathrm{K}");
defineMacro("\\larr", "\\leftarrow");
defineMacro("\\lArr", "\\Leftarrow");
defineMacro("\\Larr", "\\Leftarrow");
defineMacro("\\lrarr", "\\leftrightarrow");
defineMacro("\\lrArr", "\\Leftrightarrow");
defineMacro("\\Lrarr", "\\Leftrightarrow");
defineMacro("\\Mu", "\\mathrm{M}");
defineMacro("\\natnums", "\\mathbb{N}");
defineMacro("\\Nu", "\\mathrm{N}");
defineMacro("\\Omicron", "\\mathrm{O}");
defineMacro("\\plusmn", "\\pm");
defineMacro("\\rarr", "\\rightarrow");
defineMacro("\\rArr", "\\Rightarrow");
defineMacro("\\Rarr", "\\Rightarrow");
defineMacro("\\real", "\\Re");
defineMacro("\\reals", "\\mathbb{R}");
defineMacro("\\Reals", "\\mathbb{R}");
defineMacro("\\Rho", "\\mathrm{P}");
defineMacro("\\sdot", "\\cdot");
defineMacro("\\sect", "\\S");
defineMacro("\\spades", "\\spadesuit");
defineMacro("\\sub", "\\subset");
defineMacro("\\sube", "\\subseteq");
defineMacro("\\supe", "\\supseteq");
defineMacro("\\Tau", "\\mathrm{T}");
defineMacro("\\thetasym", "\\vartheta");
defineMacro("\\weierp", "\\wp");
defineMacro("\\Zeta", "\\mathrm{Z}");
defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits");
defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
defineMacro("\\Bra", "\\left\\langle#1\\right|");
defineMacro("\\Ket", "\\left|#1\\right\\rangle");
var braketHelper = (n) => (e) => {
  var t = e.consumeArg().tokens, r = e.consumeArg().tokens, a = e.consumeArg().tokens, s = e.consumeArg().tokens, h = e.macros.get("|"), o = e.macros.get("\\|");
  e.macros.beginGroup();
  var d = (y) => (A) => {
    n && (A.macros.set("|", h), a.length && A.macros.set("\\|", o));
    var x = y;
    if (!y && a.length) {
      var M = A.future();
      M.text === "|" && (A.popToken(), x = !0);
    }
    return {
      tokens: x ? a : r,
      numArgs: 0
    };
  };
  e.macros.set("|", d(!1)), a.length && e.macros.set("\\|", d(!0));
  var v = e.consumeArg().tokens, f = e.expandTokens([
    ...s,
    ...v,
    ...t
    // reversed
  ]);
  return e.macros.endGroup(), {
    tokens: f.reverse(),
    numArgs: 0
  };
};
defineMacro("\\bra@ket", braketHelper(!1));
defineMacro("\\bra@set", braketHelper(!0));
defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");
defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");
defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");
defineMacro("\\angln", "{\\angl n}");
defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
defineMacro("\\red", "\\textcolor{##df0030}{#1}");
defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
defineMacro("\\gray", "\\textcolor{gray}{#1}");
defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
var implicitCommands = {
  "^": !0,
  // Parser.js
  _: !0,
  // Parser.js
  "\\limits": !0,
  // Parser.js
  "\\nolimits": !0
  // Parser.js
};
class MacroExpander {
  constructor(e, t, r) {
    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 = t, this.expansionCount = 0, this.feed(e), this.macros = new Namespace(macros, t.macros), this.mode = r, this.stack = [];
  }
  /**
   * Feed a new input string to the same MacroExpander
   * (with existing macros etc.).
   */
  feed(e) {
    this.lexer = new Lexer(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 t, r, a;
    if (e) {
      if (this.consumeSpaces(), this.future().text !== "[")
        return null;
      t = this.popToken(), {
        tokens: a,
        end: r
      } = this.consumeArg(["]"]);
    } else
      ({
        tokens: a,
        start: t,
        end: r
      } = this.consumeArg());
    return this.pushToken(new Token("EOF", r.loc)), this.pushTokens(a), t.range(r, "");
  }
  /**
   * 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 t = [], r = e && e.length > 0;
    r || this.consumeSpaces();
    var a = this.future(), s, h = 0, o = 0;
    do {
      if (s = this.popToken(), t.push(s), s.text === "{")
        ++h;
      else if (s.text === "}") {
        if (--h, h === -1)
          throw new ParseError("Extra }", s);
      } else if (s.text === "EOF")
        throw new ParseError("Unexpected end of input in a macro argument, expected '" + (e && r ? e[o] : "}") + "'", s);
      if (e && r)
        if ((h === 0 || h === 1 && e[o] === "{") && s.text === e[o]) {
          if (++o, o === e.length) {
            t.splice(-o, o);
            break;
          }
        } else
          o = 0;
    } while (h !== 0 || r);
    return a.text === "{" && t[t.length - 1].text === "}" && (t.pop(), t.shift()), t.reverse(), {
      tokens: t,
      start: a,
      end: s
    };
  }
  /**
   * Consume the specified number of (delimited) arguments from the token
   * stream and return the resulting array of arguments.
   */
  consumeArgs(e, t) {
    if (t) {
      if (t.length !== e + 1)
        throw new ParseError("The length of delimiters doesn't match the number of args!");
      for (var r = t[0], a = 0; a < r.length; a++) {
        var s = this.popToken();
        if (r[a] !== s.text)
          throw new ParseError("Use of the macro doesn't match its definition", s);
      }
    }
    for (var h = [], o = 0; o < e; o++)
      h.push(this.consumeArg(t && t[o + 1]).tokens);
    return h;
  }
  /**
   * 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 ParseError("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 t = this.popToken(), r = t.text, a = t.noexpand ? null : this._getExpansion(r);
    if (a == null || e && a.unexpandable) {
      if (e && a == null && r[0] === "\\" && !this.isDefined(r))
        throw new ParseError("Undefined control sequence: " + r);
      return this.pushToken(t), !1;
    }
    this.countExpansion(1);
    var s = a.tokens, h = this.consumeArgs(a.numArgs, a.delimiters);
    if (a.numArgs) {
      s = s.slice();
      for (var o = s.length - 1; o >= 0; --o) {
        var d = s[o];
        if (d.text === "#") {
          if (o === 0)
            throw new ParseError("Incomplete placeholder at end of macro body", d);
          if (d = s[--o], d.text === "#")
            s.splice(o + 1, 1);
          else if (/^[1-9]$/.test(d.text))
            s.splice(o, 2, ...h[+d.text - 1]);
          else
            throw new ParseError("Not a valid argument number", d);
        }
      }
    }
    return this.pushTokens(s), s.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 Token(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 t = [], r = this.stack.length;
    for (this.pushTokens(e); this.stack.length > r; )
      if (this.expandOnce(!0) === !1) {
        var a = this.stack.pop();
        a.treatAsRelax && (a.noexpand = !1, a.treatAsRelax = !1), t.push(a);
      }
    return this.countExpansion(t.length), t;
  }
  /**
   * 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 t = this.expandMacro(e);
    return t && t.map((r) => r.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 t = this.macros.get(e);
    if (t == null)
      return t;
    if (e.length === 1) {
      var r = this.lexer.catcodes[e];
      if (r != null && r !== 13)
        return;
    }
    var a = typeof t == "function" ? t(this) : t;
    if (typeof a == "string") {
      var s = 0;
      if (a.indexOf("#") !== -1)
        for (var h = a.replace(/##/g, ""); h.indexOf("#" + (s + 1)) !== -1; )
          ++s;
      for (var o = new Lexer(a, this.settings), d = [], v = o.lex(); v.text !== "EOF"; )
        d.push(v), v = o.lex();
      d.reverse();
      var f = {
        tokens: d,
        numArgs: s
      };
      return f;
    }
    return a;
  }
  /**
   * 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) || functions.hasOwnProperty(e) || symbols.math.hasOwnProperty(e) || symbols.text.hasOwnProperty(e) || implicitCommands.hasOwnProperty(e);
  }
  /**
   * Determine whether a command is expandable.
   */
  isExpandable(e) {
    var t = this.macros.get(e);
    return t != null ? typeof t == "string" || typeof t == "function" || !t.unexpandable : functions.hasOwnProperty(e) && !functions[e].primitive;
  }
}
var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/, uSubsAndSups = 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",
  "ᵝ": "β",
  "ᵞ": "γ",
  "ᵟ": "δ",
  "ᵠ": "ϕ",
  "ᵡ": "χ",
  "ᶿ": "θ"
}), unicodeAccents = {
  "́": {
    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"
  }
}, unicodeSymbols = {
  á: "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̇",
  ά: "ά",
  ὰ: "ὰ",
  ᾱ: "ᾱ",
  ᾰ: "ᾰ",
  έ: "έ",
  ὲ: "ὲ",
  ή: "ή",
  ὴ: "ὴ",
  ί: "ί",
  ὶ: "ὶ",
  ϊ: "ϊ",
  ΐ: "ΐ",
  ῒ: "ῒ",
  ῑ: "ῑ",
  ῐ: "ῐ",
  ό: "ό",
  ὸ: "ὸ",
  ύ: "ύ",
  ὺ: "ὺ",
  ϋ: "ϋ",
  ΰ: "ΰ",
  ῢ: "ῢ",
  ῡ: "ῡ",
  ῠ: "ῠ",
  ώ: "ώ",
  ὼ: "ὼ",
  Ύ: "Ύ",
  Ὺ: "Ὺ",
  Ϋ: "Ϋ",
  Ῡ: "Ῡ",
  Ῠ: "Ῠ",
  Ώ: "Ώ",
  Ὼ: "Ὼ"
};
class Parser {
  constructor(e, t) {
    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 MacroExpander(e, t, this.mode), this.settings = t, this.leftrightDepth = 0;
  }
  /**
   * Checks a result to make sure it has the right type, and throws an
   * appropriate error otherwise.
   */
  expect(e, t) {
    if (t === void 0 && (t = !0), this.fetch().text !== e)
      throw new ParseError("Expected '" + e + "', got '" + this.fetch().text + "'", this.fetch());
    t && 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 t = this.nextToken;
    this.consume(), this.gullet.pushToken(new Token("}")), this.gullet.pushTokens(e);
    var r = this.parseExpression(!1);
    return this.expect("}"), this.nextToken = t, r;
  }
  /**
   * 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, t) {
    for (var r = []; ; ) {
      this.mode === "math" && this.consumeSpaces();
      var a = this.fetch();
      if (Parser.endOfExpression.indexOf(a.text) !== -1 || t && a.text === t || e && functions[a.text] && functions[a.text].infix)
        break;
      var s = this.parseAtom(t);
      if (s) {
        if (s.type === "internal")
          continue;
      } else break;
      r.push(s);
    }
    return this.mode === "text" && this.formLigatures(r), this.handleInfixNodes(r);
  }
  /**
   * 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 t = -1, r, a = 0; a < e.length; a++)
      if (e[a].type === "infix") {
        if (t !== -1)
          throw new ParseError("only one infix operator per group", e[a].token);
        t = a, r = e[a].replaceWith;
      }
    if (t !== -1 && r) {
      var s, h, o = e.slice(0, t), d = e.slice(t + 1);
      o.length === 1 && o[0].type === "ordgroup" ? s = o[0] : s = {
        type: "ordgroup",
        mode: this.mode,
        body: o
      }, d.length === 1 && d[0].type === "ordgroup" ? h = d[0] : h = {
        type: "ordgroup",
        mode: this.mode,
        body: d
      };
      var v;
      return r === "\\\\abovefrac" ? v = this.callFunction(r, [s, e[t], h], []) : v = this.callFunction(r, [s, h], []), [v];
    } else
      return e;
  }
  /**
   * Handle a subscript or superscript with nice errors.
   */
  handleSupSubscript(e) {
    var t = this.fetch(), r = t.text;
    this.consume(), this.consumeSpaces();
    var a = this.parseGroup(e);
    if (!a)
      throw new ParseError("Expected group after '" + r + "'", t);
    return a;
  }
  /**
   * 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 t = [], r = 0; r < e.length; r++)
      t.push({
        type: "textord",
        mode: "text",
        text: e[r]
      });
    var a = {
      type: "text",
      mode: this.mode,
      body: t
    }, s = {
      type: "color",
      mode: this.mode,
      color: this.settings.errorColor,
      body: [a]
    };
    return s;
  }
  /**
   * Parses a group with optional super/subscripts.
   */
  parseAtom(e) {
    var t = this.parseGroup("atom", e);
    if (this.mode === "text")
      return t;
    for (var r, a; ; ) {
      this.consumeSpaces();
      var s = this.fetch();
      if (s.text === "\\limits" || s.text === "\\nolimits") {
        if (t && t.type === "op") {
          var h = s.text === "\\limits";
          t.limits = h, t.alwaysHandleSupSub = !0;
        } else if (t && t.type === "operatorname")
          t.alwaysHandleSupSub && (t.limits = s.text === "\\limits");
        else
          throw new ParseError("Limit controls must follow a math operator", s);
        this.consume();
      } else if (s.text === "^") {
        if (r)
          throw new ParseError("Double superscript", s);
        r = this.handleSupSubscript("superscript");
      } else if (s.text === "_") {
        if (a)
          throw new ParseError("Double subscript", s);
        a = this.handleSupSubscript("subscript");
      } else if (s.text === "'") {
        if (r)
          throw new ParseError("Double superscript", s);
        var o = {
          type: "textord",
          mode: this.mode,
          text: "\\prime"
        }, d = [o];
        for (this.consume(); this.fetch().text === "'"; )
          d.push(o), this.consume();
        this.fetch().text === "^" && d.push(this.handleSupSubscript("superscript")), r = {
          type: "ordgroup",
          mode: this.mode,
          body: d
        };
      } else if (uSubsAndSups[s.text]) {
        var v = unicodeSubRegEx.test(s.text), f = [];
        for (f.push(new Token(uSubsAndSups[s.text])), this.consume(); ; ) {
          var y = this.fetch().text;
          if (!uSubsAndSups[y] || unicodeSubRegEx.test(y) !== v)
            break;
          f.unshift(new Token(uSubsAndSups[y])), this.consume();
        }
        var A = this.subparse(f);
        v ? a = {
          type: "ordgroup",
          mode: "math",
          body: A
        } : r = {
          type: "ordgroup",
          mode: "math",
          body: A
        };
      } else
        break;
    }
    return r || a ? {
      type: "supsub",
      mode: this.mode,
      base: t,
      sup: r,
      sub: a
    } : t;
  }
  /**
   * Parses an entire function, including its base and all of its arguments.
   */
  parseFunction(e, t) {
    var r = this.fetch(), a = r.text, s = functions[a];
    if (!s)
      return null;
    if (this.consume(), t && t !== "atom" && !s.allowedInArgument)
      throw new ParseError("Got function '" + a + "' with no arguments" + (t ? " as " + t : ""), r);
    if (this.mode === "text" && !s.allowedInText)
      throw new ParseError("Can't use function '" + a + "' in text mode", r);
    if (this.mode === "math" && s.allowedInMath === !1)
      throw new ParseError("Can't use function '" + a + "' in math mode", r);
    var {
      args: h,
      optArgs: o
    } = this.parseArguments(a, s);
    return this.callFunction(a, h, o, r, e);
  }
  /**
   * Call a function handler with a suitable context and arguments.
   */
  callFunction(e, t, r, a, s) {
    var h = {
      funcName: e,
      parser: this,
      token: a,
      breakOnTokenText: s
    }, o = functions[e];
    if (o && o.handler)
      return o.handler(h, t, r);
    throw new ParseError("No function handler for " + e);
  }
  /**
   * Parses the arguments of a function or environment
   */
  parseArguments(e, t) {
    var r = t.numArgs + t.numOptionalArgs;
    if (r === 0)
      return {
        args: [],
        optArgs: []
      };
    for (var a = [], s = [], h = 0; h < r; h++) {
      var o = t.argTypes && t.argTypes[h], d = h < t.numOptionalArgs;
      (t.primitive && o == null || // \sqrt expands into primitive if optional argument doesn't exist
      t.type === "sqrt" && h === 1 && s[0] == null) && (o = "primitive");
      var v = this.parseGroupOfType("argument to '" + e + "'", o, d);
      if (d)
        s.push(v);
      else if (v != null)
        a.push(v);
      else
        throw new ParseError("Null argument, please report this as a bug");
    }
    return {
      args: a,
      optArgs: s
    };
  }
  /**
   * Parses a group when the mode is changing.
   */
  parseGroupOfType(e, t, r) {
    switch (t) {
      case "color":
        return this.parseColorGroup(r);
      case "size":
        return this.parseSizeGroup(r);
      case "url":
        return this.parseUrlGroup(r);
      case "math":
      case "text":
        return this.parseArgumentGroup(r, t);
      case "hbox": {
        var a = this.parseArgumentGroup(r, "text");
        return a != null ? {
          type: "styling",
          mode: a.mode,
          body: [a],
          style: "text"
          // simulate \textstyle
        } : null;
      }
      case "raw": {
        var s = this.parseStringGroup("raw", r);
        return s != null ? {
          type: "raw",
          mode: "text",
          string: s.text
        } : null;
      }
      case "primitive": {
        if (r)
          throw new ParseError("A primitive argument cannot be optional");
        var h = this.parseGroup(e);
        if (h == null)
          throw new ParseError("Expected group as " + e, this.fetch());
        return h;
      }
      case "original":
      case null:
      case void 0:
        return this.parseArgumentGroup(r);
      default:
        throw new ParseError("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, t) {
    var r = this.gullet.scanArgument(t);
    if (r == null)
      return null;
    for (var a = "", s; (s = this.fetch()).text !== "EOF"; )
      a += s.text, this.consume();
    return this.consume(), r.text = a, r;
  }
  /**
   * 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, t) {
    for (var r = this.fetch(), a = r, s = "", h; (h = this.fetch()).text !== "EOF" && e.test(s + h.text); )
      a = h, s += a.text, this.consume();
    if (s === "")
      throw new ParseError("Invalid " + t + ": '" + r.text + "'", r);
    return r.range(a, s);
  }
  /**
   * Parses a color description.
   */
  parseColorGroup(e) {
    var t = this.parseStringGroup("color", e);
    if (t == null)
      return null;
    var r = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);
    if (!r)
      throw new ParseError("Invalid color: '" + t.text + "'", t);
    var a = r[0];
    return /^[0-9a-f]{6}$/i.test(a) && (a = "#" + a), {
      type: "color-token",
      mode: this.mode,
      color: a
    };
  }
  /**
   * Parses a size specification, consisting of magnitude and unit.
   */
  parseSizeGroup(e) {
    var t, r = !1;
    if (this.gullet.consumeSpaces(), !e && this.gullet.future().text !== "{" ? t = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size") : t = this.parseStringGroup("size", e), !t)
      return null;
    !e && t.text.length === 0 && (t.text = "0pt", r = !0);
    var a = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);
    if (!a)
      throw new ParseError("Invalid size: '" + t.text + "'", t);
    var s = {
      number: +(a[1] + a[2]),
      // sign + magnitude, cast to number
      unit: a[3]
    };
    if (!validUnit(s))
      throw new ParseError("Invalid unit: '" + s.unit + "'", t);
    return {
      type: "size",
      mode: this.mode,
      value: s,
      isBlank: r
    };
  }
  /**
   * 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 t = this.parseStringGroup("url", e);
    if (this.gullet.lexer.setCatcode("%", 14), this.gullet.lexer.setCatcode("~", 13), t == null)
      return null;
    var r = t.text.replace(/\\([#$%&~_^{}])/g, "$1");
    return {
      type: "url",
      mode: this.mode,
      url: r
    };
  }
  /**
   * Parses an argument with the mode specified.
   */
  parseArgumentGroup(e, t) {
    var r = this.gullet.scanArgument(e);
    if (r == null)
      return null;
    var a = this.mode;
    t && this.switchMode(t), this.gullet.beginGroup();
    var s = this.parseExpression(!1, "EOF");
    this.expect("EOF"), this.gullet.endGroup();
    var h = {
      type: "ordgroup",
      mode: this.mode,
      loc: r.loc,
      body: s
    };
    return t && this.switchMode(a), h;
  }
  /**
   * 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, t) {
    var r = this.fetch(), a = r.text, s;
    if (a === "{" || a === "\\begingroup") {
      this.consume();
      var h = a === "{" ? "}" : "\\endgroup";
      this.gullet.beginGroup();
      var o = this.parseExpression(!1, h), d = this.fetch();
      this.expect(h), this.gullet.endGroup(), s = {
        type: "ordgroup",
        mode: this.mode,
        loc: SourceLocation.range(r, d),
        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: a === "\\begingroup" || void 0
      };
    } else if (s = this.parseFunction(t, e) || this.parseSymbol(), s == null && a[0] === "\\" && !implicitCommands.hasOwnProperty(a)) {
      if (this.settings.throwOnError)
        throw new ParseError("Undefined control sequence: " + a, r);
      s = this.formatUnsupportedCmd(a), this.consume();
    }
    return s;
  }
  /**
   * 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 t = e.length - 1, r = 0; r < t; ++r) {
      var a = e[r], s = a.text;
      s === "-" && e[r + 1].text === "-" && (r + 1 < t && e[r + 2].text === "-" ? (e.splice(r, 3, {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(a, e[r + 2]),
        text: "---"
      }), t -= 2) : (e.splice(r, 2, {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(a, e[r + 1]),
        text: "--"
      }), t -= 1)), (s === "'" || s === "`") && e[r + 1].text === s && (e.splice(r, 2, {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(a, e[r + 1]),
        text: s + s
      }), t -= 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(), t = e.text;
    if (/^\\verb[^a-zA-Z]/.test(t)) {
      this.consume();
      var r = t.slice(5), a = r.charAt(0) === "*";
      if (a && (r = r.slice(1)), r.length < 2 || r.charAt(0) !== r.slice(-1))
        throw new ParseError(`\\verb assertion failed --
                    please report what input caused this bug`);
      return r = r.slice(1, -1), {
        type: "verb",
        mode: "text",
        body: r,
        star: a
      };
    }
    unicodeSymbols.hasOwnProperty(t[0]) && !symbols[this.mode][t[0]] && (this.settings.strict && this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + t[0] + '" used in math mode', e), t = unicodeSymbols[t[0]] + t.slice(1));
    var s = combiningDiacriticalMarksEndRegex.exec(t);
    s && (t = t.substring(0, s.index), t === "i" ? t = "ı" : t === "j" && (t = "ȷ"));
    var h;
    if (symbols[this.mode][t]) {
      this.settings.strict && this.mode === "math" && extraLatin.indexOf(t) >= 0 && this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + t[0] + '" used in math mode', e);
      var o = symbols[this.mode][t].group, d = SourceLocation.range(e), v;
      if (ATOMS.hasOwnProperty(o)) {
        var f = o;
        v = {
          type: "atom",
          mode: this.mode,
          family: f,
          loc: d,
          text: t
        };
      } else
        v = {
          type: o,
          mode: this.mode,
          loc: d,
          text: t
        };
      h = v;
    } else if (t.charCodeAt(0) >= 128)
      this.settings.strict && (supportedCodepoint(t.charCodeAt(0)) ? this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + t[0] + '" used in math mode', e) : this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + t[0] + '"' + (" (" + t.charCodeAt(0) + ")"), e)), h = {
        type: "textord",
        mode: "text",
        loc: SourceLocation.range(e),
        text: t
      };
    else
      return null;
    if (this.consume(), s)
      for (var y = 0; y < s[0].length; y++) {
        var A = s[0][y];
        if (!unicodeAccents[A])
          throw new ParseError("Unknown accent ' " + A + "'", e);
        var x = unicodeAccents[A][this.mode] || unicodeAccents[A].text;
        if (!x)
          throw new ParseError("Accent " + A + " unsupported in " + this.mode + " mode", e);
        h = {
          type: "accent",
          mode: this.mode,
          loc: SourceLocation.range(e),
          label: x,
          isStretchy: !1,
          isShifty: !0,
          // $FlowFixMe
          base: h
        };
      }
    return h;
  }
}
Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
var parseTree = function(e, t) {
  if (!(typeof e == "string" || e instanceof String))
    throw new TypeError("KaTeX can only parse string typed expression");
  var r = new Parser(e, t);
  delete r.gullet.macros.current["\\df@tag"];
  var a = r.parse();
  if (delete r.gullet.macros.current["\\current@color"], delete r.gullet.macros.current["\\color"], r.gullet.macros.get("\\df@tag")) {
    if (!t.displayMode)
      throw new ParseError("\\tag works only in display equations");
    a = [{
      type: "tag",
      mode: "text",
      body: a,
      tag: r.subparse([new Token("\\df@tag")])
    }];
  }
  return a;
}, render = function(e, t, r) {
  t.textContent = "";
  var a = renderToDomTree(e, r).toNode();
  t.appendChild(a);
};
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."), render = function() {
  throw new ParseError("KaTeX doesn't work in quirks mode.");
});
var renderToString = function(e, t) {
  var r = renderToDomTree(e, t).toMarkup();
  return r;
}, generateParseTree = function(e, t) {
  var r = new Settings(t);
  return parseTree(e, r);
}, renderError = function(e, t, r) {
  if (r.throwOnError || !(e instanceof ParseError))
    throw e;
  var a = buildCommon.makeSpan(["katex-error"], [new SymbolNode(t)]);
  return a.setAttribute("title", e.toString()), a.setAttribute("style", "color:" + r.errorColor), a;
}, renderToDomTree = function(e, t) {
  var r = new Settings(t);
  try {
    var a = parseTree(e, r);
    return buildTree(a, e, r);
  } catch (s) {
    return renderError(s, e, r);
  }
}, renderToHTMLTree = function(e, t) {
  var r = new Settings(t);
  try {
    var a = parseTree(e, r);
    return buildHTMLTree(a, e, r);
  } catch (s) {
    return renderError(s, e, r);
  }
}, katex = {
  /**
   * Current KaTeX version
   */
  version: "0.16.11",
  /**
   * Renders the given LaTeX into an HTML+MathML combination, and adds
   * it as a child to the specified DOM node.
   */
  render,
  /**
   * Renders the given LaTeX into an HTML+MathML combination string,
   * for sending to the client.
   */
  renderToString,
  /**
   * KaTeX error, usually during parsing.
   */
  ParseError,
  /**
   * The shema of Settings
   */
  SETTINGS_SCHEMA,
  /**
   * 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: generateParseTree,
  /**
   * 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: renderToDomTree,
  /**
   * 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: renderToHTMLTree,
  /**
   * extends internal font metrics object with a new object
   * each key in the new object represents a font name
  */
  __setFontMetrics: setFontMetrics,
  /**
   * adds a new symbol to builtin symbols table
   */
  __defineSymbol: defineSymbol,
  /**
   * adds a new function to builtin function list,
   * which directly produce parse tree elements
   * and have their own html/mathml builders
   */
  __defineFunction: defineFunction,
  /**
   * adds a new macro to builtin macro list
   */
  __defineMacro: defineMacro,
  /**
   * Expose the dom tree node types, which can be useful for type checking nodes.
   *
   * 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.
   */
  __domTree: {
    Span,
    Anchor,
    SymbolNode,
    SvgNode,
    PathNode,
    LineNode
  }
}, findEndOfMath = function(e, t, r) {
  for (var a = r, s = 0, h = e.length; a < t.length; ) {
    var o = t[a];
    if (s <= 0 && t.slice(a, a + h) === e)
      return a;
    o === "\\" ? a++ : o === "{" ? s++ : o === "}" && s--, a++;
  }
  return -1;
}, escapeRegex = function(e) {
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
}, amsRegex = /^\\begin{/, splitAtDelimiters = function(e, t) {
  for (var r, a = [], s = new RegExp("(" + t.map((v) => escapeRegex(v.left)).join("|") + ")"); r = e.search(s), r !== -1; ) {
    r > 0 && (a.push({
      type: "text",
      data: e.slice(0, r)
    }), e = e.slice(r));
    var h = t.findIndex((v) => e.startsWith(v.left));
    if (r = findEndOfMath(t[h].right, e, t[h].left.length), r === -1)
      break;
    var o = e.slice(0, r + t[h].right.length), d = amsRegex.test(o) ? o : e.slice(t[h].left.length, r);
    a.push({
      type: "math",
      data: d,
      rawData: o,
      display: t[h].display
    }), e = e.slice(r + t[h].right.length);
  }
  return e !== "" && a.push({
    type: "text",
    data: e
  }), a;
}, renderMathInText = function(e, t) {
  var r = splitAtDelimiters(e, t.delimiters);
  if (r.length === 1 && r[0].type === "text")
    return null;
  for (var a = document.createDocumentFragment(), s = 0; s < r.length; s++)
    if (r[s].type === "text")
      a.appendChild(document.createTextNode(r[s].data));
    else {
      var h = document.createElement("span"), o = r[s].data;
      t.displayMode = r[s].display;
      try {
        t.preProcess && (o = t.preProcess(o)), katex.render(o, h, t);
      } catch (d) {
        if (!(d instanceof katex.ParseError))
          throw d;
        t.errorCallback("KaTeX auto-render: Failed to parse `" + r[s].data + "` with ", d), a.appendChild(document.createTextNode(r[s].rawData));
        continue;
      }
      a.appendChild(h);
    }
  return a;
}, renderElem = function n(e, t) {
  for (var r = 0; r < e.childNodes.length; r++) {
    var a = e.childNodes[r];
    if (a.nodeType === 3) {
      for (var s = a.textContent, h = a.nextSibling, o = 0; h && h.nodeType === Node.TEXT_NODE; )
        s += h.textContent, h = h.nextSibling, o++;
      var d = renderMathInText(s, t);
      if (d) {
        for (var v = 0; v < o; v++)
          a.nextSibling.remove();
        r += d.childNodes.length - 1, e.replaceChild(d, a);
      } else
        r += o;
    } else a.nodeType === 1 && function() {
      var f = " " + a.className + " ", y = t.ignoredTags.indexOf(a.nodeName.toLowerCase()) === -1 && t.ignoredClasses.every((A) => f.indexOf(" " + A + " ") === -1);
      y && n(a, t);
    }();
  }
}, renderMathInElement = function(e, t) {
  if (!e)
    throw new Error("No element provided to render");
  var r = {};
  for (var a in t)
    t.hasOwnProperty(a) && (r[a] = t[a]);
  r.delimiters = r.delimiters || [
    {
      left: "$$",
      right: "$$",
      display: !0
    },
    {
      left: "\\(",
      right: "\\)",
      display: !1
    },
    // LaTeX uses $…$, but it ruins the display of normal `$` in text:
    // {left: "$", right: "$", display: false},
    // $ must come after $$
    // Render AMS environments even if outside $$…$$ delimiters.
    {
      left: "\\begin{equation}",
      right: "\\end{equation}",
      display: !0
    },
    {
      left: "\\begin{align}",
      right: "\\end{align}",
      display: !0
    },
    {
      left: "\\begin{alignat}",
      right: "\\end{alignat}",
      display: !0
    },
    {
      left: "\\begin{gather}",
      right: "\\end{gather}",
      display: !0
    },
    {
      left: "\\begin{CD}",
      right: "\\end{CD}",
      display: !0
    },
    {
      left: "\\[",
      right: "\\]",
      display: !0
    }
  ], r.ignoredTags = r.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"], r.ignoredClasses = r.ignoredClasses || [], r.errorCallback = r.errorCallback || console.error, r.macros = r.macros || {}, renderElem(e, r);
};
function _getDefaults() {
  return {
    async: !1,
    breaks: !1,
    extensions: null,
    gfm: !0,
    hooks: null,
    pedantic: !1,
    renderer: null,
    silent: !1,
    tokenizer: null,
    walkTokens: null
  };
}
let _defaults = _getDefaults();
function changeDefaults(n) {
  _defaults = n;
}
const escapeTest$1 = /[&<>"']/, escapeReplace$1 = new RegExp(escapeTest$1.source, "g"), escapeTestNoEncode$1 = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode$1 = new RegExp(escapeTestNoEncode$1.source, "g"), escapeReplacements$1 = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, getEscapeReplacement$1 = (n) => escapeReplacements$1[n];
function escape$1$1(n, e) {
  if (e) {
    if (escapeTest$1.test(n))
      return n.replace(escapeReplace$1, getEscapeReplacement$1);
  } else if (escapeTestNoEncode$1.test(n))
    return n.replace(escapeReplaceNoEncode$1, getEscapeReplacement$1);
  return n;
}
const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
function unescape(n) {
  return n.replace(unescapeTest, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
}
const caret = /(^|[^\[])\^/g;
function edit(n, e) {
  let t = typeof n == "string" ? n : n.source;
  e = e || "";
  const r = {
    replace: (a, s) => {
      let h = typeof s == "string" ? s : s.source;
      return h = h.replace(caret, "$1"), t = t.replace(a, h), r;
    },
    getRegex: () => new RegExp(t, e)
  };
  return r;
}
function cleanUrl(n) {
  try {
    n = encodeURI(n).replace(/%25/g, "%");
  } catch {
    return null;
  }
  return n;
}
const noopTest = { exec: () => null };
function splitCells(n, e) {
  const t = n.replace(/\|/g, (s, h, o) => {
    let d = !1, v = h;
    for (; --v >= 0 && o[v] === "\\"; )
      d = !d;
    return d ? "|" : " |";
  }), r = t.split(/ \|/);
  let a = 0;
  if (r[0].trim() || r.shift(), r.length > 0 && !r[r.length - 1].trim() && r.pop(), e)
    if (r.length > e)
      r.splice(e);
    else
      for (; r.length < e; )
        r.push("");
  for (; a < r.length; a++)
    r[a] = r[a].trim().replace(/\\\|/g, "|");
  return r;
}
function rtrim(n, e, t) {
  const r = n.length;
  if (r === 0)
    return "";
  let a = 0;
  for (; a < r; ) {
    const s = n.charAt(r - a - 1);
    if (s === e && !t)
      a++;
    else if (s !== e && t)
      a++;
    else
      break;
  }
  return n.slice(0, r - a);
}
function findClosingBracket(n, e) {
  if (n.indexOf(e[1]) === -1)
    return -1;
  let t = 0;
  for (let r = 0; r < n.length; r++)
    if (n[r] === "\\")
      r++;
    else if (n[r] === e[0])
      t++;
    else if (n[r] === e[1] && (t--, t < 0))
      return r;
  return -1;
}
function outputLink(n, e, t, r) {
  const a = e.href, s = e.title ? escape$1$1(e.title) : null, h = n[1].replace(/\\([\[\]])/g, "$1");
  if (n[0].charAt(0) !== "!") {
    r.state.inLink = !0;
    const o = {
      type: "link",
      raw: t,
      href: a,
      title: s,
      text: h,
      tokens: r.inlineTokens(h)
    };
    return r.state.inLink = !1, o;
  }
  return {
    type: "image",
    raw: t,
    href: a,
    title: s,
    text: escape$1$1(h)
  };
}
function indentCodeCompensation(n, e) {
  const t = n.match(/^(\s+)(?:```)/);
  if (t === null)
    return e;
  const r = t[1];
  return e.split(`
`).map((a) => {
    const s = a.match(/^\s+/);
    if (s === null)
      return a;
    const [h] = s;
    return h.length >= r.length ? a.slice(r.length) : a;
  }).join(`
`);
}
class _Tokenizer {
  options;
  rules;
  // set by the lexer
  lexer;
  // set by the lexer
  constructor(e) {
    this.options = e || _defaults;
  }
  space(e) {
    const t = this.rules.block.newline.exec(e);
    if (t && t[0].length > 0)
      return {
        type: "space",
        raw: t[0]
      };
  }
  code(e) {
    const t = this.rules.block.code.exec(e);
    if (t) {
      const r = t[0].replace(/^ {1,4}/gm, "");
      return {
        type: "code",
        raw: t[0],
        codeBlockStyle: "indented",
        text: this.options.pedantic ? r : rtrim(r, `
`)
      };
    }
  }
  fences(e) {
    const t = this.rules.block.fences.exec(e);
    if (t) {
      const r = t[0], a = indentCodeCompensation(r, t[3] || "");
      return {
        type: "code",
        raw: r,
        lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
        text: a
      };
    }
  }
  heading(e) {
    const t = this.rules.block.heading.exec(e);
    if (t) {
      let r = t[2].trim();
      if (/#$/.test(r)) {
        const a = rtrim(r, "#");
        (this.options.pedantic || !a || / $/.test(a)) && (r = a.trim());
      }
      return {
        type: "heading",
        raw: t[0],
        depth: t[1].length,
        text: r,
        tokens: this.lexer.inline(r)
      };
    }
  }
  hr(e) {
    const t = this.rules.block.hr.exec(e);
    if (t)
      return {
        type: "hr",
        raw: t[0]
      };
  }
  blockquote(e) {
    const t = this.rules.block.blockquote.exec(e);
    if (t) {
      let r = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
    $1`);
      r = rtrim(r.replace(/^ *>[ \t]?/gm, ""), `
`);
      const a = this.lexer.state.top;
      this.lexer.state.top = !0;
      const s = this.lexer.blockTokens(r);
      return this.lexer.state.top = a, {
        type: "blockquote",
        raw: t[0],
        tokens: s,
        text: r
      };
    }
  }
  list(e) {
    let t = this.rules.block.list.exec(e);
    if (t) {
      let r = t[1].trim();
      const a = r.length > 1, s = {
        type: "list",
        raw: "",
        ordered: a,
        start: a ? +r.slice(0, -1) : "",
        loose: !1,
        items: []
      };
      r = a ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = a ? r : "[*+-]");
      const h = new RegExp(`^( {0,3}${r})((?:[	 ][^\\n]*)?(?:\\n|$))`);
      let o = "", d = "", v = !1;
      for (; e; ) {
        let f = !1;
        if (!(t = h.exec(e)) || this.rules.block.hr.test(e))
          break;
        o = t[0], e = e.substring(o.length);
        let y = t[2].split(`
`, 1)[0].replace(/^\t+/, (u) => " ".repeat(3 * u.length)), A = e.split(`
`, 1)[0], x = 0;
        this.options.pedantic ? (x = 2, d = y.trimStart()) : (x = t[2].search(/[^ ]/), x = x > 4 ? 1 : x, d = y.slice(x), x += t[1].length);
        let M = !1;
        if (!y && /^ *$/.test(A) && (o += A + `
`, e = e.substring(A.length + 1), f = !0), !f) {
          const u = new RegExp(`^ {0,${Math.min(3, x - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`), p = new RegExp(`^ {0,${Math.min(3, x - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), g = new RegExp(`^ {0,${Math.min(3, x - 1)}}(?:\`\`\`|~~~)`), b = new RegExp(`^ {0,${Math.min(3, x - 1)}}#`);
          for (; e; ) {
            const c = e.split(`
`, 1)[0];
            if (A = c, this.options.pedantic && (A = A.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ")), g.test(A) || b.test(A) || u.test(A) || p.test(e))
              break;
            if (A.search(/[^ ]/) >= x || !A.trim())
              d += `
` + A.slice(x);
            else {
              if (M || y.search(/[^ ]/) >= 4 || g.test(y) || b.test(y) || p.test(y))
                break;
              d += `
` + A;
            }
            !M && !A.trim() && (M = !0), o += c + `
`, e = e.substring(c.length + 1), y = A.slice(x);
          }
        }
        s.loose || (v ? s.loose = !0 : /\n *\n *$/.test(o) && (v = !0));
        let m = null, l;
        this.options.gfm && (m = /^\[[ xX]\] /.exec(d), m && (l = m[0] !== "[ ] ", d = d.replace(/^\[[ xX]\] +/, ""))), s.items.push({
          type: "list_item",
          raw: o,
          task: !!m,
          checked: l,
          loose: !1,
          text: d,
          tokens: []
        }), s.raw += o;
      }
      s.items[s.items.length - 1].raw = o.trimEnd(), s.items[s.items.length - 1].text = d.trimEnd(), s.raw = s.raw.trimEnd();
      for (let f = 0; f < s.items.length; f++)
        if (this.lexer.state.top = !1, s.items[f].tokens = this.lexer.blockTokens(s.items[f].text, []), !s.loose) {
          const y = s.items[f].tokens.filter((x) => x.type === "space"), A = y.length > 0 && y.some((x) => /\n.*\n/.test(x.raw));
          s.loose = A;
        }
      if (s.loose)
        for (let f = 0; f < s.items.length; f++)
          s.items[f].loose = !0;
      return s;
    }
  }
  html(e) {
    const t = this.rules.block.html.exec(e);
    if (t)
      return {
        type: "html",
        block: !0,
        raw: t[0],
        pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
        text: t[0]
      };
  }
  def(e) {
    const t = this.rules.block.def.exec(e);
    if (t) {
      const r = t[1].toLowerCase().replace(/\s+/g, " "), a = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
      return {
        type: "def",
        tag: r,
        raw: t[0],
        href: a,
        title: s
      };
    }
  }
  table(e) {
    const t = this.rules.block.table.exec(e);
    if (!t || !/[:|]/.test(t[2]))
      return;
    const r = splitCells(t[1]), a = t[2].replace(/^\||\| *$/g, "").split("|"), s = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
`) : [], h = {
      type: "table",
      raw: t[0],
      header: [],
      align: [],
      rows: []
    };
    if (r.length === a.length) {
      for (const o of a)
        /^ *-+: *$/.test(o) ? h.align.push("right") : /^ *:-+: *$/.test(o) ? h.align.push("center") : /^ *:-+ *$/.test(o) ? h.align.push("left") : h.align.push(null);
      for (const o of r)
        h.header.push({
          text: o,
          tokens: this.lexer.inline(o)
        });
      for (const o of s)
        h.rows.push(splitCells(o, h.header.length).map((d) => ({
          text: d,
          tokens: this.lexer.inline(d)
        })));
      return h;
    }
  }
  lheading(e) {
    const t = this.rules.block.lheading.exec(e);
    if (t)
      return {
        type: "heading",
        raw: t[0],
        depth: t[2].charAt(0) === "=" ? 1 : 2,
        text: t[1],
        tokens: this.lexer.inline(t[1])
      };
  }
  paragraph(e) {
    const t = this.rules.block.paragraph.exec(e);
    if (t) {
      const r = t[1].charAt(t[1].length - 1) === `
` ? t[1].slice(0, -1) : t[1];
      return {
        type: "paragraph",
        raw: t[0],
        text: r,
        tokens: this.lexer.inline(r)
      };
    }
  }
  text(e) {
    const t = this.rules.block.text.exec(e);
    if (t)
      return {
        type: "text",
        raw: t[0],
        text: t[0],
        tokens: this.lexer.inline(t[0])
      };
  }
  escape(e) {
    const t = this.rules.inline.escape.exec(e);
    if (t)
      return {
        type: "escape",
        raw: t[0],
        text: escape$1$1(t[1])
      };
  }
  tag(e) {
    const t = this.rules.inline.tag.exec(e);
    if (t)
      return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
        type: "html",
        raw: t[0],
        inLink: this.lexer.state.inLink,
        inRawBlock: this.lexer.state.inRawBlock,
        block: !1,
        text: t[0]
      };
  }
  link(e) {
    const t = this.rules.inline.link.exec(e);
    if (t) {
      const r = t[2].trim();
      if (!this.options.pedantic && /^</.test(r)) {
        if (!/>$/.test(r))
          return;
        const h = rtrim(r.slice(0, -1), "\\");
        if ((r.length - h.length) % 2 === 0)
          return;
      } else {
        const h = findClosingBracket(t[2], "()");
        if (h > -1) {
          const d = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + h;
          t[2] = t[2].substring(0, h), t[0] = t[0].substring(0, d).trim(), t[3] = "";
        }
      }
      let a = t[2], s = "";
      if (this.options.pedantic) {
        const h = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a);
        h && (a = h[1], s = h[3]);
      } else
        s = t[3] ? t[3].slice(1, -1) : "";
      return a = a.trim(), /^</.test(a) && (this.options.pedantic && !/>$/.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), outputLink(t, {
        href: a && a.replace(this.rules.inline.anyPunctuation, "$1"),
        title: s && s.replace(this.rules.inline.anyPunctuation, "$1")
      }, t[0], this.lexer);
    }
  }
  reflink(e, t) {
    let r;
    if ((r = this.rules.inline.reflink.exec(e)) || (r = this.rules.inline.nolink.exec(e))) {
      const a = (r[2] || r[1]).replace(/\s+/g, " "), s = t[a.toLowerCase()];
      if (!s) {
        const h = r[0].charAt(0);
        return {
          type: "text",
          raw: h,
          text: h
        };
      }
      return outputLink(r, s, r[0], this.lexer);
    }
  }
  emStrong(e, t, r = "") {
    let a = this.rules.inline.emStrongLDelim.exec(e);
    if (!a || a[3] && r.match(/[\p{L}\p{N}]/u))
      return;
    if (!(a[1] || a[2] || "") || !r || this.rules.inline.punctuation.exec(r)) {
      const h = [...a[0]].length - 1;
      let o, d, v = h, f = 0;
      const y = a[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
      for (y.lastIndex = 0, t = t.slice(-1 * e.length + h); (a = y.exec(t)) != null; ) {
        if (o = a[1] || a[2] || a[3] || a[4] || a[5] || a[6], !o)
          continue;
        if (d = [...o].length, a[3] || a[4]) {
          v += d;
          continue;
        } else if ((a[5] || a[6]) && h % 3 && !((h + d) % 3)) {
          f += d;
          continue;
        }
        if (v -= d, v > 0)
          continue;
        d = Math.min(d, d + v + f);
        const A = [...a[0]][0].length, x = e.slice(0, h + a.index + A + d);
        if (Math.min(h, d) % 2) {
          const m = x.slice(1, -1);
          return {
            type: "em",
            raw: x,
            text: m,
            tokens: this.lexer.inlineTokens(m)
          };
        }
        const M = x.slice(2, -2);
        return {
          type: "strong",
          raw: x,
          text: M,
          tokens: this.lexer.inlineTokens(M)
        };
      }
    }
  }
  codespan(e) {
    const t = this.rules.inline.code.exec(e);
    if (t) {
      let r = t[2].replace(/\n/g, " ");
      const a = /[^ ]/.test(r), s = /^ /.test(r) && / $/.test(r);
      return a && s && (r = r.substring(1, r.length - 1)), r = escape$1$1(r, !0), {
        type: "codespan",
        raw: t[0],
        text: r
      };
    }
  }
  br(e) {
    const t = this.rules.inline.br.exec(e);
    if (t)
      return {
        type: "br",
        raw: t[0]
      };
  }
  del(e) {
    const t = this.rules.inline.del.exec(e);
    if (t)
      return {
        type: "del",
        raw: t[0],
        text: t[2],
        tokens: this.lexer.inlineTokens(t[2])
      };
  }
  autolink(e) {
    const t = this.rules.inline.autolink.exec(e);
    if (t) {
      let r, a;
      return t[2] === "@" ? (r = escape$1$1(t[1]), a = "mailto:" + r) : (r = escape$1$1(t[1]), a = r), {
        type: "link",
        raw: t[0],
        text: r,
        href: a,
        tokens: [
          {
            type: "text",
            raw: r,
            text: r
          }
        ]
      };
    }
  }
  url(e) {
    let t;
    if (t = this.rules.inline.url.exec(e)) {
      let r, a;
      if (t[2] === "@")
        r = escape$1$1(t[0]), a = "mailto:" + r;
      else {
        let s;
        do
          s = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
        while (s !== t[0]);
        r = escape$1$1(t[0]), t[1] === "www." ? a = "http://" + t[0] : a = t[0];
      }
      return {
        type: "link",
        raw: t[0],
        text: r,
        href: a,
        tokens: [
          {
            type: "text",
            raw: r,
            text: r
          }
        ]
      };
    }
  }
  inlineText(e) {
    const t = this.rules.inline.text.exec(e);
    if (t) {
      let r;
      return this.lexer.state.inRawBlock ? r = t[0] : r = escape$1$1(t[0]), {
        type: "text",
        raw: t[0],
        text: r
      };
    }
  }
}
const newline = /^(?: *(?:\n|$))+/, blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, bullet = /(?:[*+-]|\d{1,9}[.)])/, lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).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/).getRegex(), _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, blockText = /^[^\n]+/, _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/, def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex(), _tag = "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", _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, html$2 = edit("^ {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", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), paragraph = edit(_paragraph).replace("hr", hr).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", _tag).getRegex(), blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex(), blockNormal = {
  blockquote,
  code: blockCode,
  def,
  fences,
  heading,
  hr,
  html: html$2,
  lheading,
  list,
  newline,
  paragraph,
  table: noopTest,
  text: blockText
}, gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", _tag).getRegex(), blockGfm = {
  ...blockNormal,
  table: gfmTable,
  paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).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", _tag).getRegex()
}, blockPedantic = {
  ...blockNormal,
  html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).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: noopTest,
  // fences not supported
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
  paragraph: edit(_paragraph).replace("hr", hr).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, escape$2 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, br = /^( {2,}|\\)\n(?!\s*$)/, inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _punctuation = "\\p{P}\\p{S}", punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex(), blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex(), emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex(), emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex(), anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex(), autolink = edit(/^<(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(), _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex(), tag = edit("^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", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex(), nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex(), reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex(), inlineNormal = {
  _backpedal: noopTest,
  // only used for GFM url
  anyPunctuation,
  autolink,
  blockSkip,
  br,
  code: inlineCode,
  del: noopTest,
  emStrongLDelim,
  emStrongRDelimAst,
  emStrongRDelimUnd,
  escape: escape$2,
  link,
  nolink,
  punctuation,
  reflink,
  reflinkSearch,
  tag,
  text: inlineText,
  url: noopTest
}, inlinePedantic = {
  ...inlineNormal,
  link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
  reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
}, inlineGfm = {
  ...inlineNormal,
  escape: edit(escape$2).replace("])", "~|])").getRegex(),
  url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").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~])\1(?=[^~]|$)/,
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
}, inlineBreaks = {
  ...inlineGfm,
  br: edit(br).replace("{2,}", "*").getRegex(),
  text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, block = {
  normal: blockNormal,
  gfm: blockGfm,
  pedantic: blockPedantic
}, inline = {
  normal: inlineNormal,
  gfm: inlineGfm,
  breaks: inlineBreaks,
  pedantic: inlinePedantic
};
class _Lexer {
  tokens;
  options;
  state;
  tokenizer;
  inlineQueue;
  constructor(e) {
    this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || _defaults, this.options.tokenizer = this.options.tokenizer || new _Tokenizer(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
      inLink: !1,
      inRawBlock: !1,
      top: !0
    };
    const t = {
      block: block.normal,
      inline: inline.normal
    };
    this.options.pedantic ? (t.block = block.pedantic, t.inline = inline.pedantic) : this.options.gfm && (t.block = block.gfm, this.options.breaks ? t.inline = inline.breaks : t.inline = inline.gfm), this.tokenizer.rules = t;
  }
  /**
   * Expose Rules
   */
  static get rules() {
    return {
      block,
      inline
    };
  }
  /**
   * Static Lex Method
   */
  static lex(e, t) {
    return new _Lexer(t).lex(e);
  }
  /**
   * Static Lex Inline Method
   */
  static lexInline(e, t) {
    return new _Lexer(t).inlineTokens(e);
  }
  /**
   * Preprocessing
   */
  lex(e) {
    e = e.replace(/\r\n|\r/g, `
`), this.blockTokens(e, this.tokens);
    for (let t = 0; t < this.inlineQueue.length; t++) {
      const r = this.inlineQueue[t];
      this.inlineTokens(r.src, r.tokens);
    }
    return this.inlineQueue = [], this.tokens;
  }
  blockTokens(e, t = []) {
    this.options.pedantic ? e = e.replace(/\t/g, "    ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (o, d, v) => d + "    ".repeat(v.length));
    let r, a, s, h;
    for (; e; )
      if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) {
        if (r = this.tokenizer.space(e)) {
          e = e.substring(r.raw.length), r.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
` : t.push(r);
          continue;
        }
        if (r = this.tokenizer.code(e)) {
          e = e.substring(r.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += `
` + r.raw, a.text += `
` + r.text, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r);
          continue;
        }
        if (r = this.tokenizer.fences(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.heading(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.hr(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.blockquote(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.list(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.html(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.def(e)) {
          e = e.substring(r.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += `
` + r.raw, a.text += `
` + r.raw, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
            href: r.href,
            title: r.title
          });
          continue;
        }
        if (r = this.tokenizer.table(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.lheading(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (s = e, this.options.extensions && this.options.extensions.startBlock) {
          let o = 1 / 0;
          const d = e.slice(1);
          let v;
          this.options.extensions.startBlock.forEach((f) => {
            v = f.call({ lexer: this }, d), typeof v == "number" && v >= 0 && (o = Math.min(o, v));
          }), o < 1 / 0 && o >= 0 && (s = e.substring(0, o + 1));
        }
        if (this.state.top && (r = this.tokenizer.paragraph(s))) {
          a = t[t.length - 1], h && a.type === "paragraph" ? (a.raw += `
` + r.raw, a.text += `
` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r), h = s.length !== e.length, e = e.substring(r.raw.length);
          continue;
        }
        if (r = this.tokenizer.text(e)) {
          e = e.substring(r.raw.length), a = t[t.length - 1], a && a.type === "text" ? (a.raw += `
` + r.raw, a.text += `
` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r);
          continue;
        }
        if (e) {
          const o = "Infinite loop on byte: " + e.charCodeAt(0);
          if (this.options.silent) {
            console.error(o);
            break;
          } else
            throw new Error(o);
        }
      }
    return this.state.top = !0, t;
  }
  inline(e, t = []) {
    return this.inlineQueue.push({ src: e, tokens: t }), t;
  }
  /**
   * Lexing/Compiling
   */
  inlineTokens(e, t = []) {
    let r, a, s, h = e, o, d, v;
    if (this.tokens.links) {
      const f = Object.keys(this.tokens.links);
      if (f.length > 0)
        for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(h)) != null; )
          f.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (h = h.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + h.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
    }
    for (; (o = this.tokenizer.rules.inline.blockSkip.exec(h)) != null; )
      h = h.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + h.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
    for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(h)) != null; )
      h = h.slice(0, o.index) + "++" + h.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
    for (; e; )
      if (d || (v = ""), d = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((f) => (r = f.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) {
        if (r = this.tokenizer.escape(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.tag(e)) {
          e = e.substring(r.raw.length), a = t[t.length - 1], a && r.type === "text" && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r);
          continue;
        }
        if (r = this.tokenizer.link(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.reflink(e, this.tokens.links)) {
          e = e.substring(r.raw.length), a = t[t.length - 1], a && r.type === "text" && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r);
          continue;
        }
        if (r = this.tokenizer.emStrong(e, h, v)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.codespan(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.br(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.del(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (r = this.tokenizer.autolink(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (!this.state.inLink && (r = this.tokenizer.url(e))) {
          e = e.substring(r.raw.length), t.push(r);
          continue;
        }
        if (s = e, this.options.extensions && this.options.extensions.startInline) {
          let f = 1 / 0;
          const y = e.slice(1);
          let A;
          this.options.extensions.startInline.forEach((x) => {
            A = x.call({ lexer: this }, y), typeof A == "number" && A >= 0 && (f = Math.min(f, A));
          }), f < 1 / 0 && f >= 0 && (s = e.substring(0, f + 1));
        }
        if (r = this.tokenizer.inlineText(s)) {
          e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (v = r.raw.slice(-1)), d = !0, a = t[t.length - 1], a && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r);
          continue;
        }
        if (e) {
          const f = "Infinite loop on byte: " + e.charCodeAt(0);
          if (this.options.silent) {
            console.error(f);
            break;
          } else
            throw new Error(f);
        }
      }
    return t;
  }
}
class _Renderer {
  options;
  constructor(e) {
    this.options = e || _defaults;
  }
  code(e, t, r) {
    const a = (t || "").match(/^\S*/)?.[0];
    return e = e.replace(/\n$/, "") + `
`, a ? '<pre><code class="language-' + escape$1$1(a) + '">' + (r ? e : escape$1$1(e, !0)) + `</code></pre>
` : "<pre><code>" + (r ? e : escape$1$1(e, !0)) + `</code></pre>
`;
  }
  blockquote(e) {
    return `<blockquote>
${e}</blockquote>
`;
  }
  html(e, t) {
    return e;
  }
  heading(e, t, r) {
    return `<h${t}>${e}</h${t}>
`;
  }
  hr() {
    return `<hr>
`;
  }
  list(e, t, r) {
    const a = t ? "ol" : "ul", s = t && r !== 1 ? ' start="' + r + '"' : "";
    return "<" + a + s + `>
` + e + "</" + a + `>
`;
  }
  listitem(e, t, r) {
    return `<li>${e}</li>
`;
  }
  checkbox(e) {
    return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
  }
  paragraph(e) {
    return `<p>${e}</p>
`;
  }
  table(e, t) {
    return t && (t = `<tbody>${t}</tbody>`), `<table>
<thead>
` + e + `</thead>
` + t + `</table>
`;
  }
  tablerow(e) {
    return `<tr>
${e}</tr>
`;
  }
  tablecell(e, t) {
    const r = t.header ? "th" : "td";
    return (t.align ? `<${r} align="${t.align}">` : `<${r}>`) + e + `</${r}>
`;
  }
  /**
   * span level renderer
   */
  strong(e) {
    return `<strong>${e}</strong>`;
  }
  em(e) {
    return `<em>${e}</em>`;
  }
  codespan(e) {
    return `<code>${e}</code>`;
  }
  br() {
    return "<br>";
  }
  del(e) {
    return `<del>${e}</del>`;
  }
  link(e, t, r) {
    const a = cleanUrl(e);
    if (a === null)
      return r;
    e = a;
    let s = '<a href="' + e + '"';
    return t && (s += ' title="' + t + '"'), s += ">" + r + "</a>", s;
  }
  image(e, t, r) {
    const a = cleanUrl(e);
    if (a === null)
      return r;
    e = a;
    let s = `<img src="${e}" alt="${r}"`;
    return t && (s += ` title="${t}"`), s += ">", s;
  }
  text(e) {
    return e;
  }
}
class _TextRenderer {
  // no need for block level renderers
  strong(e) {
    return e;
  }
  em(e) {
    return e;
  }
  codespan(e) {
    return e;
  }
  del(e) {
    return e;
  }
  html(e) {
    return e;
  }
  text(e) {
    return e;
  }
  link(e, t, r) {
    return "" + r;
  }
  image(e, t, r) {
    return "" + r;
  }
  br() {
    return "";
  }
}
class _Parser {
  options;
  renderer;
  textRenderer;
  constructor(e) {
    this.options = e || _defaults, this.options.renderer = this.options.renderer || new _Renderer(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new _TextRenderer();
  }
  /**
   * Static Parse Method
   */
  static parse(e, t) {
    return new _Parser(t).parse(e);
  }
  /**
   * Static Parse Inline Method
   */
  static parseInline(e, t) {
    return new _Parser(t).parseInline(e);
  }
  /**
   * Parse Loop
   */
  parse(e, t = !0) {
    let r = "";
    for (let a = 0; a < e.length; a++) {
      const s = e[a];
      if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[s.type]) {
        const h = s, o = this.options.extensions.renderers[h.type].call({ parser: this }, h);
        if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(h.type)) {
          r += o || "";
          continue;
        }
      }
      switch (s.type) {
        case "space":
          continue;
        case "hr": {
          r += this.renderer.hr();
          continue;
        }
        case "heading": {
          const h = s;
          r += this.renderer.heading(this.parseInline(h.tokens), h.depth, unescape(this.parseInline(h.tokens, this.textRenderer)));
          continue;
        }
        case "code": {
          const h = s;
          r += this.renderer.code(h.text, h.lang, !!h.escaped);
          continue;
        }
        case "table": {
          const h = s;
          let o = "", d = "";
          for (let f = 0; f < h.header.length; f++)
            d += this.renderer.tablecell(this.parseInline(h.header[f].tokens), { header: !0, align: h.align[f] });
          o += this.renderer.tablerow(d);
          let v = "";
          for (let f = 0; f < h.rows.length; f++) {
            const y = h.rows[f];
            d = "";
            for (let A = 0; A < y.length; A++)
              d += this.renderer.tablecell(this.parseInline(y[A].tokens), { header: !1, align: h.align[A] });
            v += this.renderer.tablerow(d);
          }
          r += this.renderer.table(o, v);
          continue;
        }
        case "blockquote": {
          const h = s, o = this.parse(h.tokens);
          r += this.renderer.blockquote(o);
          continue;
        }
        case "list": {
          const h = s, o = h.ordered, d = h.start, v = h.loose;
          let f = "";
          for (let y = 0; y < h.items.length; y++) {
            const A = h.items[y], x = A.checked, M = A.task;
            let m = "";
            if (A.task) {
              const l = this.renderer.checkbox(!!x);
              v ? A.tokens.length > 0 && A.tokens[0].type === "paragraph" ? (A.tokens[0].text = l + " " + A.tokens[0].text, A.tokens[0].tokens && A.tokens[0].tokens.length > 0 && A.tokens[0].tokens[0].type === "text" && (A.tokens[0].tokens[0].text = l + " " + A.tokens[0].tokens[0].text)) : A.tokens.unshift({
                type: "text",
                text: l + " "
              }) : m += l + " ";
            }
            m += this.parse(A.tokens, v), f += this.renderer.listitem(m, M, !!x);
          }
          r += this.renderer.list(f, o, d);
          continue;
        }
        case "html": {
          const h = s;
          r += this.renderer.html(h.text, h.block);
          continue;
        }
        case "paragraph": {
          const h = s;
          r += this.renderer.paragraph(this.parseInline(h.tokens));
          continue;
        }
        case "text": {
          let h = s, o = h.tokens ? this.parseInline(h.tokens) : h.text;
          for (; a + 1 < e.length && e[a + 1].type === "text"; )
            h = e[++a], o += `
` + (h.tokens ? this.parseInline(h.tokens) : h.text);
          r += t ? this.renderer.paragraph(o) : o;
          continue;
        }
        default: {
          const h = 'Token with "' + s.type + '" type was not found.';
          if (this.options.silent)
            return console.error(h), "";
          throw new Error(h);
        }
      }
    }
    return r;
  }
  /**
   * Parse Inline Tokens
   */
  parseInline(e, t) {
    t = t || this.renderer;
    let r = "";
    for (let a = 0; a < e.length; a++) {
      const s = e[a];
      if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[s.type]) {
        const h = this.options.extensions.renderers[s.type].call({ parser: this }, s);
        if (h !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(s.type)) {
          r += h || "";
          continue;
        }
      }
      switch (s.type) {
        case "escape": {
          const h = s;
          r += t.text(h.text);
          break;
        }
        case "html": {
          const h = s;
          r += t.html(h.text);
          break;
        }
        case "link": {
          const h = s;
          r += t.link(h.href, h.title, this.parseInline(h.tokens, t));
          break;
        }
        case "image": {
          const h = s;
          r += t.image(h.href, h.title, h.text);
          break;
        }
        case "strong": {
          const h = s;
          r += t.strong(this.parseInline(h.tokens, t));
          break;
        }
        case "em": {
          const h = s;
          r += t.em(this.parseInline(h.tokens, t));
          break;
        }
        case "codespan": {
          const h = s;
          r += t.codespan(h.text);
          break;
        }
        case "br": {
          r += t.br();
          break;
        }
        case "del": {
          const h = s;
          r += t.del(this.parseInline(h.tokens, t));
          break;
        }
        case "text": {
          const h = s;
          r += t.text(h.text);
          break;
        }
        default: {
          const h = 'Token with "' + s.type + '" type was not found.';
          if (this.options.silent)
            return console.error(h), "";
          throw new Error(h);
        }
      }
    }
    return r;
  }
}
class _Hooks {
  options;
  constructor(e) {
    this.options = e || _defaults;
  }
  static passThroughHooks = /* @__PURE__ */ new Set([
    "preprocess",
    "postprocess",
    "processAllTokens"
  ]);
  /**
   * Process markdown before marked
   */
  preprocess(e) {
    return e;
  }
  /**
   * Process HTML after marked is finished
   */
  postprocess(e) {
    return e;
  }
  /**
   * Process all tokens before walk tokens
   */
  processAllTokens(e) {
    return e;
  }
}
class Marked {
  defaults = _getDefaults();
  options = this.setOptions;
  parse = this.#e(_Lexer.lex, _Parser.parse);
  parseInline = this.#e(_Lexer.lexInline, _Parser.parseInline);
  Parser = _Parser;
  Renderer = _Renderer;
  TextRenderer = _TextRenderer;
  Lexer = _Lexer;
  Tokenizer = _Tokenizer;
  Hooks = _Hooks;
  constructor(...e) {
    this.use(...e);
  }
  /**
   * Run callback for every token
   */
  walkTokens(e, t) {
    let r = [];
    for (const a of e)
      switch (r = r.concat(t.call(this, a)), a.type) {
        case "table": {
          const s = a;
          for (const h of s.header)
            r = r.concat(this.walkTokens(h.tokens, t));
          for (const h of s.rows)
            for (const o of h)
              r = r.concat(this.walkTokens(o.tokens, t));
          break;
        }
        case "list": {
          const s = a;
          r = r.concat(this.walkTokens(s.items, t));
          break;
        }
        default: {
          const s = a;
          this.defaults.extensions?.childTokens?.[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((h) => {
            const o = s[h].flat(1 / 0);
            r = r.concat(this.walkTokens(o, t));
          }) : s.tokens && (r = r.concat(this.walkTokens(s.tokens, t)));
        }
      }
    return r;
  }
  use(...e) {
    const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
    return e.forEach((r) => {
      const a = { ...r };
      if (a.async = this.defaults.async || a.async || !1, r.extensions && (r.extensions.forEach((s) => {
        if (!s.name)
          throw new Error("extension name required");
        if ("renderer" in s) {
          const h = t.renderers[s.name];
          h ? t.renderers[s.name] = function(...o) {
            let d = s.renderer.apply(this, o);
            return d === !1 && (d = h.apply(this, o)), d;
          } : t.renderers[s.name] = s.renderer;
        }
        if ("tokenizer" in s) {
          if (!s.level || s.level !== "block" && s.level !== "inline")
            throw new Error("extension level must be 'block' or 'inline'");
          const h = t[s.level];
          h ? h.unshift(s.tokenizer) : t[s.level] = [s.tokenizer], s.start && (s.level === "block" ? t.startBlock ? t.startBlock.push(s.start) : t.startBlock = [s.start] : s.level === "inline" && (t.startInline ? t.startInline.push(s.start) : t.startInline = [s.start]));
        }
        "childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
      }), a.extensions = t), r.renderer) {
        const s = this.defaults.renderer || new _Renderer(this.defaults);
        for (const h in r.renderer) {
          if (!(h in s))
            throw new Error(`renderer '${h}' does not exist`);
          if (h === "options")
            continue;
          const o = h, d = r.renderer[o], v = s[o];
          s[o] = (...f) => {
            let y = d.apply(s, f);
            return y === !1 && (y = v.apply(s, f)), y || "";
          };
        }
        a.renderer = s;
      }
      if (r.tokenizer) {
        const s = this.defaults.tokenizer || new _Tokenizer(this.defaults);
        for (const h in r.tokenizer) {
          if (!(h in s))
            throw new Error(`tokenizer '${h}' does not exist`);
          if (["options", "rules", "lexer"].includes(h))
            continue;
          const o = h, d = r.tokenizer[o], v = s[o];
          s[o] = (...f) => {
            let y = d.apply(s, f);
            return y === !1 && (y = v.apply(s, f)), y;
          };
        }
        a.tokenizer = s;
      }
      if (r.hooks) {
        const s = this.defaults.hooks || new _Hooks();
        for (const h in r.hooks) {
          if (!(h in s))
            throw new Error(`hook '${h}' does not exist`);
          if (h === "options")
            continue;
          const o = h, d = r.hooks[o], v = s[o];
          _Hooks.passThroughHooks.has(h) ? s[o] = (f) => {
            if (this.defaults.async)
              return Promise.resolve(d.call(s, f)).then((A) => v.call(s, A));
            const y = d.call(s, f);
            return v.call(s, y);
          } : s[o] = (...f) => {
            let y = d.apply(s, f);
            return y === !1 && (y = v.apply(s, f)), y;
          };
        }
        a.hooks = s;
      }
      if (r.walkTokens) {
        const s = this.defaults.walkTokens, h = r.walkTokens;
        a.walkTokens = function(o) {
          let d = [];
          return d.push(h.call(this, o)), s && (d = d.concat(s.call(this, o))), d;
        };
      }
      this.defaults = { ...this.defaults, ...a };
    }), this;
  }
  setOptions(e) {
    return this.defaults = { ...this.defaults, ...e }, this;
  }
  lexer(e, t) {
    return _Lexer.lex(e, t ?? this.defaults);
  }
  parser(e, t) {
    return _Parser.parse(e, t ?? this.defaults);
  }
  #e(e, t) {
    return (r, a) => {
      const s = { ...a }, h = { ...this.defaults, ...s };
      this.defaults.async === !0 && s.async === !1 && (h.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), h.async = !0);
      const o = this.#t(!!h.silent, !!h.async);
      if (typeof r > "u" || r === null)
        return o(new Error("marked(): input parameter is undefined or null"));
      if (typeof r != "string")
        return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(r) + ", string expected"));
      if (h.hooks && (h.hooks.options = h), h.async)
        return Promise.resolve(h.hooks ? h.hooks.preprocess(r) : r).then((d) => e(d, h)).then((d) => h.hooks ? h.hooks.processAllTokens(d) : d).then((d) => h.walkTokens ? Promise.all(this.walkTokens(d, h.walkTokens)).then(() => d) : d).then((d) => t(d, h)).then((d) => h.hooks ? h.hooks.postprocess(d) : d).catch(o);
      try {
        h.hooks && (r = h.hooks.preprocess(r));
        let d = e(r, h);
        h.hooks && (d = h.hooks.processAllTokens(d)), h.walkTokens && this.walkTokens(d, h.walkTokens);
        let v = t(d, h);
        return h.hooks && (v = h.hooks.postprocess(v)), v;
      } catch (d) {
        return o(d);
      }
    };
  }
  #t(e, t) {
    return (r) => {
      if (r.message += `
Please report this to https://github.com/markedjs/marked.`, e) {
        const a = "<p>An error occurred:</p><pre>" + escape$1$1(r.message + "", !0) + "</pre>";
        return t ? Promise.resolve(a) : a;
      }
      if (t)
        return Promise.reject(r);
      throw r;
    };
  }
}
const markedInstance = new Marked();
function marked(n, e) {
  return markedInstance.parse(n, e);
}
marked.options = marked.setOptions = function(n) {
  return markedInstance.setOptions(n), marked.defaults = markedInstance.defaults, changeDefaults(marked.defaults), marked;
};
marked.getDefaults = _getDefaults;
marked.defaults = _defaults;
marked.use = function(...n) {
  return markedInstance.use(...n), marked.defaults = markedInstance.defaults, changeDefaults(marked.defaults), marked;
};
marked.walkTokens = function(n, e) {
  return markedInstance.walkTokens(n, e);
};
marked.parseInline = markedInstance.parseInline;
marked.Parser = _Parser;
marked.parser = _Parser.parse;
marked.Renderer = _Renderer;
marked.TextRenderer = _TextRenderer;
marked.Lexer = _Lexer;
marked.lexer = _Lexer.lex;
marked.Tokenizer = _Tokenizer;
marked.Hooks = _Hooks;
marked.parse = marked;
marked.options;
marked.setOptions;
marked.use;
marked.walkTokens;
marked.parseInline;
_Parser.parse;
_Lexer.lex;
function markedHighlight(n) {
  if (typeof n == "function" && (n = {
    highlight: n
  }), !n || typeof n.highlight != "function")
    throw new Error("Must provide highlight function");
  return typeof n.langPrefix != "string" && (n.langPrefix = "language-"), typeof n.emptyLangClass != "string" && (n.emptyLangClass = ""), {
    async: !!n.async,
    walkTokens(e) {
      if (e.type !== "code")
        return;
      const t = getLang(e.lang);
      if (n.async)
        return Promise.resolve(n.highlight(e.text, t, e.lang || "")).then(updateToken(e));
      const r = n.highlight(e.text, t, e.lang || "");
      if (r instanceof Promise)
        throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");
      updateToken(e)(r);
    },
    useNewRenderer: !0,
    renderer: {
      code(e, t, r) {
        typeof e == "object" && (r = e.escaped, t = e.lang, e = e.text);
        const a = getLang(t), s = a ? n.langPrefix + escape$1(a) : n.emptyLangClass, h = s ? ` class="${s}"` : "";
        return e = e.replace(/\n$/, ""), `<pre><code${h}>${r ? e : escape$1(e, !0)}
</code></pre>`;
      }
    }
  };
}
function getLang(n) {
  return (n || "").match(/\S*/)[0];
}
function updateToken(n) {
  return (e) => {
    typeof e == "string" && e !== n.text && (n.escaped = !0, n.text = e);
  };
}
const escapeTest = /[&<>"']/, escapeReplace = new RegExp(escapeTest.source, "g"), escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g"), escapeReplacements = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, getEscapeReplacement = (n) => escapeReplacements[n];
function escape$1(n, e) {
  if (e) {
    if (escapeTest.test(n))
      return n.replace(escapeReplace, getEscapeReplacement);
  } else if (escapeTestNoEncode.test(n))
    return n.replace(escapeReplaceNoEncode, getEscapeReplacement);
  return n;
}
const regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g, own = Object.hasOwnProperty;
class BananaSlug {
  /**
   * Create a new slug class.
   */
  constructor() {
    this.occurrences, this.reset();
  }
  /**
   * Generate a unique slug.
  *
  * Tracks previously generated slugs: repeated calls with the same value
  * will result in different slugs.
  * Use the `slug` function to get same slugs.
   *
   * @param  {string} value
   *   String of text to slugify
   * @param  {boolean} [maintainCase=false]
   *   Keep the current case, otherwise make all lowercase
   * @return {string}
   *   A unique slug string
   */
  slug(e, t) {
    const r = this;
    let a = slug(e, t === !0);
    const s = a;
    for (; own.call(r.occurrences, a); )
      r.occurrences[s]++, a = s + "-" + r.occurrences[s];
    return r.occurrences[a] = 0, a;
  }
  /**
   * Reset - Forget all previous slugs
   *
   * @return void
   */
  reset() {
    this.occurrences = /* @__PURE__ */ Object.create(null);
  }
}
function slug(n, e) {
  return typeof n != "string" ? "" : (e || (n = n.toLowerCase()), n.replace(regex, "").replace(/ /g, "-"));
}
let slugger$1 = new BananaSlug(), headings = [];
function gfmHeadingId({ prefix: n = "", globalSlugs: e = !1 } = {}) {
  return {
    headerIds: !1,
    // prevent deprecation warning; remove this once headerIds option is removed
    hooks: {
      preprocess(t) {
        return e || resetHeadings(), t;
      }
    },
    renderer: {
      heading(t, r, a) {
        a = a.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi, "");
        const s = `${n}${slugger$1.slug(a)}`, h = { level: r, text: t, id: s };
        return headings.push(h), `<h${r} id="${s}">${t}</h${r}>
`;
      }
    }
  };
}
function resetHeadings() {
  headings = [], slugger$1 = new BananaSlug();
}
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs(n) {
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
var prism = { exports: {} };
(function(n) {
  var e = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
  /**
   * Prism: Lightweight, robust, elegant syntax highlighting
   *
   * @license MIT <https://opensource.org/licenses/MIT>
   * @author Lea Verou <https://lea.verou.me>
   * @namespace
   * @public
   */
  var t = function(r) {
    var a = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, s = 0, h = {}, o = {
      /**
       * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
       * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
       * additional languages or plugins yourself.
       *
       * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
       *
       * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
       * empty Prism object into the global scope before loading the Prism script like this:
       *
       * ```js
       * window.Prism = window.Prism || {};
       * Prism.manual = true;
       * // add a new <script> to load Prism's script
       * ```
       *
       * @default false
       * @type {boolean}
       * @memberof Prism
       * @public
       */
      manual: r.Prism && r.Prism.manual,
      /**
       * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
       * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
       * own worker, you don't want it to do this.
       *
       * By setting this value to `true`, Prism will not add its own listeners to the worker.
       *
       * You obviously have to change this value before Prism executes. To do this, you can add an
       * empty Prism object into the global scope before loading the Prism script like this:
       *
       * ```js
       * window.Prism = window.Prism || {};
       * Prism.disableWorkerMessageHandler = true;
       * // Load Prism's script
       * ```
       *
       * @default false
       * @type {boolean}
       * @memberof Prism
       * @public
       */
      disableWorkerMessageHandler: r.Prism && r.Prism.disableWorkerMessageHandler,
      /**
       * A namespace for utility methods.
       *
       * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
       * change or disappear at any time.
       *
       * @namespace
       * @memberof Prism
       */
      util: {
        encode: function p(g) {
          return g instanceof d ? new d(g.type, p(g.content), g.alias) : Array.isArray(g) ? g.map(p) : g.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
        },
        /**
         * Returns the name of the type of the given value.
         *
         * @param {any} o
         * @returns {string}
         * @example
         * type(null)      === 'Null'
         * type(undefined) === 'Undefined'
         * type(123)       === 'Number'
         * type('foo')     === 'String'
         * type(true)      === 'Boolean'
         * type([1, 2])    === 'Array'
         * type({})        === 'Object'
         * type(String)    === 'Function'
         * type(/abc+/)    === 'RegExp'
         */
        type: function(p) {
          return Object.prototype.toString.call(p).slice(8, -1);
        },
        /**
         * Returns a unique number for the given object. Later calls will still return the same number.
         *
         * @param {Object} obj
         * @returns {number}
         */
        objId: function(p) {
          return p.__id || Object.defineProperty(p, "__id", { value: ++s }), p.__id;
        },
        /**
         * Creates a deep clone of the given object.
         *
         * The main intended use of this function is to clone language definitions.
         *
         * @param {T} o
         * @param {Record<number, any>} [visited]
         * @returns {T}
         * @template T
         */
        clone: function p(g, b) {
          b = b || {};
          var c, _;
          switch (o.util.type(g)) {
            case "Object":
              if (_ = o.util.objId(g), b[_])
                return b[_];
              c = /** @type {Record<string, any>} */
              {}, b[_] = c;
              for (var E in g)
                g.hasOwnProperty(E) && (c[E] = p(g[E], b));
              return (
                /** @type {any} */
                c
              );
            case "Array":
              return _ = o.util.objId(g), b[_] ? b[_] : (c = [], b[_] = c, /** @type {Array} */
              /** @type {any} */
              g.forEach(function(w, k) {
                c[k] = p(w, b);
              }), /** @type {any} */
              c);
            default:
              return g;
          }
        },
        /**
         * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
         *
         * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
         *
         * @param {Element} element
         * @returns {string}
         */
        getLanguage: function(p) {
          for (; p; ) {
            var g = a.exec(p.className);
            if (g)
              return g[1].toLowerCase();
            p = p.parentElement;
          }
          return "none";
        },
        /**
         * Sets the Prism `language-xxxx` class of the given element.
         *
         * @param {Element} element
         * @param {string} language
         * @returns {void}
         */
        setLanguage: function(p, g) {
          p.className = p.className.replace(RegExp(a, "gi"), ""), p.classList.add("language-" + g);
        },
        /**
         * Returns the script element that is currently executing.
         *
         * This does __not__ work for line script element.
         *
         * @returns {HTMLScriptElement | null}
         */
        currentScript: function() {
          if (typeof document > "u")
            return null;
          if ("currentScript" in document)
            return (
              /** @type {any} */
              document.currentScript
            );
          try {
            throw new Error();
          } catch (c) {
            var p = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(c.stack) || [])[1];
            if (p) {
              var g = document.getElementsByTagName("script");
              for (var b in g)
                if (g[b].src == p)
                  return g[b];
            }
            return null;
          }
        },
        /**
         * Returns whether a given class is active for `element`.
         *
         * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
         * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
         * given class is just the given class with a `no-` prefix.
         *
         * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
         * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
         * ancestors have the given class or the negated version of it, then the default activation will be returned.
         *
         * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
         * version of it, the class is considered active.
         *
         * @param {Element} element
         * @param {string} className
         * @param {boolean} [defaultActivation=false]
         * @returns {boolean}
         */
        isActive: function(p, g, b) {
          for (var c = "no-" + g; p; ) {
            var _ = p.classList;
            if (_.contains(g))
              return !0;
            if (_.contains(c))
              return !1;
            p = p.parentElement;
          }
          return !!b;
        }
      },
      /**
       * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
       *
       * @namespace
       * @memberof Prism
       * @public
       */
      languages: {
        /**
         * The grammar for plain, unformatted text.
         */
        plain: h,
        plaintext: h,
        text: h,
        txt: h,
        /**
         * Creates a deep copy of the language with the given id and appends the given tokens.
         *
         * If a token in `redef` also appears in the copied language, then the existing token in the copied language
         * will be overwritten at its original position.
         *
         * ## Best practices
         *
         * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
         * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
         * understand the language definition because, normally, the order of tokens matters in Prism grammars.
         *
         * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
         * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
         *
         * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
         * @param {Grammar} redef The new tokens to append.
         * @returns {Grammar} The new language created.
         * @public
         * @example
         * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
         *     // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
         *     // at its original position
         *     'comment': { ... },
         *     // CSS doesn't have a 'color' token, so this token will be appended
         *     'color': /\b(?:red|green|blue)\b/
         * });
         */
        extend: function(p, g) {
          var b = o.util.clone(o.languages[p]);
          for (var c in g)
            b[c] = g[c];
          return b;
        },
        /**
         * Inserts tokens _before_ another token in a language definition or any other grammar.
         *
         * ## Usage
         *
         * This helper method makes it easy to modify existing languages. For example, the CSS language definition
         * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
         * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
         * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
         * this:
         *
         * ```js
         * Prism.languages.markup.style = {
         *     // token
         * };
         * ```
         *
         * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
         * before existing tokens. For the CSS example above, you would use it like this:
         *
         * ```js
         * Prism.languages.insertBefore('markup', 'cdata', {
         *     'style': {
         *         // token
         *     }
         * });
         * ```
         *
         * ## Special cases
         *
         * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
         * will be ignored.
         *
         * This behavior can be used to insert tokens after `before`:
         *
         * ```js
         * Prism.languages.insertBefore('markup', 'comment', {
         *     'comment': Prism.languages.markup.comment,
         *     // tokens after 'comment'
         * });
         * ```
         *
         * ## Limitations
         *
         * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
         * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
         * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
         * deleting properties which is necessary to insert at arbitrary positions.
         *
         * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
         * Instead, it will create a new object and replace all references to the target object with the new one. This
         * can be done without temporarily deleting properties, so the iteration order is well-defined.
         *
         * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
         * you hold the target object in a variable, then the value of the variable will not change.
         *
         * ```js
         * var oldMarkup = Prism.languages.markup;
         * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
         *
         * assert(oldMarkup !== Prism.languages.markup);
         * assert(newMarkup === Prism.languages.markup);
         * ```
         *
         * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
         * object to be modified.
         * @param {string} before The key to insert before.
         * @param {Grammar} insert An object containing the key-value pairs to be inserted.
         * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
         * object to be modified.
         *
         * Defaults to `Prism.languages`.
         * @returns {Grammar} The new grammar object.
         * @public
         */
        insertBefore: function(p, g, b, c) {
          c = c || /** @type {any} */
          o.languages;
          var _ = c[p], E = {};
          for (var w in _)
            if (_.hasOwnProperty(w)) {
              if (w == g)
                for (var k in b)
                  b.hasOwnProperty(k) && (E[k] = b[k]);
              b.hasOwnProperty(w) || (E[w] = _[w]);
            }
          var $ = c[p];
          return c[p] = E, o.languages.DFS(o.languages, function(L, z) {
            z === $ && L != p && (this[L] = E);
          }), E;
        },
        // Traverse a language definition with Depth First Search
        DFS: function p(g, b, c, _) {
          _ = _ || {};
          var E = o.util.objId;
          for (var w in g)
            if (g.hasOwnProperty(w)) {
              b.call(g, w, g[w], c || w);
              var k = g[w], $ = o.util.type(k);
              $ === "Object" && !_[E(k)] ? (_[E(k)] = !0, p(k, b, null, _)) : $ === "Array" && !_[E(k)] && (_[E(k)] = !0, p(k, b, w, _));
            }
        }
      },
      plugins: {},
      /**
       * This is the most high-level function in Prism’s API.
       * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
       * each one of them.
       *
       * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
       *
       * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
       * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
       * @memberof Prism
       * @public
       */
      highlightAll: function(p, g) {
        o.highlightAllUnder(document, p, g);
      },
      /**
       * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
       * {@link Prism.highlightElement} on each one of them.
       *
       * The following hooks will be run:
       * 1. `before-highlightall`
       * 2. `before-all-elements-highlight`
       * 3. All hooks of {@link Prism.highlightElement} for each element.
       *
       * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
       * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
       * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
       * @memberof Prism
       * @public
       */
      highlightAllUnder: function(p, g, b) {
        var c = {
          callback: b,
          container: p,
          selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
        };
        o.hooks.run("before-highlightall", c), c.elements = Array.prototype.slice.apply(c.container.querySelectorAll(c.selector)), o.hooks.run("before-all-elements-highlight", c);
        for (var _ = 0, E; E = c.elements[_++]; )
          o.highlightElement(E, g === !0, c.callback);
      },
      /**
       * Highlights the code inside a single element.
       *
       * The following hooks will be run:
       * 1. `before-sanity-check`
       * 2. `before-highlight`
       * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
       * 4. `before-insert`
       * 5. `after-highlight`
       * 6. `complete`
       *
       * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
       * the element's language.
       *
       * @param {Element} element The element containing the code.
       * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
       * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
       * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
       * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
       *
       * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
       * asynchronous highlighting to work. You can build your own bundle on the
       * [Download page](https://prismjs.com/download.html).
       * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
       * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
       * @memberof Prism
       * @public
       */
      highlightElement: function(p, g, b) {
        var c = o.util.getLanguage(p), _ = o.languages[c];
        o.util.setLanguage(p, c);
        var E = p.parentElement;
        E && E.nodeName.toLowerCase() === "pre" && o.util.setLanguage(E, c);
        var w = p.textContent, k = {
          element: p,
          language: c,
          grammar: _,
          code: w
        };
        function $(z) {
          k.highlightedCode = z, o.hooks.run("before-insert", k), k.element.innerHTML = k.highlightedCode, o.hooks.run("after-highlight", k), o.hooks.run("complete", k), b && b.call(k.element);
        }
        if (o.hooks.run("before-sanity-check", k), E = k.element.parentElement, E && E.nodeName.toLowerCase() === "pre" && !E.hasAttribute("tabindex") && E.setAttribute("tabindex", "0"), !k.code) {
          o.hooks.run("complete", k), b && b.call(k.element);
          return;
        }
        if (o.hooks.run("before-highlight", k), !k.grammar) {
          $(o.util.encode(k.code));
          return;
        }
        if (g && r.Worker) {
          var L = new Worker(o.filename);
          L.onmessage = function(z) {
            $(z.data);
          }, L.postMessage(JSON.stringify({
            language: k.language,
            code: k.code,
            immediateClose: !0
          }));
        } else
          $(o.highlight(k.code, k.grammar, k.language));
      },
      /**
       * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
       * and the language definitions to use, and returns a string with the HTML produced.
       *
       * The following hooks will be run:
       * 1. `before-tokenize`
       * 2. `after-tokenize`
       * 3. `wrap`: On each {@link Token}.
       *
       * @param {string} text A string with the code to be highlighted.
       * @param {Grammar} grammar An object containing the tokens to use.
       *
       * Usually a language definition like `Prism.languages.markup`.
       * @param {string} language The name of the language definition passed to `grammar`.
       * @returns {string} The highlighted HTML.
       * @memberof Prism
       * @public
       * @example
       * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
       */
      highlight: function(p, g, b) {
        var c = {
          code: p,
          grammar: g,
          language: b
        };
        if (o.hooks.run("before-tokenize", c), !c.grammar)
          throw new Error('The language "' + c.language + '" has no grammar.');
        return c.tokens = o.tokenize(c.code, c.grammar), o.hooks.run("after-tokenize", c), d.stringify(o.util.encode(c.tokens), c.language);
      },
      /**
       * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
       * and the language definitions to use, and returns an array with the tokenized code.
       *
       * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
       *
       * This method could be useful in other contexts as well, as a very crude parser.
       *
       * @param {string} text A string with the code to be highlighted.
       * @param {Grammar} grammar An object containing the tokens to use.
       *
       * Usually a language definition like `Prism.languages.markup`.
       * @returns {TokenStream} An array of strings and tokens, a token stream.
       * @memberof Prism
       * @public
       * @example
       * let code = `var foo = 0;`;
       * let tokens = Prism.tokenize(code, Prism.languages.javascript);
       * tokens.forEach(token => {
       *     if (token instanceof Prism.Token && token.type === 'number') {
       *         console.log(`Found numeric literal: ${token.content}`);
       *     }
       * });
       */
      tokenize: function(p, g) {
        var b = g.rest;
        if (b) {
          for (var c in b)
            g[c] = b[c];
          delete g.rest;
        }
        var _ = new y();
        return A(_, _.head, p), f(p, _, g, _.head, 0), M(_);
      },
      /**
       * @namespace
       * @memberof Prism
       * @public
       */
      hooks: {
        all: {},
        /**
         * Adds the given callback to the list of callbacks for the given hook.
         *
         * The callback will be invoked when the hook it is registered for is run.
         * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
         *
         * One callback function can be registered to multiple hooks and the same hook multiple times.
         *
         * @param {string} name The name of the hook.
         * @param {HookCallback} callback The callback function which is given environment variables.
         * @public
         */
        add: function(p, g) {
          var b = o.hooks.all;
          b[p] = b[p] || [], b[p].push(g);
        },
        /**
         * Runs a hook invoking all registered callbacks with the given environment variables.
         *
         * Callbacks will be invoked synchronously and in the order in which they were registered.
         *
         * @param {string} name The name of the hook.
         * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
         * @public
         */
        run: function(p, g) {
          var b = o.hooks.all[p];
          if (!(!b || !b.length))
            for (var c = 0, _; _ = b[c++]; )
              _(g);
        }
      },
      Token: d
    };
    r.Prism = o;
    function d(p, g, b, c) {
      this.type = p, this.content = g, this.alias = b, this.length = (c || "").length | 0;
    }
    d.stringify = function p(g, b) {
      if (typeof g == "string")
        return g;
      if (Array.isArray(g)) {
        var c = "";
        return g.forEach(function($) {
          c += p($, b);
        }), c;
      }
      var _ = {
        type: g.type,
        content: p(g.content, b),
        tag: "span",
        classes: ["token", g.type],
        attributes: {},
        language: b
      }, E = g.alias;
      E && (Array.isArray(E) ? Array.prototype.push.apply(_.classes, E) : _.classes.push(E)), o.hooks.run("wrap", _);
      var w = "";
      for (var k in _.attributes)
        w += " " + k + '="' + (_.attributes[k] || "").replace(/"/g, "&quot;") + '"';
      return "<" + _.tag + ' class="' + _.classes.join(" ") + '"' + w + ">" + _.content + "</" + _.tag + ">";
    };
    function v(p, g, b, c) {
      p.lastIndex = g;
      var _ = p.exec(b);
      if (_ && c && _[1]) {
        var E = _[1].length;
        _.index += E, _[0] = _[0].slice(E);
      }
      return _;
    }
    function f(p, g, b, c, _, E) {
      for (var w in b)
        if (!(!b.hasOwnProperty(w) || !b[w])) {
          var k = b[w];
          k = Array.isArray(k) ? k : [k];
          for (var $ = 0; $ < k.length; ++$) {
            if (E && E.cause == w + "," + $)
              return;
            var L = k[$], z = L.inside, F = !!L.lookbehind, R = !!L.greedy, P = L.alias;
            if (R && !L.pattern.global) {
              var U = L.pattern.toString().match(/[imsuy]*$/)[0];
              L.pattern = RegExp(L.pattern.source, U + "g");
            }
            for (var N = L.pattern || L, B = c.next, W = _; B !== g.tail && !(E && W >= E.reach); W += B.value.length, B = B.next) {
              var V = B.value;
              if (g.length > p.length)
                return;
              if (!(V instanceof d)) {
                var G = 1, H;
                if (R) {
                  if (H = v(N, W, p, F), !H || H.index >= p.length)
                    break;
                  var ce = H.index, Q = H.index + H[0].length, te = W;
                  for (te += B.value.length; ce >= te; )
                    B = B.next, te += B.value.length;
                  if (te -= B.value.length, W = te, B.value instanceof d)
                    continue;
                  for (var ee = B; ee !== g.tail && (te < Q || typeof ee.value == "string"); ee = ee.next)
                    G++, te += ee.value.length;
                  G--, V = p.slice(W, te), H.index -= W;
                } else if (H = v(N, 0, V, F), !H)
                  continue;
                var ce = H.index, fe = H[0], oe = V.slice(0, ce), he = V.slice(ce + fe.length), Ae = W + V.length;
                E && Ae > E.reach && (E.reach = Ae);
                var Se = B.prev;
                oe && (Se = A(g, Se, oe), W += oe.length), x(g, Se, G);
                var Ie = new d(w, z ? o.tokenize(fe, z) : fe, P, fe);
                if (B = A(g, Se, Ie), he && A(g, B, he), G > 1) {
                  var pe = {
                    cause: w + "," + $,
                    reach: Ae
                  };
                  f(p, g, b, B.prev, W, pe), E && pe.reach > E.reach && (E.reach = pe.reach);
                }
              }
            }
          }
        }
    }
    function y() {
      var p = { value: null, prev: null, next: null }, g = { value: null, prev: p, next: null };
      p.next = g, this.head = p, this.tail = g, this.length = 0;
    }
    function A(p, g, b) {
      var c = g.next, _ = { value: b, prev: g, next: c };
      return g.next = _, c.prev = _, p.length++, _;
    }
    function x(p, g, b) {
      for (var c = g.next, _ = 0; _ < b && c !== p.tail; _++)
        c = c.next;
      g.next = c, c.prev = g, p.length -= _;
    }
    function M(p) {
      for (var g = [], b = p.head.next; b !== p.tail; )
        g.push(b.value), b = b.next;
      return g;
    }
    if (!r.document)
      return r.addEventListener && (o.disableWorkerMessageHandler || r.addEventListener("message", function(p) {
        var g = JSON.parse(p.data), b = g.language, c = g.code, _ = g.immediateClose;
        r.postMessage(o.highlight(c, o.languages[b], b)), _ && r.close();
      }, !1)), o;
    var m = o.util.currentScript();
    m && (o.filename = m.src, m.hasAttribute("data-manual") && (o.manual = !0));
    function l() {
      o.manual || o.highlightAll();
    }
    if (!o.manual) {
      var u = document.readyState;
      u === "loading" || u === "interactive" && m && m.defer ? document.addEventListener("DOMContentLoaded", l) : window.requestAnimationFrame ? window.requestAnimationFrame(l) : window.setTimeout(l, 16);
    }
    return o;
  }(e);
  n.exports && (n.exports = t), typeof commonjsGlobal < "u" && (commonjsGlobal.Prism = t), t.languages.markup = {
    comment: {
      pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
      greedy: !0
    },
    prolog: {
      pattern: /<\?[\s\S]+?\?>/,
      greedy: !0
    },
    doctype: {
      // https://www.w3.org/TR/xml/#NT-doctypedecl
      pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
      greedy: !0,
      inside: {
        "internal-subset": {
          pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
          lookbehind: !0,
          greedy: !0,
          inside: null
          // see below
        },
        string: {
          pattern: /"[^"]*"|'[^']*'/,
          greedy: !0
        },
        punctuation: /^<!|>$|[[\]]/,
        "doctype-tag": /^DOCTYPE/i,
        name: /[^\s<>'"]+/
      }
    },
    cdata: {
      pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
      greedy: !0
    },
    tag: {
      pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
      greedy: !0,
      inside: {
        tag: {
          pattern: /^<\/?[^\s>\/]+/,
          inside: {
            punctuation: /^<\/?/,
            namespace: /^[^\s>\/:]+:/
          }
        },
        "special-attr": [],
        "attr-value": {
          pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
          inside: {
            punctuation: [
              {
                pattern: /^=/,
                alias: "attr-equals"
              },
              {
                pattern: /^(\s*)["']|["']$/,
                lookbehind: !0
              }
            ]
          }
        },
        punctuation: /\/?>/,
        "attr-name": {
          pattern: /[^\s>\/]+/,
          inside: {
            namespace: /^[^\s>\/:]+:/
          }
        }
      }
    },
    entity: [
      {
        pattern: /&[\da-z]{1,8};/i,
        alias: "named-entity"
      },
      /&#x?[\da-f]{1,8};/i
    ]
  }, t.languages.markup.tag.inside["attr-value"].inside.entity = t.languages.markup.entity, t.languages.markup.doctype.inside["internal-subset"].inside = t.languages.markup, t.hooks.add("wrap", function(r) {
    r.type === "entity" && (r.attributes.title = r.content.replace(/&amp;/, "&"));
  }), Object.defineProperty(t.languages.markup.tag, "addInlined", {
    /**
     * Adds an inlined language to markup.
     *
     * An example of an inlined language is CSS with `<style>` tags.
     *
     * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
     * case insensitive.
     * @param {string} lang The language key.
     * @example
     * addInlined('style', 'css');
     */
    value: function(a, s) {
      var h = {};
      h["language-" + s] = {
        pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
        lookbehind: !0,
        inside: t.languages[s]
      }, h.cdata = /^<!\[CDATA\[|\]\]>$/i;
      var o = {
        "included-cdata": {
          pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
          inside: h
        }
      };
      o["language-" + s] = {
        pattern: /[\s\S]+/,
        inside: t.languages[s]
      };
      var d = {};
      d[a] = {
        pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
          return a;
        }), "i"),
        lookbehind: !0,
        greedy: !0,
        inside: o
      }, t.languages.insertBefore("markup", "cdata", d);
    }
  }), Object.defineProperty(t.languages.markup.tag, "addAttribute", {
    /**
     * Adds an pattern to highlight languages embedded in HTML attributes.
     *
     * An example of an inlined language is CSS with `style` attributes.
     *
     * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
     * case insensitive.
     * @param {string} lang The language key.
     * @example
     * addAttribute('style', 'css');
     */
    value: function(r, a) {
      t.languages.markup.tag.inside["special-attr"].push({
        pattern: RegExp(
          /(^|["'\s])/.source + "(?:" + r + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
          "i"
        ),
        lookbehind: !0,
        inside: {
          "attr-name": /^[^\s=]+/,
          "attr-value": {
            pattern: /=[\s\S]+/,
            inside: {
              value: {
                pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
                lookbehind: !0,
                alias: [a, "language-" + a],
                inside: t.languages[a]
              },
              punctuation: [
                {
                  pattern: /^=/,
                  alias: "attr-equals"
                },
                /"|'/
              ]
            }
          }
        }
      });
    }
  }), t.languages.html = t.languages.markup, t.languages.mathml = t.languages.markup, t.languages.svg = t.languages.markup, t.languages.xml = t.languages.extend("markup", {}), t.languages.ssml = t.languages.xml, t.languages.atom = t.languages.xml, t.languages.rss = t.languages.xml, function(r) {
    var a = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
    r.languages.css = {
      comment: /\/\*[\s\S]*?\*\//,
      atrule: {
        pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + a.source + ")*?" + /(?:;|(?=\s*\{))/.source),
        inside: {
          rule: /^@[\w-]+/,
          "selector-function-argument": {
            pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
            lookbehind: !0,
            alias: "selector"
          },
          keyword: {
            pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
            lookbehind: !0
          }
          // See rest below
        }
      },
      url: {
        // https://drafts.csswg.org/css-values-3/#urls
        pattern: RegExp("\\burl\\((?:" + a.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
        greedy: !0,
        inside: {
          function: /^url/i,
          punctuation: /^\(|\)$/,
          string: {
            pattern: RegExp("^" + a.source + "$"),
            alias: "url"
          }
        }
      },
      selector: {
        pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + a.source + ")*(?=\\s*\\{)"),
        lookbehind: !0
      },
      string: {
        pattern: a,
        greedy: !0
      },
      property: {
        pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
        lookbehind: !0
      },
      important: /!important\b/i,
      function: {
        pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
        lookbehind: !0
      },
      punctuation: /[(){};:,]/
    }, r.languages.css.atrule.inside.rest = r.languages.css;
    var s = r.languages.markup;
    s && (s.tag.addInlined("style", "css"), s.tag.addAttribute("style", "css"));
  }(t), t.languages.clike = {
    comment: [
      {
        pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
        lookbehind: !0,
        greedy: !0
      },
      {
        pattern: /(^|[^\\:])\/\/.*/,
        lookbehind: !0,
        greedy: !0
      }
    ],
    string: {
      pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
      greedy: !0
    },
    "class-name": {
      pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
      lookbehind: !0,
      inside: {
        punctuation: /[.\\]/
      }
    },
    keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
    boolean: /\b(?:false|true)\b/,
    function: /\b\w+(?=\()/,
    number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
    operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
    punctuation: /[{}[\];(),.:]/
  }, t.languages.javascript = t.languages.extend("clike", {
    "class-name": [
      t.languages.clike["class-name"],
      {
        pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
        lookbehind: !0
      }
    ],
    keyword: [
      {
        pattern: /((?:^|\})\s*)catch\b/,
        lookbehind: !0
      },
      {
        pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
        lookbehind: !0
      }
    ],
    // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
    function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
    number: {
      pattern: RegExp(
        /(^|[^\w$])/.source + "(?:" + // constant
        (/NaN|Infinity/.source + "|" + // binary integer
        /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
        /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
        /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
        /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
        /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
      ),
      lookbehind: !0
    },
    operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
  }), t.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, t.languages.insertBefore("javascript", "keyword", {
    regex: {
      pattern: RegExp(
        // lookbehind
        // eslint-disable-next-line regexp/no-dupe-characters-character-class
        /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
        // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
        // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
        // with the only syntax, so we have to define 2 different regex patterns.
        /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
        /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
        /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
      ),
      lookbehind: !0,
      greedy: !0,
      inside: {
        "regex-source": {
          pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
          lookbehind: !0,
          alias: "language-regex",
          inside: t.languages.regex
        },
        "regex-delimiter": /^\/|\/$/,
        "regex-flags": /^[a-z]+$/
      }
    },
    // This must be declared before keyword because we use "function" inside the look-forward
    "function-variable": {
      pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
      alias: "function"
    },
    parameter: [
      {
        pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
        lookbehind: !0,
        inside: t.languages.javascript
      },
      {
        pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
        lookbehind: !0,
        inside: t.languages.javascript
      },
      {
        pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
        lookbehind: !0,
        inside: t.languages.javascript
      },
      {
        pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
        lookbehind: !0,
        inside: t.languages.javascript
      }
    ],
    constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
  }), t.languages.insertBefore("javascript", "string", {
    hashbang: {
      pattern: /^#!.*/,
      greedy: !0,
      alias: "comment"
    },
    "template-string": {
      pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
      greedy: !0,
      inside: {
        "template-punctuation": {
          pattern: /^`|`$/,
          alias: "string"
        },
        interpolation: {
          pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
          lookbehind: !0,
          inside: {
            "interpolation-punctuation": {
              pattern: /^\$\{|\}$/,
              alias: "punctuation"
            },
            rest: t.languages.javascript
          }
        },
        string: /[\s\S]+/
      }
    },
    "string-property": {
      pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
      lookbehind: !0,
      greedy: !0,
      alias: "property"
    }
  }), t.languages.insertBefore("javascript", "operator", {
    "literal-property": {
      pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
      lookbehind: !0,
      alias: "property"
    }
  }), t.languages.markup && (t.languages.markup.tag.addInlined("script", "javascript"), t.languages.markup.tag.addAttribute(
    /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
    "javascript"
  )), t.languages.js = t.languages.javascript, function() {
    if (typeof t > "u" || typeof document > "u")
      return;
    Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
    var r = "Loading…", a = function(m, l) {
      return "✖ Error " + m + " while fetching file: " + l;
    }, s = "✖ Error: File does not exist or is empty", h = {
      js: "javascript",
      py: "python",
      rb: "ruby",
      ps1: "powershell",
      psm1: "powershell",
      sh: "bash",
      bat: "batch",
      h: "c",
      tex: "latex"
    }, o = "data-src-status", d = "loading", v = "loaded", f = "failed", y = "pre[data-src]:not([" + o + '="' + v + '"]):not([' + o + '="' + d + '"])';
    function A(m, l, u) {
      var p = new XMLHttpRequest();
      p.open("GET", m, !0), p.onreadystatechange = function() {
        p.readyState == 4 && (p.status < 400 && p.responseText ? l(p.responseText) : p.status >= 400 ? u(a(p.status, p.statusText)) : u(s));
      }, p.send(null);
    }
    function x(m) {
      var l = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(m || "");
      if (l) {
        var u = Number(l[1]), p = l[2], g = l[3];
        return p ? g ? [u, Number(g)] : [u, void 0] : [u, u];
      }
    }
    t.hooks.add("before-highlightall", function(m) {
      m.selector += ", " + y;
    }), t.hooks.add("before-sanity-check", function(m) {
      var l = (
        /** @type {HTMLPreElement} */
        m.element
      );
      if (l.matches(y)) {
        m.code = "", l.setAttribute(o, d);
        var u = l.appendChild(document.createElement("CODE"));
        u.textContent = r;
        var p = l.getAttribute("data-src"), g = m.language;
        if (g === "none") {
          var b = (/\.(\w+)$/.exec(p) || [, "none"])[1];
          g = h[b] || b;
        }
        t.util.setLanguage(u, g), t.util.setLanguage(l, g);
        var c = t.plugins.autoloader;
        c && c.loadLanguages(g), A(
          p,
          function(_) {
            l.setAttribute(o, v);
            var E = x(l.getAttribute("data-range"));
            if (E) {
              var w = _.split(/\r\n?|\n/g), k = E[0], $ = E[1] == null ? w.length : E[1];
              k < 0 && (k += w.length), k = Math.max(0, Math.min(k - 1, w.length)), $ < 0 && ($ += w.length), $ = Math.max(0, Math.min($, w.length)), _ = w.slice(k, $).join(`
`), l.hasAttribute("data-start") || l.setAttribute("data-start", String(k + 1));
            }
            u.textContent = _, t.highlightElement(u);
          },
          function(_) {
            l.setAttribute(o, f), u.textContent = _;
          }
        );
      }
    }), t.plugins.fileHighlight = {
      /**
       * Executes the File Highlight plugin for all matching `pre` elements under the given container.
       *
       * Note: Elements which are already loaded or currently loading will not be touched by this method.
       *
       * @param {ParentNode} [container=document]
       */
      highlight: function(l) {
        for (var u = (l || document).querySelectorAll(y), p = 0, g; g = u[p++]; )
          t.highlightElement(g);
      }
    };
    var M = !1;
    t.fileHighlight = function() {
      M || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), M = !0), t.plugins.fileHighlight.highlight.apply(this, arguments);
    };
  }();
})(prism);
var prismExports = prism.exports;
Prism.languages.python = {
  comment: {
    pattern: /(^|[^\\])#.*/,
    lookbehind: !0,
    greedy: !0
  },
  "string-interpolation": {
    pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
    greedy: !0,
    inside: {
      interpolation: {
        // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
        pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
        lookbehind: !0,
        inside: {
          "format-spec": {
            pattern: /(:)[^:(){}]+(?=\}$)/,
            lookbehind: !0
          },
          "conversion-option": {
            pattern: /![sra](?=[:}]$)/,
            alias: "punctuation"
          },
          rest: null
        }
      },
      string: /[\s\S]+/
    }
  },
  "triple-quoted-string": {
    pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
    greedy: !0,
    alias: "string"
  },
  string: {
    pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
    greedy: !0
  },
  function: {
    pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
    lookbehind: !0
  },
  "class-name": {
    pattern: /(\bclass\s+)\w+/i,
    lookbehind: !0
  },
  decorator: {
    pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
    lookbehind: !0,
    alias: ["annotation", "punctuation"],
    inside: {
      punctuation: /\./
    }
  },
  keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
  builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
  boolean: /\b(?:False|None|True)\b/,
  number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
  operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
  punctuation: /[{}[\];(),.:]/
};
Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python;
Prism.languages.py = Prism.languages.python;
(function(n) {
  var e = /\\(?:[^a-z()[\]]|[a-z*]+)/i, t = {
    "equation-command": {
      pattern: e,
      alias: "regex"
    }
  };
  n.languages.latex = {
    comment: /%.*/,
    // the verbatim environment prints whitespace to the document
    cdata: {
      pattern: /(\\begin\{((?:lstlisting|verbatim)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
      lookbehind: !0
    },
    /*
     * equations can be between $$ $$ or $ $ or \( \) or \[ \]
     * (all are multiline)
     */
    equation: [
      {
        pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
        inside: t,
        alias: "string"
      },
      {
        pattern: /(\\begin\{((?:align|eqnarray|equation|gather|math|multline)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
        lookbehind: !0,
        inside: t,
        alias: "string"
      }
    ],
    /*
     * arguments which are keywords or references are highlighted
     * as keywords
     */
    keyword: {
      pattern: /(\\(?:begin|cite|documentclass|end|label|ref|usepackage)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
      lookbehind: !0
    },
    url: {
      pattern: /(\\url\{)[^}]+(?=\})/,
      lookbehind: !0
    },
    /*
     * section or chapter headlines are highlighted as bold so that
     * they stand out more
     */
    headline: {
      pattern: /(\\(?:chapter|frametitle|paragraph|part|section|subparagraph|subsection|subsubparagraph|subsubsection|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
      lookbehind: !0,
      alias: "class-name"
    },
    function: {
      pattern: e,
      alias: "selector"
    },
    punctuation: /[[\]{}&]/
  }, n.languages.tex = n.languages.latex, n.languages.context = n.languages.latex;
})(Prism);
(function(n) {
  var e = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", t = {
    pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
    lookbehind: !0,
    alias: "punctuation",
    // this looks reasonably well in all themes
    inside: null
    // see below
  }, r = {
    bash: t,
    environment: {
      pattern: RegExp("\\$" + e),
      alias: "constant"
    },
    variable: [
      // [0]: Arithmetic Environment
      {
        pattern: /\$?\(\([\s\S]+?\)\)/,
        greedy: !0,
        inside: {
          // If there is a $ sign at the beginning highlight $(( and )) as variable
          variable: [
            {
              pattern: /(^\$\(\([\s\S]+)\)\)/,
              lookbehind: !0
            },
            /^\$\(\(/
          ],
          number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
          // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
          operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
          // If there is no $ sign at the beginning highlight (( and )) as punctuation
          punctuation: /\(\(?|\)\)?|,|;/
        }
      },
      // [1]: Command Substitution
      {
        pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
        greedy: !0,
        inside: {
          variable: /^\$\(|^`|\)$|`$/
        }
      },
      // [2]: Brace expansion
      {
        pattern: /\$\{[^}]+\}/,
        greedy: !0,
        inside: {
          operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
          punctuation: /[\[\]]/,
          environment: {
            pattern: RegExp("(\\{)" + e),
            lookbehind: !0,
            alias: "constant"
          }
        }
      },
      /\$(?:\w+|[#?*!@$])/
    ],
    // Escape sequences from echo and printf's manuals, and escaped quotes.
    entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
  };
  n.languages.bash = {
    shebang: {
      pattern: /^#!\s*\/.*/,
      alias: "important"
    },
    comment: {
      pattern: /(^|[^"{\\$])#.*/,
      lookbehind: !0
    },
    "function-name": [
      // a) function foo {
      // b) foo() {
      // c) function foo() {
      // but not “foo {”
      {
        // a) and c)
        pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
        lookbehind: !0,
        alias: "function"
      },
      {
        // b)
        pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
        alias: "function"
      }
    ],
    // Highlight variable names as variables in for and select beginnings.
    "for-or-select": {
      pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
      alias: "variable",
      lookbehind: !0
    },
    // Highlight variable names as variables in the left-hand part
    // of assignments (“=” and “+=”).
    "assign-left": {
      pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
      inside: {
        environment: {
          pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + e),
          lookbehind: !0,
          alias: "constant"
        }
      },
      alias: "variable",
      lookbehind: !0
    },
    // Highlight parameter names as variables
    parameter: {
      pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
      alias: "variable",
      lookbehind: !0
    },
    string: [
      // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
      {
        pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
        lookbehind: !0,
        greedy: !0,
        inside: r
      },
      // Here-document with quotes around the tag
      // → No expansion (so no “inside”).
      {
        pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
        lookbehind: !0,
        greedy: !0,
        inside: {
          bash: t
        }
      },
      // “Normal” string
      {
        // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
        pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
        lookbehind: !0,
        greedy: !0,
        inside: r
      },
      {
        // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
        pattern: /(^|[^$\\])'[^']*'/,
        lookbehind: !0,
        greedy: !0
      },
      {
        // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
        pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
        greedy: !0,
        inside: {
          entity: r.entity
        }
      }
    ],
    environment: {
      pattern: RegExp("\\$?" + e),
      alias: "constant"
    },
    variable: r.variable,
    function: {
      pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
      lookbehind: !0
    },
    keyword: {
      pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
      lookbehind: !0
    },
    // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
    builtin: {
      pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
      lookbehind: !0,
      // Alias added to make those easier to distinguish from strings.
      alias: "class-name"
    },
    boolean: {
      pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
      lookbehind: !0
    },
    "file-descriptor": {
      pattern: /\B&\d\b/,
      alias: "important"
    },
    operator: {
      // Lots of redirections here, but not just that.
      pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
      inside: {
        "file-descriptor": {
          pattern: /^\d/,
          alias: "important"
        }
      }
    },
    punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
    number: {
      pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
      lookbehind: !0
    }
  }, t.inside = n.languages.bash;
  for (var a = [
    "comment",
    "function-name",
    "for-or-select",
    "assign-left",
    "parameter",
    "string",
    "environment",
    "function",
    "keyword",
    "builtin",
    "boolean",
    "file-descriptor",
    "operator",
    "punctuation",
    "number"
  ], s = r.variable[1].inside, h = 0; h < a.length; h++)
    s[a[h]] = n.languages.bash[a[h]];
  n.languages.sh = n.languages.bash, n.languages.shell = n.languages.bash;
})(Prism);
const LINK_ICON_CODE = '<svg class="md-link-icon" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true" fill="currentColor"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>', COPY_ICON_CODE = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15" color="currentColor" aria-hidden="true" aria-label="Copy" stroke-width="1.3" width="15" height="15">
  <path fill="currentColor" d="M12.728 4.545v8.182H4.545V4.545zm0 -0.909H4.545a0.909 0.909 0 0 0 -0.909 0.909v8.182a0.909 0.909 0 0 0 0.909 0.909h8.182a0.909 0.909 0 0 0 0.909 -0.909V4.545a0.909 0.909 0 0 0 -0.909 -0.909"/>
  <path fill="currentColor" d="M1.818 8.182H0.909V1.818a0.909 0.909 0 0 1 0.909 -0.909h6.364v0.909H1.818Z"/>
</svg>

`, CHECK_ICON_CODE = `<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 17 17" aria-hidden="true" aria-label="Copied" fill="none" stroke="currentColor" stroke-width="1.3">
  <path d="m13.813 4.781 -7.438 7.438 -3.188 -3.188"/>
</svg>
`, COPY_BUTTON_CODE = `<button title="copy" class="copy_code_button">
  <span class="copy-text">${COPY_ICON_CODE}</span>
  <span class="check">${CHECK_ICON_CODE}</span>
</button>`, escape_test = /[&<>"']/, escape_replace = new RegExp(escape_test.source, "g"), escape_test_no_encode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escape_replace_no_encode = new RegExp(escape_test_no_encode.source, "g"), escape_replacements = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, get_escape_replacement = (n) => escape_replacements[n] || "";
function escape(n, e) {
  if (e) {
    if (escape_test.test(n))
      return n.replace(escape_replace, get_escape_replacement);
  } else if (escape_test_no_encode.test(n))
    return n.replace(escape_replace_no_encode, get_escape_replacement);
  return n;
}
function createLatexTokenizer(n) {
  const e = n.map((t) => ({
    start: new RegExp(t.left.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")),
    end: new RegExp(t.right.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"))
  }));
  return {
    name: "latex",
    level: "block",
    start(t) {
      for (const r of e) {
        const a = t.match(r.start);
        if (a)
          return a.index;
      }
      return -1;
    },
    tokenizer(t, r) {
      for (const a of e) {
        const s = new RegExp(
          `${a.start.source}([\\s\\S]+?)${a.end.source}`
        ).exec(t);
        if (s)
          return {
            type: "latex",
            raw: s[0],
            text: s[1].trim()
          };
      }
    },
    renderer(t) {
      return `<div class="latex-block">${t.text}</div>`;
    }
  };
}
const renderer = {
  code(n, e, t) {
    const r = (e ?? "").match(/\S*/)?.[0] ?? "";
    return n = n.replace(/\n$/, "") + `
`, r ? '<div class="code_wrap">' + COPY_BUTTON_CODE + '<pre><code class="language-' + escape(r) + '">' + (t ? n : escape(n, !0)) + `</code></pre></div>
` : '<div class="code_wrap">' + COPY_BUTTON_CODE + "<pre><code>" + (t ? n : escape(n, !0)) + `</code></pre></div>
`;
  }
}, slugger = new BananaSlug();
function create_marked({
  header_links: n,
  line_breaks: e,
  latex_delimiters: t
}) {
  const r = new Marked();
  r.use(
    {
      gfm: !0,
      pedantic: !1,
      breaks: e
    },
    markedHighlight({
      highlight: (s, h) => prismExports.languages[h] ? prismExports.highlight(s, prismExports.languages[h], h) : s
    }),
    { renderer }
  ), n && (r.use(gfmHeadingId()), r.use({
    extensions: [
      {
        name: "heading",
        level: "block",
        renderer(s) {
          const h = s.raw.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi, ""), o = "h" + slugger.slug(h), d = s.depth, v = this.parser.parseInline(s.tokens);
          return `<h${d} id="${o}"><a class="md-header-anchor" href="#${o}">${LINK_ICON_CODE}</a>${v}</h${d}>
`;
        }
      }
    ]
  }));
  const a = createLatexTokenizer(t);
  return r.use({
    extensions: [a]
  }), r;
}
const cloneDeep = (n) => JSON.parse(JSON.stringify(n)), isElement = (n) => n.nodeType === 1, isElementFunky = (n) => FUNKY_TAG_NAMES.has(n.tagName), isElementAction = (n) => "action" in n, isElementIframe = (n) => n.tagName === "IFRAME", isElementFormAction = (n) => "formAction" in n, isElementHyperlink = (n) => "protocol" in n, isScriptOrDataUrl = /* @__PURE__ */ (() => {
  const n = /^(?:\w+script|data):/i;
  return (e) => n.test(e);
})(), isScriptOrDataUrlLoose = /* @__PURE__ */ (() => {
  const n = /(?:script|data):/i;
  return (e) => n.test(e);
})(), mergeMaps = (n) => {
  const e = {};
  for (let t = 0, r = n.length; t < r; t++) {
    const a = n[t];
    for (const s in a)
      e[s] ? e[s] = e[s].concat(a[s]) : e[s] = a[s];
  }
  return e;
}, traverseElementsBasic = (n, e) => {
  let t = n.firstChild;
  for (; t; ) {
    const r = t.nextSibling;
    isElement(t) && (e(t, n), t.parentNode && traverseElementsBasic(t, e)), t = r;
  }
}, traverseElementsIterator = (n, e) => {
  const t = document.createNodeIterator(n, NodeFilter.SHOW_ELEMENT);
  let r;
  for (; r = t.nextNode(); ) {
    const a = r.parentNode;
    a && e(r, a);
  }
}, traverseElements = (n, e) => !!globalThis.document && !!globalThis.document.createNodeIterator ? traverseElementsIterator(n, e) : traverseElementsBasic(n, e), HTML_ELEMENTS_ALLOW = [
  "a",
  "abbr",
  "acronym",
  "address",
  "area",
  "article",
  "aside",
  "audio",
  "b",
  "bdi",
  "bdo",
  "bgsound",
  "big",
  "blockquote",
  "body",
  "br",
  "button",
  "canvas",
  "caption",
  "center",
  "cite",
  "code",
  "col",
  "colgroup",
  "datalist",
  "dd",
  "del",
  "details",
  "dfn",
  "dialog",
  "dir",
  "div",
  "dl",
  "dt",
  "em",
  "fieldset",
  "figcaption",
  "figure",
  "font",
  "footer",
  "form",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hgroup",
  "hr",
  "html",
  "i",
  "img",
  "input",
  "ins",
  "kbd",
  "keygen",
  "label",
  "layer",
  "legend",
  "li",
  "link",
  "listing",
  "main",
  "map",
  "mark",
  "marquee",
  "menu",
  "meta",
  "meter",
  "nav",
  "nobr",
  "ol",
  "optgroup",
  "option",
  "output",
  "p",
  "picture",
  "popup",
  "pre",
  "progress",
  "q",
  "rb",
  "rp",
  "rt",
  "rtc",
  "ruby",
  "s",
  "samp",
  "section",
  "select",
  "selectmenu",
  "small",
  "source",
  "span",
  "strike",
  "strong",
  "style",
  "sub",
  "summary",
  "sup",
  "table",
  "tbody",
  "td",
  "tfoot",
  "th",
  "thead",
  "time",
  "tr",
  "track",
  "tt",
  "u",
  "ul",
  "var",
  "video",
  "wbr"
], HTML_ELEMENTS_DISALLOW = [
  "basefont",
  "command",
  "data",
  "iframe",
  "image",
  "plaintext",
  "portal",
  "slot",
  // 'template', //TODO: Not exactly correct to never allow this, too strict
  "textarea",
  "title",
  "xmp"
], HTML_ELEMENTS = /* @__PURE__ */ new Set([
  ...HTML_ELEMENTS_ALLOW,
  ...HTML_ELEMENTS_DISALLOW
]), SVG_ELEMENTS_ALLOW = [
  "svg",
  "a",
  "altglyph",
  "altglyphdef",
  "altglyphitem",
  "animatecolor",
  "animatemotion",
  "animatetransform",
  "circle",
  "clippath",
  "defs",
  "desc",
  "ellipse",
  "filter",
  "font",
  "g",
  "glyph",
  "glyphref",
  "hkern",
  "image",
  "line",
  "lineargradient",
  "marker",
  "mask",
  "metadata",
  "mpath",
  "path",
  "pattern",
  "polygon",
  "polyline",
  "radialgradient",
  "rect",
  "stop",
  "style",
  "switch",
  "symbol",
  "text",
  "textpath",
  "title",
  "tref",
  "tspan",
  "view",
  "vkern",
  /* FILTERS */
  "feBlend",
  "feColorMatrix",
  "feComponentTransfer",
  "feComposite",
  "feConvolveMatrix",
  "feDiffuseLighting",
  "feDisplacementMap",
  "feDistantLight",
  "feFlood",
  "feFuncA",
  "feFuncB",
  "feFuncG",
  "feFuncR",
  "feGaussianBlur",
  "feImage",
  "feMerge",
  "feMergeNode",
  "feMorphology",
  "feOffset",
  "fePointLight",
  "feSpecularLighting",
  "feSpotLight",
  "feTile",
  "feTurbulence"
], SVG_ELEMENTS_DISALLOW = [
  "animate",
  "color-profile",
  "cursor",
  "discard",
  "fedropshadow",
  "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"
], SVG_ELEMENTS = /* @__PURE__ */ new Set([
  ...SVG_ELEMENTS_ALLOW,
  ...SVG_ELEMENTS_DISALLOW
]), MATH_ELEMENTS_ALLOW = [
  "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"
], MATH_ELEMENTS_DISALLOW = [
  "maction",
  "maligngroup",
  "malignmark",
  "mlongdiv",
  "mscarries",
  "mscarry",
  "msgroup",
  "mstack",
  "msline",
  "msrow",
  "semantics",
  "annotation",
  "annotation-xml",
  "mprescripts",
  "none"
], MATH_ELEMENTS = /* @__PURE__ */ new Set([
  ...MATH_ELEMENTS_ALLOW,
  ...MATH_ELEMENTS_DISALLOW
]), HTML_ATTRIBUTES_ALLOW = [
  "abbr",
  "accept",
  "accept-charset",
  "accesskey",
  "action",
  "align",
  "alink",
  "allow",
  "allowfullscreen",
  "alt",
  "anchor",
  "archive",
  "as",
  "async",
  "autocapitalize",
  "autocomplete",
  "autocorrect",
  "autofocus",
  "autopictureinpicture",
  "autoplay",
  "axis",
  "background",
  "behavior",
  "bgcolor",
  "border",
  "bordercolor",
  "capture",
  "cellpadding",
  "cellspacing",
  "challenge",
  "char",
  "charoff",
  "charset",
  "checked",
  "cite",
  "class",
  "classid",
  "clear",
  "code",
  "codebase",
  "codetype",
  "color",
  "cols",
  "colspan",
  "compact",
  "content",
  "contenteditable",
  "controls",
  "controlslist",
  "conversiondestination",
  "coords",
  "crossorigin",
  "csp",
  "data",
  "datetime",
  "declare",
  "decoding",
  "default",
  "defer",
  "dir",
  "direction",
  "dirname",
  "disabled",
  "disablepictureinpicture",
  "disableremoteplayback",
  "disallowdocumentaccess",
  "download",
  "draggable",
  "elementtiming",
  "enctype",
  "end",
  "enterkeyhint",
  "event",
  "exportparts",
  "face",
  "for",
  "form",
  "formaction",
  "formenctype",
  "formmethod",
  "formnovalidate",
  "formtarget",
  "frame",
  "frameborder",
  "headers",
  "height",
  "hidden",
  "high",
  "href",
  "hreflang",
  "hreftranslate",
  "hspace",
  "http-equiv",
  "id",
  "imagesizes",
  "imagesrcset",
  "importance",
  "impressiondata",
  "impressionexpiry",
  "incremental",
  "inert",
  "inputmode",
  "integrity",
  "invisible",
  "ismap",
  "keytype",
  "kind",
  "label",
  "lang",
  "language",
  "latencyhint",
  "leftmargin",
  "link",
  "list",
  "loading",
  "longdesc",
  "loop",
  "low",
  "lowsrc",
  "manifest",
  "marginheight",
  "marginwidth",
  "max",
  "maxlength",
  "mayscript",
  "media",
  "method",
  "min",
  "minlength",
  "multiple",
  "muted",
  "name",
  "nohref",
  "nomodule",
  "nonce",
  "noresize",
  "noshade",
  "novalidate",
  "nowrap",
  "object",
  "open",
  "optimum",
  "part",
  "pattern",
  "ping",
  "placeholder",
  "playsinline",
  "policy",
  "poster",
  "preload",
  "pseudo",
  "readonly",
  "referrerpolicy",
  "rel",
  "reportingorigin",
  "required",
  "resources",
  "rev",
  "reversed",
  "role",
  "rows",
  "rowspan",
  "rules",
  "sandbox",
  "scheme",
  "scope",
  "scopes",
  "scrollamount",
  "scrolldelay",
  "scrolling",
  "select",
  "selected",
  "shadowroot",
  "shadowrootdelegatesfocus",
  "shape",
  "size",
  "sizes",
  "slot",
  "span",
  "spellcheck",
  "src",
  "srclang",
  "srcset",
  "standby",
  "start",
  "step",
  "style",
  "summary",
  "tabindex",
  "target",
  "text",
  "title",
  "topmargin",
  "translate",
  "truespeed",
  "trusttoken",
  "type",
  "usemap",
  "valign",
  "value",
  "valuetype",
  "version",
  "virtualkeyboardpolicy",
  "vlink",
  "vspace",
  "webkitdirectory",
  "width",
  "wrap"
], SVG_ATTRIBUTES_ALLOW = [
  "accent-height",
  "accumulate",
  "additive",
  "alignment-baseline",
  "ascent",
  "attributename",
  "attributetype",
  "azimuth",
  "basefrequency",
  "baseline-shift",
  "begin",
  "bias",
  "by",
  "class",
  "clip",
  "clippathunits",
  "clip-path",
  "clip-rule",
  "color",
  "color-interpolation",
  "color-interpolation-filters",
  "color-profile",
  "color-rendering",
  "cx",
  "cy",
  "d",
  "dx",
  "dy",
  "diffuseconstant",
  "direction",
  "display",
  "divisor",
  "dominant-baseline",
  "dur",
  "edgemode",
  "elevation",
  "end",
  "fill",
  "fill-opacity",
  "fill-rule",
  "filter",
  "filterunits",
  "flood-color",
  "flood-opacity",
  "font-family",
  "font-size",
  "font-size-adjust",
  "font-stretch",
  "font-style",
  "font-variant",
  "font-weight",
  "fx",
  "fy",
  "g1",
  "g2",
  "glyph-name",
  "glyphref",
  "gradientunits",
  "gradienttransform",
  "height",
  "href",
  "id",
  "image-rendering",
  "in",
  "in2",
  "k",
  "k1",
  "k2",
  "k3",
  "k4",
  "kerning",
  "keypoints",
  "keysplines",
  "keytimes",
  "lang",
  "lengthadjust",
  "letter-spacing",
  "kernelmatrix",
  "kernelunitlength",
  "lighting-color",
  "local",
  "marker-end",
  "marker-mid",
  "marker-start",
  "markerheight",
  "markerunits",
  "markerwidth",
  "maskcontentunits",
  "maskunits",
  "max",
  "mask",
  "media",
  "method",
  "mode",
  "min",
  "name",
  "numoctaves",
  "offset",
  "operator",
  "opacity",
  "order",
  "orient",
  "orientation",
  "origin",
  "overflow",
  "paint-order",
  "path",
  "pathlength",
  "patterncontentunits",
  "patterntransform",
  "patternunits",
  "points",
  "preservealpha",
  "preserveaspectratio",
  "primitiveunits",
  "r",
  "rx",
  "ry",
  "radius",
  "refx",
  "refy",
  "repeatcount",
  "repeatdur",
  "restart",
  "result",
  "rotate",
  "scale",
  "seed",
  "shape-rendering",
  "specularconstant",
  "specularexponent",
  "spreadmethod",
  "startoffset",
  "stddeviation",
  "stitchtiles",
  "stop-color",
  "stop-opacity",
  "stroke-dasharray",
  "stroke-dashoffset",
  "stroke-linecap",
  "stroke-linejoin",
  "stroke-miterlimit",
  "stroke-opacity",
  "stroke",
  "stroke-width",
  "style",
  "surfacescale",
  "systemlanguage",
  "tabindex",
  "targetx",
  "targety",
  "transform",
  "transform-origin",
  "text-anchor",
  "text-decoration",
  "text-rendering",
  "textlength",
  "type",
  "u1",
  "u2",
  "unicode",
  "values",
  "viewbox",
  "visibility",
  "version",
  "vert-adv-y",
  "vert-origin-x",
  "vert-origin-y",
  "width",
  "word-spacing",
  "wrap",
  "writing-mode",
  "xchannelselector",
  "ychannelselector",
  "x",
  "x1",
  "x2",
  "xmlns",
  "y",
  "y1",
  "y2",
  "z",
  "zoomandpan"
], MATH_ATTRIBUTES_ALLOW = [
  "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"
], NAMESPACES = {
  HTML: "http://www.w3.org/1999/xhtml",
  SVG: "http://www.w3.org/2000/svg",
  MATH: "http://www.w3.org/1998/Math/MathML"
}, NAMESPACES_ELEMENTS = {
  [NAMESPACES.HTML]: HTML_ELEMENTS,
  [NAMESPACES.SVG]: SVG_ELEMENTS,
  [NAMESPACES.MATH]: MATH_ELEMENTS
}, NAMESPACES_ROOTS = {
  [NAMESPACES.HTML]: "html",
  [NAMESPACES.SVG]: "svg",
  [NAMESPACES.MATH]: "math"
}, NAMESPACES_PREFIXES = {
  [NAMESPACES.HTML]: "",
  [NAMESPACES.SVG]: "svg:",
  [NAMESPACES.MATH]: "math:"
}, FUNKY_TAG_NAMES = /* @__PURE__ */ new Set([
  "A",
  "AREA",
  "BUTTON",
  "FORM",
  "IFRAME",
  "INPUT"
]), DEFAULTS = {
  allowComments: !0,
  allowCustomElements: !1,
  allowUnknownMarkup: !1,
  allowElements: [
    ...HTML_ELEMENTS_ALLOW,
    ...SVG_ELEMENTS_ALLOW.map((n) => `svg:${n}`),
    ...MATH_ELEMENTS_ALLOW.map((n) => `math:${n}`)
  ],
  allowAttributes: mergeMaps([
    Object.fromEntries(HTML_ATTRIBUTES_ALLOW.map((n) => [n, ["*"]])),
    Object.fromEntries(SVG_ATTRIBUTES_ALLOW.map((n) => [n, ["svg:*"]])),
    Object.fromEntries(MATH_ATTRIBUTES_ALLOW.map((n) => [n, ["math:*"]]))
  ])
};
var __classPrivateFieldSet = function(n, e, t, r, a) {
  if (r === "m") throw new TypeError("Private method is not writable");
  if (r === "a" && !a) throw new TypeError("Private accessor was defined without a setter");
  if (typeof e == "function" ? n !== e || !a : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return r === "a" ? a.call(n, t) : a ? a.value = t : e.set(n, t), t;
}, __classPrivateFieldGet = function(n, e, t, r) {
  if (t === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
  if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return t === "m" ? r : t === "a" ? r.call(n) : r ? r.value : e.get(n);
}, _Amuchina_configuration, _Amuchina_allowElements, _Amuchina_allowAttributes;
class Amuchina {
  /* CONSTRUCTOR */
  constructor(e = {}) {
    _Amuchina_configuration.set(this, void 0), _Amuchina_allowElements.set(this, void 0), _Amuchina_allowAttributes.set(this, void 0), this.getConfiguration = () => cloneDeep(__classPrivateFieldGet(this, _Amuchina_configuration, "f")), this.sanitize = (f) => {
      const y = __classPrivateFieldGet(this, _Amuchina_allowElements, "f"), A = __classPrivateFieldGet(this, _Amuchina_allowAttributes, "f");
      return traverseElements(f, (x, M) => {
        const m = x.namespaceURI || NAMESPACES.HTML, l = M.namespaceURI || NAMESPACES.HTML, u = NAMESPACES_ELEMENTS[m], p = NAMESPACES_ROOTS[m], g = NAMESPACES_PREFIXES[m], b = x.tagName.toLowerCase(), c = `${g}${b}`, E = `${g}*`;
        if (!u.has(b) || !y.has(c) || m !== l && b !== p)
          M.removeChild(x);
        else {
          const w = x.getAttributeNames(), k = w.length;
          if (k) {
            for (let $ = 0; $ < k; $++) {
              const L = w[$], z = A[L];
              (!z || !z.has(E) && !z.has(c)) && x.removeAttribute(L);
            }
            if (isElementFunky(x))
              if (isElementHyperlink(x)) {
                const $ = x.getAttribute("href");
                $ && isScriptOrDataUrlLoose($) && isScriptOrDataUrl(x.protocol) && x.removeAttribute("href");
              } else isElementAction(x) ? isScriptOrDataUrl(x.action) && x.removeAttribute("action") : isElementFormAction(x) ? isScriptOrDataUrl(x.formAction) && x.removeAttribute("formaction") : isElementIframe(x) && (isScriptOrDataUrl(x.src) && x.removeAttribute("formaction"), x.setAttribute("sandbox", "allow-scripts"));
          }
        }
      }), f;
    }, this.sanitizeFor = (f, y) => {
      throw new Error('"sanitizeFor" is not implemented yet');
    };
    const { allowComments: t, allowCustomElements: r, allowUnknownMarkup: a, blockElements: s, dropElements: h, dropAttributes: o } = e;
    if (t === !1)
      throw new Error('A false "allowComments" is not supported yet');
    if (r)
      throw new Error('A true "allowCustomElements" is not supported yet');
    if (a)
      throw new Error('A true "allowUnknownMarkup" is not supported yet');
    if (s)
      throw new Error('"blockElements" is not supported yet, use "allowElements" instead');
    if (h)
      throw new Error('"dropElements" is not supported yet, use "allowElements" instead');
    if (o)
      throw new Error('"dropAttributes" is not supported yet, use "allowAttributes" instead');
    __classPrivateFieldSet(this, _Amuchina_configuration, cloneDeep(DEFAULTS), "f");
    const { allowElements: d, allowAttributes: v } = e;
    d && (__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowElements = e.allowElements), v && (__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowAttributes = e.allowAttributes), __classPrivateFieldSet(this, _Amuchina_allowElements, new Set(__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowElements), "f"), __classPrivateFieldSet(this, _Amuchina_allowAttributes, Object.fromEntries(Object.entries(__classPrivateFieldGet(this, _Amuchina_configuration, "f").allowAttributes || {}).map(([f, y]) => [f, new Set(y)])), "f");
  }
}
_Amuchina_configuration = /* @__PURE__ */ new WeakMap(), _Amuchina_allowElements = /* @__PURE__ */ new WeakMap(), _Amuchina_allowAttributes = /* @__PURE__ */ new WeakMap();
Amuchina.getDefaultConfiguration = () => cloneDeep(DEFAULTS);
const is_external_url = (n, e) => {
  try {
    return !!n && new URL(n).origin !== new URL(e).origin;
  } catch {
    return !1;
  }
};
function sanitize(n, e) {
  const t = new Amuchina(), r = new DOMParser().parseFromString(n, "text/html");
  return walk_nodes(r.body, "A", (a) => {
    a instanceof HTMLElement && "target" in a && is_external_url(a.getAttribute("href"), e) && (a.setAttribute("target", "_blank"), a.setAttribute("rel", "noopener noreferrer"));
  }), t.sanitize(r).body.innerHTML;
}
function walk_nodes(n, e, t) {
  n && (n.nodeName === e || typeof e == "function") && t(n);
  const r = n?.childNodes || [];
  for (let a = 0; a < r.length; a++)
    walk_nodes(r[a], e, t);
}
const {
  HtmlTagHydration,
  SvelteComponent: SvelteComponent$h,
  attr: attr$g,
  binding_callbacks: binding_callbacks$5,
  children: children$f,
  claim_element: claim_element$d,
  claim_html_tag,
  detach: detach$h,
  element: element$d,
  init: init$h,
  insert_hydration: insert_hydration$h,
  noop: noop$e,
  safe_not_equal: safe_not_equal$i,
  toggle_class: toggle_class$8
} = window.__gradio__svelte__internal, { afterUpdate: afterUpdate$3 } = window.__gradio__svelte__internal;
function create_fragment$h(n) {
  let e, t;
  return {
    c() {
      e = element$d("span"), t = new HtmlTagHydration(!1), this.h();
    },
    l(r) {
      e = claim_element$d(r, "SPAN", { class: !0 });
      var a = children$f(e);
      t = claim_html_tag(a, !1), a.forEach(detach$h), this.h();
    },
    h() {
      t.a = null, attr$g(e, "class", "md svelte-1m32c2s"), toggle_class$8(
        e,
        "chatbot",
        /*chatbot*/
        n[0]
      ), toggle_class$8(
        e,
        "prose",
        /*render_markdown*/
        n[1]
      );
    },
    m(r, a) {
      insert_hydration$h(r, e, a), t.m(
        /*html*/
        n[3],
        e
      ), n[10](e);
    },
    p(r, [a]) {
      a & /*html*/
      8 && t.p(
        /*html*/
        r[3]
      ), a & /*chatbot*/
      1 && toggle_class$8(
        e,
        "chatbot",
        /*chatbot*/
        r[0]
      ), a & /*render_markdown*/
      2 && toggle_class$8(
        e,
        "prose",
        /*render_markdown*/
        r[1]
      );
    },
    i: noop$e,
    o: noop$e,
    d(r) {
      r && detach$h(e), n[10](null);
    }
  };
}
function escapeRegExp(n) {
  return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function instance$e(n, e, t) {
  let { chatbot: r = !0 } = e, { message: a } = e, { sanitize_html: s = !0 } = e, { latex_delimiters: h = [] } = e, { render_markdown: o = !0 } = e, { line_breaks: d = !0 } = e, { header_links: v = !1 } = e, { root: f } = e, y, A;
  const x = create_marked({
    header_links: v,
    line_breaks: d,
    latex_delimiters: h
  });
  function M(u) {
    let p = u;
    if (o) {
      const g = [];
      h.forEach((b, c) => {
        const _ = escapeRegExp(b.left), E = escapeRegExp(b.right), w = new RegExp(`${_}([\\s\\S]+?)${E}`, "g");
        p = p.replace(w, (k, $) => (g.push(k), `%%%LATEX_BLOCK_${g.length - 1}%%%`));
      }), p = x.parse(p), p = p.replace(/%%%LATEX_BLOCK_(\d+)%%%/g, (b, c) => g[parseInt(c, 10)]);
    }
    return s && sanitize && (p = sanitize(p, f)), p;
  }
  async function m(u) {
    h.length > 0 && u && h.some((g) => u.includes(g.left) && u.includes(g.right)) && renderMathInElement(y, {
      delimiters: h,
      throwOnError: !1
    });
  }
  afterUpdate$3(async () => {
    y && document.body.contains(y) ? await m(a) : console.error("Element is not in the DOM");
  });
  function l(u) {
    binding_callbacks$5[u ? "unshift" : "push"](() => {
      y = u, t(2, y);
    });
  }
  return n.$$set = (u) => {
    "chatbot" in u && t(0, r = u.chatbot), "message" in u && t(4, a = u.message), "sanitize_html" in u && t(5, s = u.sanitize_html), "latex_delimiters" in u && t(6, h = u.latex_delimiters), "render_markdown" in u && t(1, o = u.render_markdown), "line_breaks" in u && t(7, d = u.line_breaks), "header_links" in u && t(8, v = u.header_links), "root" in u && t(9, f = u.root);
  }, n.$$.update = () => {
    n.$$.dirty & /*message*/
    16 && (a && a.trim() ? t(3, A = M(a)) : t(3, A = ""));
  }, [
    r,
    o,
    y,
    A,
    a,
    s,
    h,
    d,
    v,
    f,
    l
  ];
}
class MarkdownCode extends SvelteComponent$h {
  constructor(e) {
    super(), init$h(this, e, instance$e, create_fragment$h, safe_not_equal$i, {
      chatbot: 0,
      message: 4,
      sanitize_html: 5,
      latex_delimiters: 6,
      render_markdown: 1,
      line_breaks: 7,
      header_links: 8,
      root: 9
    });
  }
}
const {
  SvelteComponent: SvelteComponent$g,
  attr: attr$f,
  children: children$e,
  claim_component: claim_component$7,
  claim_element: claim_element$c,
  create_component: create_component$7,
  destroy_component: destroy_component$7,
  detach: detach$g,
  element: element$c,
  init: init$g,
  insert_hydration: insert_hydration$g,
  mount_component: mount_component$7,
  safe_not_equal: safe_not_equal$h,
  transition_in: transition_in$7,
  transition_out: transition_out$7
} = window.__gradio__svelte__internal;
function create_fragment$g(n) {
  let e, t, r;
  return t = new MarkdownCode({
    props: {
      root: (
        /*root*/
        n[1]
      ),
      message: (
        /*info*/
        n[0]
      ),
      sanitize_html: !0
    }
  }), {
    c() {
      e = element$c("div"), create_component$7(t.$$.fragment), this.h();
    },
    l(a) {
      e = claim_element$c(a, "DIV", { class: !0 });
      var s = children$e(e);
      claim_component$7(t.$$.fragment, s), s.forEach(detach$g), this.h();
    },
    h() {
      attr$f(e, "class", "svelte-17qq50w");
    },
    m(a, s) {
      insert_hydration$g(a, e, s), mount_component$7(t, e, null), r = !0;
    },
    p(a, [s]) {
      const h = {};
      s & /*root*/
      2 && (h.root = /*root*/
      a[1]), s & /*info*/
      1 && (h.message = /*info*/
      a[0]), t.$set(h);
    },
    i(a) {
      r || (transition_in$7(t.$$.fragment, a), r = !0);
    },
    o(a) {
      transition_out$7(t.$$.fragment, a), r = !1;
    },
    d(a) {
      a && detach$g(e), destroy_component$7(t);
    }
  };
}
function instance$d(n, e, t) {
  let { info: r } = e, { root: a } = e;
  return n.$$set = (s) => {
    "info" in s && t(0, r = s.info), "root" in s && t(1, a = s.root);
  }, [r, a];
}
class Info extends SvelteComponent$g {
  constructor(e) {
    super(), init$g(this, e, instance$d, create_fragment$g, safe_not_equal$h, { info: 0, root: 1 });
  }
}
const {
  SvelteComponent: SvelteComponent$f,
  attr: attr$e,
  check_outros: check_outros$6,
  children: children$d,
  claim_component: claim_component$6,
  claim_element: claim_element$b,
  claim_space: claim_space$b,
  create_component: create_component$6,
  create_slot: create_slot$2,
  destroy_component: destroy_component$6,
  detach: detach$f,
  element: element$b,
  empty: empty$5,
  get_all_dirty_from_scope: get_all_dirty_from_scope$2,
  get_slot_changes: get_slot_changes$2,
  group_outros: group_outros$6,
  init: init$f,
  insert_hydration: insert_hydration$f,
  mount_component: mount_component$6,
  safe_not_equal: safe_not_equal$g,
  space: space$b,
  toggle_class: toggle_class$7,
  transition_in: transition_in$6,
  transition_out: transition_out$6,
  update_slot_base: update_slot_base$2
} = window.__gradio__svelte__internal;
function create_if_block$9(n) {
  let e, t;
  return e = new Info({
    props: {
      root: (
        /*root*/
        n[2]
      ),
      info: (
        /*info*/
        n[1]
      )
    }
  }), {
    c() {
      create_component$6(e.$$.fragment);
    },
    l(r) {
      claim_component$6(e.$$.fragment, r);
    },
    m(r, a) {
      mount_component$6(e, r, a), t = !0;
    },
    p(r, a) {
      const s = {};
      a & /*root*/
      4 && (s.root = /*root*/
      r[2]), a & /*info*/
      2 && (s.info = /*info*/
      r[1]), e.$set(s);
    },
    i(r) {
      t || (transition_in$6(e.$$.fragment, r), t = !0);
    },
    o(r) {
      transition_out$6(e.$$.fragment, r), t = !1;
    },
    d(r) {
      destroy_component$6(e, r);
    }
  };
}
function create_fragment$f(n) {
  let e, t, r, a;
  const s = (
    /*#slots*/
    n[4].default
  ), h = create_slot$2(
    s,
    n,
    /*$$scope*/
    n[3],
    null
  );
  let o = (
    /*info*/
    n[1] && create_if_block$9(n)
  );
  return {
    c() {
      e = element$b("span"), h && h.c(), t = space$b(), o && o.c(), r = empty$5(), this.h();
    },
    l(d) {
      e = claim_element$b(d, "SPAN", { "data-testid": !0, class: !0 });
      var v = children$d(e);
      h && h.l(v), v.forEach(detach$f), t = claim_space$b(d), o && o.l(d), r = empty$5(), this.h();
    },
    h() {
      attr$e(e, "data-testid", "block-info"), attr$e(e, "class", "svelte-22c38v"), toggle_class$7(e, "sr-only", !/*show_label*/
      n[0]), toggle_class$7(e, "hide", !/*show_label*/
      n[0]), toggle_class$7(
        e,
        "has-info",
        /*info*/
        n[1] != null
      );
    },
    m(d, v) {
      insert_hydration$f(d, e, v), h && h.m(e, null), insert_hydration$f(d, t, v), o && o.m(d, v), insert_hydration$f(d, r, v), a = !0;
    },
    p(d, [v]) {
      h && h.p && (!a || v & /*$$scope*/
      8) && update_slot_base$2(
        h,
        s,
        d,
        /*$$scope*/
        d[3],
        a ? get_slot_changes$2(
          s,
          /*$$scope*/
          d[3],
          v,
          null
        ) : get_all_dirty_from_scope$2(
          /*$$scope*/
          d[3]
        ),
        null
      ), (!a || v & /*show_label*/
      1) && toggle_class$7(e, "sr-only", !/*show_label*/
      d[0]), (!a || v & /*show_label*/
      1) && toggle_class$7(e, "hide", !/*show_label*/
      d[0]), (!a || v & /*info*/
      2) && toggle_class$7(
        e,
        "has-info",
        /*info*/
        d[1] != null
      ), /*info*/
      d[1] ? o ? (o.p(d, v), v & /*info*/
      2 && transition_in$6(o, 1)) : (o = create_if_block$9(d), o.c(), transition_in$6(o, 1), o.m(r.parentNode, r)) : o && (group_outros$6(), transition_out$6(o, 1, 1, () => {
        o = null;
      }), check_outros$6());
    },
    i(d) {
      a || (transition_in$6(h, d), transition_in$6(o), a = !0);
    },
    o(d) {
      transition_out$6(h, d), transition_out$6(o), a = !1;
    },
    d(d) {
      d && (detach$f(e), detach$f(t), detach$f(r)), h && h.d(d), o && o.d(d);
    }
  };
}
function instance$c(n, e, t) {
  let { $$slots: r = {}, $$scope: a } = e, { show_label: s = !0 } = e, { info: h = void 0 } = e, { root: o } = e;
  return n.$$set = (d) => {
    "show_label" in d && t(0, s = d.show_label), "info" in d && t(1, h = d.info), "root" in d && t(2, o = d.root), "$$scope" in d && t(3, a = d.$$scope);
  }, [s, h, o, a, r];
}
class BlockTitle extends SvelteComponent$f {
  constructor(e) {
    super(), init$f(this, e, instance$c, create_fragment$f, safe_not_equal$g, { show_label: 0, info: 1, root: 2 });
  }
}
const {
  SvelteComponent: SvelteComponent$e,
  append_hydration: append_hydration$c,
  attr: attr$d,
  bubble: bubble$1,
  check_outros: check_outros$5,
  children: children$c,
  claim_component: claim_component$5,
  claim_element: claim_element$a,
  claim_space: claim_space$a,
  claim_text: claim_text$8,
  construct_svelte_component,
  create_component: create_component$5,
  create_slot: create_slot$1,
  destroy_component: destroy_component$5,
  detach: detach$e,
  element: element$a,
  get_all_dirty_from_scope: get_all_dirty_from_scope$1,
  get_slot_changes: get_slot_changes$1,
  group_outros: group_outros$5,
  init: init$e,
  insert_hydration: insert_hydration$e,
  listen: listen$5,
  mount_component: mount_component$5,
  safe_not_equal: safe_not_equal$f,
  set_data: set_data$6,
  set_style: set_style$4,
  space: space$a,
  text: text$9,
  toggle_class: toggle_class$6,
  transition_in: transition_in$5,
  transition_out: transition_out$5,
  update_slot_base: update_slot_base$1
} = window.__gradio__svelte__internal;
function create_if_block$8(n) {
  let e, t;
  return {
    c() {
      e = element$a("span"), t = text$9(
        /*label*/
        n[1]
      ), this.h();
    },
    l(r) {
      e = claim_element$a(r, "SPAN", { class: !0 });
      var a = children$c(e);
      t = claim_text$8(
        a,
        /*label*/
        n[1]
      ), a.forEach(detach$e), this.h();
    },
    h() {
      attr$d(e, "class", "svelte-vk34kx");
    },
    m(r, a) {
      insert_hydration$e(r, e, a), append_hydration$c(e, t);
    },
    p(r, a) {
      a & /*label*/
      2 && set_data$6(
        t,
        /*label*/
        r[1]
      );
    },
    d(r) {
      r && detach$e(e);
    }
  };
}
function create_fragment$e(n) {
  let e, t, r, a, s, h, o, d, v = (
    /*show_label*/
    n[2] && create_if_block$8(n)
  );
  var f = (
    /*Icon*/
    n[0]
  );
  function y(M, m) {
    return {};
  }
  f && (a = construct_svelte_component(f, y()));
  const A = (
    /*#slots*/
    n[14].default
  ), x = create_slot$1(
    A,
    n,
    /*$$scope*/
    n[13],
    null
  );
  return {
    c() {
      e = element$a("button"), v && v.c(), t = space$a(), r = element$a("div"), a && create_component$5(a.$$.fragment), s = space$a(), x && x.c(), this.h();
    },
    l(M) {
      e = claim_element$a(M, "BUTTON", {
        "aria-label": !0,
        "aria-haspopup": !0,
        title: !0,
        class: !0
      });
      var m = children$c(e);
      v && v.l(m), t = claim_space$a(m), r = claim_element$a(m, "DIV", { class: !0 });
      var l = children$c(r);
      a && claim_component$5(a.$$.fragment, l), s = claim_space$a(l), x && x.l(l), l.forEach(detach$e), m.forEach(detach$e), this.h();
    },
    h() {
      attr$d(r, "class", "svelte-vk34kx"), toggle_class$6(
        r,
        "small",
        /*size*/
        n[4] === "small"
      ), toggle_class$6(
        r,
        "large",
        /*size*/
        n[4] === "large"
      ), toggle_class$6(
        r,
        "medium",
        /*size*/
        n[4] === "medium"
      ), e.disabled = /*disabled*/
      n[7], attr$d(
        e,
        "aria-label",
        /*label*/
        n[1]
      ), attr$d(
        e,
        "aria-haspopup",
        /*hasPopup*/
        n[8]
      ), attr$d(
        e,
        "title",
        /*label*/
        n[1]
      ), attr$d(e, "class", "svelte-vk34kx"), toggle_class$6(
        e,
        "pending",
        /*pending*/
        n[3]
      ), toggle_class$6(
        e,
        "padded",
        /*padded*/
        n[5]
      ), toggle_class$6(
        e,
        "highlight",
        /*highlight*/
        n[6]
      ), toggle_class$6(
        e,
        "transparent",
        /*transparent*/
        n[9]
      ), set_style$4(e, "color", !/*disabled*/
      n[7] && /*_color*/
      n[11] ? (
        /*_color*/
        n[11]
      ) : "var(--block-label-text-color)"), set_style$4(e, "--bg-color", /*disabled*/
      n[7] ? "auto" : (
        /*background*/
        n[10]
      ));
    },
    m(M, m) {
      insert_hydration$e(M, e, m), v && v.m(e, null), append_hydration$c(e, t), append_hydration$c(e, r), a && mount_component$5(a, r, null), append_hydration$c(r, s), x && x.m(r, null), h = !0, o || (d = listen$5(
        e,
        "click",
        /*click_handler*/
        n[15]
      ), o = !0);
    },
    p(M, [m]) {
      if (/*show_label*/
      M[2] ? v ? v.p(M, m) : (v = create_if_block$8(M), v.c(), v.m(e, t)) : v && (v.d(1), v = null), m & /*Icon*/
      1 && f !== (f = /*Icon*/
      M[0])) {
        if (a) {
          group_outros$5();
          const l = a;
          transition_out$5(l.$$.fragment, 1, 0, () => {
            destroy_component$5(l, 1);
          }), check_outros$5();
        }
        f ? (a = construct_svelte_component(f, y()), create_component$5(a.$$.fragment), transition_in$5(a.$$.fragment, 1), mount_component$5(a, r, s)) : a = null;
      }
      x && x.p && (!h || m & /*$$scope*/
      8192) && update_slot_base$1(
        x,
        A,
        M,
        /*$$scope*/
        M[13],
        h ? get_slot_changes$1(
          A,
          /*$$scope*/
          M[13],
          m,
          null
        ) : get_all_dirty_from_scope$1(
          /*$$scope*/
          M[13]
        ),
        null
      ), (!h || m & /*size*/
      16) && toggle_class$6(
        r,
        "small",
        /*size*/
        M[4] === "small"
      ), (!h || m & /*size*/
      16) && toggle_class$6(
        r,
        "large",
        /*size*/
        M[4] === "large"
      ), (!h || m & /*size*/
      16) && toggle_class$6(
        r,
        "medium",
        /*size*/
        M[4] === "medium"
      ), (!h || m & /*disabled*/
      128) && (e.disabled = /*disabled*/
      M[7]), (!h || m & /*label*/
      2) && attr$d(
        e,
        "aria-label",
        /*label*/
        M[1]
      ), (!h || m & /*hasPopup*/
      256) && attr$d(
        e,
        "aria-haspopup",
        /*hasPopup*/
        M[8]
      ), (!h || m & /*label*/
      2) && attr$d(
        e,
        "title",
        /*label*/
        M[1]
      ), (!h || m & /*pending*/
      8) && toggle_class$6(
        e,
        "pending",
        /*pending*/
        M[3]
      ), (!h || m & /*padded*/
      32) && toggle_class$6(
        e,
        "padded",
        /*padded*/
        M[5]
      ), (!h || m & /*highlight*/
      64) && toggle_class$6(
        e,
        "highlight",
        /*highlight*/
        M[6]
      ), (!h || m & /*transparent*/
      512) && toggle_class$6(
        e,
        "transparent",
        /*transparent*/
        M[9]
      ), m & /*disabled, _color*/
      2176 && set_style$4(e, "color", !/*disabled*/
      M[7] && /*_color*/
      M[11] ? (
        /*_color*/
        M[11]
      ) : "var(--block-label-text-color)"), m & /*disabled, background*/
      1152 && set_style$4(e, "--bg-color", /*disabled*/
      M[7] ? "auto" : (
        /*background*/
        M[10]
      ));
    },
    i(M) {
      h || (a && transition_in$5(a.$$.fragment, M), transition_in$5(x, M), h = !0);
    },
    o(M) {
      a && transition_out$5(a.$$.fragment, M), transition_out$5(x, M), h = !1;
    },
    d(M) {
      M && detach$e(e), v && v.d(), a && destroy_component$5(a), x && x.d(M), o = !1, d();
    }
  };
}
function instance$b(n, e, t) {
  let r, { $$slots: a = {}, $$scope: s } = e, { Icon: h } = e, { label: o = "" } = e, { show_label: d = !1 } = e, { pending: v = !1 } = e, { size: f = "small" } = e, { padded: y = !0 } = e, { highlight: A = !1 } = e, { disabled: x = !1 } = e, { hasPopup: M = !1 } = e, { color: m = "var(--block-label-text-color)" } = e, { transparent: l = !1 } = e, { background: u = "var(--block-background-fill)" } = e;
  function p(g) {
    bubble$1.call(this, n, g);
  }
  return n.$$set = (g) => {
    "Icon" in g && t(0, h = g.Icon), "label" in g && t(1, o = g.label), "show_label" in g && t(2, d = g.show_label), "pending" in g && t(3, v = g.pending), "size" in g && t(4, f = g.size), "padded" in g && t(5, y = g.padded), "highlight" in g && t(6, A = g.highlight), "disabled" in g && t(7, x = g.disabled), "hasPopup" in g && t(8, M = g.hasPopup), "color" in g && t(12, m = g.color), "transparent" in g && t(9, l = g.transparent), "background" in g && t(10, u = g.background), "$$scope" in g && t(13, s = g.$$scope);
  }, n.$$.update = () => {
    n.$$.dirty & /*highlight, color*/
    4160 && t(11, r = A ? "var(--color-accent)" : m);
  }, [
    h,
    o,
    d,
    v,
    f,
    y,
    A,
    x,
    M,
    l,
    u,
    r,
    m,
    s,
    a,
    p
  ];
}
class IconButton extends SvelteComponent$e {
  constructor(e) {
    super(), init$e(this, e, instance$b, create_fragment$e, safe_not_equal$f, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 12,
      transparent: 9,
      background: 10
    });
  }
}
const {
  SvelteComponent: SvelteComponent$d,
  append_hydration: append_hydration$b,
  attr: attr$c,
  children: children$b,
  claim_svg_element: claim_svg_element$4,
  detach: detach$d,
  init: init$d,
  insert_hydration: insert_hydration$d,
  noop: noop$d,
  safe_not_equal: safe_not_equal$e,
  svg_element: svg_element$4
} = window.__gradio__svelte__internal;
function create_fragment$d(n) {
  let e, t;
  return {
    c() {
      e = svg_element$4("svg"), t = svg_element$4("polyline"), this.h();
    },
    l(r) {
      e = claim_svg_element$4(r, "svg", {
        xmlns: !0,
        viewBox: !0,
        width: !0,
        height: !0,
        fill: !0,
        stroke: !0,
        "aria-hidden": !0,
        "stroke-width": !0,
        "stroke-linecap": !0,
        "stroke-linejoin": !0
      });
      var a = children$b(e);
      t = claim_svg_element$4(a, "polyline", { points: !0 }), children$b(t).forEach(detach$d), a.forEach(detach$d), this.h();
    },
    h() {
      attr$c(t, "points", "20 6 9 17 4 12"), attr$c(e, "xmlns", "http://www.w3.org/2000/svg"), attr$c(e, "viewBox", "2 0 20 20"), attr$c(e, "width", "100%"), attr$c(e, "height", "100%"), attr$c(e, "fill", "none"), attr$c(e, "stroke", "currentColor"), attr$c(e, "aria-hidden", "true"), attr$c(e, "stroke-width", "1.5"), attr$c(e, "stroke-linecap", "round"), attr$c(e, "stroke-linejoin", "round");
    },
    m(r, a) {
      insert_hydration$d(r, e, a), append_hydration$b(e, t);
    },
    p: noop$d,
    i: noop$d,
    o: noop$d,
    d(r) {
      r && detach$d(e);
    }
  };
}
class Check extends SvelteComponent$d {
  constructor(e) {
    super(), init$d(this, e, null, create_fragment$d, safe_not_equal$e, {});
  }
}
const {
  SvelteComponent: SvelteComponent$c,
  append_hydration: append_hydration$a,
  attr: attr$b,
  children: children$a,
  claim_svg_element: claim_svg_element$3,
  detach: detach$c,
  init: init$c,
  insert_hydration: insert_hydration$c,
  noop: noop$c,
  safe_not_equal: safe_not_equal$d,
  set_style: set_style$3,
  svg_element: svg_element$3
} = window.__gradio__svelte__internal;
function create_fragment$c(n) {
  let e, t, r, a;
  return {
    c() {
      e = svg_element$3("svg"), t = svg_element$3("g"), r = svg_element$3("path"), a = svg_element$3("path"), this.h();
    },
    l(s) {
      e = claim_svg_element$3(s, "svg", {
        width: !0,
        height: !0,
        viewBox: !0,
        version: !0,
        xmlns: !0,
        "xmlns:xlink": !0,
        "xml:space": !0,
        stroke: !0,
        style: !0
      });
      var h = children$a(e);
      t = claim_svg_element$3(h, "g", { transform: !0 });
      var o = children$a(t);
      r = claim_svg_element$3(o, "path", { d: !0, style: !0 }), children$a(r).forEach(detach$c), o.forEach(detach$c), a = claim_svg_element$3(h, "path", { d: !0, style: !0 }), children$a(a).forEach(detach$c), h.forEach(detach$c), this.h();
    },
    h() {
      attr$b(r, "d", "M18,6L6.087,17.913"), set_style$3(r, "fill", "none"), set_style$3(r, "fill-rule", "nonzero"), set_style$3(r, "stroke-width", "2px"), attr$b(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), attr$b(a, "d", "M4.364,4.364L19.636,19.636"), set_style$3(a, "fill", "none"), set_style$3(a, "fill-rule", "nonzero"), set_style$3(a, "stroke-width", "2px"), attr$b(e, "width", "100%"), attr$b(e, "height", "100%"), attr$b(e, "viewBox", "0 0 24 24"), attr$b(e, "version", "1.1"), attr$b(e, "xmlns", "http://www.w3.org/2000/svg"), attr$b(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), attr$b(e, "xml:space", "preserve"), attr$b(e, "stroke", "currentColor"), set_style$3(e, "fill-rule", "evenodd"), set_style$3(e, "clip-rule", "evenodd"), set_style$3(e, "stroke-linecap", "round"), set_style$3(e, "stroke-linejoin", "round");
    },
    m(s, h) {
      insert_hydration$c(s, e, h), append_hydration$a(e, t), append_hydration$a(t, r), append_hydration$a(e, a);
    },
    p: noop$c,
    i: noop$c,
    o: noop$c,
    d(s) {
      s && detach$c(e);
    }
  };
}
class Clear extends SvelteComponent$c {
  constructor(e) {
    super(), init$c(this, e, null, create_fragment$c, safe_not_equal$d, {});
  }
}
const {
  SvelteComponent: SvelteComponent$b,
  append_hydration: append_hydration$9,
  attr: attr$a,
  children: children$9,
  claim_svg_element: claim_svg_element$2,
  detach: detach$b,
  init: init$b,
  insert_hydration: insert_hydration$b,
  noop: noop$b,
  safe_not_equal: safe_not_equal$c,
  svg_element: svg_element$2
} = window.__gradio__svelte__internal;
function create_fragment$b(n) {
  let e, t, r;
  return {
    c() {
      e = svg_element$2("svg"), t = svg_element$2("path"), r = svg_element$2("path"), this.h();
    },
    l(a) {
      e = claim_svg_element$2(a, "svg", {
        xmlns: !0,
        viewBox: !0,
        color: !0,
        "aria-hidden": !0,
        width: !0,
        height: !0
      });
      var s = children$9(e);
      t = claim_svg_element$2(s, "path", { fill: !0, d: !0 }), children$9(t).forEach(detach$b), r = claim_svg_element$2(s, "path", { fill: !0, d: !0 }), children$9(r).forEach(detach$b), s.forEach(detach$b), this.h();
    },
    h() {
      attr$a(t, "fill", "currentColor"), attr$a(t, "d", "M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"), attr$a(r, "fill", "currentColor"), attr$a(r, "d", "M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"), attr$a(e, "xmlns", "http://www.w3.org/2000/svg"), attr$a(e, "viewBox", "0 0 33 33"), attr$a(e, "color", "currentColor"), attr$a(e, "aria-hidden", "true"), attr$a(e, "width", "100%"), attr$a(e, "height", "100%");
    },
    m(a, s) {
      insert_hydration$b(a, e, s), append_hydration$9(e, t), append_hydration$9(e, r);
    },
    p: noop$b,
    i: noop$b,
    o: noop$b,
    d(a) {
      a && detach$b(e);
    }
  };
}
class Copy extends SvelteComponent$b {
  constructor(e) {
    super(), init$b(this, e, null, create_fragment$b, safe_not_equal$c, {});
  }
}
const color_values = [
  { color: "red", primary: 600, secondary: 100 },
  { color: "green", primary: 600, secondary: 100 },
  { color: "blue", primary: 600, secondary: 100 },
  { color: "yellow", primary: 500, secondary: 100 },
  { color: "purple", primary: 600, secondary: 100 },
  { color: "teal", primary: 600, secondary: 100 },
  { color: "orange", primary: 600, secondary: 100 },
  { color: "cyan", primary: 600, secondary: 100 },
  { color: "lime", primary: 500, secondary: 100 },
  { color: "pink", primary: 600, secondary: 100 }
], tw_colors = {
  inherit: "inherit",
  current: "currentColor",
  transparent: "transparent",
  black: "#000",
  white: "#fff",
  slate: {
    50: "#f8fafc",
    100: "#f1f5f9",
    200: "#e2e8f0",
    300: "#cbd5e1",
    400: "#94a3b8",
    500: "#64748b",
    600: "#475569",
    700: "#334155",
    800: "#1e293b",
    900: "#0f172a",
    950: "#020617"
  },
  gray: {
    50: "#f9fafb",
    100: "#f3f4f6",
    200: "#e5e7eb",
    300: "#d1d5db",
    400: "#9ca3af",
    500: "#6b7280",
    600: "#4b5563",
    700: "#374151",
    800: "#1f2937",
    900: "#111827",
    950: "#030712"
  },
  zinc: {
    50: "#fafafa",
    100: "#f4f4f5",
    200: "#e4e4e7",
    300: "#d4d4d8",
    400: "#a1a1aa",
    500: "#71717a",
    600: "#52525b",
    700: "#3f3f46",
    800: "#27272a",
    900: "#18181b",
    950: "#09090b"
  },
  neutral: {
    50: "#fafafa",
    100: "#f5f5f5",
    200: "#e5e5e5",
    300: "#d4d4d4",
    400: "#a3a3a3",
    500: "#737373",
    600: "#525252",
    700: "#404040",
    800: "#262626",
    900: "#171717",
    950: "#0a0a0a"
  },
  stone: {
    50: "#fafaf9",
    100: "#f5f5f4",
    200: "#e7e5e4",
    300: "#d6d3d1",
    400: "#a8a29e",
    500: "#78716c",
    600: "#57534e",
    700: "#44403c",
    800: "#292524",
    900: "#1c1917",
    950: "#0c0a09"
  },
  red: {
    50: "#fef2f2",
    100: "#fee2e2",
    200: "#fecaca",
    300: "#fca5a5",
    400: "#f87171",
    500: "#ef4444",
    600: "#dc2626",
    700: "#b91c1c",
    800: "#991b1b",
    900: "#7f1d1d",
    950: "#450a0a"
  },
  orange: {
    50: "#fff7ed",
    100: "#ffedd5",
    200: "#fed7aa",
    300: "#fdba74",
    400: "#fb923c",
    500: "#f97316",
    600: "#ea580c",
    700: "#c2410c",
    800: "#9a3412",
    900: "#7c2d12",
    950: "#431407"
  },
  amber: {
    50: "#fffbeb",
    100: "#fef3c7",
    200: "#fde68a",
    300: "#fcd34d",
    400: "#fbbf24",
    500: "#f59e0b",
    600: "#d97706",
    700: "#b45309",
    800: "#92400e",
    900: "#78350f",
    950: "#451a03"
  },
  yellow: {
    50: "#fefce8",
    100: "#fef9c3",
    200: "#fef08a",
    300: "#fde047",
    400: "#facc15",
    500: "#eab308",
    600: "#ca8a04",
    700: "#a16207",
    800: "#854d0e",
    900: "#713f12",
    950: "#422006"
  },
  lime: {
    50: "#f7fee7",
    100: "#ecfccb",
    200: "#d9f99d",
    300: "#bef264",
    400: "#a3e635",
    500: "#84cc16",
    600: "#65a30d",
    700: "#4d7c0f",
    800: "#3f6212",
    900: "#365314",
    950: "#1a2e05"
  },
  green: {
    50: "#f0fdf4",
    100: "#dcfce7",
    200: "#bbf7d0",
    300: "#86efac",
    400: "#4ade80",
    500: "#22c55e",
    600: "#16a34a",
    700: "#15803d",
    800: "#166534",
    900: "#14532d",
    950: "#052e16"
  },
  emerald: {
    50: "#ecfdf5",
    100: "#d1fae5",
    200: "#a7f3d0",
    300: "#6ee7b7",
    400: "#34d399",
    500: "#10b981",
    600: "#059669",
    700: "#047857",
    800: "#065f46",
    900: "#064e3b",
    950: "#022c22"
  },
  teal: {
    50: "#f0fdfa",
    100: "#ccfbf1",
    200: "#99f6e4",
    300: "#5eead4",
    400: "#2dd4bf",
    500: "#14b8a6",
    600: "#0d9488",
    700: "#0f766e",
    800: "#115e59",
    900: "#134e4a",
    950: "#042f2e"
  },
  cyan: {
    50: "#ecfeff",
    100: "#cffafe",
    200: "#a5f3fc",
    300: "#67e8f9",
    400: "#22d3ee",
    500: "#06b6d4",
    600: "#0891b2",
    700: "#0e7490",
    800: "#155e75",
    900: "#164e63",
    950: "#083344"
  },
  sky: {
    50: "#f0f9ff",
    100: "#e0f2fe",
    200: "#bae6fd",
    300: "#7dd3fc",
    400: "#38bdf8",
    500: "#0ea5e9",
    600: "#0284c7",
    700: "#0369a1",
    800: "#075985",
    900: "#0c4a6e",
    950: "#082f49"
  },
  blue: {
    50: "#eff6ff",
    100: "#dbeafe",
    200: "#bfdbfe",
    300: "#93c5fd",
    400: "#60a5fa",
    500: "#3b82f6",
    600: "#2563eb",
    700: "#1d4ed8",
    800: "#1e40af",
    900: "#1e3a8a",
    950: "#172554"
  },
  indigo: {
    50: "#eef2ff",
    100: "#e0e7ff",
    200: "#c7d2fe",
    300: "#a5b4fc",
    400: "#818cf8",
    500: "#6366f1",
    600: "#4f46e5",
    700: "#4338ca",
    800: "#3730a3",
    900: "#312e81",
    950: "#1e1b4b"
  },
  violet: {
    50: "#f5f3ff",
    100: "#ede9fe",
    200: "#ddd6fe",
    300: "#c4b5fd",
    400: "#a78bfa",
    500: "#8b5cf6",
    600: "#7c3aed",
    700: "#6d28d9",
    800: "#5b21b6",
    900: "#4c1d95",
    950: "#2e1065"
  },
  purple: {
    50: "#faf5ff",
    100: "#f3e8ff",
    200: "#e9d5ff",
    300: "#d8b4fe",
    400: "#c084fc",
    500: "#a855f7",
    600: "#9333ea",
    700: "#7e22ce",
    800: "#6b21a8",
    900: "#581c87",
    950: "#3b0764"
  },
  fuchsia: {
    50: "#fdf4ff",
    100: "#fae8ff",
    200: "#f5d0fe",
    300: "#f0abfc",
    400: "#e879f9",
    500: "#d946ef",
    600: "#c026d3",
    700: "#a21caf",
    800: "#86198f",
    900: "#701a75",
    950: "#4a044e"
  },
  pink: {
    50: "#fdf2f8",
    100: "#fce7f3",
    200: "#fbcfe8",
    300: "#f9a8d4",
    400: "#f472b6",
    500: "#ec4899",
    600: "#db2777",
    700: "#be185d",
    800: "#9d174d",
    900: "#831843",
    950: "#500724"
  },
  rose: {
    50: "#fff1f2",
    100: "#ffe4e6",
    200: "#fecdd3",
    300: "#fda4af",
    400: "#fb7185",
    500: "#f43f5e",
    600: "#e11d48",
    700: "#be123c",
    800: "#9f1239",
    900: "#881337",
    950: "#4c0519"
  }
};
color_values.reduce(
  (n, { color: e, primary: t, secondary: r }) => ({
    ...n,
    [e]: {
      primary: tw_colors[e][t],
      secondary: tw_colors[e][r]
    }
  }),
  {}
);
const {
  SvelteComponent: SvelteComponent$a,
  append_hydration: append_hydration$8,
  attr: attr$9,
  children: children$8,
  claim_element: claim_element$9,
  claim_space: claim_space$9,
  detach: detach$a,
  element: element$9,
  get_svelte_dataset: get_svelte_dataset$5,
  init: init$a,
  insert_hydration: insert_hydration$a,
  listen: listen$4,
  noop: noop$a,
  run_all: run_all$4,
  safe_not_equal: safe_not_equal$b,
  space: space$9
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$6 } = window.__gradio__svelte__internal;
function create_if_block$7(n) {
  let e, t = '<svg data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="w-4 h-4 svelte-8wrmgx"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" class="svelte-8wrmgx"></path></svg> <span class="svelte-8wrmgx">Covalent modifcation</span>', r, a;
  return {
    c() {
      e = element$9("button"), e.innerHTML = t, this.h();
    },
    l(s) {
      e = claim_element$9(s, "BUTTON", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$5(e) !== "svelte-1ffedkh" && (e.innerHTML = t), this.h();
    },
    h() {
      attr$9(e, "class", "flex items-center space-x-2 block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white svelte-8wrmgx");
    },
    m(s, h) {
      insert_hydration$a(s, e, h), r || (a = listen$4(
        e,
        "click",
        /*click_handler_3*/
        n[7]
      ), r = !0);
    },
    p: noop$a,
    d(s) {
      s && detach$a(e), r = !1, a();
    }
  };
}
function create_fragment$a(n) {
  let e, t, r, a = '<svg data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="w-4 h-4 svelte-8wrmgx"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" class="svelte-8wrmgx"></path></svg> <span class="svelte-8wrmgx">Protein</span>', s, h, o = '<svg data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="w-4 h-4 svelte-8wrmgx"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" class="svelte-8wrmgx"></path></svg> <span class="svelte-8wrmgx">Nucleic acid</span>', d, v, f = '<svg data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="w-4 h-4 svelte-8wrmgx"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" class="svelte-8wrmgx"></path></svg> <span class="svelte-8wrmgx">Small molecule</span>', y, A, x, M = (
    /*displayCovMod*/
    n[0] && create_if_block$7(n)
  );
  return {
    c() {
      e = element$9("div"), t = element$9("div"), r = element$9("button"), r.innerHTML = a, s = space$9(), h = element$9("button"), h.innerHTML = o, d = space$9(), v = element$9("button"), v.innerHTML = f, y = space$9(), M && M.c(), this.h();
    },
    l(m) {
      e = claim_element$9(m, "DIV", { class: !0 });
      var l = children$8(e);
      t = claim_element$9(l, "DIV", { class: !0 });
      var u = children$8(t);
      r = claim_element$9(u, "BUTTON", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$5(r) !== "svelte-1qxi4yp" && (r.innerHTML = a), s = claim_space$9(u), h = claim_element$9(u, "BUTTON", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$5(h) !== "svelte-z7tz1a" && (h.innerHTML = o), d = claim_space$9(u), v = claim_element$9(u, "BUTTON", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$5(v) !== "svelte-3ixhlr" && (v.innerHTML = f), y = claim_space$9(u), M && M.l(u), u.forEach(detach$a), l.forEach(detach$a), this.h();
    },
    h() {
      attr$9(r, "class", "flex items-center space-x-2 block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white svelte-8wrmgx"), attr$9(h, "class", "flex items-center space-x-2 block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white svelte-8wrmgx"), attr$9(v, "class", "flex items-center space-x-2 block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white svelte-8wrmgx"), attr$9(t, "class", "flex justify-center mt-2 svelte-8wrmgx"), attr$9(e, "class", "svelte-8wrmgx");
    },
    m(m, l) {
      insert_hydration$a(m, e, l), append_hydration$8(e, t), append_hydration$8(t, r), append_hydration$8(t, s), append_hydration$8(t, h), append_hydration$8(t, d), append_hydration$8(t, v), append_hydration$8(t, y), M && M.m(t, null), A || (x = [
        listen$4(
          r,
          "click",
          /*click_handler*/
          n[4]
        ),
        listen$4(
          h,
          "click",
          /*click_handler_1*/
          n[5]
        ),
        listen$4(
          v,
          "click",
          /*click_handler_2*/
          n[6]
        )
      ], A = !0);
    },
    p(m, [l]) {
      /*displayCovMod*/
      m[0] ? M ? M.p(m, l) : (M = create_if_block$7(m), M.c(), M.m(t, null)) : M && (M.d(1), M = null);
    },
    i: noop$a,
    o: noop$a,
    d(m) {
      m && detach$a(e), M && M.d(), A = !1, run_all$4(x);
    }
  };
}
function instance$a(n, e, t) {
  const r = createEventDispatcher$6();
  let { vals: a = [] } = e;
  function s(A) {
    r("addNewChain", { type: A });
  }
  function h() {
    r("addCovalentModification");
  }
  let o = !1;
  const d = () => {
    s("protein");
  }, v = () => {
    s("DNA");
  }, f = () => {
    s("ligand");
  }, y = () => {
    h();
  };
  return n.$$set = (A) => {
    "vals" in A && t(3, a = A.vals);
  }, n.$$.update = () => {
    n.$$.dirty & /*vals*/
    8 && t(0, o = a.filter((A) => A.class === "protein" && A.sequence.length > 0).length > 0 && a.filter((A) => A.class === "ligand" && A.sdf != "").length > 0);
  }, [
    o,
    s,
    h,
    a,
    d,
    v,
    f,
    y
  ];
}
class Button extends SvelteComponent$a {
  constructor(e) {
    super(), init$a(this, e, instance$a, create_fragment$a, safe_not_equal$b, { vals: 3 });
  }
}
const {
  SvelteComponent: SvelteComponent$9,
  append_hydration: append_hydration$7,
  attr: attr$8,
  children: children$7,
  claim_element: claim_element$8,
  claim_space: claim_space$8,
  claim_text: claim_text$7,
  detach: detach$9,
  element: element$8,
  get_svelte_dataset: get_svelte_dataset$4,
  init: init$9,
  insert_hydration: insert_hydration$9,
  listen: listen$3,
  noop: noop$9,
  prevent_default,
  run_all: run_all$3,
  safe_not_equal: safe_not_equal$a,
  space: space$8,
  text: text$8
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$5 } = window.__gradio__svelte__internal;
function create_fragment$9(n) {
  let e, t, r, a = "Search", s, h, o = (
    /*databases*/
    n[1][
      /*currentSel*/
      n[3]
    ] + ""
  ), d, v, f, y = '<ul class="py-2 text-sm text-gray-700 dark:text-gray-200 svelte-8wrmgx" aria-labelledby="dropdown-button"><li class="svelte-8wrmgx"><button type="button" class="inline-flex w-full px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white svelte-8wrmgx">Pubchem</button></li> <li class="svelte-8wrmgx"><button type="button" class="inline-flex w-full px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white svelte-8wrmgx">RCSB 3 Letter code</button></li></ul>', A, x, M, m, l, u = '<svg class="w-4 h-4 svelte-8wrmgx" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" class="svelte-8wrmgx"></path></svg> <span class="sr-only svelte-8wrmgx">Search</span>', p, g;
  return {
    c() {
      e = element$8("form"), t = element$8("div"), r = element$8("label"), r.textContent = a, s = space$8(), h = element$8("button"), d = text$8(o), v = space$8(), f = element$8("div"), f.innerHTML = y, A = space$8(), x = element$8("div"), M = element$8("input"), m = space$8(), l = element$8("button"), l.innerHTML = u, this.h();
    },
    l(b) {
      e = claim_element$8(b, "FORM", { class: !0 });
      var c = children$7(e);
      t = claim_element$8(c, "DIV", { class: !0 });
      var _ = children$7(t);
      r = claim_element$8(_, "LABEL", {
        for: !0,
        class: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$4(r) !== "svelte-1ryblwq" && (r.textContent = a), s = claim_space$8(_), h = claim_element$8(_, "BUTTON", {
        id: !0,
        "data-dropdown-toggle": !0,
        class: !0,
        type: !0
      });
      var E = children$7(h);
      d = claim_text$7(E, o), E.forEach(detach$9), v = claim_space$8(_), f = claim_element$8(_, "DIV", {
        id: !0,
        class: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$4(f) !== "svelte-1mzhtad" && (f.innerHTML = y), A = claim_space$8(_), x = claim_element$8(_, "DIV", { class: !0 });
      var w = children$7(x);
      M = claim_element$8(w, "INPUT", {
        type: !0,
        id: !0,
        class: !0,
        placeholder: !0
      }), m = claim_space$8(w), l = claim_element$8(w, "BUTTON", {
        type: !0,
        class: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$4(l) !== "svelte-12vvhvj" && (l.innerHTML = u), w.forEach(detach$9), _.forEach(detach$9), c.forEach(detach$9), this.h();
    },
    h() {
      attr$8(r, "for", "search-dropdown"), attr$8(r, "class", "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white svelte-8wrmgx"), attr$8(h, "id", "dropdown-button"), attr$8(h, "data-dropdown-toggle", "dropdown"), attr$8(h, "class", "flex-shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-s-lg hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600 svelte-8wrmgx"), attr$8(h, "type", "button"), attr$8(f, "id", "dropdown"), attr$8(f, "class", "z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 svelte-8wrmgx"), attr$8(M, "type", "search"), attr$8(M, "id", "search-dropdown"), attr$8(M, "class", "block p-2.5 w-full z-20 text-sm text-gray-900 bg-gray-50 rounded-e-lg border-s-gray-50 border-s-2 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500 svelte-8wrmgx"), attr$8(
        M,
        "placeholder",
        /*placeholder*/
        n[2][
          /*currentSel*/
          n[3]
        ]
      ), attr$8(l, "type", "submit"), attr$8(l, "class", "absolute top-0 end-0 p-2.5 text-sm font-medium h-full text-white bg-blue-700 rounded-e-lg border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 svelte-8wrmgx"), attr$8(x, "class", "relative w-full svelte-8wrmgx"), attr$8(t, "class", "flex svelte-8wrmgx"), attr$8(e, "class", "max-w-lg mx-auto mb-2 my-2 svelte-8wrmgx");
    },
    m(b, c) {
      insert_hydration$9(b, e, c), append_hydration$7(e, t), append_hydration$7(t, r), append_hydration$7(t, s), append_hydration$7(t, h), append_hydration$7(h, d), append_hydration$7(t, v), append_hydration$7(t, f), append_hydration$7(t, A), append_hydration$7(t, x), append_hydration$7(x, M), append_hydration$7(x, m), append_hydration$7(x, l), p || (g = [
        listen$3(
          M,
          "input",
          /*input_handler*/
          n[7]
        ),
        listen$3(l, "click", prevent_default(
          /*triggerFetch*/
          n[4]
        ))
      ], p = !0);
    },
    p: noop$9,
    i: noop$9,
    o: noop$9,
    d(b) {
      b && detach$9(e), p = !1, run_all$3(g);
    }
  };
}
function instance$9(n, e, t) {
  const r = createEventDispatcher$5();
  let { database: a = "rcsb-bioass" } = e, { index: s = 0 } = e, h = {
    "rcsb-3ligand": "RCSB 3-Letter Codes",
    pubchem: "Pubchem",
    "rcsb-bioass": "RCSB BioAssembly"
  }, o = {
    "rcsb-3ligand": "e.g HEM, ZN, K, GOL ...",
    pubchem: "molecule name",
    "rcsb-bioass": "4 Letter PDB Code"
  }, d = a, v = "";
  function f() {
    r("triggerFetch", {
      text: v,
      database: d,
      index: s
    });
  }
  const y = (A) => t(0, v = A.target.value);
  return n.$$set = (A) => {
    "database" in A && t(5, a = A.database), "index" in A && t(6, s = A.index);
  }, [
    v,
    h,
    o,
    d,
    f,
    a,
    s,
    y
  ];
}
class SearchInput extends SvelteComponent$9 {
  constructor(e) {
    super(), init$9(this, e, instance$9, create_fragment$9, safe_not_equal$a, { database: 5, index: 6 });
  }
}
const {
  SvelteComponent: SvelteComponent$8,
  append_hydration: append_hydration$6,
  attr: attr$7,
  children: children$6,
  claim_element: claim_element$7,
  claim_space: claim_space$7,
  claim_text: claim_text$6,
  destroy_each: destroy_each$3,
  detach: detach$8,
  element: element$7,
  ensure_array_like: ensure_array_like$3,
  init: init$8,
  insert_hydration: insert_hydration$8,
  noop: noop$8,
  safe_not_equal: safe_not_equal$9,
  set_style: set_style$2,
  space: space$7,
  text: text$7
} = window.__gradio__svelte__internal;
function get_each_context$3(n, e, t) {
  const r = n.slice();
  return r[3] = e[t], r[5] = t, r;
}
function get_each_context_1$2(n, e, t) {
  const r = n.slice();
  return r[6] = e[t], r[8] = t, r;
}
function create_each_block_1$2(n) {
  let e, t, r = (
    /*letter*/
    n[6] + ""
  ), a;
  return {
    c() {
      e = element$7("span"), t = element$7("div"), a = text$7(r), this.h();
    },
    l(s) {
      e = claim_element$7(s, "SPAN", { class: !0, style: !0 });
      var h = children$6(e);
      t = claim_element$7(h, "DIV", { class: !0, title: !0 });
      var o = children$6(t);
      a = claim_text$6(o, r), o.forEach(detach$8), h.forEach(detach$8), this.h();
    },
    h() {
      attr$7(t, "class", "inline-block p-0.5 svelte-hhspdt"), attr$7(t, "title", "residue " + /*chunk_ids*/
      n[1][
        /*i*/
        n[5]
      ][
        /*j*/
        n[8]
      ]), attr$7(e, "class", "p-0.1 text-center w-full inline hover:font-bold cursor-pointer item-selectable ds-selectable svelte-hhspdt"), set_style$2(e, "font-family", "monospace");
    },
    m(s, h) {
      insert_hydration$8(s, e, h), append_hydration$6(e, t), append_hydration$6(t, a);
    },
    p: noop$8,
    d(s) {
      s && detach$8(e);
    }
  };
}
function create_each_block$3(n) {
  let e, t, r = ensure_array_like$3(
    /*chunk*/
    n[3]
  ), a = [];
  for (let s = 0; s < r.length; s += 1)
    a[s] = create_each_block_1$2(get_each_context_1$2(n, r, s));
  return {
    c() {
      e = element$7("div");
      for (let s = 0; s < a.length; s += 1)
        a[s].c();
      t = space$7(), this.h();
    },
    l(s) {
      e = claim_element$7(s, "DIV", { class: !0 });
      var h = children$6(e);
      for (let o = 0; o < a.length; o += 1)
        a[o].l(h);
      t = claim_space$7(h), h.forEach(detach$8), this.h();
    },
    h() {
      attr$7(e, "class", "sequence__chunk svelte-hhspdt");
    },
    m(s, h) {
      insert_hydration$8(s, e, h);
      for (let o = 0; o < a.length; o += 1)
        a[o] && a[o].m(e, null);
      append_hydration$6(e, t);
    },
    p(s, h) {
      if (h & /*chunk_ids, chunked_seq*/
      3) {
        r = ensure_array_like$3(
          /*chunk*/
          s[3]
        );
        let o;
        for (o = 0; o < r.length; o += 1) {
          const d = get_each_context_1$2(s, r, o);
          a[o] ? a[o].p(d, h) : (a[o] = create_each_block_1$2(d), a[o].c(), a[o].m(e, t));
        }
        for (; o < a.length; o += 1)
          a[o].d(1);
        a.length = r.length;
      }
    },
    d(s) {
      s && detach$8(e), destroy_each$3(a, s);
    }
  };
}
function create_fragment$8(n) {
  let e, t = ensure_array_like$3(
    /*chunked_seq*/
    n[0]
  ), r = [];
  for (let a = 0; a < t.length; a += 1)
    r[a] = create_each_block$3(get_each_context$3(n, t, a));
  return {
    c() {
      e = element$7("div");
      for (let a = 0; a < r.length; a += 1)
        r[a].c();
      this.h();
    },
    l(a) {
      e = claim_element$7(a, "DIV", { class: !0 });
      var s = children$6(e);
      for (let h = 0; h < r.length; h += 1)
        r[h].l(s);
      s.forEach(detach$8), this.h();
    },
    h() {
      attr$7(e, "class", "sequence_container text-xs svelte-hhspdt");
    },
    m(a, s) {
      insert_hydration$8(a, e, s);
      for (let h = 0; h < r.length; h += 1)
        r[h] && r[h].m(e, null);
    },
    p(a, [s]) {
      if (s & /*chunked_seq, chunk_ids*/
      3) {
        t = ensure_array_like$3(
          /*chunked_seq*/
          a[0]
        );
        let h;
        for (h = 0; h < t.length; h += 1) {
          const o = get_each_context$3(a, t, h);
          r[h] ? r[h].p(o, s) : (r[h] = create_each_block$3(o), r[h].c(), r[h].m(e, null));
        }
        for (; h < r.length; h += 1)
          r[h].d(1);
        r.length = t.length;
      }
    },
    i: noop$8,
    o: noop$8,
    d(a) {
      a && detach$8(e), destroy_each$3(r, a);
    }
  };
}
function instance$8(n, e, t) {
  let { seq: r = "" } = e, a = r.match(/.{1,10}/g), s = a.map((h, o) => h.split("").map((d, v) => o * 10 + v + 1));
  return n.$$set = (h) => {
    "seq" in h && t(2, r = h.seq);
  }, [a, s, r];
}
class Sequence extends SvelteComponent$8 {
  constructor(e) {
    super(), init$8(this, e, instance$8, create_fragment$8, safe_not_equal$9, { seq: 2 });
  }
}
var _3Dmol$1 = { exports: {} };
/*!
 * 3dmol v2.4.0
 * JavaScript/TypeScript molecular visualization library
 * Author: David Koes and contributors
 */
(function(module, exports) {
  (function(e, t) {
    module.exports = t();
  })(commonjsGlobal, () => (
    /******/
    (() => {
      var __webpack_modules__ = {
        /***/
        "./node_modules/iobuffer/lib-esm/IOBuffer.js": (
          /*!***************************************************!*\
            !*** ./node_modules/iobuffer/lib-esm/IOBuffer.js ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              IOBuffer: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var r = t(
              /*! ./text */
              "./node_modules/iobuffer/lib-esm/text.browser.js"
            );
            const a = 1024 * 8, s = (() => {
              const d = new Uint8Array(4), v = new Uint32Array(d.buffer);
              return !((v[0] = 1) & d[0]);
            })(), h = {
              int8: globalThis.Int8Array,
              uint8: globalThis.Uint8Array,
              int16: globalThis.Int16Array,
              uint16: globalThis.Uint16Array,
              int32: globalThis.Int32Array,
              uint32: globalThis.Uint32Array,
              uint64: globalThis.BigUint64Array,
              int64: globalThis.BigInt64Array,
              float32: globalThis.Float32Array,
              float64: globalThis.Float64Array
            };
            class o {
              /**
               * @param data - The data to construct the IOBuffer with.
               * If data is a number, it will be the new buffer's length<br>
               * If data is `undefined`, the buffer will be initialized with a default length of 8Kb<br>
               * If data is an ArrayBuffer, SharedArrayBuffer, an ArrayBufferView (Typed Array), an IOBuffer instance,
               * or a Node.js Buffer, a view will be created over the underlying ArrayBuffer.
               * @param options
               */
              constructor(v = a, f = {}) {
                let y = !1;
                typeof v == "number" ? v = new ArrayBuffer(v) : (y = !0, this.lastWrittenByte = v.byteLength);
                const A = f.offset ? f.offset >>> 0 : 0, x = v.byteLength - A;
                let M = A;
                (ArrayBuffer.isView(v) || v instanceof o) && (v.byteLength !== v.buffer.byteLength && (M = v.byteOffset + A), v = v.buffer), y ? this.lastWrittenByte = x : this.lastWrittenByte = 0, this.buffer = v, this.length = x, this.byteLength = x, this.byteOffset = M, this.offset = 0, this.littleEndian = !0, this._data = new DataView(this.buffer, M, x), this._mark = 0, this._marks = [];
              }
              /**
               * Checks if the memory allocated to the buffer is sufficient to store more
               * bytes after the offset.
               * @param byteLength - The needed memory in bytes.
               * @returns `true` if there is sufficient space and `false` otherwise.
               */
              available(v = 1) {
                return this.offset + v <= this.length;
              }
              /**
               * Check if little-endian mode is used for reading and writing multi-byte
               * values.
               * @returns `true` if little-endian mode is used, `false` otherwise.
               */
              isLittleEndian() {
                return this.littleEndian;
              }
              /**
               * Set little-endian mode for reading and writing multi-byte values.
               */
              setLittleEndian() {
                return this.littleEndian = !0, this;
              }
              /**
               * Check if big-endian mode is used for reading and writing multi-byte values.
               * @returns `true` if big-endian mode is used, `false` otherwise.
               */
              isBigEndian() {
                return !this.littleEndian;
              }
              /**
               * Switches to big-endian mode for reading and writing multi-byte values.
               */
              setBigEndian() {
                return this.littleEndian = !1, this;
              }
              /**
               * Move the pointer n bytes forward.
               * @param n - Number of bytes to skip.
               */
              skip(v = 1) {
                return this.offset += v, this;
              }
              /**
               * Move the pointer n bytes backward.
               * @param n - Number of bytes to move back.
               */
              back(v = 1) {
                return this.offset -= v, this;
              }
              /**
               * Move the pointer to the given offset.
               * @param offset
               */
              seek(v) {
                return this.offset = v, this;
              }
              /**
               * Store the current pointer offset.
               * @see {@link IOBuffer#reset}
               */
              mark() {
                return this._mark = this.offset, this;
              }
              /**
               * Move the pointer back to the last pointer offset set by mark.
               * @see {@link IOBuffer#mark}
               */
              reset() {
                return this.offset = this._mark, this;
              }
              /**
               * Push the current pointer offset to the mark stack.
               * @see {@link IOBuffer#popMark}
               */
              pushMark() {
                return this._marks.push(this.offset), this;
              }
              /**
               * Pop the last pointer offset from the mark stack, and set the current
               * pointer offset to the popped value.
               * @see {@link IOBuffer#pushMark}
               */
              popMark() {
                const v = this._marks.pop();
                if (v === void 0)
                  throw new Error("Mark stack empty");
                return this.seek(v), this;
              }
              /**
               * Move the pointer offset back to 0.
               */
              rewind() {
                return this.offset = 0, this;
              }
              /**
               * Make sure the buffer has sufficient memory to write a given byteLength at
               * the current pointer offset.
               * If the buffer's memory is insufficient, this method will create a new
               * buffer (a copy) with a length that is twice (byteLength + current offset).
               * @param byteLength
               */
              ensureAvailable(v = 1) {
                if (!this.available(v)) {
                  const y = (this.offset + v) * 2, A = new Uint8Array(y);
                  A.set(new Uint8Array(this.buffer)), this.buffer = A.buffer, this.length = this.byteLength = y, this._data = new DataView(this.buffer);
                }
                return this;
              }
              /**
               * Read a byte and return false if the byte's value is 0, or true otherwise.
               * Moves pointer forward by one byte.
               */
              readBoolean() {
                return this.readUint8() !== 0;
              }
              /**
               * Read a signed 8-bit integer and move pointer forward by 1 byte.
               */
              readInt8() {
                return this._data.getInt8(this.offset++);
              }
              /**
               * Read an unsigned 8-bit integer and move pointer forward by 1 byte.
               */
              readUint8() {
                return this._data.getUint8(this.offset++);
              }
              /**
               * Alias for {@link IOBuffer#readUint8}.
               */
              readByte() {
                return this.readUint8();
              }
              /**
               * Read `n` bytes and move pointer forward by `n` bytes.
               */
              readBytes(v = 1) {
                return this.readArray(v, "uint8");
              }
              /**
               * Creates an array of corresponding to the type `type` and size `size`.
               * For example type `uint8` will create a `Uint8Array`.
               * @param size - size of the resulting array
               * @param type - number type of elements to read
               */
              readArray(v, f) {
                const y = h[f].BYTES_PER_ELEMENT * v, A = this.byteOffset + this.offset, x = this.buffer.slice(A, A + y);
                if (this.littleEndian === s && f !== "uint8" && f !== "int8") {
                  const m = new Uint8Array(this.buffer.slice(A, A + y));
                  m.reverse();
                  const l = new h[f](m.buffer);
                  return this.offset += y, l.reverse(), l;
                }
                const M = new h[f](x);
                return this.offset += y, M;
              }
              /**
               * Read a 16-bit signed integer and move pointer forward by 2 bytes.
               */
              readInt16() {
                const v = this._data.getInt16(this.offset, this.littleEndian);
                return this.offset += 2, v;
              }
              /**
               * Read a 16-bit unsigned integer and move pointer forward by 2 bytes.
               */
              readUint16() {
                const v = this._data.getUint16(this.offset, this.littleEndian);
                return this.offset += 2, v;
              }
              /**
               * Read a 32-bit signed integer and move pointer forward by 4 bytes.
               */
              readInt32() {
                const v = this._data.getInt32(this.offset, this.littleEndian);
                return this.offset += 4, v;
              }
              /**
               * Read a 32-bit unsigned integer and move pointer forward by 4 bytes.
               */
              readUint32() {
                const v = this._data.getUint32(this.offset, this.littleEndian);
                return this.offset += 4, v;
              }
              /**
               * Read a 32-bit floating number and move pointer forward by 4 bytes.
               */
              readFloat32() {
                const v = this._data.getFloat32(this.offset, this.littleEndian);
                return this.offset += 4, v;
              }
              /**
               * Read a 64-bit floating number and move pointer forward by 8 bytes.
               */
              readFloat64() {
                const v = this._data.getFloat64(this.offset, this.littleEndian);
                return this.offset += 8, v;
              }
              /**
               * Read a 64-bit signed integer number and move pointer forward by 8 bytes.
               */
              readBigInt64() {
                const v = this._data.getBigInt64(this.offset, this.littleEndian);
                return this.offset += 8, v;
              }
              /**
               * Read a 64-bit unsigned integer number and move pointer forward by 8 bytes.
               */
              readBigUint64() {
                const v = this._data.getBigUint64(this.offset, this.littleEndian);
                return this.offset += 8, v;
              }
              /**
               * Read a 1-byte ASCII character and move pointer forward by 1 byte.
               */
              readChar() {
                return String.fromCharCode(this.readInt8());
              }
              /**
               * Read `n` 1-byte ASCII characters and move pointer forward by `n` bytes.
               */
              readChars(v = 1) {
                let f = "";
                for (let y = 0; y < v; y++)
                  f += this.readChar();
                return f;
              }
              /**
               * Read the next `n` bytes, return a UTF-8 decoded string and move pointer
               * forward by `n` bytes.
               */
              readUtf8(v = 1) {
                return (0, r.decode)(this.readBytes(v));
              }
              /**
               * Read the next `n` bytes, return a string decoded with `encoding` and move pointer
               * forward by `n` bytes.
               * If no encoding is passed, the function is equivalent to @see {@link IOBuffer#readUtf8}
               */
              decodeText(v = 1, f = "utf-8") {
                return (0, r.decode)(this.readBytes(v), f);
              }
              /**
               * Write 0xff if the passed value is truthy, 0x00 otherwise and move pointer
               * forward by 1 byte.
               */
              writeBoolean(v) {
                return this.writeUint8(v ? 255 : 0), this;
              }
              /**
               * Write `value` as an 8-bit signed integer and move pointer forward by 1 byte.
               */
              writeInt8(v) {
                return this.ensureAvailable(1), this._data.setInt8(this.offset++, v), this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as an 8-bit unsigned integer and move pointer forward by 1
               * byte.
               */
              writeUint8(v) {
                return this.ensureAvailable(1), this._data.setUint8(this.offset++, v), this._updateLastWrittenByte(), this;
              }
              /**
               * An alias for {@link IOBuffer#writeUint8}.
               */
              writeByte(v) {
                return this.writeUint8(v);
              }
              /**
               * Write all elements of `bytes` as uint8 values and move pointer forward by
               * `bytes.length` bytes.
               */
              writeBytes(v) {
                this.ensureAvailable(v.length);
                for (let f = 0; f < v.length; f++)
                  this._data.setUint8(this.offset++, v[f]);
                return this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 16-bit signed integer and move pointer forward by 2
               * bytes.
               */
              writeInt16(v) {
                return this.ensureAvailable(2), this._data.setInt16(this.offset, v, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 16-bit unsigned integer and move pointer forward by 2
               * bytes.
               */
              writeUint16(v) {
                return this.ensureAvailable(2), this._data.setUint16(this.offset, v, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 32-bit signed integer and move pointer forward by 4
               * bytes.
               */
              writeInt32(v) {
                return this.ensureAvailable(4), this._data.setInt32(this.offset, v, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 32-bit unsigned integer and move pointer forward by 4
               * bytes.
               */
              writeUint32(v) {
                return this.ensureAvailable(4), this._data.setUint32(this.offset, v, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 32-bit floating number and move pointer forward by 4
               * bytes.
               */
              writeFloat32(v) {
                return this.ensureAvailable(4), this._data.setFloat32(this.offset, v, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 64-bit floating number and move pointer forward by 8
               * bytes.
               */
              writeFloat64(v) {
                return this.ensureAvailable(8), this._data.setFloat64(this.offset, v, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 64-bit signed bigint and move pointer forward by 8
               * bytes.
               */
              writeBigInt64(v) {
                return this.ensureAvailable(8), this._data.setBigInt64(this.offset, v, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 64-bit unsigned bigint and move pointer forward by 8
               * bytes.
               */
              writeBigUint64(v) {
                return this.ensureAvailable(8), this._data.setBigUint64(this.offset, v, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
              }
              /**
               * Write the charCode of `str`'s first character as an 8-bit unsigned integer
               * and move pointer forward by 1 byte.
               */
              writeChar(v) {
                return this.writeUint8(v.charCodeAt(0));
              }
              /**
               * Write the charCodes of all `str`'s characters as 8-bit unsigned integers
               * and move pointer forward by `str.length` bytes.
               */
              writeChars(v) {
                for (let f = 0; f < v.length; f++)
                  this.writeUint8(v.charCodeAt(f));
                return this;
              }
              /**
               * UTF-8 encode and write `str` to the current pointer offset and move pointer
               * forward according to the encoded length.
               */
              writeUtf8(v) {
                return this.writeBytes((0, r.encode)(v));
              }
              /**
               * Export a Uint8Array view of the internal buffer.
               * The view starts at the byte offset and its length
               * is calculated to stop at the last written byte or the original length.
               */
              toArray() {
                return new Uint8Array(this.buffer, this.byteOffset, this.lastWrittenByte);
              }
              /**
               * Update the last written byte offset
               * @private
               */
              _updateLastWrittenByte() {
                this.offset > this.lastWrittenByte && (this.lastWrittenByte = this.offset);
              }
            }
          }
        ),
        /***/
        "./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js": (
          /*!*****************************************************************!*\
            !*** ./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js ***!
            \*****************************************************************/
          /***/
          function() {
            (function(n) {
              if (n.TextEncoder && n.TextDecoder)
                return !1;
              function e(r = "utf-8") {
                if (r !== "utf-8")
                  throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${r}') is invalid.`);
              }
              Object.defineProperty(e.prototype, "encoding", {
                value: "utf-8"
              }), e.prototype.encode = function(r, a = { stream: !1 }) {
                if (a.stream)
                  throw new Error("Failed to encode: the 'stream' option is unsupported.");
                let s = 0;
                const h = r.length;
                let o = 0, d = Math.max(32, h + (h >> 1) + 7), v = new Uint8Array(d >> 3 << 3);
                for (; s < h; ) {
                  let f = r.charCodeAt(s++);
                  if (f >= 55296 && f <= 56319) {
                    if (s < h) {
                      const y = r.charCodeAt(s);
                      (y & 64512) === 56320 && (++s, f = ((f & 1023) << 10) + (y & 1023) + 65536);
                    }
                    if (f >= 55296 && f <= 56319)
                      continue;
                  }
                  if (o + 4 > v.length) {
                    d += 8, d *= 1 + s / r.length * 2, d = d >> 3 << 3;
                    const y = new Uint8Array(d);
                    y.set(v), v = y;
                  }
                  if (f & 4294967168)
                    if (!(f & 4294965248))
                      v[o++] = f >> 6 & 31 | 192;
                    else if (!(f & 4294901760))
                      v[o++] = f >> 12 & 15 | 224, v[o++] = f >> 6 & 63 | 128;
                    else if (!(f & 4292870144))
                      v[o++] = f >> 18 & 7 | 240, v[o++] = f >> 12 & 63 | 128, v[o++] = f >> 6 & 63 | 128;
                    else
                      continue;
                  else {
                    v[o++] = f;
                    continue;
                  }
                  v[o++] = f & 63 | 128;
                }
                return v.slice(0, o);
              };
              function t(r = "utf-8", a = { fatal: !1 }) {
                if (r !== "utf-8")
                  throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${r}') is invalid.`);
                if (a.fatal)
                  throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");
              }
              Object.defineProperty(t.prototype, "encoding", {
                value: "utf-8"
              }), Object.defineProperty(t.prototype, "fatal", { value: !1 }), Object.defineProperty(t.prototype, "ignoreBOM", {
                value: !1
              }), t.prototype.decode = function(r, a = { stream: !1 }) {
                if (a.stream)
                  throw new Error("Failed to decode: the 'stream' option is unsupported.");
                const s = new Uint8Array(r);
                let h = 0;
                const o = s.length, d = [];
                for (; h < o; ) {
                  const v = s[h++];
                  if (v === 0)
                    break;
                  if (!(v & 128))
                    d.push(v);
                  else if ((v & 224) === 192) {
                    const f = s[h++] & 63;
                    d.push((v & 31) << 6 | f);
                  } else if ((v & 240) === 224) {
                    const f = s[h++] & 63, y = s[h++] & 63;
                    d.push((v & 31) << 12 | f << 6 | y);
                  } else if ((v & 248) === 240) {
                    const f = s[h++] & 63, y = s[h++] & 63, A = s[h++] & 63;
                    let x = (v & 7) << 18 | f << 12 | y << 6 | A;
                    x > 65535 && (x -= 65536, d.push(x >>> 10 & 1023 | 55296), x = 56320 | x & 1023), d.push(x);
                  }
                }
                return String.fromCharCode.apply(null, d);
              }, n.TextEncoder = e, n.TextDecoder = t;
            })(typeof window < "u" ? window : typeof self < "u" ? self : this);
          }
        ),
        /***/
        "./node_modules/iobuffer/lib-esm/text.browser.js": (
          /*!*******************************************************!*\
            !*** ./node_modules/iobuffer/lib-esm/text.browser.js ***!
            \*******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              decode: () => (
                /* binding */
                r
              ),
              /* harmony export */
              encode: () => (
                /* binding */
                s
              )
              /* harmony export */
            }), t(
              /*! ./text-encoding-polyfill */
              "./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js"
            );
            function r(h, o = "utf8") {
              return new TextDecoder(o).decode(h);
            }
            const a = new TextEncoder();
            function s(h) {
              return a.encode(h);
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/data.js": (
          /*!***********************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/data.js ***!
            \***********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              nonRecord: () => (
                /* binding */
                a
              ),
              /* harmony export */
              record: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./types */
              "./node_modules/netcdfjs/lib-esm/types.js"
            );
            function a(h, o) {
              const d = (0, r.str2num)(o.type), v = o.size / (0, r.num2bytes)(d), f = new Array(v);
              for (let y = 0; y < v; y++)
                f[y] = (0, r.readType)(h, d, 1);
              return f;
            }
            function s(h, o, d) {
              const v = (0, r.str2num)(o.type), f = o.size ? o.size / (0, r.num2bytes)(v) : 1, y = d.length, A = new Array(y), x = d.recordStep;
              if (x)
                for (let M = 0; M < y; M++) {
                  const m = h.offset;
                  A[M] = (0, r.readType)(h, v, f), h.seek(m + x);
                }
              else
                throw new Error("recordDimension.recordStep is undefined");
              return A;
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/header.js": (
          /*!*************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/header.js ***!
            \*************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              header: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var r = t(
              /*! ./types */
              "./node_modules/netcdfjs/lib-esm/types.js"
            ), a = t(
              /*! ./utils */
              "./node_modules/netcdfjs/lib-esm/utils.js"
            );
            const s = 0, h = 10, o = 11, d = 12, v = 0;
            function f(M, m) {
              const l = { version: m }, u = {
                length: M.readUint32()
              }, p = y(M);
              Array.isArray(p) || (u.id = p.recordId, u.name = p.recordName, l.dimensions = p.dimensions), l.globalAttributes = A(M);
              const g = x(M, u?.id, m);
              return Array.isArray(g) || (l.variables = g.variables, u.recordStep = g.recordStep), l.recordDimension = u, l;
            }
            function y(M) {
              const m = {};
              let l, u;
              const p = M.readUint32();
              let g;
              if (p === s)
                return (0, a.notNetcdf)(M.readUint32() !== s, "wrong empty tag for list of dimensions"), [];
              {
                (0, a.notNetcdf)(p !== h, "wrong tag for list of dimensions");
                const b = M.readUint32();
                g = new Array(b);
                for (let c = 0; c < b; c++) {
                  const _ = (0, a.readName)(M), E = M.readUint32();
                  E === v && (l = c, u = _), g[c] = {
                    name: _,
                    size: E
                  };
                }
              }
              return l !== void 0 && (m.recordId = l), u !== void 0 && (m.recordName = u), m.dimensions = g, m;
            }
            function A(M) {
              const m = M.readUint32();
              let l;
              if (m === s)
                return (0, a.notNetcdf)(M.readUint32() !== s, "wrong empty tag for list of attributes"), [];
              {
                (0, a.notNetcdf)(m !== d, "wrong tag for list of attributes");
                const u = M.readUint32();
                l = new Array(u);
                for (let p = 0; p < u; p++) {
                  const g = (0, a.readName)(M), b = M.readUint32();
                  (0, a.notNetcdf)(b < 1 || b > 6, `non valid type ${b}`);
                  const c = M.readUint32(), _ = (0, r.readType)(M, b, c);
                  (0, a.padding)(M), l[p] = {
                    name: g,
                    type: (0, r.num2str)(b),
                    value: _
                  };
                }
              }
              return l;
            }
            function x(M, m, l) {
              const u = M.readUint32();
              let p = 0, g;
              if (u === s)
                return (0, a.notNetcdf)(M.readUint32() !== s, "wrong empty tag for list of variables"), [];
              {
                (0, a.notNetcdf)(u !== o, "wrong tag for list of variables");
                const b = M.readUint32();
                g = new Array(b);
                for (let c = 0; c < b; c++) {
                  const _ = (0, a.readName)(M), E = M.readUint32(), w = new Array(E);
                  for (let R = 0; R < E; R++)
                    w[R] = M.readUint32();
                  const k = A(M), $ = M.readUint32();
                  (0, a.notNetcdf)($ < 1 && $ > 6, `non valid type ${$}`);
                  const L = M.readUint32();
                  let z = M.readUint32();
                  l === 2 && ((0, a.notNetcdf)(z > 0, "offsets larger than 4GB not supported"), z = M.readUint32());
                  let F = !1;
                  typeof m < "u" && w[0] === m && (p += L, F = !0), g[c] = {
                    name: _,
                    dimensions: w,
                    attributes: k,
                    type: (0, r.num2str)($),
                    size: L,
                    offset: z,
                    record: F
                  };
                }
              }
              return {
                variables: g,
                recordStep: p
              };
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/index.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/index.js ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              NetCDFReader: () => (
                /* reexport safe */
                r.NetCDFReader
              )
              /* harmony export */
            });
            var r = t(
              /*! ./parser */
              "./node_modules/netcdfjs/lib-esm/parser.js"
            );
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/parser.js": (
          /*!*************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/parser.js ***!
            \*************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              NetCDFReader: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! iobuffer */
              "./node_modules/iobuffer/lib-esm/IOBuffer.js"
            ), a = t(
              /*! ./data */
              "./node_modules/netcdfjs/lib-esm/data.js"
            ), s = t(
              /*! ./header */
              "./node_modules/netcdfjs/lib-esm/header.js"
            ), h = t(
              /*! ./toString */
              "./node_modules/netcdfjs/lib-esm/toString.js"
            ), o = t(
              /*! ./utils */
              "./node_modules/netcdfjs/lib-esm/utils.js"
            );
            class d {
              constructor(f) {
                this.toString = h.toString;
                const y = new r.IOBuffer(f);
                y.setBigEndian(), (0, o.notNetcdf)(y.readChars(3) !== "CDF", "should start with CDF");
                const A = y.readByte();
                (0, o.notNetcdf)(A > 2, "unknown version"), this.header = (0, s.header)(y, A), this.buffer = y;
              }
              /**
               * @return - Version for the NetCDF format
               */
              get version() {
                return this.header.version === 1 ? "classic format" : "64-bit offset format";
              }
              /**
               * @return {object} - Metadata for the record dimension
               *  * `length`: Number of elements in the record dimension
               *  * `id`: Id number in the list of dimensions for the record dimension
               *  * `name`: String with the name of the record dimension
               *  * `recordStep`: Number with the record variables step size
               */
              get recordDimension() {
                return this.header.recordDimension;
              }
              /**
               * @return - Array - List of dimensions with:
               *  * `name`: String with the name of the dimension
               *  * `size`: Number with the size of the dimension
               */
              get dimensions() {
                return this.header.dimensions;
              }
              /**
               * @return - Array - List of global attributes with:
               *  * `name`: String with the name of the attribute
               *  * `type`: String with the type of the attribute
               *  * `value`: A number or string with the value of the attribute
               */
              get globalAttributes() {
                return this.header.globalAttributes;
              }
              /**
               * Returns the value of an attribute
               * @param - AttributeName
               * @return - Value of the attributeName or null
               */
              getAttribute(f) {
                const y = this.globalAttributes.find((A) => A.name === f);
                return y ? y.value : null;
              }
              /**
               * Returns the value of a variable as a string
               * @param - variableName
               * @return - Value of the variable as a string or null
               */
              getDataVariableAsString(f) {
                const y = this.getDataVariable(f);
                return y ? y.join("") : null;
              }
              get variables() {
                return this.header.variables;
              }
              /**
               * Retrieves the data for a given variable
               * @param variableName - Name of the variable to search or variable object
               * @return The variable values
               */
              getDataVariable(f) {
                let y;
                if (typeof f == "string" ? y = this.header.variables.find((A) => A.name === f) : y = f, y === void 0)
                  throw new Error("Not a valid NetCDF v3.x file: variable not found");
                return this.buffer.seek(y.offset), y.record ? (0, a.record)(this.buffer, y, this.header.recordDimension) : (0, a.nonRecord)(this.buffer, y);
              }
              /**
               * Check if a dataVariable exists
               * @param variableName - Name of the variable to find
               * @return boolean
               */
              dataVariableExists(f) {
                return this.header.variables.find((A) => A.name === f) !== void 0;
              }
              /**
               * Check if an attribute exists
               * @param attributeName - Name of the attribute to find
               * @return boolean
               */
              attributeExists(f) {
                return this.globalAttributes.find((A) => A.name === f) !== void 0;
              }
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/toString.js": (
          /*!***************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/toString.js ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              toString: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r() {
              const a = [];
              a.push("DIMENSIONS");
              for (const h of this.dimensions)
                a.push(`  ${h.name.padEnd(30)} = size: ${h.size}`);
              a.push(""), a.push("GLOBAL ATTRIBUTES");
              for (const h of this.globalAttributes)
                a.push(`  ${h.name.padEnd(30)} = ${h.value}`);
              const s = JSON.parse(JSON.stringify(this.variables));
              a.push(""), a.push("VARIABLES:");
              for (const h of s) {
                h.value = this.getDataVariable(h);
                let o = JSON.stringify(h.value);
                o.length > 50 && (o = o.substring(0, 50)), isNaN(h.value.length) || (o += ` (length: ${h.value.length})`), a.push(`  ${h.name.padEnd(30)} = ${o}`);
              }
              return a.join(`
`);
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/types.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/types.js ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              num2bytes: () => (
                /* binding */
                s
              ),
              /* harmony export */
              num2str: () => (
                /* binding */
                a
              ),
              /* harmony export */
              readType: () => (
                /* binding */
                d
              ),
              /* harmony export */
              str2num: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            const r = {
              BYTE: 1,
              CHAR: 2,
              SHORT: 3,
              INT: 4,
              FLOAT: 5,
              DOUBLE: 6
            };
            function a(f) {
              switch (Number(f)) {
                case r.BYTE:
                  return "byte";
                case r.CHAR:
                  return "char";
                case r.SHORT:
                  return "short";
                case r.INT:
                  return "int";
                case r.FLOAT:
                  return "float";
                case r.DOUBLE:
                  return "double";
                default:
                  return "undefined";
              }
            }
            function s(f) {
              switch (Number(f)) {
                case r.BYTE:
                  return 1;
                case r.CHAR:
                  return 1;
                case r.SHORT:
                  return 2;
                case r.INT:
                  return 4;
                case r.FLOAT:
                  return 4;
                case r.DOUBLE:
                  return 8;
                default:
                  return -1;
              }
            }
            function h(f) {
              switch (String(f)) {
                case "byte":
                  return r.BYTE;
                case "char":
                  return r.CHAR;
                case "short":
                  return r.SHORT;
                case "int":
                  return r.INT;
                case "float":
                  return r.FLOAT;
                case "double":
                  return r.DOUBLE;
                default:
                  return -1;
              }
            }
            function o(f, y) {
              if (f !== 1) {
                const A = new Array(f);
                for (let x = 0; x < f; x++)
                  A[x] = y();
                return A;
              } else
                return y();
            }
            function d(f, y, A) {
              switch (y) {
                case r.BYTE:
                  return Array.from(f.readBytes(A));
                case r.CHAR:
                  return v(f.readChars(A));
                case r.SHORT:
                  return o(A, f.readInt16.bind(f));
                case r.INT:
                  return o(A, f.readInt32.bind(f));
                case r.FLOAT:
                  return o(A, f.readFloat32.bind(f));
                case r.DOUBLE:
                  return o(A, f.readFloat64.bind(f));
                default:
                  throw new Error(`non valid type ${y}`);
              }
            }
            function v(f) {
              return f.charCodeAt(f.length - 1) === 0 ? f.substring(0, f.length - 1) : f;
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/utils.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/utils.js ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              notNetcdf: () => (
                /* binding */
                r
              ),
              /* harmony export */
              padding: () => (
                /* binding */
                a
              ),
              /* harmony export */
              readName: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            function r(h, o) {
              if (h)
                throw new TypeError(`Not a valid NetCDF v3.x file: ${o}`);
            }
            function a(h) {
              h.offset % 4 !== 0 && h.skip(4 - h.offset % 4);
            }
            function s(h) {
              const o = h.readUint32(), d = h.readChars(o);
              return a(h), d;
            }
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/basic.frag": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/basic.frag ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform mat4 viewMatrix;
uniform float opacity;
uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;
varying vec3 vColor;
//DEFINEFRAGCOLOR
void main() {
    gl_FragColor = vec4( vColor, opacity );
    float depth = gl_FragCoord.z / gl_FragCoord.w;
    float fogFactor = smoothstep( fogNear, fogFar, depth );
    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );
}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/basic.vert": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/basic.vert ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;

attribute vec3 position;
attribute vec3 color;

varying vec3 vColor;

void main() {

    vColor = color;
    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
    gl_Position = projectionMatrix * mvPosition;

}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/blur/blur.frag": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/blur/blur.frag ***!
            \**********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `const float INV_TOTAL_SAMPLES_FACTOR = 1.0 / 9.0;
uniform highp sampler2D inTex;
varying highp vec2 vTexCoords;
    
void main() {
 
 vec2 texelSize = 1.0 / vec2(textureSize(inTex,0));
 float blurred_visibility_factor = 0.0f;
 for (int t = -1; t <= 1; ++t) {
  for (int s = -1; s <= 1; ++s) {
   vec2 offset = vec2(float(s), float(t)) * texelSize;
   blurred_visibility_factor += texture2D(inTex, vTexCoords + offset).r;
  }
 }
    
 gl_FragDepthEXT = blurred_visibility_factor * INV_TOTAL_SAMPLES_FACTOR;
 
}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/blur/blur.vert": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/blur/blur.vert ***!
            \**********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `attribute vec2 vertexPosition;
varying highp vec2 vTexCoords;
const vec2 scale = vec2(0.5, 0.5);

void main() {
   vTexCoords  = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range
   gl_Position = vec4(vertexPosition, 0.0, 1.0);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/instanced.frag": (
          /*!********************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/instanced.frag ***!
            \********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform mat4 viewMatrix;
uniform float opacity;

uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;
#ifdef SHADED
uniform highp sampler2D shading;
#endif
varying vec3 vLightFront;
varying vec3 vColor;
//DEFINEFRAGCOLOR

void main() {

    gl_FragColor = vec4( vec3 ( 1.0 ), opacity );

    #ifndef WIREFRAME
    gl_FragColor.xyz *= vLightFront;
    #endif

#ifdef SHADED
    ivec2 dim = textureSize(shading,0);
    float shadowFactor = texture2D(shading,vec2(gl_FragCoord.x/float(dim.x),gl_FragCoord.y/float(dim.y))).r;
    vColor *= shadowFactor;
#endif
    gl_FragColor = gl_FragColor * vec4( vColor, opacity );
    float depth = gl_FragCoord.z / gl_FragCoord.w;

    float fogFactor = smoothstep( fogNear, fogFar, depth );

    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );

}


`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/instanced.vert": (
          /*!********************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/instanced.vert ***!
            \********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 directionalLightColor[ 1 ];
uniform vec3 directionalLightDirection[ 1 ];

attribute vec3 offset;
attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;
attribute float radius;

varying vec3 vColor;
varying vec3 vLightFront;

void main() {

    vColor = color;

    vec3 objectNormal = normal;
    vec3 transformedNormal = normalMatrix * objectNormal;
    vec4 mvPosition = modelViewMatrix * vec4( position * radius + offset, 1.0 );

    vLightFront = vec3( 0.0 );

    transformedNormal = normalize( transformedNormal );

    vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );
    vec3 dirVector = normalize( lDirection.xyz );
    float dotProduct = dot( transformedNormal, dirVector );
    vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );

    vLightFront += directionalLightColor[ 0 ] * directionalLightWeighting;

    gl_Position = projectionMatrix * mvPosition;
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambert/lambert.frag": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambert/lambert.frag ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform mat4 viewMatrix;
uniform float opacity;

uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;
#ifdef SHADED
uniform highp sampler2D shading;
#endif
varying vec3 vLightFront;
varying vec3 vColor;
//DEFINEFRAGCOLOR

void main() {

    gl_FragColor = vec4( vec3 ( 1.0 ), opacity );

    #ifndef WIREFRAME
    gl_FragColor.xyz *= vLightFront;
    #endif
#ifdef SHADED
    ivec2 dim = textureSize(shading,0);
    float shadowFactor = texture2D(shading,vec2(gl_FragCoord.x/float(dim.x),gl_FragCoord.y/float(dim.y))).r;
    vColor *= shadowFactor;
#endif
    gl_FragColor = gl_FragColor * vec4( vColor, opacity );
    float depth = gl_FragCoord.z / gl_FragCoord.w;

    float fogFactor = smoothstep( fogNear, fogFar, depth );

    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );

}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambert/lambert.vert": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambert/lambert.vert ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 directionalLightColor[ 1 ];
uniform vec3 directionalLightDirection[ 1 ];

attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;

varying vec3 vColor;
varying vec3 vLightFront;

void main() {

    vColor = color;

    vec3 objectNormal = normal;
    vec3 transformedNormal = normalMatrix * objectNormal;
    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );

    vLightFront = vec3( 0.0 );

    transformedNormal = normalize( transformedNormal );

    vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );
    vec3 dirVector = normalize( lDirection.xyz );
    float dotProduct = dot( transformedNormal, dirVector );
    vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );

    vLightFront += directionalLightColor[ 0 ] * directionalLightWeighting;

    gl_Position = projectionMatrix * mvPosition;
}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag ***!
            \****************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `
#ifdef SHADED
uniform highp sampler2D shading;
#endif

uniform mat4 viewMatrix;
uniform float opacity;

uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;

varying vec3 vLightFront;
varying vec3 vLightBack;

varying vec3 vColor;


//DEFINEFRAGCOLOR

void main() {

    gl_FragColor = vec4( vec3 ( 1.0 ), opacity );

    #ifndef WIREFRAME
    if ( gl_FrontFacing )
       gl_FragColor.xyz *= vLightFront;
    else
       gl_FragColor.xyz *= vLightBack;
    #endif

    vec3 color = vColor;
#ifdef SHADED
    ivec2 dim = textureSize(shading,0);
    float shadowFactor = texture2D(shading,vec2(gl_FragCoord.x/float(dim.x),gl_FragCoord.y/float(dim.y))).r;
    color *= shadowFactor;
#endif
    gl_FragColor = gl_FragColor * vec4( color, opacity );
    float depth = gl_FragCoord.z / gl_FragCoord.w;

    float fogFactor = smoothstep( fogNear, fogFar, depth );

    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );

}


`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert ***!
            \****************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 directionalLightColor[ 1 ];
uniform vec3 directionalLightDirection[ 1 ];

attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;

varying vec3 vColor;
varying vec3 vLightFront;
varying vec3 vLightBack;

void main() {

    vColor = color;

    vec3 objectNormal = normal;
    vec3 transformedNormal = normalMatrix * objectNormal;
    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );

    vLightFront = vec3( 0.0 );
    vLightBack = vec3( 0.0 );

    transformedNormal = normalize( transformedNormal );

    vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );
    vec3 dirVector = normalize( lDirection.xyz );
    float dotProduct = dot( transformedNormal, dirVector );
    vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );
    vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );

    vLightFront += directionalLightColor[ 0 ] * directionalLightWeighting;
    vLightBack += directionalLightColor[ 0 ] * directionalLightWeightingBack;

    gl_Position = projectionMatrix * mvPosition;
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/outline/outline.frag": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/outline/outline.frag ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform float opacity;
uniform vec3 outlineColor;
uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;
//DEFINEFRAGCOLOR

void main() {
    gl_FragColor = vec4( outlineColor, 1 );

    float depth = gl_FragCoord.z / gl_FragCoord.w;
    float fogFactor = smoothstep( fogNear, fogFar, depth );
    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );    
}


`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/outline/outline.vert": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/outline/outline.vert ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform float outlineWidth;
uniform float outlinePushback;
uniform float vWidth;
uniform float vHeight;
uniform float outlineMaxPixels;

attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;

void main() {

    vec4 norm = modelViewMatrix*vec4(normalize(normal),0.0);
    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
    mvPosition.xy += norm.xy*outlineWidth;
    vec4 outpos = projectionMatrix * mvPosition;

    if(outlineMaxPixels > 0.0) {
        vec4 unadjusted = projectionMatrix*modelViewMatrix * vec4( position, 1.0 );
        float w = outpos.w;
        //normalize homogeneous coords
        unadjusted /= unadjusted.w;
        outpos /= outpos.w;
        vec2 diff = outpos.xy-unadjusted.xy;
        //put into pixels
        diff.x *= vWidth;
        diff.y *= vHeight;
        if ( length(diff) > outlineMaxPixels) {
            vec2 ndiff = normalize(diff)*outlineMaxPixels;
            ndiff.x /= vWidth;
            ndiff.y /= vHeight;
            outpos.xy = unadjusted.xy;
            outpos.xy += ndiff;
        }
        outpos *= w; //if I don't do this things blow up
    }
    gl_Position = outpos;
    mvPosition.z -= outlinePushback; //go backwards in model space
    vec4 pushpos = projectionMatrix*mvPosition; //project to get z in projection space, I'm probably missing some simple math to do the same thing..
    gl_Position.z = gl_Position.w*pushpos.z/pushpos.w;
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/screen.frag": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/screen.frag ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform sampler2D colormap;
varying highp vec2 vTexCoords;
uniform vec2 dimensions;
//DEFINEFRAGCOLOR
void main (void) {
   gl_FragColor = texture2D(colormap, vTexCoords);

   //gl_FragColor.g = gl_FragColor.b =  gl_FragColor.r; //debug shading 
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/screen.vert": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/screen.vert ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `attribute vec2 vertexPosition;
varying highp vec2 vTexCoords;
const vec2 scale = vec2(0.5, 0.5);

void main() {
   vTexCoords  = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range
   gl_Position = vec4(vertexPosition, 0.0, 1.0);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/screenaa.frag": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/screenaa.frag ***!
            \******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform highp sampler2D colormap;
varying highp vec2 vTexCoords;


// Basic FXAA implementation based on the code on geeks3d.com 
#define FXAA_REDUCE_MIN (1.0/ 128.0)
#define FXAA_REDUCE_MUL (1.0 / 8.0)
#define FXAA_SPAN_MAX 8.0


vec4 applyFXAA(vec2 fragCoord, highp sampler2D tex)
{
    vec4 color;
    ivec2 dim = textureSize(tex,0);
    vec2 dimensions = vec2(float(dim.x),float(dim.y));
    vec2 inverseVP = vec2(1.0 / dimensions.x, 1.0 / dimensions.y);
    vec3 rgbNW = texture2D(tex, fragCoord + vec2(-1.0, -1.0) * inverseVP).xyz;
    vec3 rgbNE = texture2D(tex, fragCoord + vec2(1.0, -1.0) * inverseVP).xyz;
    vec3 rgbSW = texture2D(tex, fragCoord + vec2(-1.0, 1.0) * inverseVP).xyz;
    vec3 rgbSE = texture2D(tex, fragCoord + vec2(1.0, 1.0) * inverseVP).xyz;
    vec4 rgbM  = texture2D(tex, fragCoord  * inverseVP);
    vec3 luma = vec3(0.299, 0.587, 0.114);
    float lumaNW = dot(rgbNW, luma);
    float lumaNE = dot(rgbNE, luma);
    float lumaSW = dot(rgbSW, luma);
    float lumaSE = dot(rgbSE, luma);
    float lumaM  = dot(rgbM.xyz,  luma);
    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));

    vec2 dir;
    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));

    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
                        (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);

    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
            max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
            dir * rcpDirMin)) * inverseVP;

    vec3 rgbA = 0.5 * (
        texture2D(tex, fragCoord + dir * (1.0 / 3.0 - 0.5)).xyz +
        texture2D(tex, fragCoord  + dir * (2.0 / 3.0 - 0.5)).xyz);
    vec3 rgbB = rgbA * 0.5 + 0.25 * (
        texture2D(tex, fragCoord  + dir * -0.5).xyz +
        texture2D(tex, fragCoord  + dir * 0.5).xyz);

    float lumaB = dot(rgbB, luma);
    if ((lumaB < lumaMin) || (lumaB > lumaMax))
        color = vec4(rgbA, rgbM.w);
    else
        color = vec4(rgbB, rgbM.w);
    return color;
}


//DEFINEFRAGCOLOR
void main (void) {
    ivec2 dim = textureSize(colormap,0);

  gl_FragColor = applyFXAA(vTexCoords, colormap);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/screenaa.vert": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/screenaa.vert ***!
            \******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `attribute vec2 vertexPosition;
varying highp vec2 vTexCoords;
const vec2 scale = vec2(0.5, 0.5);

void main() {
   vTexCoords  = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range
   gl_Position = vec4(vertexPosition, 0.0, 1.0);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag": (
          /*!******************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag ***!
            \******************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `
uniform mat4 viewMatrix;
uniform float opacity;
uniform mat4 projectionMatrix;

uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;
uniform float uDepth;
uniform vec3 directionalLightColor[ 1 ];

varying vec3 vColor;
varying vec2 mapping;
varying float rval;
varying vec3 vLight;
varying vec3 center;

#ifdef SHADED
uniform highp sampler2D shading;
#endif

//DEFINEFRAGCOLOR

void main() {
    float lensqr = dot(mapping,mapping);
    float rsqr = rval*rval;
    if(lensqr > rsqr)
       discard;
    float z = sqrt(rsqr-lensqr);
    vec3 cameraPos = center+ vec3(mapping.x,mapping.y,z);
    vec4 clipPos = projectionMatrix * vec4(cameraPos, 1.0);
    float ndcDepth = clipPos.z / clipPos.w;
    gl_FragDepthEXT = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;
    vec3 norm = normalize(vec3(mapping.x,mapping.y,z));
    float dotProduct = dot( norm, vLight );
    vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );
    vec3 vLight = directionalLightColor[ 0 ] * directionalLightWeighting;
    vec3 color = vLight*vColor;
#ifdef SHADED
    ivec2 dim = textureSize(shading,0);
    float shadowFactor = texture2D(shading,vec2(gl_FragCoord.x/float(dim.x),gl_FragCoord.y/float(dim.y))).r;
    color *= shadowFactor;
#endif    
    gl_FragColor = vec4(color, opacity*opacity );
    float fogFactor = smoothstep( fogNear, fogFar, gl_FragDepthEXT/gl_FragCoord.w );
    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );


}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert": (
          /*!******************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert ***!
            \******************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 directionalLightColor[ 1 ];
uniform vec3 directionalLightDirection[ 1 ];

attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;

varying vec2 mapping;
varying vec3 vColor;
varying float rval;
varying vec3 vLight;
varying vec3 center;

void main() {

    vColor = color;
    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
    center = mvPosition.xyz;
    vec4 projPosition = projectionMatrix * mvPosition;
    vec4 adjust = projectionMatrix* vec4(normal,0.0); adjust.z = 0.0; adjust.w = 0.0;
    vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );
    vLight = normalize( lDirection.xyz );
    mapping = normal.xy;
    rval = abs(normal.x);
    gl_Position = projPosition+adjust;

}
`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag": (
          /*!********************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag ***!
            \********************************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform float opacity;
uniform vec3 outlineColor;
uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;
uniform mat4 projectionMatrix;
varying vec2 mapping;
varying float rval;
varying vec3 center;

uniform float outlinePushback;

//DEFINEFRAGCOLOR

void main() {
    float lensqr = dot(mapping,mapping);
    float rsqr = rval*rval;
    if(lensqr > rsqr)
       discard;
    float z = sqrt(rsqr-lensqr);
    vec3 cameraPos = center+ vec3(mapping.x,mapping.y,z-outlinePushback);
    vec4 clipPos = projectionMatrix * vec4(cameraPos, 1.0);
    float ndcDepth = clipPos.z / clipPos.w;
    gl_FragDepthEXT = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;
    gl_FragColor = vec4(outlineColor, 1 );
}


`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert": (
          /*!********************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert ***!
            \********************************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform float outlineWidth;
uniform float outlinePushback;
uniform float outlineMaxPixels;
uniform float vWidth;
uniform float vHeight;

attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;

varying vec2 mapping;
varying float rval;
varying vec3 center;

void main() {

    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
    center = mvPosition.xyz;
    vec4 projPosition = projectionMatrix * mvPosition;
    vec2 norm = normal.xy + vec2(sign(normal.x)*outlineWidth,sign(normal.y)*outlineWidth);

    vec4 adjust = projectionMatrix* vec4(norm,normal.z,1.0); 
    mapping = norm.xy;
    rval = abs(norm.x);
    gl_Position = projPosition+vec4(adjust.xy,0.0,0.0);

    if(outlineMaxPixels > 0.0) {
        vec4 unadjusted = projectionMatrix*vec4(center.x+normal.x, center.y,center.z,1.0); 
        vec4 ccoord = projectionMatrix*vec4(center.xyz,1.0);
        adjust = projectionMatrix* vec4(center.x+norm.x,center.y,center.z,1.0); 
        //subtract center 
        unadjusted.xyz -= ccoord.xyz;
        adjust.xyz -= ccoord.xyz;
        unadjusted /= unadjusted.w;
        adjust /= adjust.w;
        float diff = abs(adjust.x-unadjusted.x);
        diff *= vWidth;
        if(diff > outlineMaxPixels) {
            
            float fixlen = abs(unadjusted.x) + outlineMaxPixels/vWidth;
            //adjsut reval by ratio of lengths
            rval *= fixlen/abs(adjust.x);
        }

    }
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/sprite.frag": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/sprite.frag ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform vec3 color;
uniform sampler2D map;
uniform float opacity;

uniform int fogType;
uniform vec3 fogColor;
uniform float fogDensity;
uniform float fogNear;
uniform float fogFar;
uniform float alphaTest;

varying vec2 vUV;
//DEFINEFRAGCOLOR

void main() {

    vec4 texture = texture2D(map, vUV);

    if (texture.a <= alphaTest) discard;

    gl_FragColor = vec4(color * texture.xyz, texture.a * opacity);

    if (fogType > 0) {

        float depth = gl_FragCoord.z / gl_FragCoord.w;
        float fogFactor = 0.0;

        if (fogType == 1) {
            fogFactor = smoothstep(fogNear, fogFar, depth);
        }

        else {
            const float LOG2 = 1.442695;
            float fogFactor = exp2(- fogDensity * fogDensity * depth * depth * LOG2);
            fogFactor = 1.0 - clamp(fogFactor, 0.0, 1.0);
        }

        gl_FragColor = mix(gl_FragColor, vec4(fogColor, gl_FragColor.w), fogFactor);

    }
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/sprite.vert": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/sprite.vert ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform int useScreenCoordinates;
uniform vec3 screenPosition;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform float rotation;
uniform vec2 scale;
uniform vec2 alignment;
uniform vec2 uvOffset;
uniform vec2 uvScale;

attribute vec2 position;
attribute vec2 uv;

varying vec2 vUV;

void main() {

    vUV = uvOffset + uv * uvScale;

    vec2 alignedPosition = position + alignment;

    vec2 rotatedPosition;
    rotatedPosition.x = ( cos(rotation) * alignedPosition.x - sin(rotation) * alignedPosition.y ) * scale.x;
    rotatedPosition.y = ( sin(rotation) * alignedPosition.x + cos(rotation) * alignedPosition.y ) * scale.y;

    vec4 finalPosition;

    if(useScreenCoordinates != 0) {
        finalPosition = vec4(screenPosition.xy + rotatedPosition, screenPosition.z, 1.0);
    }

    else {
        finalPosition = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0); finalPosition /= finalPosition.w;
        finalPosition.xy += rotatedPosition; 
    }

    gl_Position = finalPosition;

}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/ssao/ssao.frag": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/ssao/ssao.frag ***!
            \**********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform sampler2D depthmap;
varying highp vec2 vTexCoords;
uniform float vWidth;
uniform float vHeight;
uniform float total_strength;
uniform float radius;
uniform mat4 projinv;
uniform mat4 projectionMatrix;

//code for pseudorandom vector from chatgpt
float hash(vec3 p) {
    p = fract(p * vec3(0.1031, 0.1030, 0.0973));
    p += dot(p, p.yzx + 33.33);
    return fract((p.x + p.y) * p.z);
}

// Generate a pseudorandom vec3 from a seed vec3
vec3 pseudorandomVec3(vec3 seed) {
    vec3 randomVec;
    randomVec.x = hash(seed);
    randomVec.y = hash(seed + vec3(1.0, 0.0, 17.1));
    randomVec.z = hash(seed + vec3(0.0, 13.23, 0.0));
    return randomVec;
}

void main(void)
{   
   const float base = 0.2;
   const float area = 0.75;
   const int cycles = 1;

   const int samples = 64;
   vec3 sample_sphere[64] = vec3[](
      vec3(0.091258,-0.510164,0.000000),
      vec3(-0.204347,-0.872967,0.187199),
      vec3(0.009690,-0.263696,-0.110414),
      vec3(0.175208,-0.563987,0.228527),
      vec3(-0.001824,-0.003113,-0.000323),
      vec3(0.411134,-0.719869,-0.261530),
      vec3(-0.074272,-0.377368,0.276290),
      vec3(-0.147773,-0.381587,-0.284529),
      vec3(0.173317,-0.199635,0.063295),
      vec3(-0.186452,-0.199460,0.076965),
      vec3(0.143985,-0.308160,-0.307687),
      vec3(0.053194,-0.148286,0.169589),
      vec3(-0.547656,-0.486476,-0.317378),
      vec3(0.020804,-0.015092,-0.004574),
      vec3(-0.038006,-0.043165,0.054059),
      vec3(-0.094795,-0.443908,-0.731525),
      vec3(0.547552,-0.396466,0.461477),
      vec3(-0.176886,-0.089989,0.007315),
      vec3(0.074401,-0.048840,-0.074039),
      vec3(-0.008240,-0.075697,0.178197),
      vec3(-0.307880,-0.185053,-0.368943),
      vec3(0.309520,-0.108483,0.041646),
      vec3(-0.773478,-0.292946,0.538166),
      vec3(0.184487,-0.231594,-0.820065),
      vec3(0.207318,-0.100531,0.361797),
      vec3(-0.173306,-0.037737,-0.055289),
      vec3(0.548102,-0.105342,-0.253237),
      vec3(-0.119342,-0.043907,0.285162),
      vec3(-0.270247,-0.087861,-0.751357),
      vec3(0.449312,-0.039777,0.236146),
      vec3(-0.743773,-0.036095,0.196056),
      vec3(0.148819,-0.004300,-0.231448),
      vec3(0.008773,0.000809,0.051047),
      vec3(-0.461467,0.027390,-0.357386),
      vec3(0.169626,0.013338,-0.014053),
      vec3(-0.043786,0.007095,0.047331),
      vec3(0.004821,0.140371,-0.988260),
      vec3(0.092402,0.023994,0.101860),
      vec3(-0.295335,0.061530,-0.027372),
      vec3(0.024903,0.007537,-0.018901),
      vec3(-0.081463,0.125402,0.447794),
      vec3(-0.397119,0.231805,-0.631062),
      vec3(0.163853,0.059014,0.044905),
      vec3(-0.495220,0.214357,0.254139),
      vec3(0.306123,0.373687,-0.825715),
      vec3(0.021665,0.026737,0.053220),
      vec3(-0.208231,0.117129,-0.098685),
      vec3(0.139749,0.080968,-0.043086),
      vec3(-0.153599,0.182814,0.262090),
      vec3(-0.159673,0.496777,-0.743568),
      vec3(0.134797,0.117152,0.095753),
      vec3(-0.155626,0.120533,0.019395),
      vec3(0.042311,0.054462,-0.049709),
      vec3(0.001257,0.031288,0.034468),
      vec3(-0.002271,0.003199,-0.002304),
      vec3(0.662104,0.717307,0.033854),
      vec3(-0.373100,0.576021,0.308274),
      vec3(0.024233,0.231316,-0.173688),
      vec3(0.161311,0.420217,0.234273),
      vec3(-0.045248,0.078031,-0.010411),
      vec3(0.167453,0.376942,-0.094872),
      vec3(-0.056194,0.433247,0.173218),
      vec3(-0.016224,0.123149,-0.035569),
      vec3(0.067127,0.407641,0.028479)
   );

   float depth = texture2D(depthmap, vTexCoords).r;
   if(depth == 1.0) {
      discard;
   }

   vec4 screen_position = vec4(vTexCoords, depth,1.0);
   vec4 pos = projinv*screen_position;
   pos /= pos.w;
   vec3 position = pos.xyz;

   //approximate the normal from the depth map; I find this simpler
   //than trying to recompute the exact normal within every possible object shader

   //pixel offset positions in screen space
   ivec2 dim = textureSize(depthmap,0);
   vec2 offset1 = vec2(0.0,1.0/float(dim.y));
   vec2 offset2 = vec2(1.0/float(dim.x),0.0);
   float depth1 = texture2D(depthmap, vTexCoords + offset1).r;
   float depth2 = texture2D(depthmap, vTexCoords + offset2).r;
   
   vec3 p1 = vec3(screen_position.xy+offset1, depth1 - depth);
   vec3 p2 = vec3(screen_position.xy+offset2, depth2 - depth);

   //convert to model space
   vec4 pos1 = projinv*vec4(p1,1);
   pos1 /= pos1.w;
   vec4 pos2 = projinv*vec4(p2,1);
   pos2 /= pos2.w;

   vec3 normal = normalize(cross(pos1.xyz-position, pos2.xyz-position)); //model normal, important we normalize in model space

   //pseudo random number

   float occlusion = 0.0;
   for(int c = 0; c < cycles; c++) {
   vec3 random = normalize(pseudorandomVec3(position+float(c)));
   for(int i=0; i < samples; i++) {

      vec3 ray = radius * reflect(sample_sphere[i],random);
      vec3 hemi_ray = position + sign(dot(ray,normal)) * ray; //model space
      vec4 hemi_screen = projectionMatrix*vec4(hemi_ray,1.0);
      hemi_screen /= hemi_screen.w;
      
      float occ_depth = texture2D(depthmap, clamp(hemi_screen.xy,0.0,1.0)).r;
      float difference = hemi_screen.z - occ_depth;
      
      occlusion += step(0.0, difference) * (1.0-smoothstep(0.0, area, difference));
   }
   }
   float ao = 1.0 - total_strength * occlusion * (1.0 / float(cycles*samples));
   gl_FragDepthEXT = clamp(ao+base,0.0,1.0);

}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/ssao/ssao.vert": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/ssao/ssao.vert ***!
            \**********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `attribute vec2 vertexPosition;
varying highp vec2 vTexCoords;
const vec2 scale = vec2(0.5, 0.5);

void main() {
   vTexCoords  = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range
   gl_Position = vec4(vertexPosition, 0.0, 1.0);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag": (
          /*!************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag ***!
            \************************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `    float dotProduct = dot( norm, vLight );
    vec3 light = vec3( max( dotProduct, 0.0 ) );
    color *= light;
#ifdef SHADED
    ivec2 dim = textureSize(shading,0);
    float shadowFactor = texture2D(shading,vec2(gl_FragCoord.x/float(dim.x),gl_FragCoord.y/float(dim.y))).r;
    color *= shadowFactor;
#endif    
    gl_FragColor = vec4(color, opacity*opacity );
    float fogFactor = smoothstep( fogNear, fogFar, depth );
    gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );
}`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/stickimposter.vert": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/stickimposter.vert ***!
            \****************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 directionalLightColor[ 1 ];
uniform vec3 directionalLightDirection[ 1 ];

attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;
attribute float radius;

varying vec3 vColor;
varying vec3 vLight;
varying vec3 cposition;
varying vec3 p1;
varying vec3 p2;
varying float r;

void main() {

    vColor = color; vColor.z = abs(vColor.z); //z indicates which vertex and so would vary
    r = abs(radius);
    vec4 to = modelViewMatrix*vec4(normal, 1.0); //normal is other point of cylinder
    vec4 pt = modelViewMatrix*vec4(position, 1.0);
    vec4 mvPosition = pt;
    p1 = pt.xyz; p2 = to.xyz;
    vec3 norm = to.xyz-pt.xyz;
    float mult = 1.1; //slop to account for perspective of sphere
    if(length(p1) > length(p2)) { //billboard at level of closest point
       mvPosition = to;
    }
    vec3 n = normalize(mvPosition.xyz);
//intersect with the plane defined by the camera looking at the billboard point
    if(color.z >= 0.0) { //p1
       if(projectionMatrix[3][3] == 0.0) { //perspective
         vec3 pnorm = normalize(p1);
         float t = dot(mvPosition.xyz-p1,n)/dot(pnorm,n);
         mvPosition.xyz = p1+t*pnorm; 
       } else { //orthographic
         mvPosition.xyz = p1;
       }
    } else {
      if(projectionMatrix[3][3] == 0.0) { //perspective
         vec3 pnorm = normalize(p2);
         float t = dot(mvPosition.xyz-p2,n)/dot(pnorm,n);
         mvPosition.xyz = p2+t*pnorm;
       } else { //orthographic
         mvPosition.xyz = p2;
       } 
       mult *= -1.0;
    }
    vec3 cr = normalize(cross(mvPosition.xyz,norm))*radius;
    vec3 doublecr = normalize(cross(mvPosition.xyz,cr))*radius;
    mvPosition.xyz +=  mult*(cr + doublecr).xyz;
    cposition = mvPosition.xyz;
    gl_Position = projectionMatrix * mvPosition;
    vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );
    vLight = normalize( lDirection.xyz )*directionalLightColor[0]; //not really sure this is right, but color is always white so..
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/stickimposterFragmentShader.partial.frag": (
          /*!**************************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/stickimposterFragmentShader.partial.frag ***!
            \**************************************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform float opacity;
uniform mat4 projectionMatrix;

uniform vec3 fogColor;
uniform float fogNear;
uniform float fogFar;

varying vec3 vLight;
varying vec3 vColor;
varying vec3 cposition;
varying vec3 p1;
varying vec3 p2;
varying float r;

#ifdef SHADED
uniform highp sampler2D shading;
#endif

//DEFINEFRAGCOLOR

//cylinder-ray intersection testing taken from http://mrl.nyu.edu/~dzorin/cg05/lecture12.pdf
//also useful: http://stackoverflow.com/questions/9595300/cylinder-impostor-in-glsl
//with a bit more care (caps) this could be a general cylinder imposter (see also outline)
void main() {
    vec3 color = abs(vColor);
    vec3 pos = cposition;
    vec3 p = pos; //ray point
    vec3 v = vec3(0.0,0.0,-1.0); //ray normal - orthographic
    if(projectionMatrix[3][3] == 0.0) v = normalize(pos); //ray normal - perspective
    vec3 pa = p1; //cyl start
    vec3 va = normalize(p2-p1); //cyl norm
    vec3 tmp1 = v-(dot(v,va)*va);
    vec3 deltap = p-pa;
    float A = dot(tmp1,tmp1);
    if(A == 0.0) discard;
    vec3 tmp2 = deltap-(dot(deltap,va)*va);
    float B = 2.0*dot(tmp1, tmp2);
    float C = dot(tmp2,tmp2)-r*r;
//quadratic equation!
    float det = (B*B) - (4.0*A*C);
    if(det < 0.0) discard;
    float sqrtDet = sqrt(det);
    float posT = (-B+sqrtDet)/(2.0*A);
    float negT = (-B-sqrtDet)/(2.0*A);
    float intersectionT = min(posT,negT);
    vec3 qi = p+v*intersectionT;
    float dotp1 = dot(va,qi-p1);
    float dotp2 = dot(va,qi-p2);
    vec3 norm;
    if( dotp1 < 0.0 || dotp2 > 0.0) { //(p-c)^2 + 2(p-c)vt +v^2+t^2 - r^2 = 0
       vec3 cp;
       if( dotp1 < 0.0) {  
//        if(vColor.x < 0.0 ) discard; //color sign bit indicates if we should cap or not
        cp = p1;
       } else {
//          if(vColor.y < 0.0 ) discard;
          cp = p2;
       }
       vec3 diff = p-cp;
       A = dot(v,v);
       B = dot(diff,v)*2.0;
       C = dot(diff,diff)-r*r;
       det = (B*B) - (4.0*C);
       if(det < 0.0) discard;
       sqrtDet = sqrt(det);
       posT = (-B+sqrtDet)/(2.0);
       negT = (-B-sqrtDet)/(2.0);
       float t = min(posT,negT);
       qi = p+v*t; 
       norm = normalize(qi-cp); 
    } else {
       norm = normalize(qi-(dotp1*va + p1));
    }
    vec4 clipPos = projectionMatrix * vec4(qi, 1.0);
    float ndcDepth = clipPos.z / clipPos.w;
    float depth = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;
    gl_FragDepthEXT = depth;`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert": (
          /*!******************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert ***!
            \******************************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat3 normalMatrix;
uniform vec3 directionalLightColor[ 1 ];
uniform vec3 directionalLightDirection[ 1 ];
uniform vec3 outlineColor;
uniform float outlineWidth;
uniform float outlinePushback;
uniform float outlineMaxPixels;
uniform float vWidth;
uniform mat4 projinv;


attribute vec3 position;
attribute vec3 normal;
attribute vec3 color;
attribute float radius;

varying vec3 vColor;
varying vec3 vLight;
varying vec3 cposition;
varying vec3 p1;
varying vec3 p2;
varying float r;

void main() {

    vColor = outlineColor;
    float rad = radius+sign(radius)*outlineWidth;
    r = abs(rad);

    vec4 to = modelViewMatrix*vec4(normal, 1.0); //normal is other point of cylinder
    vec4 pt = modelViewMatrix*vec4(position, 1.0);
//pushback
    float scale = 1.0;
    if(projectionMatrix[3][3] != 0.0) { //orthographic
        to.z -= outlinePushback;
        pt.z -= outlinePushback;
    } else { //perspective
        vec4 midbefore = pt;
        if(length(to.xyz) < length(pt)) {
            midbefore = to;
        }
        vec4 midafter = midbefore;
        midafter.xyz += normalize(midbefore.xyz)*outlinePushback;

        to.xyz += normalize(to.xyz)*outlinePushback;
        pt.xyz += normalize(pt.xyz)*outlinePushback;

        //figure out a scaling factor for radius to account for perspective setback
        vec4 midbeforer = vec4(midbefore.x+rad,midbefore.y, midbefore.z, midbefore.w);
        vec4 midafterr = vec4(midafter.x+rad,midafter.y, midafter.z, midafter.w);

        vec4 mb = projectionMatrix*midbefore;
        vec4 mbr = projectionMatrix*midbeforer;
        vec4 ma = projectionMatrix*midafter;
        vec4 mar = projectionMatrix*midafterr;
        mb /= mb.w;
        mbr /= mbr.w;
        ma /= ma.w;
        mar /= mar.w;
        scale = abs((mbr.x-mb.x)/(mar.x-ma.x));
        rad *= scale;
        r = abs(rad);
    }
    vec4 mvPosition = pt;
    p1 = pt.xyz; p2 = to.xyz;
    vec3 norm = to.xyz-pt.xyz;
    float mult = 1.1; //slop to account for perspective of sphere
    if(length(p1) > length(p2)) { //billboard at level of closest point
       mvPosition = to;
    }

    vec3 n = normalize(mvPosition.xyz);
//intersect with the plane defined by the camera looking at the billboard point
    if(color.z >= 0.0) { //p1
       vec3 pnorm = normalize(p1);
       float t = dot(mvPosition.xyz-p1,n)/dot(pnorm,n);
       mvPosition.xyz = p1+t*pnorm;
    } else {
       vec3 pnorm = normalize(p2);
       float t = dot(mvPosition.xyz-p2,n)/dot(pnorm,n);
       mvPosition.xyz = p2+t*pnorm;
       mult *= -1.0;
    }

    if(outlineMaxPixels > 0.0) {
        vec4 cpos = mvPosition;
        vec4 unadjusted = projectionMatrix*vec4(cpos.x+abs(scale*radius), cpos.y,cpos.z,cpos.w); 
        vec4 ccoord = projectionMatrix*cpos;
        vec4 adjust = projectionMatrix*vec4(cpos.x+r,cpos.y,cpos.z,cpos.w); 
        unadjusted /= unadjusted.w;
        adjust /= adjust.w;
        unadjusted.xyz -= ccoord.xyz/ccoord.w;
        adjust.xyz -= ccoord.xyz/ccoord.w;
        float diff = abs(adjust.x-unadjusted.x);
        diff *= vWidth; //this should now be in pixels
        if(diff > outlineMaxPixels) {
            float fixlen = abs(unadjusted.x) + outlineMaxPixels/vWidth; 
            vec4 pcoord = ccoord;
            pcoord.x += fixlen*pcoord.w;
            vec4 altc = projinv*pcoord;
            r= abs(altc.x-cpos.x);
        }
    }

    vec3 cr = normalize(cross(mvPosition.xyz,norm))*rad;
    vec3 doublecr = normalize(cross(mvPosition.xyz,cr))*rad;
    mvPosition.xy +=  mult*(cr + doublecr).xy;
    cposition = mvPosition.xyz;
    gl_Position = projectionMatrix * mvPosition;
    vLight = vec3(1.0,1.0,1.0);
}

`;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/volumetric.frag": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/volumetric.frag ***!
            \**********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `
uniform highp sampler3D data;
uniform highp sampler2D colormap;
uniform highp sampler2D depthmap;


uniform mat4 textmat;
uniform mat4 projinv;
uniform mat4 projectionMatrix;

uniform float step;
uniform float subsamples;
uniform float maxdepth;
uniform float transfermin;
uniform float transfermax;
in  vec4 mvPosition;
out vec4 color;
void main(void) {

   vec4 pos = mvPosition;
   bool seengood = false;
   float i = 0.0;
   color = vec4(1,1,1,0);
   float increment = 1.0/subsamples;
   float maxsteps = (maxdepth*subsamples/step);
//there's probably a better way to do this..
//calculate farthest possible point in model coordinates
   vec4 maxpos = vec4(pos.x,pos.y,pos.z-maxdepth,1.0);
// convert to projection
   maxpos = projectionMatrix*maxpos;
   vec4 startp = projectionMatrix*pos;
// homogonize
   maxpos /= maxpos.w;
   startp /= startp.w;
//take x,y from start and z from max
   maxpos = vec4(startp.x,startp.y,maxpos.z,1.0);
//convert back to model space
   maxpos = projinv*maxpos;
   maxpos /= maxpos.w;
   float incr = step/subsamples;
//get depth from depthmap
//startp is apparently [-1,1]
   vec2 tpos = startp.xy/2.0+0.5;
   float depth = texture(depthmap, tpos).r;
//compute vector between start and end
   vec4 direction = maxpos-pos;
   for( i = 0.0; i <= maxsteps; i++) {
      vec4 pt = (pos+(i/maxsteps)*direction);
      vec4 ppt = projectionMatrix*pt;
      float ptdepth = ppt.z/ppt.w;
      ptdepth = ((gl_DepthRange.diff * ptdepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;
      if(ptdepth > depth) break;
      pt = textmat*pt;
//       pt /= pt.w;
      if(pt.x >= -0.01 && pt.y >= -0.01 && pt.z >= -0.01 && pt.x <= 1.01 && pt.y <= 1.01 && pt.z <= 1.01) {
         seengood = true;
      } else if(seengood) {
         break;
      }
      if( pt.x < -0.01 || pt.x > 1.01 || pt.y < -0.01 || pt.y > 1.01 || pt.z < -0.01 || pt.z > 1.01  ){
          color.a = 0.0;
          continue;
      }
      else {
         float val = texture(data, pt.zyx).r;
         if(isinf(val)) continue; //masked out
         float cval = (val-transfermin)/(transfermax-transfermin); //scale to texture 0-1 range
         vec4 val_color = texture(colormap, vec2(cval,0.5));
         color.rgb = color.rgb*color.a + (1.0-color.a)*val_color.a*val_color.rgb;
         color.a += (1.0 - color.a) * val_color.a; 
         if(color.a > 0.0) color.rgb /= color.a;
//          color = vec4(pt.x, pt.y, pt.z, 1.0);
      }
//       color = vec4(pt.x, pt.y, pt.z, 0.0)
    }
}

        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/volumetric.vert": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/volumetric.vert ***!
            \**********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => r
              /* harmony export */
            });
            const r = `uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

in vec3 position;
out vec4 mvPosition;
void main() {

    mvPosition = modelViewMatrix * vec4( position, 1.0 );
    gl_Position = projectionMatrix*mvPosition;
}
`;
          }
        ),
        /***/
        "./src/GLDraw.ts": (
          /*!***********************!*\
            !*** ./src/GLDraw.ts ***!
            \***********************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CAP: () => (
                /* binding */
                a
              ),
              /* harmony export */
              GLDraw: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), a;
            (function(h) {
              h[h.NONE = 0] = "NONE", h[h.FLAT = 1] = "FLAT", h[h.ROUND = 2] = "ROUND";
            })(a || (a = {}));
            var s;
            (function(h) {
              function o(m, l, u) {
                var p = Math.hypot(m, l), g, b, c, _, E;
                p < 1e-4 ? (b = 0, c = 1) : (b = -m / p, c = l / p), l = -b * m + c * l, g = Math.hypot(l, u), g < 1e-4 ? (_ = 0, E = 1) : (_ = u / g, E = l / g);
                var w = new Float32Array(9);
                return w[0] = c, w[1] = b, w[2] = 0, w[3] = -b * E, w[4] = c * E, w[5] = _, w[6] = b * _, w[7] = -c * _, w[8] = E, w;
              }
              class d {
                constructor() {
                  this.cache = {};
                  let l = [], u = 4, p = Math.pow(2, u), g = 2, b = Math.pow(2, g), c = p / b, _;
                  for (l[0] = new r.Vector3(-1, 0, 0), l[c] = new r.Vector3(0, 0, 1), l[c * 2] = new r.Vector3(1, 0, 0), l[c * 3] = new r.Vector3(0, 0, -1), g = 3; g <= u; g++) {
                    for (b = Math.pow(2, g - 1), c = p / b, _ = 0; _ < b - 1; _++)
                      l[c / 2 + _ * c] = l[_ * c].clone().add(l[(_ + 1) * c]).normalize();
                    _ = b - 1, l[c / 2 + _ * c] = l[_ * c].clone().add(l[0]).normalize();
                  }
                  this.basisVectors = l;
                }
                getVerticesForRadius(l, u, p) {
                  if (typeof this.cache < "u" && this.cache[l] !== void 0 && this.cache[l][u + p] !== void 0)
                    return this.cache[l][u + p];
                  for (var g = this.basisVectors.length, b = [], c = [], _, E = 0; E < g; E++)
                    b.push(this.basisVectors[E].clone().multiplyScalar(l)), b.push(this.basisVectors[E].clone().multiplyScalar(l)), _ = this.basisVectors[E].clone().normalize(), c.push(_), c.push(_);
                  var w = [], k = 10, $ = g, L = 0, z = Math.PI * 2, F = 0, R = Math.PI, P, U, N = !1, B = !1;
                  for (U = 0; U <= k; U++) {
                    N = U === 0 || U === k, B = U === k / 2;
                    var W = [], V = [];
                    for (P = 0; P <= $; P++) {
                      if (B) {
                        var G = P < $ ? 2 * P : 0;
                        V.push(G + 1), W.push(G);
                        continue;
                      }
                      var H = P / $, Q = U / k;
                      if (!N || P === 0)
                        if (P < $) {
                          var te = new r.Vector3();
                          te.x = -l * Math.cos(L + H * z) * Math.sin(F + Q * R), u == 1 ? te.y = 0 : te.y = l * Math.cos(F + Q * R), te.z = l * Math.sin(L + H * z) * Math.sin(F + Q * R), Math.abs(te.x) < 1e-5 && (te.x = 0), Math.abs(te.y) < 1e-5 && (te.y = 0), Math.abs(te.z) < 1e-5 && (te.z = 0), u == a.FLAT ? (_ = new r.Vector3(0, Math.cos(F + Q * R), 0), _.normalize()) : (_ = new r.Vector3(te.x, te.y, te.z), _.normalize()), b.push(te), c.push(_), W.push(b.length - 1);
                        } else
                          W.push(b.length - $);
                      else N && W.push(b.length - 1);
                    }
                    B && w.push(V), w.push(W);
                  }
                  var ee = {
                    vertices: b,
                    normals: c,
                    verticesRows: w,
                    w: $,
                    h: k
                  };
                  return l in this.cache || (this.cache[l] = {}), this.cache[l][u + p] = ee, ee;
                }
              }
              var v = new d();
              function f(m, l, u, p, g, b = 0, c = 0) {
                if (!l || !u)
                  return;
                let _ = function(Me) {
                  if (typeof Me == "string") {
                    let Ye = Me;
                    return Ye.toLowerCase() == "flat" ? a.FLAT : Ye.toLowerCase() == "round" ? a.ROUND : a.NONE;
                  } else
                    return Me;
                };
                b = _(b), c = _(c);
                var E = c || b;
                g = g || { r: 0, g: 0, b: 0 };
                var w = o(u.x - l.x, u.y - l.y, u.z - l.z), k = v.getVerticesForRadius(p, c, "to"), $ = k.w, L = k.h, z = E ? L * $ + 2 : 2 * $, F = m.updateGeoGroup(z), R = k.vertices, P = k.normals, U = k.verticesRows, N = U[L / 2], B = U[L / 2 + 1], W = F.vertices, V, G, H, Q, te, ee, ce = F.vertexArray, fe = F.normalArray, oe = F.colorArray, he = F.faceArray;
                for (H = 0; H < $; ++H) {
                  var Ae = 2 * H;
                  Q = w[0] * R[Ae].x + w[3] * R[Ae].y + w[6] * R[Ae].z, te = w[1] * R[Ae].x + w[4] * R[Ae].y + w[7] * R[Ae].z, ee = w[5] * R[Ae].y + w[8] * R[Ae].z, V = 3 * (W + Ae), G = F.faceidx, ce[V] = Q + l.x, ce[V + 1] = te + l.y, ce[V + 2] = ee + l.z, ce[V + 3] = Q + u.x, ce[V + 4] = te + u.y, ce[V + 5] = ee + u.z, fe[V] = Q, fe[V + 3] = Q, fe[V + 1] = te, fe[V + 4] = te, fe[V + 2] = ee, fe[V + 5] = ee, oe[V] = g.r, oe[V + 3] = g.r, oe[V + 1] = g.g, oe[V + 4] = g.g, oe[V + 2] = g.b, oe[V + 5] = g.b, he[G] = B[H] + W, he[G + 1] = B[H + 1] + W, he[G + 2] = N[H] + W, he[G + 3] = N[H] + W, he[G + 4] = B[H + 1] + W, he[G + 5] = N[H + 1] + W, F.faceidx += 6;
                }
                if (E) {
                  var Se = c ? 0 : L / 2, Ie = b ? L + 1 : L / 2 + 1, pe, le, ne, Te, Oe, Be, Ue, Pe, Ge, Ne, Re, De, je, Xe, X, q, re, ye, me, ze, ke, K, ae, ge, xe, ue, Ce, Z, Fe, We, I, we;
                  for (te = Se; te < Ie; te++)
                    if (te !== L / 2) {
                      var ve = te <= L / 2 ? u : l, Y = v.getVerticesForRadius(p, c, "to"), de = v.getVerticesForRadius(p, b, "from");
                      for (ve === u ? (R = Y.vertices, P = Y.normals, U = Y.verticesRows) : ve == l && (R = de.vertices, P = de.normals, U = de.verticesRows), Q = 0; Q < $; Q++)
                        G = F.faceidx, pe = U[te][Q + 1], Fe = (pe + W) * 3, le = U[te][Q], We = (le + W) * 3, ne = U[te + 1][Q], I = (ne + W) * 3, Te = U[te + 1][Q + 1], we = (Te + W) * 3, Oe = w[0] * R[pe].x + w[3] * R[pe].y + w[6] * R[pe].z, Be = w[0] * R[le].x + w[3] * R[le].y + w[6] * R[le].z, Ue = w[0] * R[ne].x + w[3] * R[ne].y + w[6] * R[ne].z, Pe = w[0] * R[Te].x + w[3] * R[Te].y + w[6] * R[Te].z, Ge = w[1] * R[pe].x + w[4] * R[pe].y + w[7] * R[pe].z, Ne = w[1] * R[le].x + w[4] * R[le].y + w[7] * R[le].z, Re = w[1] * R[ne].x + w[4] * R[ne].y + w[7] * R[ne].z, De = w[1] * R[Te].x + w[4] * R[Te].y + w[7] * R[Te].z, je = w[5] * R[pe].y + w[8] * R[pe].z, Xe = w[5] * R[le].y + w[8] * R[le].z, X = w[5] * R[ne].y + w[8] * R[ne].z, q = w[5] * R[Te].y + w[8] * R[Te].z, ce[Fe] = Oe + ve.x, ce[We] = Be + ve.x, ce[I] = Ue + ve.x, ce[we] = Pe + ve.x, ce[Fe + 1] = Ge + ve.y, ce[We + 1] = Ne + ve.y, ce[I + 1] = Re + ve.y, ce[we + 1] = De + ve.y, ce[Fe + 2] = je + ve.z, ce[We + 2] = Xe + ve.z, ce[I + 2] = X + ve.z, ce[we + 2] = q + ve.z, oe[Fe] = g.r, oe[We] = g.r, oe[I] = g.r, oe[we] = g.r, oe[Fe + 1] = g.g, oe[We + 1] = g.g, oe[I + 1] = g.g, oe[we + 1] = g.g, oe[Fe + 2] = g.b, oe[We + 2] = g.b, oe[I + 2] = g.b, oe[we + 2] = g.b, re = w[0] * P[pe].x + w[3] * P[pe].y + w[6] * P[pe].z, ye = w[0] * P[le].x + w[3] * P[le].y + w[6] * P[le].z, me = w[0] * P[ne].x + w[3] * P[ne].y + w[6] * P[ne].z, ze = w[0] * P[Te].x + w[3] * P[Te].y + w[6] * P[Te].z, ke = w[1] * P[pe].x + w[4] * P[pe].y + w[7] * P[pe].z, K = w[1] * P[le].x + w[4] * P[le].y + w[7] * P[le].z, ae = w[1] * P[ne].x + w[4] * P[ne].y + w[7] * P[ne].z, ge = w[1] * P[Te].x + w[4] * P[Te].y + w[7] * P[Te].z, xe = w[5] * P[pe].y + w[8] * P[pe].z, ue = w[5] * P[le].y + w[8] * P[le].z, Ce = w[5] * P[ne].y + w[8] * P[ne].z, Z = w[5] * P[Te].y + w[8] * P[Te].z, te === 0 ? (fe[Fe] = re, fe[I] = me, fe[we] = ze, fe[Fe + 1] = ke, fe[I + 1] = ae, fe[we + 1] = ge, fe[Fe + 2] = xe, fe[I + 2] = Ce, fe[we + 2] = Z, he[G] = pe + W, he[G + 1] = ne + W, he[G + 2] = Te + W, F.faceidx += 3) : te === Ie - 1 ? (fe[Fe] = re, fe[We] = ye, fe[I] = me, fe[Fe + 1] = ke, fe[We + 1] = K, fe[I + 1] = ae, fe[Fe + 2] = xe, fe[We + 2] = ue, fe[I + 2] = Ce, he[G] = pe + W, he[G + 1] = le + W, he[G + 2] = ne + W, F.faceidx += 3) : (fe[Fe] = re, fe[We] = ye, fe[we] = ze, fe[Fe + 1] = ke, fe[We + 1] = K, fe[we + 1] = ge, fe[Fe + 2] = xe, fe[We + 2] = ue, fe[we + 2] = Z, fe[We] = ye, fe[I] = me, fe[we] = ze, fe[We + 1] = K, fe[I + 1] = ae, fe[we + 1] = ge, fe[We + 2] = ue, fe[I + 2] = Ce, fe[we + 2] = Z, he[G] = pe + W, he[G + 1] = le + W, he[G + 2] = Te + W, he[G + 3] = le + W, he[G + 4] = ne + W, he[G + 5] = Te + W, F.faceidx += 6);
                    }
                }
                F.vertices += z;
              }
              h.drawCylinder = f;
              function y(m, l, u, p, g) {
                if (!l || !u)
                  return;
                g = g || { r: 0, g: 0, b: 0 };
                let b = new r.Vector3(u.x - l.x, u.y - l.y, u.z - l.z);
                var c = o(b.x, b.y, b.z);
                b = b.normalize();
                var _ = v.basisVectors.length, E = v.basisVectors, w = _ + 2, k = m.updateGeoGroup(w), $ = k.vertices, L, z, F, R, P, U, N = k.vertexArray, B = k.normalArray, W = k.colorArray, V = k.faceArray;
                for (L = $ * 3, N[L] = l.x, N[L + 1] = l.y, N[L + 2] = l.z, B[L] = -b.x, B[L + 1] = -b.y, B[L + 2] = -b.z, W[L] = g.r, W[L + 1] = g.g, W[L + 2] = g.b, N[L + 3] = u.x, N[L + 4] = u.y, N[L + 5] = u.z, B[L + 3] = b.x, B[L + 4] = b.y, B[L + 5] = b.z, W[L + 3] = g.r, W[L + 4] = g.g, W[L + 5] = g.b, L += 6, F = 0; F < _; ++F) {
                  var G = E[F].clone();
                  G.multiplyScalar(p), R = c[0] * G.x + c[3] * G.y + c[6] * G.z, P = c[1] * G.x + c[4] * G.y + c[7] * G.z, U = c[5] * G.y + c[8] * G.z, N[L] = R + l.x, N[L + 1] = P + l.y, N[L + 2] = U + l.z, B[L] = R, B[L + 1] = P, B[L + 2] = U, W[L] = g.r, W[L + 1] = g.g, W[L + 2] = g.b, L += 3;
                }
                for (k.vertices += _ + 2, z = k.faceidx, F = 0; F < _; F++) {
                  var H = $ + 2 + F, Q = $ + 2 + (F + 1) % _;
                  V[z] = H, V[z + 1] = Q, V[z + 2] = $, z += 3, V[z] = H, V[z + 1] = Q, V[z + 2] = $ + 1, z += 3;
                }
                k.faceidx += 6 * _;
              }
              h.drawCone = y;
              class A {
                constructor() {
                  this.cache = /* @__PURE__ */ new Map();
                }
                getVerticesForRadius(l, u) {
                  u = u || 2, this.cache.has(u) || this.cache.set(u, /* @__PURE__ */ new Map());
                  let p = this.cache.get(u);
                  if (p.has(l))
                    return p.get(l);
                  var g = {
                    vertices: [],
                    verticesRows: [],
                    normals: []
                  }, b = 16 * u, c = 10 * u;
                  l < 1 && (b = 10 * u, c = 8 * u);
                  var _ = 0, E = Math.PI * 2, w = 0, k = Math.PI, $, L;
                  for (L = 0; L <= c; L++) {
                    let F = [];
                    for ($ = 0; $ <= b; $++) {
                      let R = $ / b, P = L / c, U = -l * Math.cos(_ + R * E) * Math.sin(w + P * k), N = l * Math.cos(w + P * k), B = l * Math.sin(_ + R * E) * Math.sin(w + P * k);
                      var z = new r.Vector3(U, N, B);
                      z.normalize(), g.vertices.push({ x: U, y: N, z: B }), g.normals.push(z), F.push(g.vertices.length - 1);
                    }
                    g.verticesRows.push(F);
                  }
                  return p.set(l, g), g;
                }
              }
              var x = new A();
              function M(m, l, u, p, g) {
                var b = x.getVerticesForRadius(u, g), c = b.vertices, _ = b.normals, E = m.updateGeoGroup(c.length), w = E.vertices, k = E.vertexArray, $ = E.colorArray, L = E.faceArray, z = E.lineArray, F = E.normalArray;
                for (let U = 0, N = c.length; U < N; ++U) {
                  let B = 3 * (w + U), W = c[U];
                  k[B] = W.x + l.x, k[B + 1] = W.y + l.y, k[B + 2] = W.z + l.z, $[B] = p.r, $[B + 1] = p.g, $[B + 2] = p.b;
                }
                E.vertices += c.length;
                let R = b.verticesRows, P = R.length - 1;
                for (let U = 0; U < P; U++) {
                  let N = R[U].length - 1;
                  for (let B = 0; B < N; B++) {
                    let W = E.faceidx, V = E.lineidx, G = R[U][B + 1] + w, H = G * 3, Q = R[U][B] + w, te = Q * 3, ee = R[U + 1][B] + w, ce = ee * 3, fe = R[U + 1][B + 1] + w, oe = fe * 3, he = _[G - w], Ae = _[Q - w], Se = _[ee - w], Ie = _[fe - w];
                    Math.abs(c[G - w].y) === u ? (F[H] = he.x, F[ce] = Se.x, F[oe] = Ie.x, F[H + 1] = he.y, F[ce + 1] = Se.y, F[oe + 1] = Ie.y, F[H + 2] = he.z, F[ce + 2] = Se.z, F[oe + 2] = Ie.z, L[W] = G, L[W + 1] = ee, L[W + 2] = fe, z[V] = G, z[V + 1] = ee, z[V + 2] = G, z[V + 3] = fe, z[V + 4] = ee, z[V + 5] = fe, E.faceidx += 3, E.lineidx += 6) : Math.abs(c[ee - w].y) === u ? (F[H] = he.x, F[te] = Ae.x, F[ce] = Se.x, F[H + 1] = he.y, F[te + 1] = Ae.y, F[ce + 1] = Se.y, F[H + 2] = he.z, F[te + 2] = Ae.z, F[ce + 2] = Se.z, L[W] = G, L[W + 1] = Q, L[W + 2] = ee, z[V] = G, z[V + 1] = Q, z[V + 2] = G, z[V + 3] = ee, z[V + 4] = Q, z[V + 5] = ee, E.faceidx += 3, E.lineidx += 6) : (F[H] = he.x, F[te] = Ae.x, F[oe] = Ie.x, F[H + 1] = he.y, F[te + 1] = Ae.y, F[oe + 1] = Ie.y, F[H + 2] = he.z, F[te + 2] = Ae.z, F[oe + 2] = Ie.z, F[te] = Ae.x, F[ce] = Se.x, F[oe] = Ie.x, F[te + 1] = Ae.y, F[ce + 1] = Se.y, F[oe + 1] = Ie.y, F[te + 2] = Ae.z, F[ce + 2] = Se.z, F[oe + 2] = Ie.z, L[W] = G, L[W + 1] = Q, L[W + 2] = fe, L[W + 3] = Q, L[W + 4] = ee, L[W + 5] = fe, z[V] = G, z[V + 1] = Q, z[V + 2] = G, z[V + 3] = fe, z[V + 4] = Q, z[V + 5] = ee, z[V + 6] = ee, z[V + 7] = fe, E.faceidx += 6, E.lineidx += 8);
                  }
                }
              }
              h.drawSphere = M;
            })(s || (s = {}));
          }
        ),
        /***/
        "./src/GLModel.ts": (
          /*!************************!*\
            !*** ./src/GLModel.ts ***!
            \************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLModel: () => (
                /* binding */
                M
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), s = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ./colors */
              "./src/colors.ts"
            ), o = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), d = t(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), v = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), f = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), y = t(
              /*! ./parsers */
              "./src/parsers/index.ts"
            ), A = t(
              /*! netcdfjs */
              "./node_modules/netcdfjs/lib-esm/index.js"
            ), x = t(
              /*! ./parsers/utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            class M {
              // class functions
              // return true if a and b represent the same style
              static sameObj(l, u) {
                return l && u ? JSON.stringify(l) == JSON.stringify(u) : l == u;
              }
              constructor(l, u) {
                this.atoms = [], this.frames = [], this.box = null, this.atomdfs = null, this.id = 0, this.hidden = !1, this.molObj = null, this.renderedMolObj = null, this.lastColors = null, this.modelData = {}, this.modelDatas = null, this.idMatrix = new s.Matrix4(), this.dontDuplicateAtoms = !0, this.defaultColor = h.elementColors.defaultColor, this.defaultStickRadius = 0.25, this.options = u || {}, this.ElementColors = this.options.defaultcolors ? this.options.defaultcolors : h.elementColors.defaultColors, this.defaultSphereRadius = this.options.defaultSphereRadius ? this.options.defaultSphereRadius : 1.5, this.defaultCartoonQuality = this.options.cartoonQuality ? this.options.cartoonQuality : 10, this.id = l;
              }
              // return proper radius for atom given style
              /**
               *
               * @param {AtomSpec} atom
               * @param {atomstyle} style
               * @return {number}
               *
               */
              getRadiusFromStyle(l, u) {
                var p = this.defaultSphereRadius;
                if (typeof u.radius < "u")
                  p = u.radius;
                else if (M.vdwRadii[l.elem])
                  p = M.vdwRadii[l.elem];
                else if (l.elem.length > 1) {
                  let g = l.elem;
                  g = g[0].toUpperCase() + g[1].toLowerCase(), M.vdwRadii[g] && (p = M.vdwRadii[g]);
                }
                return typeof u.scale < "u" && (p *= u.scale), p;
              }
              // cross drawing
              /**
               *
               * @param {AtomSpec} atom
               * @param {Record<number, Geometry>} geos
               */
              drawAtomCross(l, u) {
                if (l.style.cross) {
                  var p = l.style.cross;
                  if (!p.hidden) {
                    var g = p.linewidth || M.defaultlineWidth;
                    u[g] || (u[g] = new r.Geometry());
                    var b = u[g].updateGeoGroup(6), c = this.getRadiusFromStyle(l, p), _ = [
                      [c, 0, 0],
                      [-c, 0, 0],
                      [0, c, 0],
                      [0, -c, 0],
                      [0, 0, c],
                      [0, 0, -c]
                    ], E = l.clickable || l.hoverable;
                    E && l.intersectionShape === void 0 && (l.intersectionShape = { sphere: [], cylinder: [], line: [] });
                    for (var w = (0, v.getColorFromStyle)(l, p), k = b.vertexArray, $ = b.colorArray, L = 0; L < 6; L++) {
                      var z = b.vertices * 3;
                      if (b.vertices++, k[z] = l.x + _[L][0], k[z + 1] = l.y + _[L][1], k[z + 2] = l.z + _[L][2], $[z] = w.r, $[z + 1] = w.g, $[z + 2] = w.b, E) {
                        var F = new s.Vector3(_[L][0], _[L][1], _[L][2]);
                        F.multiplyScalar(0.1), F.set(F.x + l.x, F.y + l.y, F.z + l.z), l.intersectionShape.line.push(F);
                      }
                    }
                  }
                }
              }
              getGoodCross(l, u, p, g) {
                for (var b = null, c = -1, _ = 0, E = l.bonds.length; _ < E; _++)
                  if (l.bonds[_] != u.index) {
                    let k = l.bonds[_], $ = this.atoms[k], z = new s.Vector3($.x, $.y, $.z).clone();
                    z.sub(p);
                    let F = z.clone();
                    F.cross(g);
                    var w = F.lengthSq();
                    if (w > c && (c = w, b = F, c > 0.1))
                      return b;
                  }
                return b;
              }
              //from atom, return a normalized vector v that is orthogonal and along which
              //it is appropraite to draw multiple bonds
              getSideBondV(l, u, p) {
                var g, b, c, _, E, w = new s.Vector3(l.x, l.y, l.z), k = new s.Vector3(u.x, u.y, u.z), $ = k.clone(), L = null;
                if ($.sub(w), l.bonds.length === 1)
                  u.bonds.length === 1 ? (L = $.clone(), Math.abs(L.x) > 1e-4 ? L.y += 1 : L.x += 1) : (g = (p + 1) % u.bonds.length, b = u.bonds[g], c = this.atoms[b], c.index == l.index && (g = (g + 1) % u.bonds.length, b = u.bonds[g], c = this.atoms[b]), _ = new s.Vector3(c.x, c.y, c.z), E = _.clone(), E.sub(w), L = E.clone(), L.cross($));
                else if (L = this.getGoodCross(l, u, w, $), L.lengthSq() < 0.01) {
                  var z = this.getGoodCross(u, l, w, $);
                  z != null && (L = z);
                }
                return L.lengthSq() < 0.01 && (L = $.clone(), Math.abs(L.x) > 1e-4 ? L.y += 1 : L.x += 1), L.cross($), L.normalize(), L;
              }
              addLine(l, u, p, g, b, c) {
                l[p] = g.x, l[p + 1] = g.y, l[p + 2] = g.z, u[p] = c.r, u[p + 1] = c.g, u[p + 2] = c.b, l[p + 3] = b.x, l[p + 4] = b.y, l[p + 5] = b.z, u[p + 3] = c.r, u[p + 4] = c.g, u[p + 5] = c.b;
              }
              // bonds - both atoms must match bond style
              // standardize on only drawing for lowest to highest
              /**
               *
               * @param {AtomSpec}
               *            atom
               * @param {AtomSpec[]} atoms
               * @param {Record<number,Geometry>} geos
               */
              drawBondLines(l, u, p) {
                if (l.style.line) {
                  var g = l.style.line;
                  if (!g.hidden) {
                    var b, c, _, E, w = g.linewidth || M.defaultlineWidth;
                    p[w] || (p[w] = new r.Geometry());
                    for (var k = p[w].updateGeoGroup(6 * l.bonds.length), $ = k.vertexArray, L = k.colorArray, z = 0; z < l.bonds.length; z++) {
                      var F = l.bonds[z], R = u[F];
                      if (R.style.line && !(l.index >= R.index)) {
                        var P = new s.Vector3(l.x, l.y, l.z), U = new s.Vector3(R.x, R.y, R.z), N = P.clone().add(U).multiplyScalar(0.5), B = !1, W = l.clickable || l.hoverable, V = R.clickable || R.hoverable;
                        (W || V) && (W && (l.intersectionShape === void 0 && (l.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), l.intersectionShape.line.push(P), l.intersectionShape.line.push(N)), V && (R.intersectionShape === void 0 && (R.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), R.intersectionShape.line.push(N), R.intersectionShape.line.push(U)));
                        var G = (0, v.getColorFromStyle)(l, l.style.line), H = (0, v.getColorFromStyle)(R, R.style.line);
                        if (l.bondStyles && l.bondStyles[z]) {
                          var Q = l.bondStyles[z];
                          if (!Q.iswire)
                            continue;
                          Q.singleBond && (B = !0), typeof Q.color1 < "u" && (G = h.CC.color(Q.color1)), typeof Q.color2 < "u" && (H = h.CC.color(Q.color2));
                        }
                        var te = k.vertices * 3, ee, ce;
                        if (l.bondOrder[z] > 1 && l.bondOrder[z] < 4 && !B) {
                          var fe = this.getSideBondV(l, R, z), oe = U.clone();
                          oe.sub(P), l.bondOrder[z] == 2 ? (fe.multiplyScalar(0.1), b = P.clone(), b.add(fe), c = P.clone(), c.sub(fe), _ = b.clone(), _.add(oe), E = c.clone(), E.add(oe), G == H ? (k.vertices += 4, this.addLine($, L, te, b, _, G), this.addLine($, L, te + 6, c, E, G)) : (k.vertices += 8, oe.multiplyScalar(0.5), ee = b.clone(), ee.add(oe), ce = c.clone(), ce.add(oe), this.addLine($, L, te, b, ee, G), this.addLine($, L, te + 6, ee, _, H), this.addLine($, L, te + 12, c, ce, G), this.addLine($, L, te + 18, ce, E, H))) : l.bondOrder[z] == 3 && (fe.multiplyScalar(0.1), b = P.clone(), b.add(fe), c = P.clone(), c.sub(fe), _ = b.clone(), _.add(oe), E = c.clone(), E.add(oe), G == H ? (k.vertices += 6, this.addLine($, L, te, P, U, G), this.addLine($, L, te + 6, b, _, G), this.addLine($, L, te + 12, c, E, G)) : (k.vertices += 12, oe.multiplyScalar(0.5), ee = b.clone(), ee.add(oe), ce = c.clone(), ce.add(oe), this.addLine($, L, te, P, N, G), this.addLine($, L, te + 6, N, U, H), this.addLine($, L, te + 12, b, ee, G), this.addLine($, L, te + 18, ee, _, H), this.addLine($, L, te + 24, c, ce, G), this.addLine($, L, te + 30, ce, E, H)));
                        } else
                          G == H ? (k.vertices += 2, this.addLine($, L, te, P, U, G)) : (k.vertices += 4, this.addLine($, L, te, P, N, G), this.addLine($, L, te + 6, N, U, H));
                      }
                    }
                  }
                }
              }
              //sphere drawing
              //See also: drawCylinder
              /**
               *
               * @param {AtomSpec} atom
               * @param {Geometry} geo
               */
              drawAtomSphere(l, u) {
                if (l.style.sphere) {
                  var p = l.style.sphere;
                  if (!p.hidden) {
                    var g = (0, v.getColorFromStyle)(l, p), b = this.getRadiusFromStyle(l, p);
                    if ((l.clickable === !0 || l.hoverable) && l.intersectionShape !== void 0) {
                      var c = new s.Vector3(l.x, l.y, l.z);
                      l.intersectionShape.sphere.push(new a.Sphere(c, b));
                    }
                    o.GLDraw.drawSphere(u, l, b, g);
                  }
                }
              }
              /** Register atom shaped click handlers */
              drawAtomClickSphere(l) {
                if (l.style.clicksphere) {
                  var u = l.style.clicksphere;
                  if (!u.hidden) {
                    var p = this.getRadiusFromStyle(l, u);
                    if ((l.clickable === !0 || l.hoverable) && l.intersectionShape !== void 0) {
                      var g = new s.Vector3(l.x, l.y, l.z);
                      l.intersectionShape.sphere.push(new a.Sphere(g, p));
                    }
                  }
                }
              }
              drawAtomInstanced(l, u) {
                if (l.style.sphere) {
                  var p = l.style.sphere;
                  if (!p.hidden) {
                    var g = this.getRadiusFromStyle(l, p), b = (0, v.getColorFromStyle)(l, p), c = u.updateGeoGroup(1), _ = c.vertices, E = _ * 3, w = c.vertexArray, k = c.colorArray, $ = c.radiusArray;
                    if (w[E] = l.x, w[E + 1] = l.y, w[E + 2] = l.z, k[E] = b.r, k[E + 1] = b.g, k[E + 2] = b.b, $[_] = g, (l.clickable === !0 || l.hoverable) && l.intersectionShape !== void 0) {
                      var L = new s.Vector3(l.x, l.y, l.z);
                      l.intersectionShape.sphere.push(new a.Sphere(L, g));
                    }
                    c.vertices += 1;
                  }
                }
              }
              drawSphereImposter(l, u, p, g) {
                var b = l.updateGeoGroup(4), c, _ = b.vertices, E = _ * 3, w = b.vertexArray, k = b.colorArray;
                for (c = 0; c < 4; c++)
                  w[E + 3 * c] = u.x, w[E + 3 * c + 1] = u.y, w[E + 3 * c + 2] = u.z;
                var $ = b.normalArray;
                for (c = 0; c < 4; c++)
                  k[E + 3 * c] = g.r, k[E + 3 * c + 1] = g.g, k[E + 3 * c + 2] = g.b;
                $[E + 0] = -p, $[E + 1] = p, $[E + 2] = 0, $[E + 3] = -p, $[E + 4] = -p, $[E + 5] = 0, $[E + 6] = p, $[E + 7] = -p, $[E + 8] = 0, $[E + 9] = p, $[E + 10] = p, $[E + 11] = 0, b.vertices += 4;
                var L = b.faceArray, z = b.faceidx;
                L[z + 0] = _, L[z + 1] = _ + 1, L[z + 2] = _ + 2, L[z + 3] = _ + 2, L[z + 4] = _ + 3, L[z + 5] = _, b.faceidx += 6;
              }
              //dkoes -  code for sphere imposters
              drawAtomImposter(l, u) {
                if (l.style.sphere) {
                  var p = l.style.sphere;
                  if (!p.hidden) {
                    var g = this.getRadiusFromStyle(l, p), b = (0, v.getColorFromStyle)(l, p);
                    if ((l.clickable === !0 || l.hoverable) && l.intersectionShape !== void 0) {
                      var c = new s.Vector3(l.x, l.y, l.z);
                      l.intersectionShape.sphere.push(new a.Sphere(c, g));
                    }
                    this.drawSphereImposter(u, l, g, b);
                  }
                }
              }
              calculateDashes(l, u, p, g, b) {
                var c = Math.sqrt(Math.pow(l.x - u.x, 2) + Math.pow(l.y - u.y, 2) + Math.pow(l.z - u.z, 2));
                p = Math.max(p, 0), b = Math.max(b, 0) + 2 * p, g = Math.max(g, 1e-3), g + b > c && (g = c, b = 0);
                var _ = Math.floor((c - g) / (g + b)) + 1, E = _ * g;
                b = (c - E) / _;
                for (var w, k = new s.Vector3(l.x, l.y, l.z), $ = new s.Vector3((u.x - l.x) / (c / b), (u.y - l.y) / (c / b), (u.z - l.z) / (c / b)), L = new s.Vector3((u.x - l.x) / (c / g), (u.y - l.y) / (c / g), (u.z - l.z) / (c / g)), z = [], F = 0; F < _; F++)
                  w = new s.Vector3(k.x + L.x, k.y + L.y, k.z + L.z), z.push({ from: k, to: w }), k = new s.Vector3(w.x + $.x, w.y + $.y, w.z + $.z);
                return z;
              }
              static drawStickImposter(l, u, p, g, b, c = 0, _ = 0) {
                for (var E = l.updateGeoGroup(4), w = E.vertices, k = w * 3, $ = E.vertexArray, L = E.colorArray, z = E.radiusArray, F = E.normalArray, R = b.r, P = b.g, U = b.b, N = function(H) {
                  var Q = -H;
                  return Q == 0 && (Q = -1e-4), Q;
                }, B = k, W = 0; W < 4; W++)
                  $[B] = u.x, F[B] = p.x, L[B] = R, B++, $[B] = u.y, F[B] = p.y, L[B] = P, B++, $[B] = u.z, F[B] = p.z, W < 2 ? L[B] = U : L[B] = N(U), B++;
                E.vertices += 4, z[w] = -g, z[w + 1] = g, z[w + 2] = -g, z[w + 3] = g;
                var V = E.faceArray, G = E.faceidx;
                V[G + 0] = w, V[G + 1] = w + 1, V[G + 2] = w + 2, V[G + 3] = w + 2, V[G + 4] = w + 3, V[G + 5] = w, E.faceidx += 6;
              }
              // draws cylinders and small spheres (at bond radius)
              drawBondSticks(l, u, p) {
                var g, b;
                if (l.style.stick) {
                  var c = l.style.stick;
                  if (!c.hidden) {
                    var _ = c.radius || this.defaultStickRadius, E = c.doubleBondScaling || 0.4, w = c.tripleBondScaling || 0.25, k = ((g = c.dashedBondConfig) === null || g === void 0 ? void 0 : g.dashLength) || 0.1, $ = ((b = c.dashedBondConfig) === null || b === void 0 ? void 0 : b.gapLength) || 0.25, L = _, z = c.singleBonds || !1, F = c.dashedBonds || !1, R = 0, P = 0, U, N, B, W, V, G, H, Q, te, ee, ce, fe = (0, v.getColorFromStyle)(l, c), oe, he, Ae;
                    !l.capDrawn && l.bonds.length < 4 && (R = 2);
                    var Se = (ae) => {
                      var ge = p.imposter ? M.drawStickImposter : o.GLDraw.drawCylinder;
                      return !F && ae >= 1 ? ge : (xe, ue, Ce, Z, Fe, We = 0, I = 0, we = 0.1, ve = 0.25) => {
                        var Y = this.calculateDashes(ue, Ce, Z, we, ve);
                        Y.forEach((de) => {
                          ge(xe, de.from, de.to, Z, Fe, We, I);
                        });
                      };
                    };
                    for (B = 0; B < l.bonds.length; B++) {
                      var Ie = Se(l.bondOrder[B]), pe = l.bonds[B], le = u[pe];
                      if (oe = he = Ae = null, l.index < le.index) {
                        var ne = le.style;
                        if (!ne.stick || ne.stick.hidden)
                          continue;
                        var Te = (0, v.getColorFromStyle)(le, ne.stick);
                        if (L = _, W = z, l.bondStyles && l.bondStyles[B]) {
                          if (V = l.bondStyles[B], V.iswire)
                            continue;
                          V.radius && (L = V.radius), V.singleBond && (W = !0), typeof V.color1 < "u" && (fe = h.CC.color(V.color1)), typeof V.color2 < "u" && (Te = h.CC.color(V.color2));
                        }
                        var Oe = new s.Vector3(l.x, l.y, l.z), Be = new s.Vector3(le.x, le.y, le.z);
                        if (l.bondOrder[B] <= 1 || W || l.bondOrder[B] > 3) {
                          if (l.bondOrder[B] < 1 && (L *= l.bondOrder[B]), !le.capDrawn && le.bonds.length < 4 && (P = 2), fe != Te ? (oe = new s.Vector3().addVectors(Oe, Be).multiplyScalar(0.5), Ie(p, Oe, oe, L, fe, R, 0, k, $), Ie(p, oe, Be, L, Te, 0, P, k, $)) : Ie(p, Oe, Be, L, fe, R, P, k, $), U = l.clickable || l.hoverable, N = le.clickable || le.hoverable, U || N) {
                            if (oe || (oe = new s.Vector3().addVectors(Oe, Be).multiplyScalar(0.5)), U) {
                              var Ue = new a.Cylinder(Oe, oe, L), Pe = new a.Sphere(Oe, L);
                              l.intersectionShape.cylinder.push(Ue), l.intersectionShape.sphere.push(Pe);
                            }
                            if (N) {
                              var Ge = new a.Cylinder(Be, oe, L), Ne = new a.Sphere(Be, L);
                              le.intersectionShape.cylinder.push(Ge), le.intersectionShape.sphere.push(Ne);
                            }
                          }
                        } else if (l.bondOrder[B] > 1) {
                          var Re = 0, De = 0;
                          L != _ && (Re = 2, De = 2);
                          var je = Be.clone(), Xe = null;
                          je.sub(Oe);
                          var X, q, re, ye, me;
                          Xe = this.getSideBondV(l, le, B), l.bondOrder[B] == 2 ? (X = L * E, Xe.multiplyScalar(X * 1.5), q = Oe.clone(), q.add(Xe), re = Oe.clone(), re.sub(Xe), ye = q.clone(), ye.add(je), me = re.clone(), me.add(je), fe != Te ? (oe = new s.Vector3().addVectors(q, ye).multiplyScalar(0.5), he = new s.Vector3().addVectors(re, me).multiplyScalar(0.5), Ie(p, q, oe, X, fe, Re, 0), Ie(p, oe, ye, X, Te, 0, De), Ie(p, re, he, X, fe, Re, 0), Ie(p, he, me, X, Te, 0, De)) : (Ie(p, q, ye, X, fe, Re, De), Ie(p, re, me, X, fe, Re, De)), U = l.clickable || l.hoverable, N = le.clickable || le.hoverable, (U || N) && (oe || (oe = new s.Vector3().addVectors(q, ye).multiplyScalar(0.5)), he || (he = new s.Vector3().addVectors(re, me).multiplyScalar(0.5)), U && (G = new a.Cylinder(q, oe, X), H = new a.Cylinder(re, he, X), l.intersectionShape.cylinder.push(G), l.intersectionShape.cylinder.push(H)), N && (te = new a.Cylinder(ye, oe, X), ee = new a.Cylinder(me, he, X), le.intersectionShape.cylinder.push(te), le.intersectionShape.cylinder.push(ee)))) : l.bondOrder[B] == 3 && (X = L * w, Xe.cross(je), Xe.normalize(), Xe.multiplyScalar(X * 3), q = Oe.clone(), q.add(Xe), re = Oe.clone(), re.sub(Xe), ye = q.clone(), ye.add(je), me = re.clone(), me.add(je), fe != Te ? (oe = new s.Vector3().addVectors(q, ye).multiplyScalar(0.5), he = new s.Vector3().addVectors(re, me).multiplyScalar(0.5), Ae = new s.Vector3().addVectors(Oe, Be).multiplyScalar(0.5), Ie(p, q, oe, X, fe, Re, 0), Ie(p, oe, ye, X, Te, 0, De), Ie(p, Oe, Ae, X, fe, R, 0), Ie(p, Ae, Be, X, Te, 0, P), Ie(p, re, he, X, fe, Re, 0), Ie(p, he, me, X, Te, 0, De)) : (Ie(p, q, ye, X, fe, Re, De), Ie(p, Oe, Be, X, fe, R, P), Ie(p, re, me, X, fe, Re, De)), U = l.clickable || l.hoverable, N = le.clickable || le.hoverable, (U || N) && (oe || (oe = new s.Vector3().addVectors(q, ye).multiplyScalar(0.5)), he || (he = new s.Vector3().addVectors(re, me).multiplyScalar(0.5)), Ae || (Ae = new s.Vector3().addVectors(Oe, Be).multiplyScalar(0.5)), U && (G = new a.Cylinder(q.clone(), oe.clone(), X), H = new a.Cylinder(re.clone(), he.clone(), X), Q = new a.Cylinder(Oe.clone(), Ae.clone(), X), l.intersectionShape.cylinder.push(G), l.intersectionShape.cylinder.push(H), l.intersectionShape.cylinder.push(Q)), N && (te = new a.Cylinder(ye.clone(), oe.clone(), X), ee = new a.Cylinder(me.clone(), he.clone(), X), ce = new a.Cylinder(Be.clone(), Ae.clone(), X), le.intersectionShape.cylinder.push(te), le.intersectionShape.cylinder.push(ee), le.intersectionShape.cylinder.push(ce))));
                        }
                      }
                    }
                    var ze = !1, ke = 0, K = !1;
                    for (B = 0; B < l.bonds.length; B++)
                      W = z, l.bondStyles && l.bondStyles[B] && (V = l.bondStyles[B], V.singleBond && (W = !0), V.radius && V.radius != _ && (K = !0)), (W || l.bondOrder[B] == 1) && ke++;
                    K ? ke > 0 && (ze = !0) : ke == 0 && (l.bonds.length > 0 || c.showNonBonded) && (ze = !0), ze && (L = _, p.imposter ? this.drawSphereImposter(p.sphereGeometry, l, L, fe) : o.GLDraw.drawSphere(p, l, L, fe));
                  }
                }
              }
              // go through all the atoms and regenerate their geometries
              // we try to have one geometry for each style since this is much much
              // faster
              // at some point we should optimize this to avoid unnecessary
              // recalculation
              /** param {AtomSpec[]} atoms */
              createMolObj(l, u) {
                u = u || {};
                var p = new r.Object3D(), g = [], b = {}, c = {}, _ = this.drawAtomSphere, E = null, w = null;
                u.supportsImposters ? (_ = this.drawAtomImposter, E = new r.Geometry(!0), E.imposter = !0, w = new r.Geometry(!0, !0), w.imposter = !0, w.sphereGeometry = new r.Geometry(!0), w.sphereGeometry.imposter = !0, w.drawnCaps = {}) : u.supportsAIA ? (_ = this.drawAtomInstanced, E = new r.Geometry(!1, !0, !0), E.instanced = !0, w = new r.Geometry(!0)) : (E = new r.Geometry(!0), w = new r.Geometry(!0));
                var k, $, L, z, F = {}, R = [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY];
                for (k = 0, L = l.length; k < L; k++) {
                  var P = l[k];
                  if (P && P.style) {
                    (P.clickable || P.hoverable) && P.intersectionShape === void 0 && (P.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), z = { line: void 0, cross: void 0, stick: void 0, sphere: void 0 };
                    for ($ in z)
                      P.style[$] ? P.style[$].opacity ? z[$] = parseFloat(P.style[$].opacity) : z[$] = 1 : z[$] = void 0, F[$] ? z[$] != null && F[$] != z[$] && (console.log("Warning: " + $ + " opacity is ambiguous"), F[$] = 1) : F[$] = z[$];
                    _.call(this, P, E), this.drawAtomClickSphere(P), this.drawAtomCross(P, c), this.drawBondLines(P, l, b), this.drawBondSticks(P, l, w), typeof P.style.cartoon < "u" && !P.style.cartoon.hidden && (P.style.cartoon.color === "spectrum" && typeof P.resi == "number" && !P.hetflag && (P.resi < R[0] && (R[0] = P.resi), P.resi > R[1] && (R[1] = P.resi)), g.push(P));
                  }
                }
                if (g.length > 0 && (0, d.drawCartoon)(p, g, R, this.defaultCartoonQuality), E && E.vertices > 0) {
                  E.initTypedArrays();
                  var U = null, N = null;
                  E.imposter ? U = new r.SphereImposterMaterial({
                    ambient: 0,
                    vertexColors: !0,
                    reflectivity: 0
                  }) : E.instanced ? (N = new r.Geometry(!0), o.GLDraw.drawSphere(N, { x: 0, y: 0, z: 0 }, 1, new h.Color(0.5, 0.5, 0.5)), N.initTypedArrays(), U = new r.InstancedMaterial({
                    sphereMaterial: new r.MeshLambertMaterial({
                      ambient: 0,
                      vertexColors: !0,
                      reflectivity: 0
                    }),
                    sphere: N
                  })) : U = new r.MeshLambertMaterial({
                    ambient: 0,
                    vertexColors: !0,
                    reflectivity: 0
                  }), F.sphere < 1 && F.sphere >= 0 && (U.transparent = !0, U.opacity = F.sphere), N = new r.Mesh(E, U), p.add(N);
                }
                if (w.vertices > 0) {
                  var B = null, W = null, V = w.sphereGeometry;
                  (!V || typeof V.vertices > "u" || V.vertices == 0) && (V = null), w.initTypedArrays(), V && V.initTypedArrays();
                  var G = { ambient: 0, vertexColors: !0, reflectivity: 0 };
                  w.imposter ? (B = new r.StickImposterMaterial(G), W = new r.SphereImposterMaterial(G)) : (B = new r.MeshLambertMaterial(G), W = new r.MeshLambertMaterial(G), B.wireframe && (w.setUpWireframe(), V && V.setUpWireframe())), F.stick < 1 && F.stick >= 0 && (B.transparent = !0, B.opacity = F.stick, W.transparent = !0, W.opacity = F.stick);
                  var H = new r.Mesh(w, B);
                  if (p.add(H), V) {
                    var Q = new r.Mesh(V, W);
                    p.add(Q);
                  }
                }
                var te;
                for (k in b)
                  if (b.hasOwnProperty(k)) {
                    te = k;
                    var ee = new r.LineBasicMaterial({
                      linewidth: te,
                      vertexColors: !0
                    });
                    F.line < 1 && F.line >= 0 && (ee.transparent = !0, ee.opacity = F.line), b[k].initTypedArrays();
                    var ce = new r.Line(b[k], ee, r.LineStyle.LinePieces);
                    p.add(ce);
                  }
                for (k in c)
                  if (c.hasOwnProperty(k)) {
                    te = k;
                    var fe = new r.LineBasicMaterial({
                      linewidth: te,
                      vertexColors: !0
                    });
                    F.cross < 1 && F.cross >= 0 && (fe.transparent = !0, fe.opacity = F.cross), c[k].initTypedArrays();
                    var oe = new r.Line(c[k], fe, r.LineStyle.LinePieces);
                    p.add(oe);
                  }
                if (this.dontDuplicateAtoms && this.modelData.symmetries && this.modelData.symmetries.length > 0) {
                  var he = new r.Object3D(), Ae;
                  for (Ae = 0; Ae < this.modelData.symmetries.length; Ae++) {
                    var Se = new r.Object3D();
                    Se = p.clone(), Se.matrix.copy(this.modelData.symmetries[Ae]), Se.matrixAutoUpdate = !1, he.add(Se);
                  }
                  return he;
                }
                return p;
              }
              /**
               * Return object representing internal state of
               * the model appropriate for passing to setInternalState
               *
              */
              getInternalState() {
                return {
                  atoms: this.atoms,
                  frames: this.frames
                };
              }
              /**
               * Overwrite the internal model state with the passed state.
               *
              */
              setInternalState(l) {
                this.atoms = l.atoms, this.frames = l.frames, this.molObj = null;
              }
              /**
               * Returns crystallographic information if present.
               *
               *
               */
              getCrystData() {
                if (this.modelData.cryst) {
                  if (!this.modelData.cryst.matrix) {
                    const l = this.modelData.cryst;
                    this.modelData.cryst.matrix = (0, s.conversionMatrix3)(l.a, l.b, l.c, l.alpha, l.beta, l.gamma);
                  }
                  return this.modelData.cryst;
                } else
                  return null;
              }
              /**
              	     * Set crystallographic information using three angles and three lengths
              	     *
              	     * @param {number} a - length of unit cell side
              	     * @param {number} b - length of unit cell side
              	     * @param {number} c - length of unit cell side
              	     * @param {number} alpha - unit cell angle in degrees (default 90)
              	     * @param {number} beta - unit cell angle in degrees (default 90)
              	     * @param {number} gamma - unit cell angle in degrees (default 90)
              
              	     */
              setCrystData(l, u, p, g, b, c) {
                l = l || 1, u = u || 1, p = p || 1, g = g || 90, b = b || 90, c = c || 90;
                const _ = (0, s.conversionMatrix3)(l, u, p, g, b, c);
                this.modelData.cryst = {
                  a: l,
                  b: u,
                  c: p,
                  alpha: g,
                  beta: b,
                  gamma: c,
                  matrix: _
                };
              }
              /**
               * Set the crystallographic matrix to the given matrix.
               *
               * This function removes `a`, `b`, `c`, `alpha`, `beta`, `gamma` from
               * the crystal data.
               *
               * @param {Matrix3} matrix - unit cell matrix
               */
              setCrystMatrix(l) {
                l = l || new s.Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), this.modelData.cryst = {
                  matrix: l
                };
              }
              /**
               * Returns list of rotational/translational matrices if there is BIOMT data
               * Otherwise returns a list of just the ID matrix
               *
               * @return {Array<Matrix4>}
               *
               */
              getSymmetries() {
                return typeof this.modelData.symmetries > "u" && (this.modelData.symmetries = [this.idMatrix]), this.modelData.symmetries;
              }
              /**
               * Sets symmetries based on specified matrices in list
               *
               * @param {Array<Matrix4>} list
               *
               */
              setSymmetries(l) {
                typeof l > "u" ? this.modelData.symmetries = [this.idMatrix] : this.modelData.symmetries = l;
              }
              /**
               * Returns model id number
               *
               * @return {number} Model ID
               */
              getID() {
                return this.id;
              }
              /**
               * Returns model's frames property, a list of atom lists
               *
               * @return {number}
               */
              getNumFrames() {
                return this.frames.numFrames != null ? this.frames.numFrames : this.frames.length;
              }
              adjustCoord(l, u, p, g) {
                var b = u - l;
                return b < -p ? u + g : b > p ? u - g : u;
              }
              //go over current atoms in depth first order and ensure that connected
              //attoms aren't split across the box
              adjustCoordinatesToBox() {
                if (this.box && this.atomdfs)
                  for (var l = this.box[0], u = this.box[1], p = this.box[2], g = l * 0.9, b = u * 0.9, c = p * 0.9, _ = 0; _ < this.atomdfs.length; _++)
                    for (var E = this.atomdfs[_], w = 1; w < E.length; w++) {
                      var k = this.atoms[E[w][0]], $ = this.atoms[E[w][1]];
                      k.x = this.adjustCoord($.x, k.x, g, l), k.y = this.adjustCoord($.y, k.y, b, u), k.z = this.adjustCoord($.z, k.z, c, p);
                    }
              }
              /**
               * Sets model's atomlist to specified frame
               * Sets to last frame if framenum out of range
               *
               * @param {number} framenum - model's atoms are set to this index in frames list
               * @return {Promise}
               */
              setFrame(l, u) {
                var p = this.getNumFrames();
                let g = this;
                return new Promise(function(b, c) {
                  if (p == 0 && b(), (l < 0 || l >= p) && (l = p - 1), g.frames.url != null) {
                    var _ = g.frames.url;
                    (0, v.getbin)(_ + "/traj/frame/" + l + "/" + g.frames.path, void 0, "POST", void 0).then(function(E) {
                      for (var w = new Float32Array(E, 44), k = 0, $ = 0; $ < g.atoms.length; $++)
                        g.atoms[$].x = w[k++], g.atoms[$].y = w[k++], g.atoms[$].z = w[k++];
                      g.box && g.atomdfs && g.adjustCoordinatesToBox(), b();
                    }).catch(c);
                  } else
                    g.atoms = g.frames[l], b();
                  g.molObj = null, g.modelDatas && l < g.modelDatas.length && (g.modelData = g.modelDatas[l], g.unitCellObjects && u && (u.removeUnitCell(g), u.addUnitCell(g)));
                });
              }
              /**
               * Add atoms as frames of model
               *
               * @param {AtomSpec[]} atoms - atoms to be added
               */
              addFrame(l) {
                this.frames.push(l);
              }
              /**
              	     * If model atoms have dx, dy, dz properties (in some xyz files), vibrate populates the model's frame property based on parameters.
              	     * Model can then be animated
              	     *
              	     * @param {number} numFrames - number of frames to be created, default to 10
              	     * @param {number} amplitude - amplitude of distortion, default to 1 (full)
              	     * @param {boolean} bothWays - if true, extend both in positive and negative directions by numFrames
              	     * @param {GLViewer} viewer - required if arrowSpec is provided
              	     * @param {ArrowSpec} arrowSpec - specification for drawing animated arrows. If color isn't specified, atom color (sphere, stick, line preference) is used.
              	     *@example
              
              	      $3Dmol.download("pdb:4UAA",viewer,{},function(){
              	        viewer.setStyle({},{stick:{}});
              	        viewer.vibrate(10, 1);
              	        viewer.animate({loop: "forward",reps: 1});
              
              	        viewer.zoomTo();
              	              viewer.render();
              	          });
              	     */
              vibrate(l = 10, u = 1, p = !1, g, b) {
                var c = 0, _ = l;
                p && (c = -l, _ = l), this.frames !== void 0 && this.frames.origIndex !== void 0 ? this.setFrame(this.frames.origIndex) : this.setFrame(0), c < _ && (this.frames = []), p && (this.frames.origIndex = l);
                for (var E = c; E < _; E++) {
                  var w = [], k = this.frames.length;
                  if (E == 0 && !b) {
                    this.frames.push(this.atoms);
                    continue;
                  }
                  for (var $ = 0; $ < this.atoms.length; $++) {
                    var L = (0, v.getAtomProperty)(this.atoms[$], "dx"), z = (0, v.getAtomProperty)(this.atoms[$], "dy"), F = (0, v.getAtomProperty)(this.atoms[$], "dz"), R = new s.Vector3(L, z, F), P = new s.Vector3(this.atoms[$].x, this.atoms[$].y, this.atoms[$].z), U = E * u / l;
                    R.multiplyScalar(U), P.add(R);
                    var N = {};
                    for (var B in this.atoms[$])
                      N[B] = this.atoms[$][B];
                    if (N.x = P.x, N.y = P.y, N.z = P.z, w.push(N), g && b) {
                      var W = (0, v.extend)({}, b), V = new s.Vector3(L, z, F);
                      if (V.multiplyScalar(u), V.add(P), W.start = P, W.end = V, W.frame = k, !W.color) {
                        var G = N.style.sphere;
                        G || (G = N.style.stick), G || (G = N.style.line), W.color = (0, v.getColorFromStyle)(N, G);
                      }
                      g.addArrow(W);
                    }
                  }
                  this.frames.push(w);
                }
              }
              // set default style and colors for atoms
              setAtomDefaults(l) {
                for (let u = 0; u < l.length; u++) {
                  let p = l[u];
                  p && (p.style = p.style || (0, v.deepCopy)(M.defaultAtomStyle), p.color = p.color || this.ElementColors[p.elem] || this.defaultColor, p.model = this.id, (p.clickable || p.hoverable) && (p.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }));
                }
              }
              /** add atoms to this model from molecular data string
               *
               * @param {string|ArrayBuffer} data - atom structure file input data string, for gzipped input use ArrayBuffer
               * @param {string} format - input file string format (e.g 'pdb', 'sdf', 'sdf.gz', etc.)
               * @param {ParserOptionsSpec} options - format dependent options. Attributes depend on the input format
               */
              addMolData(l, u, p = {}) {
                var g = M.parseMolData(l, u, p);
                this.dontDuplicateAtoms = !p.duplicateAssemblyAtoms;
                var b = g.modelData;
                if (b && (Array.isArray(b) ? (this.modelData = b[0], p.frames && (this.modelDatas = b)) : this.modelData = b), g.box ? this.box = g.box : this.box = null, this.frames.length == 0) {
                  for (let _ = 0; _ < g.length; _++)
                    g[_].length != 0 && this.frames.push(g[_]);
                  this.frames[0] && (this.atoms = this.frames[0]);
                } else if (p.frames)
                  for (let _ = 0; _ < g.length; _++)
                    this.frames.push(g[_]);
                else
                  for (var c = 0; c < g.length; c++)
                    this.addAtoms(g[c]);
                for (let _ = 0; _ < this.frames.length; _++)
                  this.setAtomDefaults(this.frames[_]);
                p.vibrate && p.vibrate.frames && p.vibrate.amplitude && this.vibrate(p.vibrate.frames, p.vibrate.amplitude), p.style && this.setStyle({}, p.style);
              }
              setDontDuplicateAtoms(l) {
                this.dontDuplicateAtoms = l;
              }
              setModelData(l) {
                this.modelData = l;
              }
              //return true if atom value matches property val
              propertyMatches(l, u) {
                if (l == u)
                  return !0;
                if (typeof u == "string" && typeof l == "number") {
                  var p = u.match(/(-?\d+)\s*-\s*(-?\d+)/);
                  if (p) {
                    var g = parseInt(p[1]), b = parseInt(p[2]);
                    if (p && l >= g && l <= b)
                      return !0;
                  }
                }
                return !1;
              }
              // make a deep copy of a selection object and create caches of expensive
              // selections.  We create a copy so caches are not attached to user
              // supplied objects where the user might change them invalidating the cache.
              // This does not support arbitrary
              // javascript objects, but support enough for eveything that is
              // used in selections: number, string, boolean, functions; as well
              // as arrays and nested objects with values of the aformentioned
              // types.
              static deepCopyAndCache(l, u) {
                if (typeof l != "object" || l == null || l.__cache_created)
                  return l;
                const p = {};
                for (const g in l) {
                  const b = l[g];
                  if (Array.isArray(b)) {
                    p[g] = [];
                    for (let c = 0; c < b.length; c++)
                      p[g].push(M.deepCopyAndCache(b[c], u));
                  } else typeof b == "object" && g != "properties" && g != "model" ? p[g] = M.deepCopyAndCache(b, u) : p[g] = b;
                  if (g == "and" || g == "or") {
                    const c = [];
                    for (const _ of p[g]) {
                      const E = /* @__PURE__ */ new Set();
                      for (const w of u.selectedAtoms(_))
                        E.add(w.index);
                      c.push(E);
                    }
                    if (g == "and") {
                      const _ = function(w, k) {
                        const $ = /* @__PURE__ */ new Set();
                        for (const L of k)
                          w.has(L) && $.add(L);
                        return $;
                      };
                      let E = new Set(c[0]);
                      for (const w of c.splice(1))
                        E = _(E, w);
                      p[g].__cached_results = E;
                    } else if (g == "or") {
                      const _ = /* @__PURE__ */ new Set();
                      for (const E of c)
                        for (const w of E)
                          _.add(w);
                      p[g].__cached_results = _;
                    }
                  }
                }
                return p.__cache_created = !0, p;
              }
              /** given a selection specification, return true if atom is selected.
               * Does not support context-aware selectors like expand/within/byres.
               *
               * @param {AtomSpec} atom
               * @param {AtomSelectionSpec} sel
               * @return {boolean}
               */
              atomIsSelected(l, u) {
                if (typeof u > "u")
                  return !0;
                var p = !!u.invert, g = !0;
                for (var b in u)
                  if (b == "and" || b == "or" || b == "not") {
                    if (b == "not") {
                      if (this.atomIsSelected(l, u[b])) {
                        g = !1;
                        break;
                      }
                    } else if (u[b].__cached_results === void 0 && (u = M.deepCopyAndCache(u, this)), g = u[b].__cached_results.has(l.index), !g)
                      break;
                  } else if (b === "predicate") {
                    if (!u.predicate(l)) {
                      g = !1;
                      break;
                    }
                  } else if (b == "properties" && l[b]) {
                    for (var c in u.properties)
                      if (!c.startsWith("__cache")) {
                        if (typeof l.properties[c] > "u") {
                          g = !1;
                          break;
                        }
                        if (l.properties[c] != u.properties[c]) {
                          g = !1;
                          break;
                        }
                      }
                  } else if (u.hasOwnProperty(b) && !M.ignoredKeys.has(b) && !b.startsWith("__cache")) {
                    if (typeof l[b] > "u") {
                      g = !1;
                      break;
                    }
                    var _ = !1;
                    if (b === "bonds") {
                      var E = u[b];
                      if (E != l.bonds.length) {
                        g = !1;
                        break;
                      }
                    } else if (Array.isArray(u[b])) {
                      var w = u[b], k = l[b];
                      for (let $ = 0; $ < w.length; $++)
                        if (this.propertyMatches(k, w[$])) {
                          _ = !0;
                          break;
                        }
                      if (!_) {
                        g = !1;
                        break;
                      }
                    } else {
                      let $ = u[b];
                      if (!this.propertyMatches(l[b], $)) {
                        g = !1;
                        break;
                      }
                    }
                  }
                return p ? !g : g;
              }
              static squaredDistance(l, u) {
                var p = u.x - l.x, g = u.y - l.y, b = u.z - l.z;
                return p * p + g * g + b * b;
              }
              /** returns a list of atoms in the expanded bounding box, but not in the current one
               *
               *  Bounding box:
               *
               *    [ [ xmin, ymin, zmin ],
               *      [ xmax, ymax, zmax ],
               *      [ xctr, yctr, zctr ] ]
               *
               **/
              expandAtomList(l, u) {
                if (u <= 0)
                  return l;
                for (var p = (0, v.getExtent)(l, void 0), g = [[], [], []], b = 0; b < 3; b++)
                  g[0][b] = p[0][b] - u, g[1][b] = p[1][b] + u, g[2][b] = p[2][b];
                var c = [];
                for (let k = 0; k < this.atoms.length; k++) {
                  var _ = this.atoms[k].x, E = this.atoms[k].y, w = this.atoms[k].z;
                  _ >= g[0][0] && _ <= g[1][0] && E >= g[0][1] && E <= g[1][1] && w >= g[0][2] && w <= g[1][2] && (_ >= p[0][0] && _ <= p[1][0] && E >= p[0][1] && E <= p[1][1] && w >= p[0][2] && w <= p[1][2] || c.push(this.atoms[k]));
                }
                return c;
              }
              static getFloat(l) {
                return typeof l == "number" ? l : parseFloat(l);
              }
              /** return list of atoms selected by sel, this is specific to glmodel
               *
               * @param {AtomSelectionSpec} sel
               * @return {Object[]}
               * @example
               $3Dmol.download("pdb:4wwy",viewer,{},function(){
                        var atoms = viewer.selectedAtoms({chain:'A'});
                        for(var i = 0, n = atoms.length; i < n; i++) {
                           atoms[i].b = 0.0;
                        }
                        viewer.setStyle({cartoon:{colorscheme:{prop:'b',gradient: 'roygb',min:0,max:30}}});
                        viewer.render();
                    });
               */
              selectedAtoms(l, u) {
                var p = [];
                l = M.deepCopyAndCache(l || {}, this), u || (u = this.atoms);
                for (var g = u.length, b = 0; b < g; b++) {
                  var c = u[b];
                  c && this.atomIsSelected(c, l) && p.push(c);
                }
                if (l.hasOwnProperty("expand")) {
                  const N = M.getFloat(l.expand);
                  let B = this.expandAtomList(p, N), W = p.length;
                  const V = N * N;
                  for (let G = 0; G < B.length; G++)
                    for (let H = 0; H < W; H++) {
                      var _ = M.squaredDistance(B[G], p[H]);
                      _ < V && _ > 0 && p.push(B[G]);
                    }
                }
                if (l.hasOwnProperty("within") && l.within.hasOwnProperty("sel") && l.within.hasOwnProperty("distance")) {
                  var E = this.selectedAtoms(l.within.sel, this.atoms), w = {};
                  const N = M.getFloat(l.within.distance), B = N * N;
                  for (let W = 0; W < E.length; W++)
                    for (let V = 0; V < p.length; V++) {
                      let G = M.squaredDistance(E[W], p[V]);
                      G < B && G > 0 && (w[V] = 1);
                    }
                  var k = [];
                  if (l.within.invert)
                    for (let W = 0; W < p.length; W++)
                      w[W] || k.push(p[W]);
                  else
                    for (let W in w)
                      k.push(p[W]);
                  p = k;
                }
                if (l.hasOwnProperty("byres")) {
                  var $ = {}, L = [], z = [];
                  for (let N = 0; N < p.length; N++) {
                    let B = p[N];
                    var F = B.chain, R = B.resi;
                    if ($[F] === void 0 && ($[F] = {}), B.hasOwnProperty("resi") && $[F][R] === void 0) {
                      for ($[F][R] = !0, z.push(B); z.length > 0; )
                        if (B = z.pop(), F = B.chain, R = B.resi, L[B.index] === void 0) {
                          L[B.index] = !0;
                          for (var P = 0; P < B.bonds.length; P++) {
                            var U = this.atoms[B.bonds[P]];
                            L[U.index] === void 0 && U.hasOwnProperty("resi") && U.chain == F && U.resi == R && (z.push(U), p.push(U));
                          }
                        }
                    }
                  }
                }
                return p;
              }
              /** Add list of new atoms to model.  Adjusts bonds appropriately.
              	     *
              	     * @param {AtomSpec[]} newatoms
              	     * @example
              	     * var atoms = [{elem: 'C', x: 0, y: 0, z: 0, bonds: [1,2], bondOrder: [1,2]}, {elem: 'O', x: -1.5, y: 0, z: 0, bonds: [0]},{elem: 'O', x: 1.5, y: 0, z: 0, bonds: [0], bondOrder: [2]}];
              
              	        viewer.setBackgroundColor(0xffffffff);
              	        var m = viewer.addModel();
              	        m.addAtoms(atoms);
              	        m.setStyle({},{stick:{}});
              	        viewer.zoomTo();
              	        viewer.render();
              	     */
              addAtoms(l) {
                this.molObj = null;
                var u = this.atoms.length, p = [], g;
                for (g = 0; g < l.length; g++)
                  typeof l[g].index > "u" && (l[g].index = g), typeof l[g].serial > "u" && (l[g].serial = g), p[l[g].index] = u + g;
                for (g = 0; g < l.length; g++) {
                  var b = l[g], c = p[b.index], _ = (0, v.extend)({}, b);
                  _.index = c, _.bonds = [], _.bondOrder = [], _.model = this.id, _.style = _.style || (0, v.deepCopy)(M.defaultAtomStyle), typeof _.color > "u" && (_.color = this.ElementColors[_.elem] || this.defaultColor);
                  for (var E = b.bonds ? b.bonds.length : 0, w = 0; w < E; w++) {
                    var k = p[b.bonds[w]];
                    typeof k < "u" && (_.bonds.push(k), _.bondOrder.push(b.bondOrder ? b.bondOrder[w] : 1));
                  }
                  this.atoms.push(_);
                }
              }
              /** Assign bonds based on atomic coordinates.
               *  This currently uses a primitive distance-based algorithm that does not
               * consider valence constraints and will only create single bonds.
               */
              assignBonds() {
                (0, x.assignBonds)(this.atoms, { assignBonds: !0 });
              }
              /** Remove specified atoms from model
               *
               * @param {AtomSpec[]} badatoms - list of atoms
               */
              removeAtoms(l) {
                this.molObj = null;
                var u = [], p;
                for (p = 0; p < l.length; p++)
                  u[l[p].index] = !0;
                var g = [];
                for (p = 0; p < this.atoms.length; p++) {
                  var b = this.atoms[p];
                  u[b.index] || g.push(b);
                }
                this.atoms = [], this.addAtoms(g);
              }
              /** Set atom style of selected atoms
              	     *
              	     * @param {AtomSelectionSpec} sel
              	     * @param {AtomStyleSpec} style
              	     * @param {boolean} add - if true, add to current style, don't replace
              	     @example
              	    $3Dmol.download("pdb:4UB9",viewer,{},function(){
              	              viewer.setBackgroundColor(0xffffffff);
              
              	              viewer.setStyle({chain:'A'},{line:{hidden:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'B'},{line:{colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'C'},{cross:{hidden:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'D'},{cross:{colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.RWB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'E'},{cross:{radius:2.0,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.RWB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'F'},{stick:{hidden:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.RWB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'G'},{stick:{radius:0.8,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.ROYGB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.setStyle({chain:'H'},{stick:{singleBonds:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.ROYGB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}});
              	              viewer.render();
              	          });
              	     */
              setStyle(l, u, p) {
                typeof u > "u" && typeof p > "u" && (u = l, l = {}), l = l, typeof u == "string" && (u = (0, v.specStringToObject)(u));
                var g = !1, b = this, c = function(E) {
                  var w = b.selectedAtoms(l, E);
                  for (let k = 0; k < E.length; k++)
                    E[k] && (E[k].capDrawn = !1);
                  for (let k = 0; k < w.length; k++) {
                    g = !0, (w[k].clickable || w[k].hoverable) && (w[k].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), p || (w[k].style = {});
                    for (let $ in u)
                      u.hasOwnProperty($) && (w[k].style[$] = w[k].style[$] || {}, Object.assign(w[k].style[$], u[$]));
                  }
                };
                if (l.frame !== void 0 && l.frame < this.frames.length) {
                  let E = l.frame;
                  E < 0 && (E = this.frames.length + E), c(this.frames[E]);
                } else {
                  c(this.atoms);
                  for (var _ = 0; _ < this.frames.length; _++)
                    this.frames[_] !== this.atoms && c(this.frames[_]);
                }
                g && (this.molObj = null);
              }
              /** Set clickable and callback of selected atoms
              	     *
              	     * @param {AtomSelectionSpec} sel - atom selection to apply clickable settings to
              	     * @param {boolean} clickable - whether click-handling is enabled for the selection
              	     * @param {function} callback - function called when an atom in the selection is clicked
              
              	     */
              setClickable(l, u, p) {
                if (u = !!u, p = (0, v.makeFunction)(p), p === null) {
                  console.log("Callback is not a function");
                  return;
                }
                var g = this.selectedAtoms(l, this.atoms), b = g.length;
                for (let c = 0; c < b; c++)
                  g[c].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, g[c].clickable = u, p && (g[c].callback = p);
                b > 0 && (this.molObj = null);
              }
              /** Set hoverable and callback of selected atoms
              *
              * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to
              * @param {boolean} hoverable - whether hover-handling is enabled for the selection
              * @param {function} hover_callback - function called when an atom in the selection is hovered over
              * @param {function} unhover_callback - function called when the mouse moves out of the hover area
              */
              setHoverable(l, u, p, g) {
                if (u = !!u, p = (0, v.makeFunction)(p), g = (0, v.makeFunction)(g), p === null) {
                  console.log("Hover_callback is not a function");
                  return;
                }
                if (g === null) {
                  console.log("Unhover_callback is not a function");
                  return;
                }
                var b = this.selectedAtoms(l, this.atoms), c = b.length;
                for (let _ = 0; _ < c; _++)
                  b[_].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, b[_].hoverable = u, p && (b[_].hover_callback = p), g && (b[_].unhover_callback = g);
                c > 0 && (this.molObj = null);
              }
              /** enable context menu of selected atoms
               *
               * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to
               * @param {boolean} contextMenuEnabled - whether contextMenu-handling is enabled for the selection
               */
              enableContextMenu(l, u) {
                u = !!u;
                var p, g = this.selectedAtoms(l, this.atoms), b = g.length;
                for (p = 0; p < b; p++)
                  g[p].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, g[p].contextMenuEnabled = u;
                b > 0 && (this.molObj = null);
              }
              /** given a mapping from element to color, set atom colors
               *
               * @param {AtomSelectionSpec} sel
               * @param {object} colors
               */
              setColorByElement(l, u) {
                if (!(this.molObj !== null && M.sameObj(u, this.lastColors))) {
                  this.lastColors = u;
                  var p = this.selectedAtoms(l, p);
                  p.length > 0 && (this.molObj = null);
                  for (var g = 0; g < p.length; g++) {
                    var b = p[g];
                    typeof u[b.elem] < "u" && (b.color = u[b.elem]);
                  }
                }
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {string} prop
               * @param {Gradient|string} scheme
               */
              setColorByProperty(l, u, p, g) {
                var b, c, _ = this.selectedAtoms(l, _);
                for (this.lastColors = null, _.length > 0 && (this.molObj = null), typeof p == "string" && typeof f.Gradient.builtinGradients[p] < "u" && (p = new f.Gradient.builtinGradients[p]()), p = p, g || (g = p.range()), g || (g = (0, v.getPropertyRange)(_, u)), b = 0; b < _.length; b++) {
                  c = _[b];
                  var E = (0, v.getAtomProperty)(c, u);
                  E != null && (c.color = p.valueToHex(parseFloat(c.properties[u]), g));
                }
              }
              /**
              	     * @deprecated use setStyle and colorfunc attribute
              	     * @param {AtomSelectionSpec} sel - selection object
              	     * @param {function} func - function to be used to set the color
              	     @example
              	      $3Dmol.download("pdb:4UAA",viewer,{},function(){
              	              viewer.setBackgroundColor(0xffffffff);
              	              var colorAsSnake = function(atom) {
              	                return atom.resi % 2 ? 'white': 'green'
              	              };
              
              	              viewer.setStyle( {}, { cartoon: {colorfunc: colorAsSnake }});
              
              	              viewer.render();
              	          });
              
              	     */
              setColorByFunction(l, u) {
                var p = this.selectedAtoms(l, p);
                if (typeof u == "function") {
                  this.lastColors = null, p.length > 0 && (this.molObj = null);
                  for (let g = 0; g < p.length; g++) {
                    let b = p[g];
                    b.color = u(b);
                  }
                }
              }
              /** Convert the model into an object in the format of a ChemDoodle JSON model.
               *
               * @param {boolean} whether or not to include style information. Defaults to false.
               * @return {Object}
               */
              toCDObject(l = !1) {
                var u = { a: [], b: [] };
                l && (u.s = []);
                for (let g = 0; g < this.atoms.length; g++) {
                  let b = {}, c = this.atoms[g];
                  if (b.x = c.x, b.y = c.y, b.z = c.z, c.elem != "C" && (b.l = c.elem), l) {
                    for (var p = 0; p < u.s.length && JSON.stringify(c.style) !== JSON.stringify(u.s[p]); )
                      p++;
                    p === u.s.length && u.s.push(c.style), p !== 0 && (b.s = p);
                  }
                  u.a.push(b);
                  for (let _ = 0; _ < c.bonds.length; _++) {
                    let E = g, w = c.bonds[_];
                    if (E >= w)
                      continue;
                    let k = {
                      b: E,
                      e: w
                    }, $ = c.bondOrder[_];
                    $ != 1 && (k.o = $), u.b.push(k);
                  }
                }
                return u;
              }
              /** manage the globj for this model in the possed modelGroup - if it has to be regenerated, remove and add
               *
               * @param {Object3D} group
               * @param Object options
               */
              globj(l, u) {
                (this.molObj === null || u.regen) && (this.molObj = this.createMolObj(this.atoms, u), this.renderedMolObj && (l.remove(this.renderedMolObj), this.renderedMolObj = null), this.renderedMolObj = this.molObj.clone(), this.hidden && (this.renderedMolObj.setVisible(!1), this.molObj.setVisible(!1)), l.add(this.renderedMolObj));
              }
              /** return a VRML string representation of the model.  Does not include VRML header information
               * @return VRML
               */
              exportVRML() {
                var l = this.createMolObj(this.atoms, { supportsImposters: !1, supportsAIA: !1 });
                return l.vrml();
              }
              /** Remove any renderable mol object from scene
               *
               * @param {Object3D} group
               */
              removegl(l) {
                this.renderedMolObj && (this.renderedMolObj.geometry !== void 0 && this.renderedMolObj.geometry.dispose(), this.renderedMolObj.material !== void 0 && this.renderedMolObj.material.dispose(), l.remove(this.renderedMolObj), this.renderedMolObj = null), this.molObj = null;
              }
              /**
              	     * Don't show this model in future renderings. Keep all styles and state
              	     * so it can be efficiencly shown again.
              	     *
              	     * * @see GLModel#show
              
              	     * @example
              	        $3Dmol.download("pdb:3ucr",viewer,{},function(){
              	        viewer.setStyle({},{stick:{}});
              	        viewer.getModel().hide();
              	        viewer.render();
              	        });
              	     */
              hide() {
                this.hidden = !0, this.renderedMolObj && this.renderedMolObj.setVisible(!1), this.molObj && this.molObj.setVisible(!1);
              }
              /**
               * Unhide a hidden model
               * @see GLModel#hide
               * @example
                  $3Dmol.download("pdb:3ucr",viewer,{},function(){
                  viewer.setStyle({},{stick:{}});
                  viewer.getModel().hide();
                  viewer.render(  )
                  viewer.getModel().show()
                  viewer.render();
                  });
               */
              show() {
                this.hidden = !1, this.renderedMolObj && this.renderedMolObj.setVisible(!0), this.molObj && this.molObj.setVisible(!0);
              }
              /** Create labels for atoms that show the value of the passed property.
               *
               * @param {String} prop - property name
               * @param {AtomSelectionSpec} sel
               * @param {GLViewer} viewer
               * @param {LabelSpec} options
               */
              addPropertyLabels(l, u, p, g) {
                for (var b = this.selectedAtoms(u, b), c = (0, v.deepCopy)(g), _ = 0; _ < b.length; _++) {
                  var E = b[_], w = null;
                  typeof E[l] < "u" ? w = String(E[l]) : typeof E.properties[l] < "u" && (w = String(E.properties[l])), w != null && (c.position = E, p.addLabel(w, c));
                }
              }
              /** Create labels for residues of selected atoms.
               * Will create a single label at the center of mass of all atoms
               * with the same chain,resn, and resi.
               *
               * @param {AtomSelectionSpec} sel
               * @param {GLViewer} viewer
               * @param {LabelSpec} options
               * @param {boolean} byframe - if true, create labels for every individual frame, not just current; frames must be loaded already
               */
              addResLabels(l, u, p, g = !1) {
                var b = [], c = function(E, w) {
                  for (var k = E.selectedAtoms(l, k), $ = {}, L = 0; L < k.length; L++) {
                    var z = k[L], F = z.chain, R = z.resn, P = z.resi, U = R + "" + P;
                    $[F] || ($[F] = {}), $[F][U] || ($[F][U] = []), $[F][U].push(z);
                  }
                  var N = (0, v.deepCopy)(p);
                  for (let W in $)
                    if ($.hasOwnProperty(W)) {
                      var B = $[W];
                      for (let V in B)
                        if (B.hasOwnProperty(V)) {
                          let G = B[V], H = new s.Vector3(0, 0, 0);
                          for (let te = 0; te < G.length; te++) {
                            let ee = G[te];
                            H.x += ee.x, H.y += ee.y, H.z += ee.z;
                          }
                          H.divideScalar(G.length), N.position = H, N.frame = w;
                          let Q = u.addLabel(V, N, void 0, !0);
                          b.push(Q);
                        }
                    }
                };
                if (g) {
                  var _ = this.getNumFrames();
                  let E = this.atoms;
                  for (let w = 0; w < _; w++)
                    this.frames[w] && (this.atoms = this.frames[w], c(this, w));
                  this.atoms = E;
                } else
                  c(this);
                return b;
              }
              //recurse over the current atoms to establish a depth first order
              setupDFS() {
                this.atomdfs = [];
                var l = this, u = new Int8Array(this.atoms.length);
                u.fill(0);
                for (var p = function(_, E, w) {
                  w.push([_, E]);
                  var k = l.atoms[_];
                  u[_] = 1;
                  for (var $ = 0; $ < k.bonds.length; $++) {
                    var L = k.bonds[$];
                    l.atoms[L] && !u[L] && p(L, _, w);
                  }
                }, g = 0; g < this.atoms.length; g++) {
                  var b = this.atoms[g];
                  if (b && !u[g]) {
                    var c = [];
                    p(g, -1, c), this.atomdfs.push(c);
                  }
                }
              }
              /**
              * Set coordinates from remote trajectory file.
              * @param {string} url - contains the url where mdsrv has been hosted
              * @param {string} path - contains the path of the file (<root>/filename)
              * @return {Promise}
              */
              setCoordinatesFromURL(l, u) {
                this.frames = [];
                var p = this;
                return this.box && this.setupDFS(), l.startsWith("http") || (l = "http://" + l), (0, v.get)(l + "/traj/numframes/" + u, function(g) {
                  if (!isNaN(parseInt(g)))
                    return p.frames.push(p.atoms), p.frames.numFrames = g, p.frames.url = l, p.frames.path = u, p.setFrame(0);
                });
              }
              /**
              * Set coordinates for the atoms from provided trajectory file.
              * @param {string|ArrayBuffer} str - contains the data of the file
              * @param {string} format - contains the format of the file (mdcrd, inpcrd, pdb, netcdf, or array).  Arrays should be TxNx3 where T is the number of timesteps and N the number of atoms.
                @example
                   let m = viewer.addModel()  //create an empty model
                   m.addAtoms([{x:0,y:0,z:0,elem:'C'},{x:2,y:0,z:0,elem:'C'}]) //provide a list of dictionaries representing the atoms
                   viewer.setStyle({'sphere':{}})
                   m.setCoordinates([[[0.0, 0.0, 0.0], [2.0, 0.0, 0.0]], [[0.0, 0.0, 0.0], [2.8888888359069824, 0.0, 0.0]], [[0.0, 0.0, 0.0], [3.777777671813965, 0.0, 0.0]], [[0.0, 0.0, 0.0], [4.666666507720947, 0.0, 0.0]], [[0.0, 0.0, 0.0], [5.55555534362793, 0.0, 0.0]], [[0.0, 0.0, 0.0], [6.44444465637207, 0.0, 0.0]], [[0.0, 0.0, 0.0], [7.333333492279053, 0.0, 0.0]], [[0.0, 0.0, 0.0], [8.222222328186035, 0.0, 0.0]], [[0.0, 0.0, 0.0], [9.11111068725586, 0.0, 0.0]], [[0.0, 0.0, 0.0], [10.0, 0.0, 0.0]]],'array');
                   viewer.animate({loop: "forward",reps: 1});
                   viewer.zoomTo();
                   viewer.zoom(0.5);
                   viewer.render();
              */
              setCoordinates(l, u) {
                if (u = u || "", !l)
                  return [];
                if (/\.gz$/.test(u)) {
                  u = u.replace(/\.gz$/, "");
                  try {
                    l = (0, v.inflateString)(l);
                  } catch ($) {
                    console.log($);
                  }
                }
                var p = { mdcrd: "", inpcrd: "", pdb: "", netcdf: "", array: "" };
                if (p.hasOwnProperty(u)) {
                  this.frames = [];
                  for (var g = this.atoms.length, b = M.parseCrd(l, u), c = 0; c < b.length; ) {
                    for (var _ = [], E = 0; E < g; E++) {
                      var w = {};
                      for (var k in this.atoms[E])
                        w[k] = this.atoms[E][k];
                      _[E] = w, _[E].x = b[c++], _[E].y = b[c++], _[E].z = b[c++];
                    }
                    this.frames.push(_);
                  }
                  return this.atoms = this.frames[0], this.frames;
                }
                return [];
              }
              /**
               * add atomSpecs to validAtomSelectionSpecs
               * @deprecated
               * @param {Array} customAtomSpecs - array of strings that can be used as atomSelectionSpecs
               * this is to prevent the 'Unknown Selector x' message on the console for the strings passed.
               * These messages are no longer generated as, in theory, typescript will catch problems at compile time.
               * In practice, there may still be issues at run-time but we don't check for them...
               *
               * What we should do is use something like https://github.com/woutervh-/typescript-is to do runtime
               * type checking, but it currently doesn't work with our types...
               */
              addAtomSpecs(l) {
              }
              static parseCrd(l, u) {
                var p = [], g = 0;
                if (u == "pdb")
                  for (var b = l.indexOf(`
ATOM`); b != -1; ) {
                    for (; l.slice(b, b + 5) == `
ATOM` || l.slice(b, b + 7) == `
HETATM`; )
                      p[g++] = parseFloat(l.slice(b + 31, b + 39)), p[g++] = parseFloat(l.slice(b + 39, b + 47)), p[g++] = parseFloat(l.slice(b + 47, b + 55)), b = l.indexOf(`
`, b + 54), l.slice(b, b + 4) == `
TER` && (b = l.indexOf(`
`, b + 5));
                    b = l.indexOf(`
ATOM`, b);
                  }
                else if (u == "netcdf") {
                  var c = new A.NetCDFReader(l);
                  p = [].concat.apply([], c.getDataVariable("coordinates"));
                } else {
                  if (u == "array" || Array.isArray(l))
                    return l.flat(2);
                  {
                    let _ = l.indexOf(`
`);
                    u == "inpcrd" && (_ = l.indexOf(`
`, _ + 1)), l = l.slice(_ + 1), p = l.match(/\S+/g).map(parseFloat);
                  }
                }
                return p;
              }
              static parseMolData(l, u = "", p) {
                if (!l)
                  return [];
                if (/\.gz$/.test(u)) {
                  u = u.replace(/\.gz$/, "");
                  try {
                    u.match(/bcif/i) ? l = (0, v.inflateString)(l, !1) : l = (0, v.inflateString)(l);
                  } catch (c) {
                    console.log(c);
                  }
                }
                typeof y.Parsers[u] > "u" && (u = u.split(".").pop(), typeof y.Parsers[u] > "u" && (console.log("Unknown format: " + u), l instanceof Uint8Array ? u = "bcif" : l.match(/^@<TRIPOS>MOLECULE/gm) ? u = "mol2" : l.match(/^data_/gm) && l.match(/^loop_/gm) ? u = "cif" : l.match(/^HETATM/gm) || l.match(/^ATOM/gm) ? u = "pdb" : l.match(/ITEM: TIMESTEP/gm) ? u = "lammpstrj" : l.match(/^.*\n.*\n.\s*(\d+)\s+(\d+)/gm) ? u = "sdf" : l.match(/^%VERSION\s+VERSION_STAMP/gm) ? u = "prmtop" : u = "xyz", console.log("Best guess: " + u)));
                var g = y.Parsers[u], b = g(l, p);
                return b;
              }
            }
            M.defaultAtomStyle = {
              line: {}
            }, M.defaultlineWidth = 1, M.vdwRadii = {
              H: 1.2,
              He: 1.4,
              Li: 1.82,
              Be: 1.53,
              B: 1.92,
              C: 1.7,
              N: 1.55,
              O: 1.52,
              F: 1.47,
              Ne: 1.54,
              Na: 2.27,
              Mg: 1.73,
              Al: 1.84,
              Si: 2.1,
              P: 1.8,
              S: 1.8,
              Cl: 1.75,
              Ar: 1.88,
              K: 2.75,
              Ca: 2.31,
              Ni: 1.63,
              Cu: 1.4,
              Zn: 1.39,
              Ga: 1.87,
              Ge: 2.11,
              As: 1.85,
              Se: 1.9,
              Br: 1.85,
              Kr: 2.02,
              Rb: 3.03,
              Sr: 2.49,
              Pd: 1.63,
              Ag: 1.72,
              Cd: 1.58,
              In: 1.93,
              Sn: 2.17,
              Sb: 2.06,
              Te: 2.06,
              I: 1.98,
              Xe: 2.16,
              Cs: 3.43,
              Ba: 2.68,
              Pt: 1.75,
              Au: 1.66,
              Hg: 1.55,
              Tl: 1.96,
              Pb: 2.02,
              Bi: 2.07,
              Po: 1.97,
              At: 2.02,
              Rn: 2.2,
              Fr: 3.48,
              Ra: 2.83,
              U: 1.86
            }, M.ignoredKeys = /* @__PURE__ */ new Set(["props", "invert", "model", "frame", "byres", "expand", "within", "and", "or", "not"]);
          }
        ),
        /***/
        "./src/GLShape.ts": (
          /*!************************!*\
            !*** ./src/GLShape.ts ***!
            \************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLShape: () => (
                /* binding */
                A
              ),
              /* harmony export */
              splitMesh: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), s = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ./colors */
              "./src/colors.ts"
            ), o = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), d = t(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), v = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), f = t(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), y = t(
              /*! ./utilities */
              "./src/utilities.ts"
            );
            class A {
              static finalizeGeo(m) {
                var l = m.updateGeoGroup(0);
                l.vertices > 0 && l.truncateArrayBuffers(!0, !0);
              }
              /*
               *
               * @param {Geometry}
               *            geo
               * @param {Color | colorlike} color
               */
              static updateColor(m, l) {
                l = l || h.CC.color(l), m.colorsNeedUpdate = !0;
                var u, p, g;
                l.constructor !== Array && (u = l.r, p = l.g, g = l.b);
                for (let b in m.geometryGroups) {
                  let c = m.geometryGroups[b], _ = c.colorArray;
                  for (let E = 0, w = c.vertices; E < w; ++E) {
                    if (l.constructor === Array) {
                      let k = l[E];
                      u = k.r, p = k.g, g = k.b;
                    }
                    _[E * 3] = u, _[E * 3 + 1] = p, _[E * 3 + 2] = g;
                  }
                }
              }
              /*
               * @param {GLShape}
               *            shape
               * @param {geometryGroup}
               *            geoGroup
               * @param {ArrowSpec}
               *            spec
               */
              static drawArrow(m, l, u) {
                var p = u.start, g = u.end, b = u.radius, c = u.radiusRatio, _ = u.mid, E = u.midpos;
                if (!(p && g))
                  return;
                var w = l.updateGeoGroup(51), k = new s.Vector3(g.x, g.y, g.z).sub(p);
                if (E) {
                  let ue = k.length();
                  E > 0 ? _ = E / ue : _ = (ue + E) / ue;
                }
                k.multiplyScalar(_);
                var $ = new s.Vector3(p.x, p.y, p.z).add(k), L = k.clone().negate();
                let z = new s.Vector3(p.x, p.y, p.z);
                m.intersectionShape.cylinder.push(new a.Cylinder(z, $.clone(), b)), m.intersectionShape.sphere.push(new a.Sphere(z, b));
                var F = [];
                F[0] = k.clone(), Math.abs(F[0].x) > 1e-4 ? F[0].y += 1 : F[0].x += 1, F[0].cross(k), F[0].normalize(), F[4] = F[0].clone(), F[4].crossVectors(F[0], k), F[4].normalize(), F[8] = F[0].clone().negate(), F[12] = F[4].clone().negate(), F[2] = F[0].clone().add(F[4]).normalize(), F[6] = F[4].clone().add(F[8]).normalize(), F[10] = F[8].clone().add(F[12]).normalize(), F[14] = F[12].clone().add(F[0]).normalize(), F[1] = F[0].clone().add(F[2]).normalize(), F[3] = F[2].clone().add(F[4]).normalize(), F[5] = F[4].clone().add(F[6]).normalize(), F[7] = F[6].clone().add(F[8]).normalize(), F[9] = F[8].clone().add(F[10]).normalize(), F[11] = F[10].clone().add(F[12]).normalize(), F[13] = F[12].clone().add(F[14]).normalize(), F[15] = F[14].clone().add(F[0]).normalize();
                var R = w.vertices, P = w.vertexArray, U = w.faceArray, N = w.normalArray, B = w.lineArray, W, V, G;
                for (V = 0, G = F.length; V < G; ++V) {
                  W = 3 * (R + 3 * V);
                  var H = F[V].clone().multiplyScalar(b).add(p), Q = F[V].clone().multiplyScalar(b).add($), te = F[V].clone().multiplyScalar(b * c).add($);
                  if (P[W] = H.x, P[W + 1] = H.y, P[W + 2] = H.z, P[W + 3] = Q.x, P[W + 4] = Q.y, P[W + 5] = Q.z, P[W + 6] = te.x, P[W + 7] = te.y, P[W + 8] = te.z, V > 0) {
                    var ee = P[W - 3], ce = P[W - 2], fe = P[W - 1], oe = new s.Vector3(ee, ce, fe), he = new s.Vector3(g.x, g.y, g.z), Ae = $.clone(), Se = new s.Vector3(te.x, te.y, te.z);
                    m.intersectionShape.triangle.push(new a.Triangle(Se, he, oe)), m.intersectionShape.triangle.push(new a.Triangle(oe.clone(), Ae, Se.clone()));
                  }
                }
                w.vertices += 48, W = w.vertices * 3, P[W] = p.x, P[W + 1] = p.y, P[W + 2] = p.z, P[W + 3] = $.x, P[W + 4] = $.y, P[W + 5] = $.z, P[W + 6] = g.x, P[W + 7] = g.y, P[W + 8] = g.z, w.vertices += 3;
                var Ie, pe, le, ne, Te, Oe, Be, Ue, Pe, Ge, Ne, Re, De, je, Xe, X, q, re, ye, me = w.vertices - 3, ze = w.vertices - 2, ke = w.vertices - 1, K = me * 3, ae = ze * 3, ge = ke * 3;
                for (V = 0, G = F.length - 1; V < G; ++V) {
                  var xe = R + 3 * V;
                  W = xe * 3, pe = w.faceidx, le = w.lineidx, ne = xe, Ge = ne * 3, Te = xe + 1, Ne = Te * 3, Oe = xe + 2, Re = Oe * 3, Be = xe + 4, De = Be * 3, Ue = xe + 5, je = Ue * 3, Pe = xe + 3, Xe = Pe * 3, X = q = F[V], re = ye = F[V + 1], N[Ge] = X.x, N[Ne] = q.x, N[Xe] = ye.x, N[Ge + 1] = X.y, N[Ne + 1] = q.y, N[Xe + 1] = ye.y, N[Ge + 2] = X.z, N[Ne + 2] = q.z, N[Xe + 2] = ye.z, N[Ne] = q.x, N[De] = re.x, N[Xe] = ye.x, N[Ne + 1] = q.y, N[De + 1] = re.y, N[Xe + 1] = ye.y, N[Ne + 2] = q.z, N[De + 2] = re.z, N[Xe + 2] = ye.z, N[Re] = q.x, N[je] = re.x, N[Re + 1] = q.y, N[je + 1] = re.y, N[Re + 2] = q.z, N[je + 2] = re.z, U[pe] = ne, U[pe + 1] = Te, U[pe + 2] = Pe, U[pe + 3] = Te, U[pe + 4] = Be, U[pe + 5] = Pe, U[pe + 6] = ne, U[pe + 7] = Pe, U[pe + 8] = me, U[pe + 9] = Oe, U[pe + 10] = ze, U[pe + 11] = Ue, U[pe + 12] = Oe, U[pe + 13] = ke, U[pe + 14] = Ue, B[le] = ne, B[le + 1] = Te, B[le + 2] = ne, B[le + 3] = Pe, B[le + 4] = Be, B[le + 5] = Pe, B[le + 6] = ne, B[le + 7] = Pe, B[le + 8] = Oe, B[le + 9] = Te, B[le + 10] = Oe, B[le + 11] = Ue, B[le + 12] = Be, B[le + 13] = Ue, B[le + 14] = Oe, B[le + 15] = ke, B[le + 16] = Oe, B[le + 17] = Ue, B[le + 18] = ke, B[le + 19] = Ue, w.faceidx += 15, w.lineidx += 20;
                }
                Ie = [
                  R + 45,
                  R + 46,
                  R + 1,
                  R,
                  R + 47,
                  R + 2
                ], pe = w.faceidx, le = w.lineidx, ne = Ie[0], Ge = ne * 3, Te = Ie[1], Ne = Te * 3, Oe = Ie[4], Re = Oe * 3, Be = Ie[2], De = Be * 3, Ue = Ie[5], je = Ue * 3, Pe = Ie[3], Xe = Pe * 3, X = q = F[15], re = ye = F[0], N[Ge] = X.x, N[Ne] = q.x, N[Xe] = ye.x, N[Ge + 1] = X.y, N[Ne + 1] = q.y, N[Xe + 1] = ye.y, N[Ge + 2] = X.z, N[Ne + 2] = q.z, N[Xe + 2] = ye.z, N[Ne] = q.x, N[De] = re.x, N[Xe] = ye.x, N[Ne + 1] = q.y, N[De + 1] = re.y, N[Xe + 1] = ye.y, N[Ne + 2] = q.z, N[De + 2] = re.z, N[Xe + 2] = ye.z, N[Re] = q.x, N[je] = re.x, N[Re + 1] = q.y, N[je + 1] = re.y, N[Re + 2] = q.z, N[je + 2] = re.z, k.normalize(), L.normalize(), N[K] = L.x, N[ae] = N[ge] = k.x, N[K + 1] = L.y, N[ae + 1] = N[ge + 1] = k.y, N[K + 2] = L.z, N[ae + 2] = N[ge + 2] = k.z, U[pe] = ne, U[pe + 1] = Te, U[pe + 2] = Pe, U[pe + 3] = Te, U[pe + 4] = Be, U[pe + 5] = Pe, U[pe + 6] = ne, U[pe + 7] = Pe, U[pe + 8] = me, U[pe + 9] = Oe, U[pe + 10] = ze, U[pe + 11] = Ue, U[pe + 12] = Oe, U[pe + 13] = ke, U[pe + 14] = Ue, B[le] = ne, B[le + 1] = Te, B[le + 2] = ne, B[le + 3] = Pe, B[le + 4] = Be, B[le + 5] = Pe, B[le + 6] = ne, B[le + 7] = Pe, B[le + 8] = Oe, B[le + 9] = Te, B[le + 10] = Oe, B[le + 11] = Ue, B[le + 12] = Be, B[le + 13] = Ue, B[le + 14] = Oe, B[le + 15] = ke, B[le + 16] = Oe, B[le + 17] = Ue, B[le + 18] = ke, B[le + 19] = Ue, w.faceidx += 15, w.lineidx += 20;
              }
              // Update a bounding sphere's position and radius
              // from list of centroids and new points
              /*
               * @param {Sphere}
               *            sphere
               * @param {Object}
               *            components, centroid of all objects in shape
               * @param {Array}
               *            points, flat array of all points in shape
               * @param {int} numPoints, number of valid poitns in points
               */
              static updateBoundingFromPoints(m, l, u, p) {
                m.center.set(0, 0, 0);
                let g = 1 / 0, b = 1 / 0, c = 1 / 0, _ = -1 / 0, E = -1 / 0, w = -1 / 0;
                m.box && (g = m.box.min.x, _ = m.box.max.x, b = m.box.min.y, E = m.box.max.y, c = m.box.min.z, w = m.box.max.z);
                for (let z = 0, F = p; z < F; z++) {
                  var k = u[z * 3], $ = u[z * 3 + 1], L = u[z * 3 + 2];
                  k < g && (g = k), $ < b && (b = $), L < c && (c = L), k > _ && (_ = k), $ > E && (E = $), L > w && (w = L);
                }
                m.center.set((_ + g) / 2, (E + b) / 2, (w + c) / 2), m.radius = m.center.distanceTo({ x: _, y: E, z: w }), m.box = { min: { x: g, y: b, z: c }, max: { x: _, y: E, z: w } };
              }
              //helper function for adding an appropriately sized mesh
              static addCustomGeo(m, l, u, p, g) {
                var b = l.addGeoGroup(), c = u.vertexArr, _ = u.normalArr, E = u.faceArr;
                b.vertices = c.length, b.faceidx = E.length;
                var w, k, $, L, z, F, R, P, U, N = b.vertexArray, B = b.colorArray;
                for (p.constructor !== Array && (P = p.r, U = p.g, L = p.b), F = 0, R = b.vertices; F < R; ++F)
                  w = F * 3, k = c[F], N[w] = k.x, N[w + 1] = k.y, N[w + 2] = k.z, p.constructor === Array && (z = p[F], P = z.r, U = z.g, L = z.b), B[w] = P, B[w + 1] = U, B[w + 2] = L;
                if (g)
                  for (F = 0, R = b.faceidx / 3; F < R; ++F) {
                    w = F * 3, $ = E[w], L = E[w + 1], z = E[w + 2];
                    var W = new s.Vector3(), V = new s.Vector3(), G = new s.Vector3();
                    m.intersectionShape.triangle.push(new a.Triangle(W.copy(c[$]), V.copy(c[L]), G.copy(c[z])));
                  }
                if (g) {
                  var H = new s.Vector3(0, 0, 0), Q = 0;
                  for (let ce = 0; ce < l.geometryGroups.length; ce++)
                    H.add(l.geometryGroups[ce].getCentroid()), Q++;
                  H.divideScalar(Q), A.updateBoundingFromPoints(m.boundingSphere, { centroid: H }, N, b.vertices);
                }
                if (b.faceArray = new Uint16Array(E), b.truncateArrayBuffers(!0, !0), _.length < b.vertices)
                  b.setNormals();
                else {
                  var te = b.normalArray = new Float32Array(b.vertices * 3), ee;
                  for (F = 0, R = b.vertices; F < R; ++F)
                    w = F * 3, ee = _[F], te[w] = ee.x, te[w + 1] = ee.y, te[w + 2] = ee.z;
                }
                b.setLineIndices(), b.lineidx = b.lineArray.length;
              }
              /*
               *
               * @param {$3Dmol.GLShape}
               *            shape
               * @param {ShapeSpec}
               *            stylespec
               * @returns {undefined}
               */
              static updateFromStyle(m, l) {
                typeof l.color < "u" ? (m.color = l.color || new h.Color(), l.color instanceof h.Color || (m.color = h.CC.color(l.color))) : m.color = h.CC.color(0), m.wireframe = !!l.wireframe, m.opacity = l.alpha ? (0, s.clamp)(l.alpha, 0, 1) : 1, typeof l.opacity < "u" && (m.opacity = (0, s.clamp)(l.opacity, 0, 1)), m.side = l.side !== void 0 ? l.side : r.DoubleSide, m.linewidth = typeof l.linewidth > "u" ? 1 : l.linewidth, m.clickable = !!l.clickable, m.callback = (0, y.makeFunction)(l.callback), m.hoverable = !!l.hoverable, m.hover_callback = (0, y.makeFunction)(l.hover_callback), m.unhover_callback = (0, y.makeFunction)(l.unhover_callback), m.contextMenuEnabled = !!l.contextMenuEnabled, m.hidden = l.hidden, m.frame = l.frame;
              }
              /**
               * Custom renderable shape
               *
               * @constructor
               *
               * @param {ShapeSpec} stylespec
               */
              constructor(m) {
                this.color = 16777215, this.hidden = !1, this.wireframe = !1, this.opacity = 1, this.linewidth = 1, this.clickable = !1, this.hoverable = !1, this.contextMenuEnabled = !1, this.side = r.DoubleSide, this.stylespec = m || {}, this.boundingSphere = new a.Sphere(), this.intersectionShape = {
                  sphere: [],
                  cylinder: [],
                  line: [],
                  triangle: []
                }, A.updateFromStyle(this, this.stylespec), this.components = [], this.shapeObj = null, this.renderedShapeObj = null, this.geo = new r.Geometry(!0), this.linegeo = new r.Geometry(!0);
              }
              /** Update shape with new style specification
               * @param {ShapeSpec} newspec
                 @example
                  let sphere = viewer.addSphere({center:{x:0,y:0,z:0},radius:10.0,color:'red'});
                  sphere.updateStyle({color:'yellow',opacity:0.5});
                  viewer.render();
               */
              updateStyle(m) {
                for (var l in m)
                  this.stylespec[l] = m[l];
                if (A.updateFromStyle(this, this.stylespec), m.voldata && m.volscheme) {
                  (0, y.adjustVolumeStyle)(m);
                  const u = m.volscheme, p = m.voldata, g = h.CC, b = u.range() || [-1, 1];
                  this.geo.setColors(function(c, _, E) {
                    let w = p.getVal(c, _, E);
                    return g.color(u.valueToHex(w, b));
                  }), delete this.color;
                }
              }
              /**
               * Creates a custom shape from supplied vertex and face arrays
               * @param {CustomShapeSpec} customSpec
               */
              addCustom(m) {
                m.vertexArr = m.vertexArr || [], m.faceArr = m.faceArr || [], m.normalArr = m.normalArr || [], A.drawCustom(this, this.geo, m);
              }
              /**
               * Creates a sphere shape
               * @param {SphereSpec} sphereSpec
               @example
               viewer.addSphere({center:{x:0,y:0,z:0},radius:10.0,color:'red'});
               
               viewer.render();
               */
              addSphere(m) {
                m.center || (m.center = new s.Vector3(0, 0, 0)), m.radius = m.radius ? (0, s.clamp)(m.radius, 0, 1 / 0) : 1.5, m.color = h.CC.color(m.color), this.intersectionShape.sphere.push(new a.Sphere(m.center, m.radius)), v.GLDraw.drawSphere(this.geo, m.center, m.radius, m.color, m.quality), this.components.push({
                  centroid: new s.Vector3(m.center.x, m.center.y, m.center.z)
                });
                var l = this.geo.updateGeoGroup(0);
                A.updateBoundingFromPoints(this.boundingSphere, this.components, l.vertexArray, l.vertices);
              }
              /**
               * Creates a box
               * @param {BoxSpec} boxSpec
               @example
               var shape = viewer.addShape({color:'red'});
               shape.addBox({corner: {x:1,y:2,z:0}, dimensions: {w: 4, h: 2, d: 6}});
               shape.addBox({corner: {x:-5,y:-3,z:0},
                             dimensions: { w: {x:1,y:1,z:0},
                                           h: {x:-1,y:1,z:0},
                                           d: {x:0,y:0,z:1} }});
               viewer.zoomTo();
               viewer.rotate(30);
               viewer.render();
               */
              addBox(m) {
                var l = m.dimensions || { w: 1, h: 1, d: 1 }, u;
                typeof l.w == "number" ? u = { x: l.w, y: 0, z: 0 } : u = l.w;
                var p;
                typeof l.h == "number" ? p = { x: 0, y: l.h, z: 0 } : p = l.h;
                var g;
                typeof l.d == "number" ? g = { x: 0, y: 0, z: l.d } : g = l.d;
                var b = m.corner;
                b == null && (m.center !== void 0 ? b = {
                  x: m.center.x - 0.5 * (u.x + p.x + g.x),
                  y: m.center.y - 0.5 * (u.y + p.y + g.y),
                  z: m.center.z - 0.5 * (u.z + p.z + g.z)
                } : b = { x: 0, y: 0, z: 0 });
                var c = [
                  { x: b.x, y: b.y, z: b.z },
                  { x: b.x + u.x, y: b.y + u.y, z: b.z + u.z },
                  { x: b.x + p.x, y: b.y + p.y, z: b.z + p.z },
                  { x: b.x + u.x + p.x, y: b.y + u.y + p.y, z: b.z + u.z + p.z },
                  { x: b.x + g.x, y: b.y + g.y, z: b.z + g.z },
                  { x: b.x + u.x + g.x, y: b.y + u.y + g.y, z: b.z + u.z + g.z },
                  { x: b.x + p.x + g.x, y: b.y + p.y + g.y, z: b.z + p.z + g.z },
                  { x: b.x + u.x + p.x + g.x, y: b.y + u.y + p.y + g.y, z: b.z + u.z + p.z + g.z }
                ], _ = [], E = [];
                _.splice(_.length, 0, c[0], c[1], c[2], c[3]), E.splice(E.length, 0, 0, 2, 1, 1, 2, 3);
                var w = 4;
                _.splice(_.length, 0, c[2], c[3], c[6], c[7]), E.splice(E.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, _.splice(_.length, 0, c[4], c[5], c[0], c[1]), E.splice(E.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, _.splice(_.length, 0, c[6], c[7], c[4], c[5]), E.splice(E.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, _.splice(_.length, 0, c[3], c[1], c[7], c[5]), E.splice(E.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, _.splice(_.length, 0, c[2], c[6], c[0], c[4]), E.splice(E.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4;
                var k = (0, y.extend)({}, m);
                k.vertexArr = _, k.faceArr = E, k.normalArr = [], A.drawCustom(this, this.geo, k);
                var $ = new s.Vector3();
                this.components.push({
                  centroid: $.addVectors(c[0], c[7]).multiplyScalar(0.5)
                });
                var L = this.geo.updateGeoGroup(0);
                A.updateBoundingFromPoints(this.boundingSphere, this.components, L.vertexArray, L.vertices);
              }
              /**
               * Creates a cylinder shape
               * @param {CylinderSpec} cylinderSpec
               @example
                    viewer.addCylinder({start:{x:0.0,y:0.0,z:0.0},
                                        end:{x:10.0,y:0.0,z:0.0},
                                        radius:1.0,
                                        fromCap:1,
                                        toCap:2,
                                        color:'red',
                                        hoverable:true,
                                        clickable:true,
                                        callback:function(){ this.color.setHex(0x00FFFF00);viewer.render( );},
                                        hover_callback: function(){ viewer.render( );},
                                        unhover_callback: function(){ this.color.setHex(0xFF000000);viewer.render( );}
                                       });
                    viewer.addCylinder({start:{x:0.0,y:2.0,z:0.0},
                                        end:{x:0.0,y:10.0,z:0.0},
                                        radius:0.5,
                                        fromCap:false,
                                        toCap:true,
                                        color:'teal'});
                    viewer.addCylinder({start:{x:15.0,y:0.0,z:0.0},
                                        end:{x:20.0,y:0.0,z:0.0},
                                        radius:1.0,
                                        color:'black',
                                        fromCap:false,
                                        toCap:false});
                    viewer.render();
               */
              addCylinder(m) {
                var l, u;
                m.start ? l = new s.Vector3(m.start.x || 0, m.start.y || 0, m.start.z || 0) : l = new s.Vector3(0, 0, 0), m.end ? (u = new s.Vector3(m.end.x, m.end.y || 0, m.end.z || 0), typeof u.x > "u" && (u.x = 3)) : u = new s.Vector3(0, 0, 0);
                var p = m.radius || 0.1, g = h.CC.color(m.color);
                this.intersectionShape.cylinder.push(new a.Cylinder(l, u, p)), v.GLDraw.drawCylinder(this.geo, l, u, p, g, m.fromCap, m.toCap);
                var b = new s.Vector3();
                this.components.push({
                  centroid: b.addVectors(l, u).multiplyScalar(0.5)
                });
                var c = this.geo.updateGeoGroup(0);
                A.updateBoundingFromPoints(this.boundingSphere, this.components, c.vertexArray, c.vertices);
              }
              /**
               * Creates a dashed cylinder shape
               * @param {CylinderSpec} cylinderSpec
               */
              addDashedCylinder(m) {
                m.dashLength = m.dashLength || 0.25, m.gapLength = m.gapLength || 0.25;
                var l;
                m.start ? l = new s.Vector3(m.start.x || 0, m.start.y || 0, m.start.z || 0) : l = new s.Vector3(0, 0, 0);
                var u;
                m.end ? (u = new s.Vector3(m.end.x, m.end.y || 0, m.end.z || 0), typeof u.x > "u" && (u.x = 3)) : u = new s.Vector3(3, 0, 0);
                for (var p = m.radius || 0.1, g = h.CC.color(m.color), b = Math.sqrt(Math.pow(l.x - u.x, 2) + Math.pow(l.y - u.y, 2) + Math.pow(l.z - u.z, 2)), c = b / (m.gapLength + m.dashLength), _ = new s.Vector3(m.start.x || 0, m.start.y || 0, m.start.z || 0), E = new s.Vector3(m.end.x, m.end.y || 0, m.end.z || 0), w = new s.Vector3((u.x - l.x) / (b / m.gapLength), (u.y - l.y) / (b / m.gapLength), (u.z - l.z) / (b / m.gapLength)), k = new s.Vector3((u.x - l.x) / (b / m.dashLength), (u.y - l.y) / (b / m.dashLength), (u.z - l.z) / (b / m.dashLength)), $ = 0; $ < c; $++)
                  E = new s.Vector3(_.x + k.x, _.y + k.y, _.z + k.z), this.intersectionShape.cylinder.push(new a.Cylinder(_, E, p)), v.GLDraw.drawCylinder(this.geo, _, E, p, g, m.fromCap, m.toCap), _ = new s.Vector3(E.x + w.x, E.y + w.y, E.z + w.z);
                var L = new s.Vector3();
                this.components.push({
                  centroid: L.addVectors(l, u).multiplyScalar(0.5)
                });
                var z = this.geo.updateGeoGroup(0);
                A.updateBoundingFromPoints(this.boundingSphere, this.components, z.vertexArray, z.vertices);
              }
              /**
               * Creates a curved shape
               * @param {CurveSpec} curveSpec
               */
              addCurve(m) {
                m.points = m.points || [], m.smooth = m.smooth || 10, typeof m.fromCap > "u" && (m.fromCap = 2), typeof m.toCap > "u" && (m.toCap = 2);
                var l = (0, f.subdivide_spline)(m.points, m.smooth);
                if (l.length < 3) {
                  console.log("Too few points in addCurve");
                  return;
                }
                var u = m.radius || 0.1, p = h.CC.color(m.color), g = 0, b = l.length - 1, c = l[0].distanceTo(l[1]), _ = Math.ceil(2 * u / c);
                if (m.toArrow) {
                  b -= _;
                  let $ = {
                    start: l[b],
                    end: l[l.length - 1],
                    radius: u,
                    color: p,
                    mid: 1e-4
                  };
                  this.addArrow($);
                }
                if (m.fromArrow) {
                  g += _;
                  let $ = {
                    start: l[g],
                    end: l[0],
                    radius: u,
                    color: p,
                    mid: 1e-4
                  };
                  this.addArrow($);
                }
                for (var E = Math.ceil(l.length / 2), w = { radius: u, color: p, fromCap: 2, toCap: 2 }, k = g; k < b; k++)
                  w.start = l[k], w.end = l[k + 1], w.fromCap = 2, w.toCap = 2, k < E ? (w.fromCap = 2, w.toCap = 0) : k > E ? (w.fromCap = 0, w.toCap = 2) : (w.fromCap = 2, w.toCap = 2), this.addCylinder(w);
              }
              /**
               * Creates a line shape
               * @param {LineSpec} lineSpec
               @example
               $3Dmol.download("pdb:2ABJ",viewer,{},function(){
                        viewer.addLine({dashed:true,start:{x:0,y:0,z:0},end:{x:100,y:100,z:100}});
                        viewer.render(callback);
                    });
              
               */
              addLine(m) {
                var l, u;
                m.start ? l = new s.Vector3(m.start.x || 0, m.start.y || 0, m.start.z || 0) : l = new s.Vector3(0, 0, 0), m.end ? (u = new s.Vector3(m.end.x, m.end.y || 0, m.end.z || 0), typeof u.x > "u" && (u.x = 3)) : u = new s.Vector3(3, 0, 0);
                var p = this.geo.updateGeoGroup(2), g = p.vertices, b = g * 3, c = p.vertexArray;
                c[b] = l.x, c[b + 1] = l.y, c[b + 2] = l.z, c[b + 3] = u.x, c[b + 4] = u.y, c[b + 5] = u.z, p.vertices += 2;
                var _ = p.lineArray, E = p.lineidx;
                _[E] = g, _[E + 1] = g + 1, p.lineidx += 2;
                var w = new s.Vector3();
                this.components.push({
                  centroid: w.addVectors(l, u).multiplyScalar(0.5)
                }), p = this.geo.updateGeoGroup(0), A.updateBoundingFromPoints(this.boundingSphere, this.components, p.vertexArray, p.vertices);
              }
              /**
               * Creates an arrow shape
               * @param {ArrowSpec} arrowSpec
               @example
                $3Dmol.download("pdb:4DM7",viewer,{},function(){
                        viewer.setBackgroundColor(0xffffffff);
                        viewer.addArrow({
                            start: {x:-10.0, y:0.0, z:0.0},
                            end: {x:0.0, y:-10.0, z:0.0},
                            radius: 1.0,
                            radiusRadio:1.0,
                            mid:1.0,
                            clickable:true,
                            callback:function(){
                                this.color.setHex(0xFF0000FF);
                                viewer.render( );
                            }
                        });
                        viewer.render();
                      });
               */
              addArrow(m) {
                if (m.start ? m.start = new s.Vector3(m.start.x || 0, m.start.y || 0, m.start.z || 0) : m.start = new s.Vector3(0, 0, 0), m.dir instanceof s.Vector3 && typeof m.length == "number") {
                  var l = m.dir.clone().multiplyScalar(m.length).add(m.start);
                  m.end = l;
                } else m.end ? (m.end = new s.Vector3(m.end.x, m.end.y || 0, m.end.z || 0), typeof m.end.x > "u" && (m.end.x = 3)) : m.end = new s.Vector3(3, 0, 0);
                m.radius = m.radius || 0.1, m.radiusRatio = m.radiusRatio || 1.618034, m.mid = 0 < m.mid && m.mid < 1 ? m.mid : 0.618034, A.drawArrow(this, this.geo, m);
                var u = new s.Vector3();
                this.components.push({
                  centroid: u.addVectors(m.start, m.end).multiplyScalar(0.5)
                });
                var p = this.geo.updateGeoGroup(0);
                A.updateBoundingFromPoints(this.boundingSphere, this.components, p.vertexArray, p.vertices);
              }
              static distance_from(m, l) {
                return Math.sqrt(Math.pow(m.x - l.x, 2) + Math.pow(m.y - l.y, 2) + Math.pow(m.z - l.z, 2));
              }
              static inSelectedRegion(m, l, u) {
                for (var p = 0; p < l.length; p++)
                  if (A.distance_from(l[p], m) <= u)
                    return !0;
                return !1;
              }
              /**
               * Create isosurface from volumetric data.
               * @param {VolumeData} data - volumetric input data
               * @param {IsoSurfaceSpec} isoSpec - volumetric data shape specification
               * @example //the user can specify a selected region for the isosurface
               $.get('../test_structs/benzene-homo.cube', function(data){
                        var voldata = new $3Dmol.VolumeData(data, "cube");
                        viewer.addIsosurface(voldata, {isoval: 0.01,
                                                       color: "blue",
                                                       alpha: 0.5,
                                                       smoothness: 10});
                        viewer.addIsosurface(voldata, {isoval: -0.01,
                                                       color: "red",
                                                       smoothness: 5,
                                                       opacity:0.5,
                                                       wireframe:true,
                                                       clickable:true,
                                                       callback:
                                                       function() {
                                                           this.opacity = 0.0;
                                                           viewer.render( );
                                                       }});
                        viewer.setStyle({}, {stick:{}});
                        viewer.zoomTo();
                        viewer.render();
                      });
               */
              addIsosurface(m, l, u, p) {
                var g = l.isoval !== void 0 && typeof l.isoval == "number" ? l.isoval : 0, b = !!l.voxel, c = l.smoothness === void 0 ? 1 : l.smoothness, _ = m.size.x, E = m.size.y, w = m.size.z, k = new Int16Array(_ * E * w), $ = m.data, L, z;
                for (L = 0, z = k.length; L < z; ++L)
                  k[L] = -1;
                var F = new Uint8Array(_ * E * w);
                for (L = 0, z = $.length; L < z; ++L) {
                  var R = g >= 0 ? $[L] - g : g - $[L];
                  R > 0 && (F[L] |= A.ISDONE);
                }
                var P = [], U = [];
                o.MarchingCube.march(F, P, U, {
                  fulltable: !0,
                  voxel: b,
                  unitCube: m.unit,
                  origin: m.origin,
                  matrix: m.matrix,
                  nX: _,
                  nY: E,
                  nZ: w
                }), !b && c > 0 && o.MarchingCube.laplacianSmooth(c, P, U);
                var N = [], B = [], W = [];
                if (l.selectedRegion && l.coords === void 0 && (l.coords = l.selectedRegion), l.coords === void 0 && l.selection !== void 0 && (p ? l.coords = p.selectedAtoms(l.selection) : console.log("addIsosurface needs viewer is selection provided.")), l.coords !== void 0) {
                  var V = l.coords[0].x, G = l.coords[0].y, H = l.coords[0].z, Q = l.coords[0].x, te = l.coords[0].y, ee = l.coords[0].z;
                  for (let le = 0; le < l.coords.length; le++)
                    l.coords[le].x > V ? V = l.coords[le].x : l.coords[le].x < Q && (Q = l.coords[le].x), l.coords[le].y > G ? G = l.coords[le].y : l.coords[le].y < te && (te = l.coords[le].y), l.coords[le].z > H ? H = l.coords[le].z : l.coords[le].z < ee && (ee = l.coords[le].z);
                  var ce = 2;
                  l.radius !== void 0 && (ce = l.radius), l.selectedOffset !== void 0 && (ce = l.selectedOffset), l.seldist !== void 0 && (ce = l.seldist), Q -= ce, V += ce, te -= ce, G += ce, ee -= ce, H += ce;
                  for (let le = 0; le < P.length; le++)
                    P[le].x > Q && P[le].x < V && P[le].y > te && P[le].y < G && P[le].z > ee && P[le].z < H && A.inSelectedRegion(P[le], l.coords, ce) ? (N.push(B.length), B.push(P[le])) : N.push(-1);
                  for (let le = 0; le + 2 < U.length; le += 3)
                    N[U[le]] !== -1 && N[U[le + 1]] !== -1 && N[U[le + 2]] !== -1 && (W.push(U[le] - (U[le] - N[U[le]])), W.push(U[le + 1] - (U[le + 1] - N[U[le + 1]])), W.push(U[le + 2] - (U[le + 2] - N[U[le + 2]])));
                  P = B, U = W;
                }
                A.drawCustom(this, this.geo, {
                  vertexArr: P,
                  faceArr: U,
                  normalArr: [],
                  clickable: l.clickable,
                  hoverable: l.hoverable
                }), this.updateStyle(l);
                var fe = new s.Vector3(m.origin.x, m.origin.y, m.origin.z), oe = new s.Vector3(m.size.x * m.unit.x, m.size.y * m.unit.y, m.size.z * m.unit.z), he = new s.Vector3(0, 0, 0), Ae = fe.clone(), Se = fe.clone().add(oe);
                for (let le = 0; le < P.length; le++)
                  he.add(P[le]), Ae.max(P[le]), Se.min(P[le]);
                he.divideScalar(P.length);
                var Ie = he.distanceTo(Se), pe = he.distanceTo(Ae);
                this.boundingSphere.center = he, this.boundingSphere.radius = Math.max(Ie, pe), typeof u == "function" && u();
              }
              /**
               * @deprecated Use addIsosurface instead
               * Creates custom shape from volumetric data
               * @param {string} data - Volumetric input data
               * @param {string} fmt - Input data format (e.g. 'cube' for cube file format)
               * @param {IsoSurfaceSpec} isoSpec - Volumetric data shape specification
               */
              addVolumetricData(m, l, u) {
                m = new d.VolumeData(m, l), this.addIsosurface(m, u);
              }
              //for internal use, truncate buffers to save memory
              finalize() {
                return A.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.geo;
              }
              /*
               * Initialize webgl objects for rendering
               * @param {$3Dmol.Object3D} group
               *
               */
              globj(m) {
                if (this.renderedShapeObj && (m.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) {
                  A.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.wireframe && this.geo.setUpWireframe(), typeof this.color < "u" && A.updateColor(this.geo, this.color), this.shapeObj = new r.Object3D();
                  var l = null;
                  this.side == r.DoubleSide ? l = new r.MeshDoubleLambertMaterial({
                    wireframe: this.wireframe,
                    side: this.side,
                    transparent: this.opacity < 1,
                    opacity: this.opacity,
                    wireframeLinewidth: this.linewidth,
                    vertexColors: r.Coloring.VertexColors
                  }) : l = new r.MeshLambertMaterial({
                    wireframe: this.wireframe,
                    side: this.side,
                    transparent: this.opacity < 1,
                    opacity: this.opacity,
                    wireframeLinewidth: this.linewidth,
                    vertexColors: r.Coloring.VertexColors
                  });
                  var u = new r.Mesh(this.geo, l);
                  if (this.shapeObj.add(u), this.linegeo && this.linegeo.vertices > 0) {
                    var p = new r.LineBasicMaterial({
                      linewidth: this.linewidth,
                      color: this.color
                    }), g = new r.Line(this.linegeo, p, r.LineStyle.LinePieces);
                    this.shapeObj.add(g);
                  }
                  this.renderedShapeObj = this.shapeObj.clone(), m.add(this.renderedShapeObj);
                }
              }
              removegl(m) {
                this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), m.remove(this.renderedShapeObj), this.renderedShapeObj = null), this.shapeObj = null;
              }
              get position() {
                return this.boundingSphere.center;
              }
              get x() {
                return this.boundingSphere.center.x;
              }
              get y() {
                return this.boundingSphere.center.y;
              }
              get z() {
                return this.boundingSphere.center.z;
              }
            }
            A.ISDONE = 2, A.drawCustom = function(M, m, l) {
              var u = l, p = u.vertexArr, g = u.faceArr;
              (p.length === 0 || g.length === 0) && console.warn("Error adding custom shape component: No vertices and/or face indices supplied!");
              var b = l.color;
              typeof b > "u" && (b = M.color), b = h.CC.color(b);
              for (var c = x(u), _ = 0, E = c.length; _ < E; _++)
                A.addCustomGeo(M, m, c[_], c[_].colorArr ? c[_].colorArr : b, l.clickable);
            };
            function x(M) {
              var m = 64e3;
              if (M.vertexArr.length < m)
                return [M];
              var l = [{ vertexArr: [], normalArr: [], faceArr: [] }];
              M.colorArr && (l.colorArr = []);
              var u = [], p = [], g = 0, b = M.faceArr;
              for (let _ = 0, E = b.length; _ < E; _ += 3) {
                let w = l[g];
                for (let k = 0; k < 3; k++) {
                  var c = b[_ + k];
                  u[c] !== g && (u[c] = g, p[c] = w.vertexArr.length, w.vertexArr.push(M.vertexArr[c]), M.normalArr && M.normalArr[c] && w.normalArr.push(M.normalArr[c]), M.colorArr && M.colorArr[c] && w.colorArr.push(M.colorArr[c])), w.faceArr.push(p[c]);
                }
                w.vertexArr.length >= m && (l.push({ vertexArr: [], normalArr: [], faceArr: [] }), M.colorArr && (l.colorArr = []), g++);
              }
              return l;
            }
          }
        ),
        /***/
        "./src/GLViewer.ts": (
          /*!*************************!*\
            !*** ./src/GLViewer.ts ***!
            \*************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CONTEXTS_PER_VIEWPORT: () => (
                /* binding */
                m
              ),
              /* harmony export */
              GLViewer: () => (
                /* binding */
                l
              ),
              /* harmony export */
              createStereoViewer: () => (
                /* binding */
                g
              ),
              /* harmony export */
              createViewer: () => (
                /* binding */
                u
              ),
              /* harmony export */
              createViewerGrid: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), s = t(
              /*! ./colors */
              "./src/colors.ts"
            ), h = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), o = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), d = t(
              /*! ./GLModel */
              "./src/GLModel.ts"
            ), v = t(
              /*! ./Label */
              "./src/Label.ts"
            ), f = t(
              /*! ./GLShape */
              "./src/GLShape.ts"
            ), y = t(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), A = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), x = t(
              /*! ./VolumetricRender */
              "./src/VolumetricRender.ts"
            ), M = t(
              /*! upng-js */
              "./node_modules/upng-js/UPNG.js"
            );
            const m = 16;
            class l {
              getWidth() {
                let c = this.container, _ = c.offsetWidth;
                if (_ == 0 && c.style.display === "none") {
                  let E = c.style.position, w = c.style.visibility;
                  c.style.display = "block", c.style.visibility = "hidden", c.style.position = "absolute", _ = c.offsetWidth, c.style.display = "none", c.style.visibility = w, c.style.position = E;
                }
                return _;
              }
              getHeight() {
                let c = this.container, _ = c.offsetHeight;
                if (_ == 0 && c.style.display === "none") {
                  let E = c.style.position, w = c.style.visibility;
                  c.style.display = "block", c.style.visibility = "hidden", c.style.position = "absolute", _ = c.offsetHeight, c.style.display = "none", c.style.visibility = w, c.style.position = E;
                }
                return _;
              }
              setupRenderer() {
                this.renderer = new r.Renderer({
                  antialias: this.config.antialias,
                  preserveDrawingBuffer: !0,
                  premultipliedAlpha: !1,
                  id: this.config.id,
                  row: this.config.row,
                  col: this.config.col,
                  rows: this.config.rows,
                  cols: this.config.cols,
                  canvas: this.config.canvas,
                  //cannot initialize with zero size - render will start out lost
                  containerWidth: this.WIDTH,
                  containerHeight: this.HEIGHT,
                  ambientOcclusion: this.config.ambientOcclusion,
                  outline: this.config.outline
                }), this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%", this.renderer.domElement.style.padding = "0", this.renderer.domElement.style.position = "absolute", this.renderer.domElement.style.top = "0px", this.renderer.domElement.style.left = "0px", this.renderer.domElement.style.zIndex = "0";
              }
              initializeScene() {
                this.scene = new r.Scene(), this.scene.fog = new r.Fog(this.bgColor, 100, 200), this.modelGroup = new r.Object3D(), this.rotationGroup = new r.Object3D(), this.rotationGroup.useQuaternion = !0, this.rotationGroup.quaternion = new a.Quaternion(0, 0, 0, 1), this.rotationGroup.add(this.modelGroup), this.scene.add(this.rotationGroup);
                var c = new r.Light(16777215);
                c.position = new a.Vector3(0.2, 0.2, 1).normalize(), c.intensity = 1, this.scene.add(c);
              }
              _handleLostContext(c) {
                const _ = function(E) {
                  const w = E.getBoundingClientRect();
                  return !(w.right < 0 || w.bottom < 0 || w.top > (window.innerHeight || document.documentElement.clientHeight) || w.left > (window.innerWidth || document.documentElement.clientWidth));
                };
                if (_(this.container)) {
                  let E = 0;
                  for (let w of document.getElementsByTagName("canvas"))
                    if (_(w) && w._3dmol_viewer != null && (w._3dmol_viewer.resize(), E += 1, E >= m))
                      break;
                }
              }
              initContainer(c) {
                this.container = c, this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight(), this.ASPECT = this.renderer.getAspect(this.WIDTH, this.HEIGHT), this.renderer.setSize(this.WIDTH, this.HEIGHT), this.container.append(this.renderer.domElement), this.glDOM = this.renderer.domElement, this.glDOM._3dmol_viewer = this, this.glDOM.addEventListener("webglcontextlost", this._handleLostContext.bind(this)), this.nomouse || (this.glDOM.addEventListener("mousedown", this._handleMouseDown.bind(this), { passive: !1 }), this.glDOM.addEventListener("touchstart", this._handleMouseDown.bind(this), { passive: !1 }), this.glDOM.addEventListener("wheel", this._handleMouseScroll.bind(this), { passive: !1 }), this.glDOM.addEventListener("mousemove", this._handleMouseMove.bind(this), { passive: !1 }), this.glDOM.addEventListener("touchmove", this._handleMouseMove.bind(this), { passive: !1 }), this.glDOM.addEventListener("contextmenu", this._handleContextMenu.bind(this), { passive: !1 }));
              }
              decAnim() {
                this.animated--, this.animated < 0 && (this.animated = 0);
              }
              incAnim() {
                this.animated++;
              }
              nextSurfID() {
                var c = 0;
                for (let E in this.surfaces)
                  if (this.surfaces.hasOwnProperty(E)) {
                    var _ = parseInt(E);
                    isNaN(_) || _ > c && (c = _);
                  }
                return c + 1;
              }
              setSlabAndFog() {
                let c = this.camera.position.z - this.rotationGroup.position.z;
                c < 1 && (c = 1), this.camera.near = c + this.slabNear, this.camera.near < 1 && (this.camera.near = 1), this.camera.far = c + this.slabFar, this.camera.near + 1 > this.camera.far && (this.camera.far = this.camera.near + 1), this.camera.fov = this.fov, this.camera.right = c * Math.tan(Math.PI / 180 * this.fov), this.camera.left = -this.camera.right, this.camera.top = this.camera.right / this.ASPECT, this.camera.bottom = -this.camera.top, this.camera.updateProjectionMatrix(), this.scene.fog.near = this.camera.near + this.fogStart * (this.camera.far - this.camera.near), this.scene.fog.far = this.camera.far, this.config.disableFog && (this.scene.fog.near = this.scene.fog.far);
              }
              // display scene
              //if nolink is set/true, don't propagate changes to linked viewers
              show(c) {
                if (this.renderer.setViewport(), !!this.scene && (this.setSlabAndFog(), this.renderer.render(this.scene, this.camera), this.viewChangeCallback && this.viewChangeCallback(this._viewer.getView()), !c && this.linkedViewers.length > 0))
                  for (var _ = this._viewer.getView(), E = 0; E < this.linkedViewers.length; E++) {
                    var w = this.linkedViewers[E];
                    w.setView(_, !0);
                  }
              }
              //regenerate the list of clickables
              //also updates hoverables
              updateClickables() {
                this.clickables.splice(0, this.clickables.length), this.hoverables.splice(0, this.hoverables.length), this.contextMenuEnabledObjects.splice(0, this.contextMenuEnabledObjects.length);
                for (let c = 0, _ = this.models.length; c < _; c++) {
                  let E = this.models[c];
                  if (E) {
                    let w = E.selectedAtoms({
                      clickable: !0
                    }), k = E.selectedAtoms({
                      hoverable: !0
                    }), $ = E.selectedAtoms({ contextMenuEnabled: !0 });
                    for (let L = 0; L < k.length; L++)
                      this.hoverables.push(k[L]);
                    for (let L = 0; L < w.length; L++)
                      this.clickables.push(w[L]);
                    for (let L = 0; L < $.length; L++)
                      this.contextMenuEnabledObjects.push($[L]);
                  }
                }
                for (let c = 0, _ = this.shapes.length; c < _; c++) {
                  let E = this.shapes[c];
                  E && E.clickable && this.clickables.push(E), E && E.hoverable && this.hoverables.push(E), E && E.contextMenuEnabled && this.contextMenuEnabledObjects.push(E);
                }
              }
              // Checks for selection intersects on mousedown
              handleClickSelection(c, _, E) {
                let w = this.targetedObjects(c, _, this.clickables);
                if (w.length) {
                  var k = w[0].clickable;
                  k.callback !== void 0 && (typeof k.callback != "function" && (k.callback = (0, h.makeFunction)(k.callback)), typeof k.callback == "function" && (this.mouseButton === 3 && this.contextMenuEnabledObjects.includes(k) && this.userContextMenuHandler || k.callback(k, this._viewer, E, this.container, w)));
                }
              }
              //return offset of container
              canvasOffset() {
                let c = this.glDOM, _ = c.getBoundingClientRect(), E = c.ownerDocument, w = E.documentElement, k = E.defaultView;
                return {
                  top: _.top + k.pageYOffset - w.clientTop,
                  left: _.left + k.pageXOffset - w.clientLeft
                };
              }
              //set current_hover to sel (which can be null), calling appropraite callbacks
              setHover(c, _, E) {
                this.current_hover != c && (this.current_hover && (typeof this.current_hover.unhover_callback != "function" && (this.current_hover.unhover_callback = (0, h.makeFunction)(this.current_hover.unhover_callback)), this.current_hover.unhover_callback(this.current_hover, this._viewer, _, this.container, E)), this.current_hover = c, c && c.hover_callback !== void 0 && (typeof c.hover_callback != "function" && (c.hover_callback = (0, h.makeFunction)(c.hover_callback)), typeof c.hover_callback == "function" && c.hover_callback(c, this._viewer, _, this.container, E)));
              }
              //checks for selection intersects on hover
              handleHoverSelection(c, _, E) {
                if (this.hoverables.length == 0)
                  return;
                let w = this.targetedObjects(c, _, this.hoverables);
                if (w.length) {
                  var k = w[0].clickable;
                  this.setHover(k, E, w), this.current_hover = k;
                } else
                  this.setHover(null);
              }
              //sees if the mouse is still on the object that invoked a hover event and if not then the unhover callback is called
              handleHoverContinue(c, _) {
                let E = this.targetedObjects(c, _, this.hoverables);
                (E.length == 0 || E[0] === void 0) && this.setHover(null), E[0] !== void 0 && E[0].clickable !== this.current_hover && this.setHover(null);
              }
              /**
               * Determine if a positioned event is "close enough" to mouseStart to be considered a click.
               * With a mouse, the position should be exact, but allow a slight delta for a touch interface.
               * @param {Event} event
               * @param {{ allowTolerance, tolerance: number }} options
               */
              closeEnoughForClick(c, { allowTolerance: _ = c.targetTouches, tolerance: E = 5 } = {}) {
                const w = this.getX(c), k = this.getY(c);
                if (_) {
                  const $ = Math.abs(w - this.mouseStartX), L = Math.abs(k - this.mouseStartY);
                  return $ <= E && L <= E;
                } else
                  return w === this.mouseStartX && k === this.mouseStartY;
              }
              calcTouchDistance(c) {
                var _ = c.targetTouches[0].pageX - c.targetTouches[1].pageX, E = c.targetTouches[0].pageY - c.targetTouches[1].pageY;
                return Math.hypot(_, E);
              }
              //check targetTouches as well
              getX(c) {
                var _ = c.pageX;
                return _ == null && (_ = c.pageX), c.targetTouches && c.targetTouches[0] ? _ = c.targetTouches[0].pageX : c.changedTouches && c.changedTouches[0] && (_ = c.changedTouches[0].pageX), _;
              }
              getY(c) {
                var _ = c.pageY;
                return _ == null && (_ = c.pageY), c.targetTouches && c.targetTouches[0] ? _ = c.targetTouches[0].pageY : c.changedTouches && c.changedTouches[0] && (_ = c.changedTouches[0].pageY), _;
              }
              //for grid viewers, return true if point is in this viewer
              isInViewer(c, _) {
                if (this.viewers != null) {
                  var E = this.WIDTH / this.cols, w = this.HEIGHT / this.rows, k = this.canvasOffset(), $ = c - k.left, L = _ - k.top, z = this.rows - Math.floor(L / w) - 1, F = Math.floor($ / E);
                  if (z != this.row || F != this.col)
                    return !1;
                }
                return !0;
              }
              //if the user has specify zoom limits, readjust to fit within them
              //also, make sure we don't go past CAMERA_Z
              adjustZoomToLimits(c) {
                if (this.config.lowerZoomLimit && this.config.lowerZoomLimit > 0) {
                  let _ = this.CAMERA_Z - this.config.lowerZoomLimit;
                  c > _ && (c = _);
                }
                if (this.config.upperZoomLimit && this.config.upperZoomLimit > 0) {
                  let _ = this.CAMERA_Z - this.config.upperZoomLimit;
                  c < _ && (c = _);
                }
                return c > this.CAMERA_Z - 1 && (c = this.CAMERA_Z - 1), c;
              }
              //interpolate between two normalized quaternions (t between 0 and 1)
              //https://en.wikipedia.org/wiki/Slerp
              static slerp(c, _, E) {
                if (E == 1)
                  return _.clone();
                if (E == 0)
                  return c.clone();
                let w = c.x * _.x + c.y * _.y + c.z * _.z + c.w * _.w;
                if (w > 0.9995) {
                  let P = new a.Quaternion(c.x + E * (_.x - c.x), c.y + E * (_.y - c.y), c.z + E * (_.z - c.z), c.w + E * (_.w - c.w));
                  return P.normalize(), P;
                }
                w < 0 && (_ = _.clone().multiplyScalar(-1), w = -w), w > 1 ? w = 1 : w < -1 && (w = -1);
                var k = Math.acos(w), $ = k * E, L = _.clone();
                L.sub(c.clone().multiplyScalar(w)), L.normalize();
                var z = Math.cos($), F = Math.sin($), R = new a.Quaternion(c.x * z + L.x * F, c.y * z + L.y * F, c.z * z + L.z * F, c.w * z + L.w * F);
                return R.normalize(), R;
              }
              /* @param {Object} element HTML element within which to create viewer
               * @param {ViewerSpec} config Object containing optional configuration for the viewer
               */
              constructor(c, _ = {}) {
                if (this.nomouse = !1, this.glDOM = null, this.models = [], this.surfaces = {}, this.shapes = [], this.labels = [], this.clickables = [], this.hoverables = [], this.contextMenuEnabledObjects = [], this.current_hover = null, this.hoverDuration = 500, this.longTouchDuration = 1e3, this.viewer_frame = 0, this.viewChangeCallback = null, this.stateChangeCallback = null, this.NEAR = 1, this.FAR = 800, this.CAMERA_Z = 150, this.fov = 20, this.linkedViewers = [], this.renderer = null, this.control_all = !1, this.scene = null, this.rotationGroup = null, this.modelGroup = null, this.fogStart = 0.4, this.slabNear = -50, this.slabFar = 50, this.cq = new a.Quaternion(0, 0, 0, 1), this.dq = new a.Quaternion(0, 0, 0, 1), this.animated = 0, this.animationTimers = /* @__PURE__ */ new Set(), this.isDragging = !1, this.mouseStartX = 0, this.mouseStartY = 0, this.touchDistanceStart = 0, this.touchHold = !1, this.currentModelPos = 0, this.cz = 0, this.cslabNear = 0, this.cslabFar = 0, this.userContextMenuHandler = null, this.config = _, this.callback = this.config.callback, this.defaultcolors = this.config.defaultcolors, this.defaultcolors || (this.defaultcolors = s.elementColors.defaultColors), this.nomouse = !!this.config.nomouse, this.bgColor = 0, this.config.backgroundColor = this.config.backgroundColor || "#ffffff", typeof this.config.backgroundColor < "u" && (this.bgColor = s.CC.color(this.config.backgroundColor).getHex()), this.config.backgroundAlpha = this.config.backgroundAlpha == null ? 1 : this.config.backgroundAlpha, this.camerax = 0, typeof this.config.camerax < "u" && (this.camerax = typeof this.config.camerax == "string" ? parseFloat(this.config.camerax) : this.config.camerax), this._viewer = this, this.container = c, this.config.hoverDuration != null && (this.hoverDuration = this.config.hoverDuration), this.config.antialias === void 0 && (this.config.antialias = !0), this.config.cartoonQuality === void 0 && (this.config.cartoonQuality = 10), this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight(), this.setupRenderer(), this.row = this.config.row == null ? 0 : this.config.row, this.col = this.config.col == null ? 0 : this.config.col, this.cols = this.config.cols, this.rows = this.config.rows, this.viewers = this.config.viewers, this.control_all = this.config.control_all, this.ASPECT = this.renderer.getAspect(this.WIDTH, this.HEIGHT), this.camera = new r.Camera(this.fov, this.ASPECT, this.NEAR, this.FAR, this.config.orthographic), this.camera.position = new a.Vector3(this.camerax, 0, this.CAMERA_Z), this.lookingAt = new a.Vector3(), this.camera.lookAt(this.lookingAt), this.raycaster = new r.Raycaster(new a.Vector3(0, 0, 0), new a.Vector3(0, 0, 0)), this.projector = new r.Projector(), this.initializeScene(), this.renderer.setClearColorHex(this.bgColor, this.config.backgroundAlpha), this.scene.fog.color = s.CC.color(this.bgColor), document.body.addEventListener("mouseup", this._handleMouseUp.bind(this)), document.body.addEventListener("touchend", this._handleMouseUp.bind(this)), this.initContainer(this.container), this.config.style && this.setViewStyle(this.config), window.addEventListener("resize", this.resize.bind(this)), typeof window.ResizeObserver < "u" && (this.divwatcher = new window.ResizeObserver(this.resize.bind(this)), this.divwatcher.observe(this.container)), typeof window.IntersectionObserver < "u") {
                  let E = (w, k) => {
                    w.forEach(($) => {
                      $.isIntersecting && this.resize();
                    });
                  };
                  this.intwatcher = new window.IntersectionObserver(E), this.intwatcher.observe(this.container);
                }
                try {
                  typeof this.callback == "function" && this.callback(this);
                } catch (E) {
                  console.log("error with glviewer callback: " + E);
                }
              }
              /**
              * Return a list of objects that intersect that at the specified viewer position.
              *
              * @param x - x position in screen coordinates
              * @param y - y position in screen coordinates
              * @param {Object[]} - list of objects or selection object specifying what object to check for targeting
              */
              targetedObjects(c, _, E) {
                var w = {
                  x: c,
                  y: _,
                  z: -1
                };
                return Array.isArray(E) || (E = this.selectedAtoms(E)), E.length == 0 ? [] : (this.raycaster.setFromCamera(w, this.camera), this.raycaster.intersectObjects(this.modelGroup, E));
              }
              /** Convert model coordinates to screen coordinates.
               * @param {object | list} - an object or list of objects with x,y,z attributes (e.g. an atom)
               * @return {object | list} - and object or list of {x: screenX, y: screenY}
               */
              modelToScreen(c) {
                let _ = !1;
                Array.isArray(c) || (c = [c], _ = !0);
                let E = this.renderer.getXRatio(), w = this.renderer.getYRatio(), k = this.col, $ = this.row, L = k * (this.WIDTH / E), z = (w - $ - 1) * (this.HEIGHT / w), F = [], R = this.canvasOffset();
                return c.forEach((P) => {
                  let U = new a.Vector3(P.x, P.y, P.z);
                  U.applyMatrix4(this.modelGroup.matrixWorld), this.projector.projectVector(U, this.camera);
                  let N = this.WIDTH / E * (U.x + 1) / 2 + R.left + L, B = -(this.HEIGHT / w) * (U.y - 1) / 2 + R.top + z;
                  F.push({ x: N, y: B });
                }), _ && (F = F[0]), F;
              }
              /**
               * For a given screen (x,y) displacement return model displacement
               * @param{x} x displacement in screen coordinates
               * @param{y} y displacement in screen corodinates
               * @param{modelz} z coordinate in model coordinates to compute offset for, default is model axis
              */
              screenOffsetToModel(c, _, E) {
                var w = c / this.WIDTH, k = _ / this.HEIGHT, $ = E === void 0 ? this.rotationGroup.position.z : E, L = this.rotationGroup.quaternion, z = new a.Vector3(0, 0, $);
                return this.projector.projectVector(z, this.camera), z.x += w * 2, z.y -= k * 2, this.projector.unprojectVector(z, this.camera), z.z = 0, z.applyQuaternion(L), z;
              }
              /**
               * Distance from screen coordinate to model coordinate assuming screen point
               * is projected to the same depth as model coordinate
               * @param{screen} xy screen coordinate
               * @param{model} xyz model coordinate
              */
              screenToModelDistance(c, _) {
                let E = this.canvasOffset(), w = new a.Vector3(_.x, _.y, _.z);
                w.applyMatrix4(this.modelGroup.matrixWorld);
                let k = w.clone();
                this.projector.projectVector(w, this.camera);
                let $ = new a.Vector3((c.x - E.left) * 2 / this.WIDTH - 1, (c.y - E.top) * 2 / -this.HEIGHT + 1, w.z);
                return this.projector.unprojectVector($, this.camera), $.distanceTo(k);
              }
              /**
               * Set a callback to call when the view has potentially changed.
               *
              */
              setViewChangeCallback(c) {
                (typeof c == "function" || c == null) && (this.viewChangeCallback = c);
              }
              /**
               * Set a callback to call when the view has potentially changed.
               *
              */
              setStateChangeCallback(c) {
                (typeof c == "function" || c == null) && (this.stateChangeCallback = c);
              }
              /**
               * Return configuration of viewer
               */
              getConfig() {
                return this.config;
              }
              /**
               * Set the configuration object.  Note that some settings may only
               * have an effect at viewer creation time.
               */
              setConfig(c) {
                this.config = c, c.ambientOcclusion && this.renderer.enableAmbientOcclusion(c.ambientOcclusion);
              }
              /**
               * Return object representing internal state of
               * the viewer appropriate for passing to setInternalState
               *
              */
              getInternalState() {
                var c = { models: [], surfaces: [], shapes: [], labels: [] };
                for (let _ = 0; _ < this.models.length; _++)
                  this.models[_] && (c.models[_] = this.models[_].getInternalState());
                return c;
              }
              /**
               * Overwrite internal state of the viewer with passed  object
               * which should come from getInternalState.
               *
              */
              setInternalState(c) {
                this.clear();
                var _ = c.models;
                for (let E = 0; E < _.length; E++)
                  _[E] && (this.models[E] = new d.GLModel(E), this.models[E].setInternalState(_[E]));
                this.render();
              }
              /**
               * Set lower and upper limit stops for zoom.
               *
               * @param {lower} - limit on zoom in (positive number).  Default 0.
               * @param {upper} - limit on zoom out (positive number).  Default infinite.
               * @example
                $3Dmol.get("data/set1_122_complex.mol2", function(moldata) {
                      var m = viewer.addModel(moldata);
                      viewer.setStyle({stick:{colorscheme:"Jmol"}});
                      viewer.setZoomLimits(100,200);
                      viewer.zoomTo();
                      viewer.zoom(10); //will not zoom all the way
                      viewer.render();
                  });
              */
              setZoomLimits(c, _) {
                typeof c < "u" && (this.config.lowerZoomLimit = c), _ && (this.config.upperZoomLimit = _), this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z), this.show();
              }
              /**
               * Set camera parameters (distance to the origin and field of view)
               *
               * @param {parameters} - new camera parameters, with possible fields
               *                       being fov for the field of view, z for the
               *                       distance to the origin, and orthographic (boolean)
               *                       for kind of projection (default false).
               * @example
                $3Dmol.get("data/set1_122_complex.mol2", function(data) {
                      var m = viewer.addModel(data);
                      viewer.setStyle({stick:{}});
                      viewer.zoomTo();
                      viewer.setCameraParameters({ fov: 10 , z: 300 });
                      viewer.render();
                  });
              */
              setCameraParameters(c) {
                c.fov !== void 0 && (this.fov = c.fov, this.camera.fov = this.fov), c.z !== void 0 && (this.CAMERA_Z = c.z, this.camera.z = this.CAMERA_Z), c.orthographic !== void 0 && (this.camera.ortho = c.orthographic);
              }
              _handleMouseDown(c) {
                if (c.preventDefault(), !this.scene)
                  return;
                var _ = this.getX(c), E = this.getY(c);
                if (_ === void 0)
                  return;
                this.isDragging = !0, this.mouseButton = c.which, this.mouseStartX = _, this.mouseStartY = E, this.touchHold = !0, this.touchDistanceStart = 0, c.targetTouches && c.targetTouches.length == 2 && (this.touchDistanceStart = this.calcTouchDistance(c)), this.cq = this.rotationGroup.quaternion.clone(), this.cz = this.rotationGroup.position.z, this.currentModelPos = this.modelGroup.position.clone(), this.cslabNear = this.slabNear, this.cslabFar = this.slabFar;
                let w = this;
                c.targetTouches && c.targetTouches.length === 1 && (this.longTouchTimeout = setTimeout(function() {
                  if (w.touchHold == !0) {
                    w.glDOM = w.renderer.domElement;
                    const k = c.targetTouches[0], $ = new PointerEvent("contextmenu", Object.assign(Object.assign({}, c), { pageX: k.pageX, pageY: k.pageY, screenX: k.screenX, screenY: k.screenY, clientX: k.clientX, clientY: k.clientY }));
                    w.glDOM.dispatchEvent($);
                  }
                }, this.longTouchDuration));
              }
              _handleMouseUp(c) {
                if (this.touchHold = !1, this.isDragging && this.scene) {
                  var _ = this.getX(c), E = this.getY(c);
                  if (this.closeEnoughForClick(c) && this.isInViewer(_, E)) {
                    let w = this.mouseXY(_, E);
                    this.handleClickSelection(w.x, w.y, c);
                  }
                }
                this.isDragging = !1;
              }
              _handleMouseScroll(c) {
                if (c.preventDefault(), !!this.scene) {
                  var _ = this.getX(c), E = this.getY(c);
                  if (_ !== void 0 && !(!this.control_all && !this.isInViewer(_, E))) {
                    var w = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, k = 1;
                    if (c.ctrlKey && (k = -1), c.detail)
                      this.rotationGroup.position.z += k * w * c.detail / 10;
                    else if (c.wheelDelta) {
                      let $ = c.wheelDelta * 600 / (c.wheelDelta + 600);
                      this.rotationGroup.position.z -= k * w * $ / 400;
                    }
                    this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z), this.show();
                  }
                }
              }
              /**
               * Return image URI of viewer contents (base64 encoded).     *
               */
              pngURI() {
                return this.getCanvas().toDataURL("image/png");
              }
              /**
               * Return a promise that resolves to an animated PNG image URI of
               viewer contents (base64 encoded) for nframes of viewer changes.
               * @return {Promise}
               */
              apngURI(c) {
                let _ = this;
                return c = c || 1, new Promise(function(E) {
                  let w = 0, k = _.viewChangeCallback, $ = [], L = [], z = Date.now();
                  _.viewChangeCallback = function() {
                    L.push(Date.now() - z), z = Date.now(), $.push(new Promise((F) => {
                      _.getCanvas().toBlob(function(R) {
                        R.arrayBuffer().then(F);
                      }, "image/png");
                    })), w += 1, w == c && (_.viewChangeCallback = k, Promise.all($).then((F) => {
                      let R = [];
                      for (let V = 0; V < F.length; V++) {
                        let G = (0, M.decode)(F[V]);
                        R.push((0, M.toRGBA8)(G)[0]);
                      }
                      let P = _.getCanvas().width, U = _.getCanvas().height, N = (0, M.encode)(R, P, U, 0, L), B = new Blob([N], { type: "image/png" }), W = new FileReader();
                      W.onload = function(V) {
                        E(V.target.result);
                      }, W.readAsDataURL(B);
                    }));
                  };
                });
              }
              /**
               * Return underlying canvas element.
               */
              getCanvas() {
                return this.glDOM;
              }
              /**
               * Return renderer element.
               */
              getRenderer() {
                return this.renderer;
              }
              /**
                   * Set the duration of the hover delay
                   *
                   * @param {number}
                   *            [hoverDuration] - an optional parameter that denotes
                   *            the duration of the hover delay (in milliseconds) before the hover action is called
                   *
               */
              setHoverDuration(c) {
                this.hoverDuration = c;
              }
              mouseXY(c, _) {
                let E = this.canvasOffset(), w = this.renderer.getXRatio(), k = this.renderer.getYRatio(), $ = this.col, L = this.row, z = $ * (this.WIDTH / w), F = (k - L - 1) * (this.HEIGHT / k), R = (c - E.left - z) / (this.WIDTH / w) * 2 - 1, P = -((_ - E.top - F) / (this.HEIGHT / k)) * 2 + 1;
                return { x: R, y: P };
              }
              _handleMouseMove(c) {
                clearTimeout(this.hoverTimeout), c.preventDefault();
                let _ = this.getX(c), E = this.getY(c);
                if (_ === void 0)
                  return;
                let w = this.renderer.getXRatio(), k = this.renderer.getYRatio(), $ = this.mouseXY(_, E), L = this;
                this.current_hover !== null && this.handleHoverContinue($.x, $.y);
                var z = 0;
                if (!(!this.control_all && !this.isInViewer(_, E)) && this.scene && (this.hoverables.length > 0 && (this.hoverTimeout = setTimeout(function() {
                  L.handleHoverSelection($.x, $.y, c);
                }, this.hoverDuration)), !!this.isDragging)) {
                  c.targetTouches && (c.targetTouches.length > 1 || c.targetTouches.length === 1 && !this.closeEnoughForClick(c)) && clearTimeout(this.longTouchTimeout);
                  var F = (_ - this.mouseStartX) / this.WIDTH, R = (E - this.mouseStartY) / this.HEIGHT;
                  if (this.touchDistanceStart != 0 && c.targetTouches && c.targetTouches.length == 2) {
                    var P = this.calcTouchDistance(c);
                    z = 2, R = (P - this.touchDistanceStart) * 2 / (this.WIDTH + this.HEIGHT);
                  } else c.targetTouches && c.targetTouches.length == 3 && (z = 1);
                  F *= w, R *= k;
                  var U = Math.hypot(F, R), N;
                  if (z == 3 || this.mouseButton == 3 && c.ctrlKey)
                    this.slabNear = this.cslabNear + F * 100, this.slabFar = this.cslabFar - R * 100;
                  else if (z == 2 || this.mouseButton == 3 || c.shiftKey)
                    N = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, N < 80 && (N = 80), this.rotationGroup.position.z = this.cz + R * N, this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z);
                  else if (z == 1 || this.mouseButton == 2 || c.ctrlKey) {
                    var B = this.screenOffsetToModel(w * (_ - this.mouseStartX), k * (E - this.mouseStartY));
                    this.modelGroup.position.addVectors(this.currentModelPos, B);
                  } else if ((z === 0 || this.mouseButton == 1) && U !== 0) {
                    var W = Math.sin(U * Math.PI) / U;
                    this.dq.x = Math.cos(U * Math.PI), this.dq.y = 0, this.dq.z = W * F, this.dq.w = -W * R, this.rotationGroup.quaternion.set(1, 0, 0, 0), this.rotationGroup.quaternion.multiply(this.dq), this.rotationGroup.quaternion.multiply(this.cq);
                  }
                  this.show();
                }
              }
              _handleContextMenu(c) {
                if (c.preventDefault(), this.closeEnoughForClick(c)) {
                  var w = this.mouseStartX, k = this.mouseStartY, E = this.canvasOffset();
                  let $ = this.mouseXY(w, k), L = $.x, z = $.y, F = this.targetedObjects(L, z, this.contextMenuEnabledObjects);
                  var _ = null;
                  F.length && (_ = F[0].clickable);
                  var E = this.canvasOffset(), w = this.mouseStartX - E.left, k = this.mouseStartY - E.top;
                  this.userContextMenuHandler && (this.userContextMenuHandler(_, w, k, F, c), this.isDragging = !1);
                }
              }
              /**
              	     * Change the viewer's container element
              	     * Also useful if the original container element was removed from the DOM.
              	     *
              	     * @param {Object | string} element
              	     *            Either HTML element or string identifier. Defaults to the element used to initialize the viewer.
              
              	     */
              setContainer(c) {
                let _ = (0, h.getElement)(c) || this.container;
                return this.initContainer(_), this;
              }
              /**
              	     * Set the background color (default white)
              	     *
              	     * @param {number}
              	     *            hex Hexcode specified background color, or standard color spec
              	     * @param {number}
              	     *            a Alpha level (default 1.0)
              	     *
              	     * @example
              	     *
              	     * viewer.setBackgroundColor("green",0.5);
              
              
              	     *
              	     */
              setBackgroundColor(c, _) {
                (typeof _ > "u" || _ < 0 || _ > 1) && (_ = 1);
                var E = s.CC.color(c);
                return this.scene.fog.color = E, this.bgColor = E.getHex(), this.renderer.setClearColorHex(E.getHex(), _), this.show(), this;
              }
              /**
              	     * Set view projection scheme.  Either orthographic or perspective.
              	     * Default is perspective.  Orthographic can also be enabled on viewer creation
              	     * by setting orthographic to true in the config object.
              	     *
              	     *
              	     * @example
              	     viewer.setViewStyle({style:"outline"});
              	          $3Dmol.get('data/1fas.pqr', function(data){
              	              viewer.addModel(data, "pqr");
              	              $3Dmol.get("data/1fas.cube",function(volumedata){
              	                  viewer.addSurface($3Dmol.SurfaceType.VDW, {opacity:0.85,voldata: new $3Dmol.VolumeData(volumedata, "cube"), volscheme: new $3Dmol.Gradient.RWB(-10,10)},{});
              	              });
              	              viewer.zoomTo();
              
              	              viewer.setProjection("orthographic");
              	              viewer.render(callback);
              	          });
              	     *
              	     */
              setProjection(c) {
                this.camera.ortho = c === "orthographic", this.setSlabAndFog();
              }
              /**
               * Set global view styles.
               *
               * @example
               *   viewer.setViewStyle({style:"outline"});
                    $3Dmol.get('data/1fas.pqr', function(data){
                        viewer.addModel(data, "pqr");
                        $3Dmol.get("data/1fas.cube",function(volumedata){
                            viewer.addSurface($3Dmol.SurfaceType.VDW, {opacity:0.85,voldata: new $3Dmol.VolumeData(volumedata, "cube"), volscheme: new $3Dmol.Gradient.RWB(-10,10)},{});
                        });
                        viewer.zoomTo();
                        viewer.render(callback);
                    });
               *
               */
              setViewStyle(c) {
                if (c = c || {}, c.style = c.style || "", c.style.includes("outline") ? this.renderer.enableOutline(c) : this.renderer.disableOutline(), c.style.includes("ambientOcclusion")) {
                  var _ = {};
                  c.strength && (_.strength = c.strength), c.radius && (_.radius = c.radius), this.renderer.enableAmbientOcclusion(_);
                } else
                  this.renderer.disableAmbientOcclusion();
                return this;
              }
              updateSize() {
                this.renderer.setSize(this.WIDTH, this.HEIGHT), this.ASPECT = this.renderer.getAspect(this.WIDTH, this.HEIGHT), this.renderer.setSize(this.WIDTH, this.HEIGHT), this.camera.aspect = this.ASPECT, this.camera.updateProjectionMatrix();
              }
              /**
               * Set viewer width independently of the HTML container.  This is probably not what you want.
               *
               * @param {number} w Width in pixels
               */
              setWidth(c) {
                return this.WIDTH = c || this.WIDTH, this.updateSize(), this;
              }
              /**
               * Set viewer height independently of the HTML container.  This is probably not what you want.
               *
               * @param {number} h Height in pixels
               */
              setHeight(c) {
                return this.HEIGHT = c || this.HEIGHT, this.updateSize(), this;
              }
              /**
               * Resize viewer according to containing HTML element's dimensions
               *
               */
              resize() {
                this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight();
                let c = !1;
                if (this.renderer.isLost() && this.WIDTH > 0 && this.HEIGHT > 0) {
                  let _ = !1, E = this.container.querySelector("canvas");
                  E && E != this.renderer.getCanvas() ? this.config.canvas = E : (E.remove(), this.config && this.config.canvas != null && (delete this.config.canvas, _ = !0)), this.setupRenderer(), this.initContainer(this.container), this.renderer.setClearColorHex(this.bgColor, this.config.backgroundAlpha), c = !0, _ && (this.config.canvas = this.renderer.getCanvas());
                }
                if (this.WIDTH == 0 || this.HEIGHT == 0 ? this.animated && this._viewer.pauseAnimate() : this.animated && this._viewer.resumeAnimate(), this.updateSize(), c) {
                  let _ = this.renderer.supportedExtensions();
                  if (_.regen = !0, this.viewers)
                    for (let E = 0, w = this.viewers.length; E < w; E++)
                      for (let k = 0, $ = this.viewers[E].length; k < $; k++)
                        this.viewers[E][k].render(null, _);
                  this._viewer.render(null, _);
                } else
                  this.show();
                return this;
              }
              /**
               * Return specified model
               *
               * @param {number}
               *            [id=last model id] - Retrieve model with specified id
               * @default Returns last model added to viewer or null if there are no models
               * @return {GLModel}
               *
               * @example // Retrieve reference to first GLModel added var m =
               *    $3Dmol.download("pdb:1UBQ",viewer,{},function(m1){
                        $3Dmol.download("pdb:1UBI", viewer,{}, function(m2) {
                          viewer.zoomTo();
                          m1.setStyle({cartoon: {color:'green'}});
                          //could use m2 here as well
                          viewer.getModel().setStyle({cartoon: {color:'blue'}});
                          viewer.render();
                      })
                    });
               */
              getModel(c) {
                return c === void 0 ? this.models.length == 0 ? null : this.models[this.models.length - 1] : c instanceof d.GLModel ? c : c in this.models ? this.models[c] : this.models.length == 0 ? null : this.models[this.models.length - 1];
              }
              /**
               * Continuously rotate a scene around the specified axis.
               *
               * Call `spin(false)` to stop spinning.
               *
               * @param  {string|boolean|Array} axis
               *            [axis] - Axis ("x", "y", "z", "vx", "vy", or "vz") to rotate around.
               *            Default "y".  View relative (rather than model relative) axes are prefixed with v.
               * @param  {number} speed
               *            [speed] - Speed multiplier for spinning the viewer. 1 is default and a negative
               *             value reverses the direction of the spin.
               *
               */
              spin(c, _ = 1) {
                if (clearInterval(this.spinInterval), typeof c > "u" && (c = "y"), typeof c == "boolean")
                  if (c)
                    c = "y";
                  else
                    return;
                Array.isArray(c) && (c = { x: c[0], y: c[1], z: c[2] });
                var E = this;
                this.spinInterval = setInterval(function() {
                  !E.getCanvas().isConnected && E.renderer.isLost() && clearInterval(E.spinInterval), E.rotate(1 * _, c);
                }, 25);
              }
              //animate motion between current position and passed position
              // can set some parameters to null
              //if fixed is true will enforce the request animation, otherwise
              //does relative updates
              //positions objects have modelggroup position, rotation group position.z,
              //and rotationgroup quaternion
              //return array includes final position, but not current
              //the returned array includes an animate method
              animateMotion(c, _, E, w, k, $) {
                var L = 20, z = Math.ceil(c / L);
                z < 1 && (z = 1), this.incAnim();
                var F = {
                  mpos: this.modelGroup.position.clone(),
                  rz: this.rotationGroup.position.z,
                  rot: this.rotationGroup.quaternion.clone(),
                  cam: this.lookingAt.clone()
                };
                if (_) {
                  let U = new Array(z);
                  for (let V = 0; V < z; V++) {
                    let G = (V + 1) / z, H = { mpos: F.mpos, rz: F.rz, rot: F.rot };
                    H.mpos = E.clone().sub(F.mpos).multiplyScalar(G).add(F.mpos), H.rz = F.rz + G * (w - F.rz), H.rot = l.slerp(F.rot, k, G), H.cam = $.clone().sub(F.cam).multiplyScalar(G).add(F.cam), U[V] = H;
                  }
                  let N = 0, B = this, W = function() {
                    var V = U[N];
                    N += 1, B.modelGroup.position = V.mpos, B.rotationGroup.position.z = V.rz, B.rotationGroup.quaternion = V.rot, B.camera.lookAt(V.cam), N < U.length ? setTimeout(W, L) : B.decAnim(), B.show();
                  };
                  setTimeout(W, L);
                } else {
                  var R = {};
                  let U = 1 / z;
                  if (E && (R.mpos = E.clone().sub(F.mpos).multiplyScalar(U)), typeof w < "u" && w != null && (R.rz = U * (w - F.rz)), k) {
                    var P = l.slerp(F.rot, k, U);
                    R.rot = F.rot.clone().inverse().multiply(P);
                  }
                  $ && (R.cam = $.clone().sub(F.cam).multiplyScalar(U));
                  let N = 0, B = this, W = function() {
                    N += 1, R.mpos && B.modelGroup.position.add(R.mpos), R.rz && (B.rotationGroup.position.z += R.rz), R.rot && B.rotationGroup.quaternion.multiply(R.rot), R.cam && (B.lookingAt.add(R.cam), B.camera.lookAt(B.lookingAt)), N < z ? setTimeout(W, L) : B.decAnim(), B.show();
                  };
                  setTimeout(W, L);
                }
              }
              /**
              	     * Rotate scene by angle degrees around axis
              	     *
              	     * @param {number}
              	     *            [angle] - Angle, in degrees, to rotate by.
              	     * @param {string}
              	     *            [axis] - Axis ("x", "y", "z", "vx", "vy", or "vz") to rotate around.
              	     *            Default "y".  View relative (rather than model relative) axes are prefixed with v.
              	     *            Axis can also be specified as a vector.
              	     * @param {number}
              	     *            [animationDuration] - an optional parameter that denotes
              	     *            the duration of the rotation animation. Default 0 (no animation)
              	     * @param {boolean} [fixedPath] - if true animation is constrained to
              	     *      requested motion, overriding updates that happen during the animation         *
              	     * @example     $3Dmol.download('cid:4000', viewer, {}, function() {
              	    viewer.setStyle({stick:{}});
              	    viewer.zoomTo();
              	    viewer.rotate(90,'y',1);
              	    viewer.render(callback);
              	    });
              
              	     *
              	     */
              rotate(c, _ = "y", E = 0, w = !1) {
                if (_ == "x" ? _ = { x: 1, y: 0, z: 0 } : _ == "y" ? _ = { x: 0, y: 1, z: 0 } : _ == "z" && (_ = { x: 0, y: 0, z: 1 }), _ == "vx" ? _ = { vx: 1, vy: 0, vz: 0 } : _ == "vy" ? _ = { vx: 0, vy: 1, vz: 0 } : _ == "vz" && (_ = { vx: 0, vy: 0, vz: 1 }), typeof _.vx < "u") {
                  var k = new a.Vector3(_.vx, _.vy, _.vz);
                  k.applyQuaternion(this.rotationGroup.quaternion), _ = { x: k.x, y: k.y, z: k.z };
                }
                var $ = function(R) {
                  var P = Math.sin(R / 2), U = Math.cos(R / 2), N = 0, B = 0, W = 0;
                  return N = _.x * P, B = _.y * P, W = _.z * P, new a.Quaternion(N, B, W, U).normalize();
                }, L = Math.PI * c / 180, z = $(L);
                if (E) {
                  var F = new a.Quaternion().copy(this.rotationGroup.quaternion).multiply(z);
                  this.animateMotion(E, w, this.modelGroup.position, this.rotationGroup.position.z, F, this.lookingAt);
                } else
                  this.rotationGroup.quaternion.multiply(z), this.show();
                return this;
              }
              surfacesFinished() {
                for (var c in this.surfaces)
                  if (!this.surfaces[c][0].done)
                    return !1;
                return !0;
              }
              /** Returns an array representing the current viewpoint.
               * Translation, zoom, and rotation quaternion.
               * @returns {Array.<number>} [ pos.x, pos.y, pos.z, rotationGroup.position.z, q.x, q.y, q.z, q.w ]
               *  */
              getView() {
                if (!this.modelGroup)
                  return [0, 0, 0, 0, 0, 0, 0, 1];
                var c = this.modelGroup.position, _ = this.rotationGroup.quaternion;
                return [
                  c.x,
                  c.y,
                  c.z,
                  this.rotationGroup.position.z,
                  _.x,
                  _.y,
                  _.z,
                  _.w
                ];
              }
              /** Sets the view to the specified translation, zoom, and rotation.
               *
               * @param {Array.<number>} arg Array formatted identically to the return value of getView */
              setView(c, _) {
                return c === void 0 || !(c instanceof Array || c.length !== 8) ? this : !this.modelGroup || !this.rotationGroup ? this : (this.modelGroup.position.x = c[0], this.modelGroup.position.y = c[1], this.modelGroup.position.z = c[2], this.rotationGroup.position.z = c[3], this.rotationGroup.quaternion.x = c[4], this.rotationGroup.quaternion.y = c[5], this.rotationGroup.quaternion.z = c[6], this.rotationGroup.quaternion.w = c[7], typeof c[8] < "u" && (this.rotationGroup.position.x = c[8], this.rotationGroup.position.y = c[9]), this.show(_), this);
              }
              // apply styles, models, etc in viewer
              /**
               * Render current state of viewer, after
               * adding/removing models, applying styles, etc.
               *
               */
              render(c, _) {
                this.renderer.setViewport(), this.updateClickables();
                var E = this.getView();
                this.stateChangeCallback && this.stateChangeCallback(this.getInternalState());
                var w, k;
                for (_ || (_ = this.renderer.supportedExtensions()), w = 0; w < this.models.length; w++)
                  this.models[w] && this.models[w].globj(this.modelGroup, _);
                for (w = 0; w < this.shapes.length; w++)
                  this.shapes[w] && (typeof this.shapes[w].frame > "u" || this.viewer_frame < 0 || this.shapes[w].frame < 0 || this.shapes[w].frame == this.viewer_frame ? this.shapes[w].globj(this.modelGroup, _) : this.shapes[w].removegl(this.modelGroup));
                for (w = 0; w < this.labels.length; w++)
                  _.regen && (this.labels[w].dispose(), this.modelGroup.remove(this.labels[w].sprite), this.labels[w].setContext(), this.modelGroup.add(this.labels[w].sprite)), this.labels[w] && typeof this.labels[w].frame < "u" && this.labels[w].frame >= 0 && (this.modelGroup.remove(this.labels[w].sprite), (this.viewer_frame < 0 || this.labels[w].frame == this.viewer_frame) && this.modelGroup.add(this.labels[w].sprite));
                for (w in this.surfaces)
                  if (this.surfaces.hasOwnProperty(w)) {
                    var $ = this.surfaces[w];
                    for (k = 0; k < $.length; k++)
                      if ($.hasOwnProperty(k)) {
                        var L = $[k].geo;
                        if (!$[k].finished || _.regen) {
                          L.verticesNeedUpdate = !0, L.elementsNeedUpdate = !0, L.normalsNeedUpdate = !0, L.colorsNeedUpdate = !0, L.buffersNeedUpdate = !0, $[k].mat.needsUpdate = !0, $[k].done && ($[k].finished = !0), $[k].lastGL && this.modelGroup.remove($[k].lastGL);
                          var z = null;
                          if ($[k].mat instanceof r.LineBasicMaterial ? z = new r.Line(L, $[k].mat) : z = new r.Mesh(L, $[k].mat), $[k].mat.transparent && $[k].mat.opacity == 0 ? z.visible = !1 : z.visible = !0, $[k].symmetries.length > 1 || $[k].symmetries.length == 1 && !$[k].symmetries[k].isIdentity()) {
                            var F, R = new r.Object3D();
                            for (F = 0; F < $[k].symmetries.length; F++) {
                              var P = z.clone();
                              P.matrix = $[k].symmetries[F], P.matrixAutoUpdate = !1, R.add(P);
                            }
                            $[k].lastGL = R, this.modelGroup.add(R);
                          } else
                            $[k].lastGL = z, this.modelGroup.add(z);
                        }
                      }
                  }
                return this.setView(E), typeof c == "function" && c(this), this;
              }
              /* @param {AtomSelectionSpec|any} sel
               * @return list of models specified by sel
               */
              getModelList(c) {
                let _ = [];
                if (typeof c > "u" || typeof c.model > "u")
                  for (let w = 0; w < this.models.length; w++)
                    this.models[w] && _.push(this.models[w]);
                else {
                  let w = c.model;
                  Array.isArray(w) || (w = [w]);
                  for (let k = 0; k < w.length; k++)
                    if (typeof w[k] == "number") {
                      var E = w[k];
                      E < 0 && (E += this.models.length), _.push(this.models[E]);
                    } else
                      _.push(w[k]);
                }
                return _;
              }
              /**
               *
               * @param {AtomSelectionSpec}
               *            sel
               * @return {AtomSpec[]}
               */
              getAtomsFromSel(c) {
                var _ = [];
                typeof c > "u" && (c = {});
                var E = this.getModelList(c);
                for (let w = 0; w < E.length; w++)
                  _ = _.concat(E[w].selectedAtoms(c));
                return _;
              }
              /**
               *
               * @param {AtomSpec}
               *            atom
               * @param {AtomSelectionSpec}
               *            sel
               * @return {boolean}
               */
              atomIsSelected(c, _) {
                typeof _ > "u" && (_ = {});
                for (var E = this.getModelList(_), w = 0; w < E.length; w++)
                  if (E[w].atomIsSelected(c, _))
                    return !0;
                return !1;
              }
              /** return list of atoms selected by sel
               *
               * @param {AtomSelectionSpec} sel
               * @return {AtomSpec[]}
               */
              selectedAtoms(c) {
                return this.getAtomsFromSel(c);
              }
              /**
              * Returns valid values for the specified attribute in the given selection
              * @param {string} attribute
              * @param {AtomSelectionSpec} sel
              * @return {Array.<Object>}
              *
              */
              getUniqueValues(c, _) {
                typeof _ > "u" && (_ = {});
                var E = this.getAtomsFromSel(_), w = {};
                for (var k in E)
                  if (E[k].hasOwnProperty(c)) {
                    var $ = E[k][c];
                    w[$] = !0;
                  }
                return Object.keys(w);
              }
              /**
               * Return pdb output of selected atoms (if atoms from pdb input)
               *
               * @param {AtomSelectionSpec} sel - Selection specification specifying model and atom properties to select.  Default: all atoms in viewer
               * @return {string} PDB string of selected atoms
               */
              pdbData(c) {
                for (var _ = this.getAtomsFromSel(c), E = "", w = 0, k = _.length; w < k; ++w)
                  E += _[w].pdbline + `
`;
                return E;
              }
              /**
              	     * Zoom current view by a constant factor
              	     *
              	     * @param {number}
              	     *            [factor] - Magnification factor. Values greater than 1
              	     *            will zoom in, less than one will zoom out. Default 2.
              	     * @param {number}
              	     *            [animationDuration] - an optional parameter that denotes
              	     *            the duration of a zoom animation
              	     * @param {Boolean} [fixedPath] - if true animation is constrained to
              	     *      requested motion, overriding updates that happen during the animation
              	     * @example
              	    $3Dmol.get('data/4csv.pdb', function(data) {
              	    viewer.addModel(data,'pdb');
              	    viewer.setStyle({cartoon:{},stick:{}});
              	    viewer.zoomTo()
              	    viewer.zoom(2,1000);
              	    viewer.render();
              	    });
              
              	         */
              zoom(c = 2, _ = 0, E = !1) {
                var w = (this.CAMERA_Z - this.rotationGroup.position.z) / c, k = this.CAMERA_Z - w;
                return _ > 0 ? this.animateMotion(_, E, this.modelGroup.position, this.adjustZoomToLimits(k), this.rotationGroup.quaternion, this.lookingAt) : (this.rotationGroup.position.z = this.adjustZoomToLimits(k), this.show()), this;
              }
              /**
               * Translate current view by x,y screen coordinates
               * This pans the camera rather than translating the model.
               *
               * @param {number} x Relative change in view coordinates of camera
               * @param {number} y Relative change in view coordinates of camera
               * @param {number}
               *            [animationDuration] - an optional parameter that denotes
               *            the duration of a zoom animation
               * @param {Boolean} [fixedPath] - if true animation is constrained to
               *      requested motion, overriding updates that happen during the animation         *
               * @example     $3Dmol.get('data/4csv.pdb', function(data) {
              viewer.addModel(data,'pdb');
              viewer.setStyle({cartoon:{},stick:{}});
              viewer.zoomTo();
              viewer.translate(200,50);
              viewer.rotate(90,'z');
              viewer.render(callback);
              });
               */
              translate(c, _, E = 0, w = !1) {
                var k = c / this.WIDTH, $ = _ / this.HEIGHT, L = new a.Vector3(0, 0, -this.CAMERA_Z);
                this.projector.projectVector(L, this.camera), L.x -= k, L.y -= $, this.projector.unprojectVector(L, this.camera), L.z = 0;
                var z = this.lookingAt.clone().add(L);
                return E > 0 ? this.animateMotion(E, w, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, z) : (this.lookingAt = z, this.camera.lookAt(this.lookingAt), this.show()), this;
              }
              /**
               * Translate current models by x,y screen coordinates
               * This translates the models relative to the current view. It does
               * not change the center of rotation.
               *
               * @param {number} x Relative change in x screen coordinate
               * @param {number} y Relative change in y screen coordinate
               * @param {number}
               *            [animationDuration] - an optional parameter that denotes
               *            the duration of a zoom animation
               * @param {Boolean} [fixedPath] - if true animation is constrained to
               *      requested motion, overriding updates that happen during the animation         *
               * @example     $3Dmol.get('data/4csv.pdb', function(data) {
              viewer.addModel(data,'pdb');
              viewer.setStyle({cartoon:{},stick:{}});
              viewer.zoomTo();
              viewer.translateScene(200,50);
              viewer.rotate(90,'z'); // will no longer be around model center
              viewer.render(callback);
              });
               */
              translateScene(c, _, E = 0, w = !1) {
                var k = this.screenOffsetToModel(c, _), $ = this.modelGroup.position.clone().add(k);
                return E > 0 ? this.animateMotion(E, w, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = $, this.show()), this;
              }
              /**
               * Adjust slab to fully enclose selection (default everything).
               *
               * @param {AtomSelectionSpec} sel
               *            Selection specification specifying model and atom
               *            properties to select. Default: all atoms in viewer
               */
              fitSlab(c) {
                c = c || {};
                var _ = this.getAtomsFromSel(c), E = (0, h.getExtent)(_), w = E[1][0] - E[0][0], k = E[1][1] - E[0][1], $ = E[1][2] - E[0][2], L = Math.hypot(w, k, $);
                return L < 5 && (L = 5), this.slabNear = -L / 1.9, this.slabFar = L / 2, this;
              }
              /**
               * Re-center the viewer around the provided selection (unlike zoomTo, does not zoom).
               *
               * @param {AtomSelectionSpec}
               *            [sel] - Selection specification specifying model and atom
               *            properties to select. Default: all atoms in viewer
               * @param {number}
               *            [animationDuration] - an optional parameter that denotes
               *            the duration of a zoom animation
               * @param {Boolean} [fixedPath] - if true animation is constrained to
               *      requested motion, overriding updates that happen during the animation         *
               * @example // if the user were to pass the animationDuration value to
               *           // the function like so viewer.zoomTo({resn:'STI'},1000);
               *         //   the program would center on resn 'STI' over the course
               *         //   of 1 second(1000 milleseconds).
               *  // Reposition to centroid of all atoms of all models in this
               * //viewer glviewer.center();
              $3Dmol.get('data/4csv.pdb', function(data) {
              viewer.addModel(data,'pdb');
              viewer.setStyle({cartoon:{},stick:{}});
              viewer.center();
              viewer.render(callback);
              });
               */
              center(c = {}, _ = 0, E = !1) {
                var w, k, $ = this.getAtomsFromSel(c), L = (0, h.getExtent)($);
                (0, h.isEmptyObject)(c) ? (this.shapes.forEach((G) => {
                  if (G && G.boundingSphere && G.boundingSphere.center) {
                    var H = G.boundingSphere.center, Q = G.boundingSphere.radius;
                    Q > 0 ? ($.push(new a.Vector3(H.x + Q, H.y, H.z)), $.push(new a.Vector3(H.x - Q, H.y, H.z)), $.push(new a.Vector3(H.x, H.y + Q, H.z)), $.push(new a.Vector3(H.x, H.y - Q, H.z)), $.push(new a.Vector3(H.x, H.y, H.z + Q)), $.push(new a.Vector3(H.x, H.y, H.z - Q))) : $.push(H);
                  }
                }), L = (0, h.getExtent)($), w = $, k = L) : (w = this.getAtomsFromSel({}), k = (0, h.getExtent)(w));
                var z = new a.Vector3(L[2][0], L[2][1], L[2][2]), F = k[1][0] - k[0][0], R = k[1][1] - k[0][1], P = k[1][2] - k[0][2], U = Math.hypot(F, R, P);
                U < 5 && (U = 5), this.slabNear = -U / 1.9, this.slabFar = U / 2, F = L[1][0] - L[0][0], R = L[1][1] - L[0][1], P = L[1][2] - L[0][2], U = Math.hypot(F, R, P), U < 5 && (U = 5);
                for (var N = 25, B = 0; B < $.length; B++)
                  if ($[B]) {
                    var W = z.distanceToSquared($[B]);
                    W > N && (N = W);
                  }
                U = Math.sqrt(N) * 2;
                var V = z.clone().multiplyScalar(-1);
                return _ > 0 ? this.animateMotion(_, E, V, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = V, this.show()), this;
              }
              /**
              	     * Zoom to center of atom selection.  The slab will be set appropriately for
              	     * the selection, unless an empty selection is provided, in which case there will be no slab.
              	     *
              	     * @param {Object}
              	     *            [sel] - Selection specification specifying model and atom
              	     *            properties to select. Default: all atoms in viewer
              	     * @param {number}
              	     *            [animationDuration] - an optional parameter that denotes
              	     *            the duration of a zoom animation
              	     * @param {Boolean} [fixedPath] - if true animation is constrained to
              	     *      requested motion, overriding updates that happen during the animation         *
              	      * @example
              
              
              	          $3Dmol.get('data/1fas.pqr', function(data){
              	              viewer.addModel(data, "pqr");
              	          viewer.zoomTo();
              	              $3Dmol.get("data/1fas.cube",function(volumedata){
              	                  viewer.addSurface($3Dmol.SurfaceType.VDW, {
              	                      opacity:0.85,
              	                      voldata: new $3Dmol.VolumeData(volumedata, "cube"),
              	                      volscheme: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'charge'))
              	                  },{});
              
              	              viewer.render();
              	              });
              	            });
              	     */
              zoomTo(c = {}, _ = 0, E = !1) {
                let w = this.getAtomsFromSel(c), k = (0, h.getExtent)(w), $ = k;
                if ((0, h.isEmptyObject)(c)) {
                  let H = w && w.length;
                  if (this.shapes.forEach((Q) => {
                    if (Q && Q.boundingSphere) {
                      if (Q.boundingSphere.box) {
                        let ce = Q.boundingSphere.box;
                        w.push(new a.Vector3(ce.min.x, ce.min.y, ce.min.z)), w.push(new a.Vector3(ce.max.x, ce.max.y, ce.max.z));
                      } else if (Q.boundingSphere.center) {
                        var te = Q.boundingSphere.center, ee = Q.boundingSphere.radius;
                        ee > 0 ? (w.push(new a.Vector3(te.x + ee, te.y, te.z)), w.push(new a.Vector3(te.x - ee, te.y, te.z)), w.push(new a.Vector3(te.x, te.y + ee, te.z)), w.push(new a.Vector3(te.x, te.y - ee, te.z)), w.push(new a.Vector3(te.x, te.y, te.z + ee)), w.push(new a.Vector3(te.x, te.y, te.z - ee))) : w.push(te);
                      }
                    }
                  }), $ = (0, h.getExtent)(w), !H)
                    for (let Q = 0; Q < 3; Q++)
                      k[2][Q] = ($[0][Q] + $[1][Q]) / 2;
                } else {
                  let H = this.getAtomsFromSel({});
                  $ = (0, h.getExtent)(H);
                }
                var L = new a.Vector3(k[2][0], k[2][1], k[2][2]), z = $[1][0] - $[0][0], F = $[1][1] - $[0][1], R = $[1][2] - $[0][2], P = Math.hypot(z, F, R);
                P < 5 && (P = 5), this.slabNear = -P / 1.9, this.slabFar = P / 2, Object.keys(c).length === 0 && (this.slabNear = Math.min(-P * 2, -50), this.slabFar = Math.max(P * 2, 50));
                var U = this.config.minimumZoomToDistance || 5;
                z = k[1][0] - k[0][0], F = k[1][1] - k[0][1], R = k[1][2] - k[0][2], P = Math.hypot(z, F, R), P < U && (P = U);
                for (var N = U * U, B = 0; B < w.length; B++)
                  if (w[B]) {
                    var W = L.distanceToSquared(w[B]);
                    W > N && (N = W);
                  }
                P = Math.sqrt(N) * 2;
                var V = L.clone().multiplyScalar(-1), G = -(P * 0.5 / Math.tan(Math.PI / 180 * this.camera.fov / 2) - this.CAMERA_Z);
                return G = this.adjustZoomToLimits(G), _ > 0 ? this.animateMotion(_, E, V, G, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = V, this.rotationGroup.position.z = G, this.show()), this;
              }
              /**
               * Set slab of view (contents outside of slab are clipped).
               * Must call render to update.
               *
               * @param {number} near near clipping plane distance
               * @param {number} far far clipping plane distance
               */
              setSlab(c, _) {
                this.slabNear = c, this.slabFar = _;
              }
              /**
               * Get slab of view (contents outside of slab are clipped).
               *
               * @return {Object}
               *      @property {number} near - near clipping plane distance
               *      @property {number} far - far clipping plane distance
               */
              getSlab() {
                return { near: this.slabNear, far: this.slabFar };
              }
              /**
              	     * Add label to viewer
              	     *
              	     * @param {string}
              	     *            text - Label text
              	     * @param {LabelSpec}
              	     *            options - Label style specification
              	      @param {AtomSelection}
              	     *            sel - Set position of label to center of this selection
              	     * @param {boolean} noshow - if true, do not immediately display label - when adding multiple labels this is more efficient
              	     * @return {Label}
              	     *
              	     * @example
              	     *  $3Dmol.download("pdb:2EJ0",viewer,{},function(){
              
              	              viewer.addLabel("Aromatic", {position: {x:-6.89, y:0.75, z:0.35}, backgroundColor: 0x800080, backgroundOpacity: 0.8});
              	              viewer.addLabel("Label",{font:'sans-serif',fontSize:18,fontColor:'white',fontOpacity:1,borderThickness:1.0,
              	                                       borderColor:'red',borderOpacity:0.5,backgroundColor:'black',backgroundOpacity:0.5,
              	                                       position:{x:50.0,y:0.0,z:0.0},inFront:true,showBackground:true});
              	              viewer.setStyle({chain:'A'},{cross:{hidden:true}});
              	              viewer.setStyle({chain:'B'},{cross:{hidden:false,
              	                                                  linewidth:1.0,
              	                                                  colorscheme:'greenCarbon'}});
              	              viewer.setStyle({chain:'C'},{cross:{hidden:false,
              	                                                  linewidth:1.0,
              	                                                  radius:0.5}});
              	              viewer.setStyle({chain:'D'},{cross:{hidden:false,
              	                                                  linewidth:10.0}});
              	              viewer.setStyle({chain:'E'},{cross:{hidden:false,
              	                                                  linewidth:1.0,
              	                                                  color:'black'}});
              
              	              viewer.render();
              
              
              	            });
              
              	     */
              addLabel(c, _ = {}, E, w = !1) {
                if (E) {
                  var k = (0, h.getExtent)(this.getAtomsFromSel(E));
                  _.position = { x: k[2][0], y: k[2][1], z: k[2][2] };
                }
                var $ = new v.Label(c, _);
                return $.setContext(), this.modelGroup.add($.sprite), this.labels.push($), w || this.show(), $;
              }
              /** Add residue labels.  This will generate one label per a
               * residue within the selected atoms.  The label will be at the
               * centroid of the atoms and styled according to the passed style.
               * The label text will be [resn][resi]
               *
               * @param {AtomSelectionSpec} sel
               * @param {AtomStyleSpec} style
               * @param {boolean} byframe - if true, create labels for every individual frame, not just current
               *
               * @example
                   $3Dmol.download("mmtf:2ll5",viewer,{},function(){
                        viewer.setStyle({stick:{radius:0.15},cartoon:{}});
                        viewer.addResLabels({hetflag:false}, {font: 'Arial', fontColor:'black',showBackground:false, screenOffset: {x:0,y:0}});
                        viewer.zoomTo();
                        viewer.render();
                      });
               */
              addResLabels(c, _, E = !1) {
                let w = this.labels.length;
                return this.applyToModels("addResLabels", c, this, _, E), this.show(), this.labels.slice(w);
              }
              /** Add property labels.  This will generate one label per a selected
               * atom at the atom's coordinates with the property value as the label text.
               *
               * @param {string} prop - property name
               * @param {AtomSelectionSpec} sel
               * @param {AtomStyleSpec} style
               *
               * * @example
                   $3Dmol.download("cid:5291",viewer,{},function(){
                        viewer.setStyle({stick: {radius:.2}});
                        viewer.addPropertyLabels("index",{not:{elem:'H'}}, {fontColor:'black',font: 'sans-serif', fontSize: 28, showBackground:false,alignment:'center'});
                        viewer.zoomTo();
                        viewer.render();
                      });
               */
              addPropertyLabels(c, _, E) {
                return this.applyToModels("addPropertyLabels", c, _, this, E), this.show(), this;
              }
              /**
              	     * Remove label from viewer
              	     *
              	     * @param {Label} label - $3Dmol label
              	     *
              	     * @example // Remove labels created in
              	     $3Dmol.download("pdb:2EJ0",viewer,{},function(){
              	              var toremove = viewer.addLabel("Aromatic", {position: {x:-6.89, y:0.75, z:0.35}, backgroundColor: 0x800080, backgroundOpacity: 0.8});
              	              viewer.addLabel("Label",{font:'sans-serif',fontSize:18,fontColor:'white',fontOpacity:1,borderThickness:1.0,
              	                                       borderColor:'red',borderOpacity:0.5,backgroundColor:'black',backgroundOpacity:0.5,
              	                                       position:{x:50.0,y:0.0,z:0.0},inFront:true,showBackground:true});
              	              viewer.removeLabel(toremove);
              	              viewer.render();
              
              
              	            });
              
              	     */
              removeLabel(c) {
                for (var _ = 0; _ < this.labels.length; _++)
                  if (this.labels[_] == c) {
                    this.labels.splice(_, 1), c.dispose(), this.modelGroup.remove(c.sprite);
                    break;
                  }
                return this.show(), this;
              }
              /**
              	     * Remove all labels from viewer
              	     *
              	     *         @example
              	    $3Dmol.download("pdb:1ubq",viewer,{},function(){
              
              	           viewer.addResLabels();
              	           viewer.setStyle({},{stick:{}});
              	           viewer.render( ); //show labels
              
              	           viewer.removeAllLabels();
              	           viewer.render(); //hide labels
              	    });
              	     */
              removeAllLabels() {
                for (var c = 0; c < this.labels.length; c++)
                  this.labels[c] && this.labels[c].sprite && this.modelGroup.remove(this.labels[c].sprite);
                return this.labels.splice(0, this.labels.length), this.show(), this;
              }
              // Modify label style
              /**
               * Modify existing label's style
               *
               * @param {Label} label - $3Dmol label
               * @param {LabelSpec}
               *            stylespec - Label style specification
               * @return {Label}
               */
              setLabelStyle(c, _) {
                return this.modelGroup.remove(c.sprite), c.dispose(), c.stylespec = _, c.setContext(), this.modelGroup.add(c.sprite), this.show(), c;
              }
              // Change label text
              /**
               * Modify existing label's text
               *
               * @param {Label}  label - $3Dmol label
               * @param {String}
               *            text - Label text
               * @return {Label}
               */
              setLabelText(c, _) {
                return this.modelGroup.remove(c.sprite), c.dispose(), c.text = _, c.setContext(), this.modelGroup.add(c.sprite), this.show(), c;
              }
              /**
               * Add shape object to viewer
               * @see {GLShape}
               *
               * @param {ShapeSpec} shapeSpec - style specification for label
               * @return {GLShape}
               */
              addShape(c) {
                c = c || {};
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, this.shapes.push(_), _;
              }
              /**
               * Remove shape object from viewer
               *
               * @param {GLShape} shape - Reference to shape object to remove
               */
              removeShape(c) {
                if (!c)
                  return this;
                for (c.removegl(this.modelGroup), delete this.shapes[c.shapePosition]; this.shapes.length > 0 && typeof this.shapes[this.shapes.length - 1] > "u"; )
                  this.shapes.pop();
                return this;
              }
              /**
               * Remove all shape objects from viewer
               */
              removeAllShapes() {
                for (var c = 0; c < this.shapes.length; c++) {
                  var _ = this.shapes[c];
                  _ && _.removegl(this.modelGroup);
                }
                return this.shapes.splice(0, this.shapes.length), this;
              }
              //gets the center of the selection
              getSelectionCenter(c) {
                if (c.hasOwnProperty("x") && c.hasOwnProperty("y") && c.hasOwnProperty("z"))
                  return c;
                var _ = this.getAtomsFromSel(c);
                if (_.length == 0)
                  return { x: 0, y: 0, z: 0 };
                var E = (0, h.getExtent)(_);
                return { x: E[0][0] + (E[1][0] - E[0][0]) / 2, y: E[0][1] + (E[1][1] - E[0][1]) / 2, z: E[0][2] + (E[1][2] - E[0][2]) / 2 };
              }
              /**
              	     * Create and add sphere shape. This method provides a shorthand
              	     * way to create a spherical shape object
              	     *
              	     * @param {SphereShapeSpec} spec - Sphere shape style specification
              	     * @return {GLShape}
              	     @example
              
              	     viewer.addSphere({center:{x:0,y:0,z:0},radius:10.0,color:'red'});
              
              	     viewer.render();
              	     */
              addSphere(c) {
                c = c || {}, c.center = this.getSelectionCenter(c.center);
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, _.addSphere(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Create and add box shape. This method provides a shorthand
              	     * way to create a box shape object
              	     *
              	     * @param {BoxSpec} spec - Box shape style specification
              	     * @return {GLShape}
              	     @example
              
              	     viewer.addLine({color:'red',start:{x:0,y:0,z:0},end:{x:5,y:0,z:0}});
              	     viewer.addLine({color:'blue',start:{x:0,y:0,z:0},end:{x:0,y:5,z:0}});
              	     viewer.addLine({color:'green',start:{x:0,y:0,z:0},end:{x:0,y:0,z:5}});
              
              	     viewer.addBox({center:{x:0,y:0,z:0},dimensions: {w:3,h:4,d:2},color:'magenta'});
              	     viewer.zoomTo();
              	     viewer.rotate(45, {x:1,y:1,z:1});
              	     viewer.render();
              	     */
              addBox(c = {}) {
                c.corner != null && (c.corner = this.getSelectionCenter(c.corner)), c.center != null && (c.center = this.getSelectionCenter(c.center));
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, _.addBox(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Create and add arrow shape
              	     *
              	     * @param {ArrowSpec} spec - Style specification
              	     * @return {GLShape}
              	     @example
              	    $3Dmol.download("pdb:4DM7",viewer,{},function(){
              
              	              viewer.setBackgroundColor(0xffffffff);
              	              viewer.addArrow({
              	                  start: {x:-10.0, y:0.0, z:0.0},
              	                  end: {x:0.0, y:-10.0, z:0.0},
              	                  radius: 1.0,
              	                  radiusRadio:1.0,
              	                  mid:1.0,
              	                  clickable:true,
              	                  callback:function(){
              	                      this.color.setHex(0xFF0000FF);
              	                      viewer.render( );
              	                  }
              	              });
              	              viewer.render();
              	            });
              	     */
              addArrow(c = {}) {
                c.start = this.getSelectionCenter(c.start), c.end = this.getSelectionCenter(c.end);
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, _.addArrow(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Create and add cylinder shape
              	     *
              	     * @param {CylinderSpec} spec - Style specification
              	     * @return {GLShape}
              
              	      @example
              	     viewer.setBackgroundColor(0xffffffff);
              	          viewer.addCylinder({start:{x:0.0,y:0.0,z:0.0},
              	                              end:{x:10.0,y:0.0,z:0.0},
              	                              radius:1.0,
              	                              fromCap:1,
              	                              toCap:2,
              	                              color:'red',
              	                              hoverable:true,
              	                              clickable:true,
              	                              callback:function(){ this.color.setHex(0x00FFFF00);viewer.render( );},
              	                              hover_callback: function(){ viewer.render( );},
              	                              unhover_callback: function(){ this.color.setHex(0xFF000000);viewer.render( );}
              	                             });
              	          viewer.addCylinder({start:{x:0.0,y:2.0,z:0.0},
              	                              end:{x:0.0,y:10.0,z:0.0},
              	                              radius:0.5,
              	                              fromCap:false,
              	                              toCap:true,
              	                              color:'teal'});
              	          viewer.addCylinder({start:{x:15.0,y:0.0,z:0.0},
              	                              end:{x:20.0,y:0.0,z:0.0},
              	                              radius:1.0,
              	                              color:'black',
              	                              fromCap:false,
              	                              toCap:false});
              	          viewer.render();
              	     */
              addCylinder(c = {}) {
                c.start = this.getSelectionCenter(c.start), c.end = this.getSelectionCenter(c.end);
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, c.dashed ? _.addDashedCylinder(c) : _.addCylinder(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Create and add Curve shape
              	     *
              	     * @param {CurveSpec} spec - Style specification
              	     * @return {GLShape}
              
              	     @example
              	          viewer.addCurve({points: [{x:0.0,y:0.0,z:0.0}, {x:5.0,y:3.0,z:0.0}, {x:5.0,y:7.0,z:0.0}, {x:0.0,y:10.0,z:0.0}],
              	                              radius:0.5,
              	                              smooth: 10,
              	                              fromArrow:false,
              	                              toArrow: true,
              	                              color:'orange',
              	                              });
              	          viewer.addCurve({points: [{x:-1,y:0.0,z:0.0}, {x:-5.0,y:5.0,z:0.0}, {x:-2,y:10.0,z:0.0}],
              	                              radius:1,
              	                              fromArrow:true,
              	                              toArrow: false,
              	                              color:'purple',
              	                              });
              	          viewer.zoomTo();
              	          viewer.render();
              	     */
              addCurve(c = {}) {
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, _.addCurve(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Create and add line shape
              	     *
              	     * @param {LineSpec} spec - Style specification, can specify dashed, dashLength, and gapLength
              	     * @return {GLShape}
              	     @example
              	     $3Dmol.download("pdb:2ABJ",viewer,{},function(){
              
              	              viewer.setViewStyle({style:"outline"});
              	              viewer.setStyle({chain:'A'},{sphere:{hidden:true}});
              	              viewer.setStyle({chain:'D'},{sphere:{radius:3.0}});
              	              viewer.setStyle({chain:'G'},{sphere:{colorscheme:'greenCarbon'}});
              	              viewer.setStyle({chain:'J'},{sphere:{color:'blue'}});
              	              viewer.addLine({dashed:true,start:{x:0,y:0,z:0},end:{x:100,y:100,z:100}});
              	              viewer.render();
              	          });
              
              	     */
              addLine(c = {}) {
                c.start = this.getSelectionCenter(c.start), c.end = this.getSelectionCenter(c.end), c.wireframe = !0;
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, c.dashed ? _ = this.addLineDashed(c, _) : _.addLine(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Create and add unit cell visualization.
              	     *
              	     * @param {GLModel|number} model - Model with unit cell information (e.g., pdb derived).  If omitted uses most recently added model.
              	     * @param {UnitCellStyleSpec} spec - visualization style
              	       @example
              
              	            $3Dmol.get('data/1jpy.cif', function(data) {
              	              let m = viewer.addModel(data);
              	              viewer.addUnitCell(m, {box:{color:'purple'},alabel:'X',blabel:'Y',clabel:'Z',alabelstyle: {fontColor: 'black',backgroundColor:'white',inFront:true,fontSize:40},astyle:{color:'darkred', radius:5,midpos: -10}});
              	              viewer.zoomTo();
              	              viewer.render();
              	    });
              	     */
              addUnitCell(c, _) {
                c = this.getModel(c), _ = _ || { alabel: "a", blabel: "b", clabel: "c" }, _.box = _.box || {}, _.astyle = _.astyle || { color: "red", radius: 0.1, midpos: -1 }, _.bstyle = _.bstyle || { color: "green", radius: 0.1, midpos: -1 }, _.cstyle = _.cstyle || { color: "blue", radius: 0.1, midpos: -1 }, _.alabelstyle = _.alabelstyle || { fontColor: "red", showBackground: !1, alignment: "center", inFront: !1 }, _.blabelstyle = _.blabelstyle || { fontColor: "green", showBackground: !1, alignment: "center", inFront: !1 }, _.clabelstyle = _.clabelstyle || { fontColor: "blue", showBackground: !1, alignment: "center", inFront: !1 }, c.unitCellObjects && this.removeUnitCell(c), c.unitCellObjects = { shapes: [], labels: [] };
                var E = c.getCrystData(), w = null;
                if (E) {
                  if (E.matrix)
                    w = E.matrix;
                  else {
                    var k = E.a, $ = E.b, L = E.c, z = E.alpha, F = E.beta, R = E.gamma;
                    z = z * Math.PI / 180, F = F * Math.PI / 180, R = R * Math.PI / 180;
                    var P, U, N;
                    P = Math.cos(F), U = (Math.cos(z) - Math.cos(F) * Math.cos(R)) / Math.sin(R), N = Math.sqrt(Math.max(0, 1 - P * P - U * U)), w = new a.Matrix3(k, $ * Math.cos(R), L * P, 0, $ * Math.sin(R), L * U, 0, 0, L * N);
                  }
                  var B = [
                    new a.Vector3(0, 0, 0),
                    new a.Vector3(1, 0, 0),
                    new a.Vector3(0, 1, 0),
                    new a.Vector3(0, 0, 1),
                    new a.Vector3(1, 1, 0),
                    new a.Vector3(0, 1, 1),
                    new a.Vector3(1, 0, 1),
                    new a.Vector3(1, 1, 1)
                  ];
                  if (E.matrix4)
                    for (let V = 0; V < B.length; V++)
                      E.size && B[V].multiplyVectors(B[V], E.size), B[V] = B[V].applyMatrix4(E.matrix4);
                  else
                    for (let V = 0; V < B.length; V++)
                      B[V] = B[V].applyMatrix3(w);
                  if (_.box && !_.box.hidden) {
                    _.box.wireframe = !0;
                    var W = new f.GLShape(_.box);
                    W.shapePosition = this.shapes.length, W.addLine({ start: B[0], end: B[1] }), W.addLine({ start: B[0], end: B[2] }), W.addLine({ start: B[1], end: B[4] }), W.addLine({ start: B[2], end: B[4] }), W.addLine({ start: B[0], end: B[3] }), W.addLine({ start: B[3], end: B[5] }), W.addLine({ start: B[2], end: B[5] }), W.addLine({ start: B[1], end: B[6] }), W.addLine({ start: B[4], end: B[7] }), W.addLine({ start: B[6], end: B[7] }), W.addLine({ start: B[3], end: B[6] }), W.addLine({ start: B[5], end: B[7] }), this.shapes.push(W), c.unitCellObjects.shapes.push(W), W.finalize();
                  }
                  if (!_.astyle.hidden) {
                    _.astyle.start = B[0], _.astyle.end = B[1];
                    let V = this.addArrow(_.astyle);
                    c.unitCellObjects.shapes.push(V);
                  }
                  if (!_.bstyle.hidden) {
                    _.bstyle.start = B[0], _.bstyle.end = B[2];
                    let V = this.addArrow(_.bstyle);
                    c.unitCellObjects.shapes.push(V);
                  }
                  if (!_.cstyle.hidden) {
                    _.cstyle.start = B[0], _.cstyle.end = B[3];
                    let V = this.addArrow(_.cstyle);
                    c.unitCellObjects.shapes.push(V);
                  }
                  if (_.alabel) {
                    _.alabelstyle.position = B[1];
                    let V = this.addLabel(_.alabel, _.alabelstyle);
                    c.unitCellObjects.labels.push(V);
                  }
                  if (_.blabel) {
                    _.blabelstyle.position = B[2];
                    let V = this.addLabel(_.blabel, _.blabelstyle);
                    c.unitCellObjects.labels.push(V);
                  }
                  if (_.clabel) {
                    _.clabelstyle.position = B[3];
                    let V = this.addLabel(_.clabel, _.clabelstyle);
                    c.unitCellObjects.labels.push(V);
                  }
                }
              }
              /**
              * Remove unit cell visualization from model.
              *
              * @param {GLModel|number} model - Model with unit cell information (e.g., pdb derived).  If omitted uses most recently added model.
                @example
                     $3Dmol.get('data/icsd_200866.cif', function(data) {
                       let m = viewer.addModel(data);
                       viewer.setStyle({sphere:{}})
                       viewer.addUnitCell();
                       viewer.zoomTo();
                       viewer.removeUnitCell();
                       viewer.render();
                 });
              */
              removeUnitCell(c) {
                if (c = this.getModel(c), c.unitCellObjects) {
                  let _ = this;
                  c.unitCellObjects.shapes.forEach(function(E) {
                    _.removeShape(E);
                  }), c.unitCellObjects.labels.forEach(function(E) {
                    _.removeLabel(E);
                  });
                }
                delete c.unitCellObjects;
              }
              /**
              * Replicate atoms in model to form a super cell of the specified dimensions.
              * Original cell will be centered as much as possible.
              *
              * @param {integer} A - number of times to replicate cell in X dimension.
              * @param {integer} B - number of times to replicate cell in Y dimension.  If absent, X value is used.
              * @param {integer} C - number of times to replicate cell in Z dimension.  If absent, Y value is used.
              * @param {GLModel} model - Model with unit cell information (e.g., pdb derived).  If omitted uses most recently added model.
              * @param {boolean} addBonds - Create bonds between unit cells based on distances.
              * @param {boolean} prune - Keep only atoms that are within the original unit cell (i.e., on edges).  Alternatively, call replicateUnitCell(1).
                @example
                     $3Dmol.get('data/icsd_200866.cif', function(data) {
                       let m = viewer.addModel(data);
                       viewer.setStyle({sphere:{scale:.25}})
                       viewer.addUnitCell();
                       viewer.zoomTo();
                       viewer.replicateUnitCell(3,2,1,m);
                       viewer.render();
                 });
              */
              replicateUnitCell(c = 3, _ = c, E = _, w, k, $) {
                w = this.getModel(w);
                let L = w.getCrystData();
                if (L) {
                  const z = w.selectedAtoms({}), F = L.matrix;
                  let R = function(U) {
                    return U % 2 == 0 ? -U / 2 : Math.ceil(U / 2);
                  };
                  c <= 1 && _ <= 1 && E <= 1 && ($ = !0, c = _ = E = 3);
                  let P = function(U, N, B) {
                    return !1;
                  };
                  if ($) {
                    const U = new a.Matrix3().getInverse3(F);
                    P = function(N, B, W) {
                      let V = new a.Vector3(N, B, W).applyMatrix3(U);
                      return !(V.x > -1e-4 && V.x < 1.0001 && V.y > -1e-4 && V.y < 1.0001 && V.z > -1e-4 && V.z < 1.0001);
                    };
                  }
                  for (let U = 0; U < c; U++)
                    for (let N = 0; N < _; N++)
                      for (let B = 0; B < E; B++) {
                        if (U == 0 && N == 0 && B == 0)
                          continue;
                        let W = new a.Vector3(R(U), R(N), R(B));
                        W.applyMatrix3(F);
                        let V = [];
                        for (let G = 0; G < z.length; G++) {
                          let H = z[G].x + W.x, Q = z[G].y + W.y, te = z[G].z + W.z;
                          if (P(H, Q, te))
                            continue;
                          let ee = {};
                          for (let ce in z[G])
                            ee[ce] = z[G][ce];
                          ee.x = H, ee.y = Q, ee.z = te, V.push(ee);
                        }
                        w.addAtoms(V);
                      }
                  k && w.assignBonds();
                }
              }
              /** Add dashed line to shape */
              addLineDashed(c, _) {
                c.dashLength = c.dashLength || 0.5, c.gapLength = c.gapLength || 0.5;
                var E;
                c.start ? E = new a.Vector3(c.start.x || 0, c.start.y || 0, c.start.z || 0) : E = new a.Vector3(0, 0, 0);
                var w;
                c.end ? w = new a.Vector3(c.end.x, c.end.y || 0, c.end.z || 0) : w = new a.Vector3(0, 0, 0);
                var k = new a.Vector3(), $ = new a.Vector3(), L = new a.Vector3(), z, F, R, P = E.clone(), U = 0;
                for (k.subVectors(w, E), z = k.length(), k.normalize(), $ = k.clone(), L = k.clone(), $.multiplyScalar(c.dashLength), L.multiplyScalar(c.gapLength), F = $.length(), R = L.length(); U < z; ) {
                  if (U + F > z) {
                    c.start = E, c.end = w, _.addLine(c);
                    break;
                  }
                  P.addVectors(E, $), c.start = E, c.end = P, _.addLine(c), E = P.clone(), U += F, P.addVectors(E, L), E = P.clone(), U += R;
                }
                return _.finalize(), _;
              }
              /**
              	     * Add custom shape component from user supplied function
              	     *
              	     * @param {CustomSpec} spec - Style specification
              	     * @return {GLShape}
              	     @example
              	     function triangle(viewer) {
              	        var vertices = [];
              	        var normals = [];
              	        var colors = [];
              	        var r = 20;
              	        //triangle
              	        vertices.push(new $3Dmol.Vector3(0,0,0));
              	        vertices.push(new $3Dmol.Vector3(r,0,0));
              	        vertices.push(new $3Dmol.Vector3(0,r,0));
              
              	        normals.push(new $3Dmol.Vector3(0,0,1));
              	        normals.push(new $3Dmol.Vector3(0,0,1));
              	        normals.push(new $3Dmol.Vector3(0,0,1));
              
              	        colors.push({r:1,g:0,b:0});
              	        colors.push({r:0,g:1,b:0});
              	        colors.push({r:0,g:0,b:1});
              
              	        var faces = [ 0,1,2 ];
              
              	        var spec = {vertexArr:vertices, normalArr: normals, faceArr:faces,color:colors};
              	        viewer.addCustom(spec);
              	    }
              	    triangle(viewer);
              	    viewer.render();
              	     */
              addCustom(c) {
                c = c || {};
                var _ = new f.GLShape(c);
                return _.shapePosition = this.shapes.length, _.addCustom(c), this.shapes.push(_), _.finalize(), _;
              }
              /**
              	     * Construct isosurface from volumetric data in gaussian cube format
              	     * @param {String} data - Input file contents
              	     * @param {String} format - Input file format
              	     * @param {VolumetricRendererSpec|IsoSurfaceSpec} spec - Shape style specification
              	     * @return {GLShape}
              	     *
              	     * @example
              
              
              	    $3Dmol.get('data/bohr.cube', function(data) {
              
              	    viewer.addVolumetricData(data, "cube", {isoval: -0.01, color: "red", opacity: 0.95});
              	    viewer.setStyle({cartoon:{},stick:{}});
              	    viewer.zoomTo();
              	    viewer.render();
              	    });
              
              
              	     */
              addVolumetricData(c, _, E = {}) {
                var w = new y.VolumeData(c, _);
                return E.hasOwnProperty("transferfn") ? this.addVolumetricRender(w, E) : this.addIsosurface(w, E);
              }
              /**
               * Construct isosurface from volumetric data.  This is more flexible
              * than addVolumetricData, but can not be used with py3Dmol.
               * @param {VolumeData} data - volumetric data
               * @param {IsoSurfaceSpec} spec - Shape style specification
               * @return {GLShape}
               *
               @example
               $3Dmol.get('../test_structs/benzene-homo.cube', function(data){
                        var voldata = new $3Dmol.VolumeData(data, "cube");
                        viewer.addIsosurface(voldata, {isoval: 0.01,
                                                       color: "blue"});
                        viewer.addIsosurface(voldata, {isoval: -0.01,
                                                       color: "red"});
                        viewer.zoomTo();
                        viewer.render();
                      });
               */
              addIsosurface(c, _ = {}, E) {
                var w = new f.GLShape(_);
                return w.shapePosition = this.shapes.length, w.addIsosurface(c, _, E, this), this.shapes.push(w), w;
              }
              /**
               * Create volumetric renderer for volumetricData
               * @param {VolumeData} data - volumetric data
               * @param {VolumetricRenderSpec} spec - specification of volumetric render
               *
               * @return {GLShape}
               *
               */
              addVolumetricRender(c, _) {
                _ = _ || {};
                var E = new x.GLVolumetricRender(c, _, this);
                return E.shapePosition = this.shapes.length, this.shapes.push(E), E;
              }
              /**
               * Return true if volumetric rendering is supported (WebGL 2.0 required)
               *
               * @return {boolean}
               */
              hasVolumetricRender() {
                return this.renderer.supportsVolumetric();
              }
              /**
               * Enable/disable fog for content far from the camera
               *
               * @param {boolean} fog whether to enable or disable the fog
               */
              enableFog(c) {
                c ? this.scene.fog = new r.Fog(this.bgColor, 100, 200) : (this.config.disableFog = !0, this.show());
              }
              /**
               * Sets the atomlists of all models in the viewer to specified frame.
               * Shapes and labels can also be displayed by frame.
               * Sets to last frame if framenum out of range
               *
               * @param {number} framenum - fame index to use, starts at zero
               * @return {Promise}
               */
              setFrame(c) {
                this.viewer_frame = c;
                let _ = this;
                return new Promise(function(E) {
                  var w = _.models.map(function(k) {
                    return k.setFrame(c, _);
                  });
                  Promise.all(w).then(function() {
                    E();
                  });
                });
              }
              /**
               * Gets the current viewer frame.
               *
               */
              getFrame() {
                return this.viewer_frame;
              }
              /**
               * Returns the number of frames that the model with the most frames in the viewer has
               *
               * @return {number}
               */
              getNumFrames() {
                var c = 0;
                for (let _ = 0; _ < this.models.length; _++)
                  this.models[_].getNumFrames() > c && (c = this.models[_].getNumFrames());
                for (let _ = 0; _ < this.shapes.length; _++)
                  this.shapes[_].frame && this.shapes[_].frame >= c && (c = this.shapes[_].frame + 1);
                for (let _ = 0; _ < this.labels.length; _++)
                  this.labels[_].frame && this.labels[_].frame >= c && (c = this.labels[_].frame + 1);
                return c;
              }
              /**
               * Animate all models in viewer from their respective frames
               * @param {Object} options - can specify interval (speed of animation), loop (direction
               * of looping, 'backward', 'forward' or 'backAndForth'), step interval between frames ('step'), startFrame, and reps (numer of repetitions, 0 indicates infinite loop)
               *
               */
              animate(c) {
                this.incAnim();
                var _ = 100, E = "forward", w = 1 / 0;
                c = c || {}, c.interval && (_ = c.interval), c.loop && (E = c.loop), c.reps && (w = c.reps);
                var k = this.getNumFrames(), $ = this, L = 0;
                c.startFrame && (L = c.startFrame % k);
                var z = 1;
                c.step && (z = c.step, w /= z);
                var F = 0, R = k * w, P = /* @__PURE__ */ new Date(), U, N, B = function(W) {
                  P = /* @__PURE__ */ new Date(), W == "forward" ? $.setFrame(L).then(function() {
                    L = (L + z) % k, U();
                  }) : W == "backward" ? $.setFrame(k - 1 - L).then(function() {
                    L = (L + z) % k, U();
                  }) : $.setFrame(L).then(function() {
                    L += z, z *= L % (k - 1) == 0 ? -1 : 1, U();
                  });
                };
                return U = function() {
                  if ($.render(), !$.getCanvas().isConnected)
                    $.stopAnimate();
                  else if (++F >= R || !$.isAnimated())
                    N.cancel(), $.animationTimers.delete(N), $.decAnim();
                  else {
                    var W = _ - ((/* @__PURE__ */ new Date()).getTime() - P.getTime());
                    W = W > 0 ? W : 0, $.animationTimers.delete(N), N = new h.PausableTimer(B, W, E), $.animationTimers.add(N);
                  }
                }, N = new h.PausableTimer(B, 0, E), this.animationTimers.add(N), this;
              }
              /**
               * Stop animation of all models in viewer
               */
              stopAnimate() {
                return this.animated = 0, this.animationTimers.forEach(function(c) {
                  c.cancel();
                }), this.animationTimers = /* @__PURE__ */ new Set(), this;
              }
              /**
               * Pause animation of all models in viewer
               */
              pauseAnimate() {
                return this.animationTimers.forEach(function(c) {
                  c.pause();
                }), this;
              }
              /**
               * Resume animation of all models in viewer
               */
              resumeAnimate() {
                return this.animationTimers.forEach(function(c) {
                  c.resume();
                }), this;
              }
              /**
               * Return true if viewer is currently being animated, false otherwise
               * @return {boolean}
               */
              isAnimated() {
                return this.animated > 0;
              }
              //setup options dict
              getModelOpt(c) {
                return c && !c.defaultcolors ? (c.defaultcolors = this.defaultcolors, c.cartoonQuality = c.cartoonQuality || this.config.cartoonQuality) : typeof c > "u" && (c = { defaultcolors: this.defaultcolors, cartoonQuality: this.config.cartoonQuality }), c;
              }
              /**
              	     * Create and add model to viewer, given molecular data and its format
              	     *
              	     * @param {string} data - Input data
              	     * @param {string} format - Input format ('pdb', 'sdf', 'xyz', 'pqr', or 'mol2')
              	     * @param {ParserOptionsSpec} options - format dependent options. Attributes depend on the input file format.
              	     * @example
              
              
              	          viewer.setViewStyle({style:"outline"});
              	          $3Dmol.get('data/1fas.pqr', function(data){
              	              viewer.addModel(data, "pqr");
              	              $3Dmol.get("data/1fas.cube",function(volumedata){
              	                  viewer.addSurface($3Dmol.SurfaceType.VDW, {opacity:0.85,voldata: new $3Dmol.VolumeData(volumedata, "cube"), volscheme: new $3Dmol.Gradient.RWB(-10,10)},{});
              
              	              viewer.render();
              	              });
              	              viewer.zoomTo();
              	          });
              	     *
              	     * @return {GLModel}
              	     */
              addModel(c, _ = "", E) {
                E = this.getModelOpt(E);
                var w = new d.GLModel(this.models.length, E);
                return w.addMolData(c, _, E), this.models.push(w), w;
              }
              /**
               * Given multimodel file and its format, add atom data to the viewer as separate models
               * and return list of these models
               *
               * @param {string} data - Input data
               * @param {string} format - Input format (see {@link FileFormats})
               * @return {Array<GLModel>}
               */
              addModels(c, _, E) {
                E = this.getModelOpt(E), E.multimodel = !0, E.frames = !0;
                for (var w = d.GLModel.parseMolData(c, _, E), k = 0; k < w.length; k++) {
                  var $ = new d.GLModel(this.models.length, E);
                  $.setAtomDefaults(w[k]), $.addFrame(w[k]), $.setFrame(0), w.modelData && $.setModelData(w.modelData[k]), $.setDontDuplicateAtoms(!E.duplicateAssemblyAtoms), this.models.push($);
                }
                return this.models;
              }
              /**
               * Create and add model to viewer. Given multimodel file and its format,
               * different atomlists are stored in model's frame
               * property and model's atoms are set to the 0th frame
               *
               * @param {string} data - Input data
               * @param {string} format - Input format (see {@link FileFormats})
               * @return {GLModel}
               *
               * @example
                      $3Dmol.get('../test_structs/multiple2.xyz', function(data){
                        viewer.addModelsAsFrames(data, "xyz");
                        viewer.animate({loop: "forward",reps: 1});
                        viewer.setStyle({stick:{colorscheme:'magentaCarbon'}});
                        viewer.zoomTo();
                        viewer.render();
                    });
               */
              addModelsAsFrames(c, _, E) {
                E = this.getModelOpt(E), E.multimodel = !0, E.frames = !0;
                var w = new d.GLModel(this.models.length, E);
                return w.addMolData(c, _, E), this.models.push(w), w;
              }
              /**
              	     * Create and add model to viewer. Given multimodel file and its format,
              	     * all atoms are added to one model
              	     *
              	     * @param {string} data - Input data
              	     * @param {string} format - Input format (see {@link FileFormats})
              	     * @return {GLModel}
              	     @example
              
              
              	          $3Dmol.get('../test_structs/multiple.sdf', function(data){
              	              viewer.addAsOneMolecule(data, "sdf");
              	              viewer.zoomTo();
              	              viewer.render();
              	          });
              	     */
              addAsOneMolecule(c, _, E) {
                E = this.getModelOpt(E), E.multimodel = !0, E.onemol = !0;
                var w = new d.GLModel(this.models.length, E);
                return w.addMolData(c, _, E), this.models.push(w), w;
              }
              /**
               * Delete specified model from viewer
               *
               * @param {GLModel|number} model
               */
              removeModel(c) {
                if (c = this.getModel(c), !!c) {
                  for (c.removegl(this.modelGroup), delete this.models[c.getID()]; this.models.length > 0 && typeof this.models[this.models.length - 1] > "u"; )
                    this.models.pop();
                  return this;
                }
              }
              /**
               * Delete all existing models
               */
              removeAllModels() {
                for (var c = 0; c < this.models.length; c++) {
                  var _ = this.models[c];
                  _ && _.removegl(this.modelGroup);
                }
                return this.models.splice(0, this.models.length), this;
              }
              /**
               * Export one or all of the loaded models into ChemDoodle compatible JSON.
               * @param {boolean} includeStyles - Whether or not to include style information.
               * @param {number} modelID - Optional parameter for which model to export. If left out, export all of them.
               * @return {string}
               */
              exportJSON(c, _) {
                var E = {};
                return _ === void 0 ? E.m = this.models.map(function(w) {
                  return w.toCDObject(c);
                }) : E.m = [this.models[_].toCDObject()], JSON.stringify(E);
              }
              /** return a VRML string representation of the scene.  Include VRML header information
               * @return VRML
               */
              exportVRML() {
                var c = this.modelGroup;
                this.applyToModels("removegl", this.modelGroup), this.modelGroup = new r.Object3D(), this.render(null, { supportsImposters: !1, supportsAIA: !1, regen: !0 });
                var _ = `#VRML V2.0 utf8
` + this.modelGroup.vrml() + `
`;
                return this.applyToModels("removegl", this.modelGroup), this.modelGroup = c, _;
              }
              /**
               * Create a new model from atoms specified by sel.
               * If extract, removes selected atoms from existing models
               *
               * @param {AtomSelectionSpec} sel - Atom selection specification
               * @param {boolean=} extract - If true, remove selected atoms from existing models
               * @return {GLModel}
               */
              createModelFrom(c, _ = !1) {
                for (var E = new d.GLModel(this.models.length, this.defaultcolors), w = 0; w < this.models.length; w++)
                  if (this.models[w]) {
                    var k = this.models[w].selectedAtoms(c);
                    E.addAtoms(k), _ && this.models[w].removeAtoms(k);
                  }
                return this.models.push(E), E;
              }
              applyToModels(c, _, E, w, k, $, L) {
                for (var z = this.getModelList(_), F = 0; F < z.length; F++)
                  z[F][c](_, E, w, k, $, L);
              }
              setStyle(c, _) {
                return typeof _ > "u" && (_ = c, c = {}), this.applyToModels("setStyle", c, _, !1), this;
              }
              addStyle(c, _) {
                return typeof _ > "u" && (_ = c, c = {}), this.applyToModels("setStyle", c, _, !0), this;
              }
              /**
              	     * Set click-handling properties to all selected atoms. *Important*: render must be called for this to take effect.
              	     *
              	     * @param {AtomSelectionSpec} sel - atom selection to apply clickable settings to
              	     * @param {boolean} clickable - whether click-handling is enabled for the selection
              	     * @param {function} callback - function called when an atom in the selection is clicked. The function is passed
              	     * the selected (foremost) object, the viewer, the triggering event, the associated container, and a list
              	     * of all intersecting objects with their distances from the viewer.
              	     *
              	     * @example
              	        $3Dmol.download("cid:307900",viewer,{},function(){
              
              	               viewer.setStyle({},{sphere:{}});
              	               viewer.setClickable({},true,function(atom,viewer,event,container) {
              	                   viewer.addLabel(atom.resn+":"+atom.atom,{position: atom, backgroundColor: 'darkgreen', backgroundOpacity: 0.8});
              	               });
              	               viewer.render();
              	    });
              	     */
              setClickable(c, _, E) {
                return this.applyToModels("setClickable", c, _, E), this;
              }
              /** Set hoverable and callback of selected atoms
              	     *
              	     * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to
              	     * @param {boolean} hoverable - whether hover-handling is enabled for the selection
              	     * @param {function} hover_callback - function called when an atom in the selection is hovered over.  The function has the same signature as a click handler.
              	     * @param {function} unhover_callback - function called when the mouse moves out of the hover area
              	    @example
              	    $3Dmol.download("pdb:1ubq",viewer,{},function(){
              
              	           viewer.setHoverable({},true,function(atom,viewer,event,container) {
              	               if(!atom.label) {
              	                atom.label = viewer.addLabel(atom.resn+":"+atom.atom,{position: atom, backgroundColor: 'mintcream', fontColor:'black'});
              	               }
              	           },
              	           function(atom) {
              	               if(atom.label) {
              	                viewer.removeLabel(atom.label);
              	                delete atom.label;
              	               }
              	            }
              	           );
              	           viewer.setStyle({},{stick:{}});
              	           viewer.render();
              	    });
              
              	     */
              setHoverable(c, _, E, w) {
                return this.applyToModels("setHoverable", c, _, E, w), this;
              }
              /** enable context menu and callback of selected atoms
              	     *
              	     * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to
              	     * @param {boolean} contextMenuEnabled - whether contextMenu-handling is enabled for the selection
              
              	     */
              enableContextMenu(c, _) {
                return this.applyToModels("enableContextMenu", c, _), this;
              }
              /**
               * If  atoms have dx, dy, dz properties (in some xyz files), vibrate populates each model's frame property based on parameters.
               * Models can then be animated
               *
               * @param {number} numFrames - number of frames to be created, default to 10
               * @param {number} amplitude - amplitude of distortion, default to 1 (full)
               * @param {boolean} bothWays - if true, extend both in positive and negative directions by numFrames
               * @param {ArrowSpec} arrowSpec - specification for drawing animated arrows. If color isn't specified, atom color (sphere, stick, line preference) is used.
               */
              vibrate(c, _, E, w) {
                return this.applyToModels("vibrate", c, _, E, this, w), this;
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {string} prop
               * @param {Gradient|string} scheme
               * @param {object} range
               */
              setColorByProperty(c, _, E, w) {
                return this.applyToModels("setColorByProperty", c, _, E, w), this;
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {object} colors
               */
              setColorByElement(c, _) {
                return this.applyToModels("setColorByElement", c, _), this;
              }
              /**
               *
               * @param {AtomSpec[]} atomlist
               * @param {Array}
               *            extent
               * @return {Array}
               */
              static getAtomsWithin(c, _) {
                var E = [];
                for (let k = 0; k < c.length; k++) {
                  var w = c[k];
                  typeof w > "u" || w.x < _[0][0] || w.x > _[1][0] || w.y < _[0][1] || w.y > _[1][1] || w.z < _[0][2] || w.z > _[1][2] || E.push(w);
                }
                return E;
              }
              // return volume of extent
              static volume(c) {
                var _ = c[1][0] - c[0][0], E = c[1][1] - c[0][1], w = c[1][2] - c[0][2];
                return _ * E * w;
              }
              // volume
              /*
               * Break up bounding box/atoms into smaller pieces so we can parallelize
               * with webworkers and also limit the size of the working memory Returns
               * a list of bounding boxes with the corresponding atoms. These extents
               * are expanded by 4 angstroms on each side.
               */
              /**
               *
               * @param {Array}
               *            extent
               * @param {AtomSpec[]} atomlist
               * @param {AtomSpec[]} atomstoshow
               * @return {Array}
               */
              carveUpExtent(c, _, E) {
                let w = [], k = {};
                for (let P = 0, U = _.length; P < U; P++)
                  k[_[P].index] = P;
                let $ = function(P) {
                  let U = [];
                  for (let N = 0, B = P.length; N < B; N++)
                    P[N].index in k && U.push(k[P[N].index]);
                  return U;
                }, L = function(P) {
                  let U = [];
                  return U[0] = [P[0][0], P[0][1], P[0][2]], U[1] = [P[1][0], P[1][1], P[1][2]], U;
                }, z = function(P) {
                  if (l.volume(P) < l.maxVolume)
                    return [P];
                  var U = P[1][0] - P[0][0], N = P[1][1] - P[0][1], B = P[1][2] - P[0][2], W;
                  U > N && U > B ? W = 0 : N > U && N > B ? W = 1 : W = 2;
                  var V = L(P), G = L(P), H = (P[1][W] - P[0][W]) / 2 + P[0][W];
                  V[1][W] = H, G[0][W] = H;
                  var Q = z(V), te = z(G);
                  return Q.concat(te);
                }, F = z(c), R = 6;
                for (let P = 0, U = F.length; P < U; P++) {
                  let N = L(F[P]);
                  N[0][0] -= R, N[0][1] -= R, N[0][2] -= R, N[1][0] += R, N[1][1] += R, N[1][2] += R;
                  let B = l.getAtomsWithin(_, N), W = l.getAtomsWithin(E, F[P]);
                  w.push({
                    extent: F[P],
                    atoms: $(B),
                    toshow: $(W)
                  });
                }
                return w;
              }
              // create a mesh defined from the passed vertices and faces and material
              // Just create a single geometry chunk - broken up whether sync or not
              /**
               *
               * @param {AtomSpec[]} atoms
               * @param {{vertices:number,faces:number}}
               *            VandF
               * @param {MeshLambertMaterial}
               *            mat
               * @return {Mesh}
               */
              static generateSurfaceMesh(c, _, E) {
                var w = new r.Geometry(!0), k = w.updateGeoGroup(0), $ = [];
                for (let pe = 0, le = c.length; pe < le; pe++) {
                  var L = c[pe];
                  L && (typeof L.surfaceColor < "u" ? $[pe] = L.surfaceColor : L.color && ($[pe] = s.CC.color(L.color)));
                }
                var z = k.vertexArray, F = _.vertices;
                for (let pe = 0, le = F.length; pe < le; pe++) {
                  let ne = k.vertices * 3;
                  z[ne] = F[pe].x, z[ne + 1] = F[pe].y, z[ne + 2] = F[pe].z, k.vertices++;
                }
                var R = k.colorArray;
                let P = k.atomArray;
                if (E.voldata && E.volscheme) {
                  var U = E.volscheme, N = E.voldata, B = U.range() || [-1, 1];
                  for (let pe = 0, le = F.length; pe < le; pe++) {
                    let ne = F[pe].atomid, Te = N.getVal(F[pe].x, F[pe].y, F[pe].z), Oe = s.CC.color(U.valueToHex(Te, B)), Be = pe * 3;
                    R[Be] = Oe.r, R[Be + 1] = Oe.g, R[Be + 2] = Oe.b, P[pe] = c[ne];
                  }
                } else if ($.length > 0)
                  for (let pe = 0, le = F.length; pe < le; pe++) {
                    let ne = F[pe].atomid, Te = pe * 3;
                    R[Te] = $[ne].r, R[Te + 1] = $[ne].g, R[Te + 2] = $[ne].b, P[pe] = c[ne];
                  }
                var W = _.faces;
                k.faceidx = W.length, w.initTypedArrays();
                var V = k.vertexArray, G = k.normalArray, H, Q, te, ee;
                for (let pe = 0, le = W.length; pe < le; pe += 3) {
                  var ce = W[pe], fe = W[pe + 1], oe = W[pe + 2], he = ce * 3, Ae = fe * 3, Se = oe * 3;
                  H = new a.Vector3(V[he], V[he + 1], V[he + 2]), Q = new a.Vector3(V[Ae], V[Ae + 1], V[Ae + 2]), te = new a.Vector3(V[Se], V[Se + 1], V[Se + 2]), te.subVectors(te, Q), H.subVectors(H, Q), te.cross(H), ee = te, ee.normalize(), G[he] += ee.x, G[Ae] += ee.x, G[Se] += ee.x, G[he + 1] += ee.y, G[Ae + 1] += ee.y, G[Se + 1] += ee.y, G[he + 2] += ee.z, G[Ae + 2] += ee.z, G[Se + 2] += ee.z;
                }
                k.faceArray = new Uint16Array(W);
                var Ie = new r.Mesh(w, E);
                return Ie;
              }
              // do same thing as worker in main thread
              /**
               *
               * @param {SurfaceType}
               *            type
               * @param {Array}
               *            expandedExtent
               * @param {AtomSpec[]}
               *            extendedAtoms
               * @param {AtomSpec[]}
               *            atomsToShow
               * @param {AtomSpec[]} atoms
               * @param {number}
               *            vol
               * @return {Object}
               */
              static generateMeshSyncHelper(c, _, E, w, k, $) {
                var L = new A.ProteinSurface();
                return L.initparm(_, c !== 1, $), L.fillvoxels(k, E), L.buildboundary(), (c == A.SurfaceType.SES || c == A.SurfaceType.MS) && (L.fastdistancemap(), L.boundingatom(!1), L.fillvoxelswaals(k, E)), L.marchingcube(c), L.getFacesAndVertices(w);
              }
              /*
               *
               * @param {SurfaceStyleSpec}
               *            style
               * @return {MeshLambertMaterial}
               */
              static getMatWithStyle(c) {
                let _ = null;
                c.onesided ? _ = new r.MeshLambertMaterial() : _ = new r.MeshDoubleLambertMaterial(), _.vertexColors = r.Coloring.VertexColors;
                for (var E in c)
                  E === "color" || E === "map" || c.hasOwnProperty(E) && (_[E] = c[E]);
                return c.opacity !== void 0 && (c.opacity === 1 ? _.transparent = !1 : _.transparent = !0), _;
              }
              /**
               * Adds an explicit mesh as a surface object.
               * @param {Mesh}
               *            mesh
               * @param {Object}
               *            style
               * @returns {number} surfid
               */
              addMesh(c) {
                var _ = {
                  geo: c.geometry,
                  mat: c.material,
                  done: !0,
                  finished: !1
                  //the rendered finishes surfaces when they are done
                }, E = this.nextSurfID();
                return this.surfaces[E] = [_], E;
              }
              //return a shallow copy of list l, e.g., for atoms so we can
              //ignore superficial changes (ie surfacecolor, position) that happen
              //while we're surface building
              static shallowCopy(c) {
                var _ = [];
                let E = c.length;
                for (let w = 0; w < E; w++)
                  _[w] = (0, h.extend)({}, c[w]);
                return _;
              }
              /**
               * Add surface representation to atoms
               * @param {SurfaceType|string} type - Surface type (VDW, MS, SAS, or SES)
               * @param {SurfaceStyleSpec} style - optional style specification for surface material (e.g. for different coloring scheme, etc)
               * @param {AtomSelectionSpec} atomsel - Show surface for atoms in this selection
               * @param {AtomSelectionSpec} allsel - Use atoms in this selection to calculate surface; may be larger group than 'atomsel'
               * @param {AtomSelectionSpec} focus - Optionally begin rendering surface specified atoms
               * @param {function} surfacecallback - function to be called after setting the surface
               * @return {Promise} promise - Returns a promise that ultimately resovles to the surfid.  Returns surfid immediately if surfacecallback is specified.  Returned promise has a [surfid, GLViewer, style, atomsel, allsel, focus] fields for immediate access.
               */
              addSurface(c, _ = {}, E = {}, w, k, $) {
                let L = this.nextSurfID(), z = null, F = this, R = A.SurfaceType.VDW;
                typeof c == "string" ? l.surfaceTypeMap[c.toUpperCase()] !== void 0 ? R = l.surfaceTypeMap[c] : console.log("Surface type : " + c + " is not recognized") : typeof c == "number" && (R = c);
                var P = null, U = null, N = l.shallowCopy(this.getAtomsFromSel(E));
                w ? P = l.shallowCopy(this.getAtomsFromSel(w)) : P = N, (0, h.adjustVolumeStyle)(_);
                var B = !1, W;
                for (W = 0; W < this.models.length; W++)
                  if (this.models[W]) {
                    var V = this.models[W].getSymmetries();
                    if (V.length > 1 || V.length == 1 && !V[0].isIdentity()) {
                      B = !0;
                      break;
                    }
                  }
                var G = function(oe, he, Ae) {
                  k ? U = l.shallowCopy(F.getAtomsFromSel(k)) : U = Ae;
                  var Se, Ie = (0, h.getExtent)(Ae, !0);
                  if (_.map && _.map.prop) {
                    var pe = _.map.prop;
                    let De = (0, o.getGradient)(_.map.scheme || _.map.gradient || new o.Gradient.RWB()), je = De.range();
                    je || (je = (0, h.getPropertyRange)(Ae, pe)), _.colorscheme = { prop: pe, gradient: De };
                  }
                  for (let De = 0, je = he.length; De < je; De++)
                    Se = he[De], Se.surfaceColor = (0, h.getColorFromStyle)(Se, _);
                  var le = l.volume(Ie), ne = F.carveUpExtent(Ie, he, Ae);
                  if (U && U.length && U.length > 0) {
                    var Te = (0, h.getExtent)(U, !0), Oe = function(De, je) {
                      var Xe = function(re, ye) {
                        var me = re.extent, ze = me[1][0] - me[0][0], ke = me[1][1] - me[0][1], K = me[1][2] - me[0][2], ae = ze - ye[2][0];
                        ae *= ae;
                        var ge = ke - ye[2][1];
                        ge *= ge;
                        var xe = K - ye[2][2];
                        return xe *= xe, ae + ge + xe;
                      }, X = Xe(De, Te), q = Xe(je, Te);
                      return X - q;
                    };
                    ne.sort(Oe);
                  }
                  var Be = [];
                  for (let De = 0, je = he.length; De < je; De++)
                    Se = he[De], Be[De] = {
                      x: Se.x,
                      y: Se.y,
                      z: Se.z,
                      serial: De,
                      elem: Se.elem
                    };
                  var Ue = !!A.syncSurface;
                  if (Ue) {
                    var Pe = function(je) {
                      return new Promise(function(Xe) {
                        for (var X = l.generateMeshSyncHelper(R, ne[je].extent, ne[je].atoms, ne[je].toshow, Be, le), q = (0, f.splitMesh)({ vertexArr: X.vertices, faceArr: X.faces }), re = 0, ye = q.length; re < ye; re++) {
                          X = {
                            vertices: q[re].vertexArr,
                            faces: q[re].faceArr
                          };
                          var me = l.generateSurfaceMesh(he, X, z);
                          (0, h.mergeGeos)(oe.geo, me);
                        }
                        F.render(), Xe();
                      });
                    }, Ge = [];
                    for (let De = 0; De < ne.length; De++)
                      Ge.push(Pe(De));
                    return Promise.all(Ge).then(function() {
                      return oe.done = !0, Promise.resolve(L);
                    });
                  } else {
                    var Ne = [];
                    R < 0 && (R = 0);
                    for (let De = 0, je = l.numWorkers; De < je; De++) {
                      var Re = new Worker($3Dmol.SurfaceWorker);
                      Ne.push(Re), Re.postMessage({
                        type: -1,
                        atoms: Be,
                        volume: le
                      });
                    }
                    return new Promise(function(De, je) {
                      var Xe = 0, X = function() {
                        !Ne || !Ne.length || Ne.forEach(function(me) {
                          me && me.terminate && me.terminate();
                        });
                      }, q = function(me) {
                        for (var ze = (0, f.splitMesh)({
                          vertexArr: me.data.vertices,
                          faceArr: me.data.faces
                        }), ke = 0, K = ze.length; ke < K; ke++) {
                          var ae = {
                            vertices: ze[ke].vertexArr,
                            faces: ze[ke].faceArr
                          }, ge = l.generateSurfaceMesh(he, ae, z);
                          (0, h.mergeGeos)(oe.geo, ge);
                        }
                        F.render(), Xe++, Xe == ne.length && (oe.done = !0, X(), De(L));
                      }, re = function(me) {
                        X(), console.log(me.message + " (" + me.filename + ":" + me.lineno + ")"), je(me);
                      };
                      for (let me = 0; me < ne.length; me++) {
                        var ye = Ne[me % Ne.length];
                        ye.onmessage = q, ye.onerror = re, ye.postMessage({
                          type: R,
                          expandedExtent: ne[me].extent,
                          extendedAtoms: ne[me].atoms,
                          atomsToShow: ne[me].toshow
                        });
                      }
                    });
                  }
                };
                _ = _ || {}, z = l.getMatWithStyle(_);
                var H = [];
                H.style = _, H.atomsel = E, H.allsel = w, H.focus = k;
                var Q = null;
                if (B) {
                  var te = {}, ee = {};
                  for (W = 0; W < this.models.length; W++)
                    te[W] = [], ee[W] = [];
                  for (W = 0; W < P.length; W++)
                    te[P[W].model].push(P[W]);
                  for (W = 0; W < N.length; W++)
                    ee[N[W].model].push(N[W]);
                  var ce = [];
                  for (W = 0; W < this.models.length; W++)
                    ee[W].length > 0 && (H.push({
                      geo: new r.Geometry(!0),
                      mat: z,
                      done: !1,
                      finished: !1,
                      symmetries: this.models[W].getSymmetries()
                      // also webgl initialized
                    }), ce.push(G(H[H.length - 1], te[W], ee[W])));
                  Q = Promise.all(ce);
                } else
                  H.push({
                    geo: new r.Geometry(!0),
                    mat: z,
                    done: !1,
                    finished: !1,
                    symmetries: [new a.Matrix4()]
                  }), Q = G(H[H.length - 1], P, N);
                return this.surfaces[L] = H, Q.surfid = L, $ && typeof $ == "function" ? (Q.then(function(fe) {
                  $(fe);
                }), L) : Q;
              }
              /**
               * Set the surface material to something else, must render change
               * @param {number} surf - Surface ID to apply changes to
               * @param {SurfaceStyleSpec} style - new material style specification
               @example
               $3Dmol.get("data/9002806.cif",function(data){
                  viewer.addModel(data);
                  viewer.setStyle({stick:{}});
                  let surf = viewer.addSurface("SAS");
                  surf.then(function() {
                      viewer.setSurfaceMaterialStyle(surf.surfid, {color:'blue',opacity:0.5});
                      viewer.render();
                      });
                 });
               */
              setSurfaceMaterialStyle(c, _) {
                if ((0, h.adjustVolumeStyle)(_), this.surfaces[c]) {
                  var E = this.surfaces[c];
                  for (let k = 0; k < E.length; k++) {
                    var w = E[k].mat = l.getMatWithStyle(_);
                    if (E[k].mat.side = r.FrontSide, _.color) {
                      E[k].mat.color = s.CC.color(_.color), E[k].geo.colorsNeedUpdate = !0;
                      const $ = s.CC.color(_.color);
                      E[k].geo.setColor($);
                    } else if (w.voldata && w.volscheme) {
                      const $ = w.volscheme, L = w.voldata, z = s.CC, F = $.range() || [-1, 1];
                      E[k].geo.setColors(function(R, P, U) {
                        let N = L.getVal(R, P, U);
                        return z.color($.valueToHex(N, F));
                      });
                    } else {
                      E[k].geo.colorsNeedUpdate = !0;
                      for (let $ of E[k].geo.geometryGroups)
                        for (let L = 0; L < $.vertices; L++) {
                          let z = (0, h.getColorFromStyle)($.atomArray[L], _), F = 3 * L;
                          $.colorArray[F] = z.r, $.colorArray[F + 1] = z.g, $.colorArray[F + 2] = z.b;
                        }
                    }
                    E[k].finished = !1;
                  }
                }
                return this;
              }
              /**
               * Return surface object
               * @param {number} surf - surface id
               */
              getSurface(c) {
                return this.surfaces[c];
              }
              /**
               * Remove surface with given ID
               * @param {number} surf - surface id
               */
              removeSurface(c) {
                for (var _ = this.surfaces[c], E = 0; E < _.length; E++)
                  _[E] && _[E].lastGL && (_[E].geo !== void 0 && _[E].geo.dispose(), _[E].mat !== void 0 && _[E].mat.dispose(), this.modelGroup.remove(_[E].lastGL));
                return delete this.surfaces[c], this.show(), this;
              }
              /** Remove all surfaces.
               **/
              removeAllSurfaces() {
                for (var c in this.surfaces)
                  if (this.surfaces.hasOwnProperty(c)) {
                    for (var _ = this.surfaces[c], E = 0; E < _.length; E++)
                      _[E] && _[E].lastGL && (_[E].geo !== void 0 && _[E].geo.dispose(), _[E].mat !== void 0 && _[E].mat.dispose(), this.modelGroup.remove(_[E].lastGL));
                    delete this.surfaces[c];
                  }
                return this.show(), this;
              }
              /** return Jmol moveto command to position this scene */
              jmolMoveTo() {
                var c = this.modelGroup.position, _ = "center { " + -c.x + " " + -c.y + " " + -c.z + " }; ", E = this.rotationGroup.quaternion;
                return _ += "moveto .5 quaternion { " + E.x + " " + E.y + " " + E.z + " " + E.w + " };", _;
              }
              /** Clear scene of all objects
               * */
              clear() {
                return this.removeAllSurfaces(), this.removeAllModels(), this.removeAllLabels(), this.removeAllShapes(), this.show(), this;
              }
              // props is a list of objects that select certain atoms and enumerate
              // properties for those atoms
              /**
               * Add specified properties to all atoms matching input argument
               * @param {Object} props, either array of atom selectors with associated props, or function that takes atom and sets its properties
               * @param {AtomSelectionSpec} sel  - subset of atoms to work on - model selection must be specified here
                   @example
                   $3Dmol.get('../test_structs/b.sdf', function(data){
                            viewer.addModel(data,'sdf');
                            let props = [];
                            //make the atom index a property x
                            for(let i = 0; i < 8; i++) {
                              props.push({index:i,props:{'x':i}});
                            }
                            viewer.mapAtomProperties(props);
                            viewer.setStyle({sphere:{colorscheme:{gradient:'roygb',prop:'x',min:0,max:8}}});
                            viewer.zoomTo();
                            viewer.render();
                          });
               */
              mapAtomProperties(c, _) {
                _ = _ || {};
                var E = this.getAtomsFromSel(_);
                if (typeof c == "function")
                  for (let $ = 0, L = E.length; $ < L; $++) {
                    let z = E[$];
                    c(z);
                  }
                else
                  for (let $ = 0, L = E.length; $ < L; $++) {
                    var w = E[$];
                    for (let z = 0, F = c.length; z < F; z++) {
                      let R = c[z];
                      if (R.props)
                        for (var k in R.props)
                          R.props.hasOwnProperty(k) && this.atomIsSelected(w, R) && (w.properties || (w.properties = {}), w.properties[k] = R.props[k]);
                    }
                  }
                return this;
              }
              /**
               * Synchronize this view matrix of this viewer to the passed viewer.
               * When the viewpoint of this viewer changes, the other viewer will
               * be set to this viewer's view.
               * @param {GLViewer} otherview
               */
              linkViewer(c) {
                return this.linkedViewers.push(c), this;
              }
              /**
               * Return the z distance between the model and the camera
               * @return {number} distance
               */
              getPerceivedDistance() {
                return this.CAMERA_Z - this.rotationGroup.position.z;
              }
              /**
               * Set the distance between the model and the camera
               * Essentially zooming. Useful while stereo rendering.
               */
              setPerceivedDistance(c) {
                this.rotationGroup.position.z = this.CAMERA_Z - c;
              }
              /**
               * Used for setting an approx value of eyeSeparation. Created for calling by StereoViewer object
               * @return {number} camera x position
               */
              setAutoEyeSeparation(c, _) {
                var E = this.getPerceivedDistance();
                return _ || (_ = 5), c || this.camera.position.x > 0 ? this.camera.position.x = E * Math.tan(Math.PI / 180 * _) : this.camera.position.x = -E * Math.tan(Math.PI / 180 * _), this.camera.lookAt(new a.Vector3(0, 0, this.rotationGroup.position.z)), this.camera.position.x;
              }
              /**
               * Set the default cartoon quality for newly created models.  Default is 5.
               * Current models are not affected.
               * @number quality, higher results in higher resolution renders
               */
              setDefaultCartoonQuality(c) {
                this.config.cartoonQuality = c;
              }
            }
            l.numWorkers = 4, l.maxVolume = 64e3, l.surfaceTypeMap = {
              VDW: A.SurfaceType.VDW,
              MS: A.SurfaceType.MS,
              SAS: A.SurfaceType.SAS,
              SES: A.SurfaceType.SES
            };
            function u(b, c) {
              if (b = (0, h.getElement)(b), !!b) {
                c = c || {};
                try {
                  var _ = new l(b, c);
                  return _;
                } catch (E) {
                  throw "error creating viewer: " + E;
                }
              }
            }
            function p(b, c = {}, _ = {}) {
              if (b = (0, h.getElement)(b), !!b) {
                var E = [], w = document.createElement("canvas");
                _.rows = c.rows, _.cols = c.cols, _.control_all = c.control_all != null ? c.control_all : !1, b.appendChild(w);
                try {
                  for (var k = 0; k < c.rows; k++) {
                    for (var $ = [], L = 0; L < c.cols; L++) {
                      _.row = k, _.col = L, _.canvas = w, _.viewers = E, _.control_all = c.control_all;
                      var z = u(b, (0, h.extend)({}, _));
                      $.push(z);
                    }
                    E.unshift($);
                  }
                } catch (F) {
                  throw "error creating viewer grid: " + F;
                }
                return E;
              }
            }
            function g(b) {
              var c = this;
              if (b = (0, h.getElement)(b), !!b) {
                var _ = p(b, { rows: 1, cols: 2, control_all: !0 });
                this.glviewer1 = _[0][0], this.glviewer2 = _[0][1], this.glviewer1.setAutoEyeSeparation(!1), this.glviewer2.setAutoEyeSeparation(!0), this.glviewer1.linkViewer(this.glviewer2), this.glviewer2.linkViewer(this.glviewer1);
                for (var E = Object.getOwnPropertyNames(this.glviewer1.__proto__).filter(function(k) {
                  return typeof c.glviewer1[k] == "function";
                }), w = 0; w < E.length; w++)
                  this[E[w]] = /* @__PURE__ */ function(k) {
                    return function() {
                      var $ = this.glviewer1[k].apply(this.glviewer1, arguments), L = this.glviewer2[k].apply(this.glviewer2, arguments);
                      return [$, L];
                    };
                  }(E[w]);
                this.setCoordinates = function(k, $, L) {
                  for (var z = 0; z < k.length; z++)
                    k[z].setCoordinates($, L);
                }, this.surfacesFinished = function() {
                  return this.glviewer1.surfacesFinished() && this.glviewer2.surfacesFinished();
                }, this.isAnimated = function() {
                  return this.glviewer1.isAnimated() || this.glviewer2.isAnimated();
                }, this.render = function(k) {
                  this.glviewer1.render(), this.glviewer2.render(), k && k(this);
                }, this.getCanvas = function() {
                  return this.glviewer1.getCanvas();
                };
              }
            }
          }
        ),
        /***/
        "./src/Gradient.ts": (
          /*!*************************!*\
            !*** ./src/Gradient.ts ***!
            \*************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CustomLinear: () => (
                /* binding */
                f
              ),
              /* harmony export */
              Gradient: () => (
                /* binding */
                A
              ),
              /* harmony export */
              GradientType: () => (
                /* binding */
                a
              ),
              /* harmony export */
              ROYGB: () => (
                /* binding */
                d
              ),
              /* harmony export */
              RWB: () => (
                /* binding */
                o
              ),
              /* harmony export */
              Sinebow: () => (
                /* binding */
                v
              ),
              /* harmony export */
              builtinGradients: () => (
                /* binding */
                y
              ),
              /* harmony export */
              getGradient: () => (
                /* binding */
                h
              ),
              /* harmony export */
              normalizeValue: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./colors */
              "./src/colors.ts"
            );
            class a {
            }
            function s(x, M, m) {
              return M >= x ? (m < x && (m = x), m > M && (m = M), { lo: x, hi: M, val: m }) : (m > x && (m = x), m < M && (m = M), m = x - m + M, { lo: M, hi: x, val: m });
            }
            function h(x) {
              if (x instanceof a)
                return x;
              if (x.gradient !== void 0 && y[x.gradient]) {
                let M = x.min === void 0 ? -1 : x.min, m = x.max === void 0 ? 1 : x.max;
                return x.mid === void 0 ? x.colors === void 0 ? new y[x.gradient](M, m) : new y[x.gradient](M, m, x.colors) : new y[x.gradient](M, m, x.mid);
              } else if (typeof x.gradient == "string" && x.gradient.startsWith("linear_")) {
                let M = x.gradient.split("_");
                M.shift();
                let m = x.min === void 0 ? -1 : x.min, l = x.max === void 0 ? 1 : x.max;
                return new f(m, l, M);
              }
              return x;
            }
            class o extends a {
              constructor(M, m, l) {
                super(), this.gradient = "RWB", this.mult = 1, this.mid = l, this.min = M, this.max = m, typeof m > "u" && Array.isArray(M) && M.length >= 2 ? (this.max = M[1], this.min = M[0]) : M && m && !Array.isArray(M) && (this.min = M, this.max = m);
              }
              //return range used for color mapping, null if none set
              range() {
                return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null;
              }
              //map value to hex color, range is provided
              valueToHex(M, m) {
                var l, u;
                if (M = this.mult * M, m ? (l = m[0], u = m[1]) : (l = this.min, u = this.max), M === void 0)
                  return 16777215;
                var p = s(l, u, M);
                l = p.lo, u = p.hi, M = p.val;
                var g = (u + l) / 2;
                m && typeof m[2] < "u" ? g = m[2] : typeof this.mid < "u" ? g = this.mid : g = (l + u) / 2;
                var b, c;
                return M < g ? (b = Math.floor(255 * Math.sqrt((M - l) / (g - l))), c = 16711680 + 256 * b + b, c) : M > g ? (b = Math.floor(255 * Math.sqrt(1 - (M - g) / (u - g))), c = 65536 * b + 256 * b + 255, c) : 16777215;
              }
            }
            class d extends a {
              constructor(M, m) {
                super(), this.gradient = "ROYGB", this.mult = 1, this.min = M, this.max = m, typeof m > "u" && Array.isArray(M) && M.length >= 2 ? (this.max = M[1], this.min = M[0]) : M && m && !Array.isArray(M) && (this.min = M, this.max = m);
              }
              //map value to hex color, range is provided
              valueToHex(M, m) {
                var l, u;
                if (M = this.mult * M, m ? (l = m[0], u = m[1]) : (l = this.min, u = this.max), typeof M > "u")
                  return 16777215;
                var p = s(l, u, M);
                l = p.lo, u = p.hi, M = p.val;
                var g = (l + u) / 2, b = (l + g) / 2, c = (g + u) / 2, _, E;
                return M < b ? (_ = Math.floor(255 * Math.sqrt((M - l) / (b - l))), E = 16711680 + 256 * _ + 0, E) : M < g ? (_ = Math.floor(255 * Math.sqrt(1 - (M - b) / (g - b))), E = 65536 * _ + 65280 + 0, E) : M < c ? (_ = Math.floor(255 * Math.sqrt((M - g) / (c - g))), E = 65280 + 1 * _, E) : (_ = Math.floor(255 * Math.sqrt(1 - (M - c) / (u - c))), E = 0 + 256 * _ + 255, E);
              }
              //return range used for color mapping, null if none set
              range() {
                return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null;
              }
            }
            class v extends a {
              constructor(M, m) {
                super(), this.gradient = "Sinebow", this.mult = 1, this.min = M, this.max = m, typeof m > "u" && Array.isArray(M) && M.length >= 2 && (this.max = M[1], this.min = M[0]), m < M && (this.mult = -1, this.min *= -1, this.max *= -1);
              }
              //map value to hex color, range is provided
              valueToHex(M, m) {
                var l, u;
                if (M = this.mult * M, m ? (l = m[0], u = m[1]) : (l = this.min, u = this.max), typeof M > "u")
                  return 16777215;
                var p = A.normalizeValue(l, u, M);
                l = p.lo, u = p.hi, M = p.val;
                var g = (M - l) / (u - l), b = 5 * g / 6 + 0.5, c = Math.sin(Math.PI * b);
                c *= c * 255;
                var _ = Math.sin(Math.PI * (b + 1 / 3));
                _ *= _ * 255;
                var E = Math.sin(Math.PI * (b + 2 / 3));
                return E *= E * 255, 65536 * Math.floor(c) + 256 * Math.floor(E) + 1 * Math.floor(_);
              }
              //return range used for color mapping, null if none set
              range() {
                return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null;
              }
            }
            class f extends a {
              constructor(M, m, l) {
                super(), this.gradient = "linear", this.colors = new Array();
                var u;
                if (Array.isArray(M) && M.length >= 2 ? (this.max = M[1], this.min = M[0], u = m) : (this.min = M, this.max = m, u = l), u)
                  for (let p of u)
                    this.colors.push(r.CC.color(p));
                else
                  this.colors.push(r.CC.color(0));
              }
              //return range used for color mapping, null if none set
              range() {
                return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null;
              }
              //map value to hex color, range is provided
              valueToHex(M, m) {
                var l, u;
                if (m ? (l = m[0], u = m[1]) : (l = this.min, u = this.max), M === void 0)
                  return 16777215;
                var p = s(l, u, M);
                l = p.lo, u = p.hi, M = p.val;
                let g = this.colors.length, b = (u - l) / g, c = Math.min(Math.floor((M - l) / b), g - 1), _ = Math.min(c + 1, g - 1), E = (M - l - c * b) / b, w = this.colors[c], k = this.colors[_];
                return new r.Color(w.r + E * (k.r - w.r), w.g + E * (k.g - w.g), w.b + E * (k.b - w.b)).getHex();
              }
            }
            const y = {
              rwb: o,
              RWB: o,
              roygb: d,
              ROYGB: d,
              sinebow: v,
              linear: f
            };
            class A extends a {
              valueToHex(M, m) {
                return 0;
              }
              range() {
                return null;
              }
            }
            A.RWB = o, A.ROYGB = d, A.Sinebow = v, A.CustomLinear = f, A.builtinGradients = y, A.normalizeValue = s, A.getGradient = h;
          }
        ),
        /***/
        "./src/Label.ts": (
          /*!**********************!*\
            !*** ./src/Label.ts ***!
            \**********************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Label: () => (
                /* binding */
                v
              ),
              /* harmony export */
              LabelCount: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), s = t(
              /*! ./colors */
              "./src/colors.ts"
            );
            let h = 0;
            function o(f, y, A, x, M, m, l) {
              f.beginPath(), f.moveTo(y + m, A), f.lineTo(y + x - m, A), f.quadraticCurveTo(y + x, A, y + x, A + m), f.lineTo(y + x, A + M - m), f.quadraticCurveTo(y + x, A + M, y + x - m, A + M), f.lineTo(y + m, A + M), f.quadraticCurveTo(y, A + M, y, A + M - m), f.lineTo(y, A + m), f.quadraticCurveTo(y, A, y + m, A), f.closePath(), f.fill(), l && f.stroke();
            }
            function d(f, y, A) {
              var x = A;
              return typeof f < "u" && (f instanceof s.Color ? x = f.scaled() : (x = s.CC.color(f), typeof x.scaled < "u" && (x = x.scaled()))), typeof y < "u" && (x.a = parseFloat(y)), x;
            }
            class v {
              constructor(y, A) {
                this.id = h++, this.stylespec = A || {}, this.canvas = document.createElement("canvas"), this.canvas.width = 134, this.canvas.height = 35, this.context = this.canvas.getContext("2d"), this.sprite = new r.Sprite(), this.text = y, this.frame = this.stylespec.frame;
              }
              getStyle() {
                return this.stylespec;
              }
              /** Hide this label. */
              hide() {
                this.sprite.visible = !1;
              }
              /** Show a hidden label. */
              show() {
                this.sprite.visible = !0;
              }
              setContext() {
                var y = this.stylespec, A = typeof y.useScreen > "u" ? !1 : y.useScreen, x = y.showBackground;
                (x === "0" || x === "false") && (x = !1), typeof x > "u" && (x = !0);
                var M = y.font ? y.font : "sans-serif", m = parseInt(y.fontSize) ? parseInt(y.fontSize) : 18, l = d(y.fontColor, y.fontOpacity, {
                  r: 255,
                  g: 255,
                  b: 255,
                  a: 1
                }), u = y.padding ? y.padding : 4, p = y.borderThickness ? y.borderThickness : 0, g = d(y.backgroundColor, y.backgroundOpacity, {
                  r: 0,
                  g: 0,
                  b: 0,
                  a: 1
                }), b = d(y.borderColor, y.borderOpacity, g), c = y.position ? y.position : {
                  x: -10,
                  y: 1,
                  z: 1
                }, _ = y.inFront !== void 0 ? y.inFront : !0;
                (_ === "false" || _ === "0") && (_ = !1);
                var E = y.alignment || r.SpriteAlignment.topLeft;
                typeof E == "string" && E in r.SpriteAlignment && (E = r.SpriteAlignment[E]);
                var w = "";
                y.bold && (w = "bold "), this.context.font = w + m + "px  " + M;
                var k = this.context.measureText(this.text), $ = k.width;
                x || (p = 0);
                var L = $ + 2.5 * p + 2 * u, z = m * 1.25 + 2 * p + 2 * u;
                if (y.backgroundImage) {
                  var F = y.backgroundImage, R = y.backgroundWidth ? y.backgroundWidth : F.width, P = y.backgroundHeight ? y.backgroundHeight : F.height;
                  R > L && (L = R), P > z && (z = P);
                }
                if (this.canvas.width = L, this.canvas.height = z, this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), w = "", y.bold && (w = "bold "), this.context.font = w + m + "px  " + M, this.context.fillStyle = "rgba(" + g.r + "," + g.g + "," + g.b + "," + g.a + ")", this.context.strokeStyle = "rgba(" + b.r + "," + b.g + "," + b.b + "," + b.a + ")", y.backgroundGradient) {
                  let N = this.context.createLinearGradient(0, z / 2, L, z / 2), B = a.Gradient.getGradient(y.backgroundGradient), W = B.range(), V = -1, G = 1;
                  W && (V = W[0], G = W[1]);
                  let H = G - V;
                  for (let Q = 0; Q < 1.01; Q += 0.1) {
                    let te = d(B.valueToHex(V + H * Q)), ee = "rgba(" + te.r + "," + te.g + "," + te.b + "," + te.a + ")";
                    N.addColorStop(Q, ee);
                  }
                  this.context.fillStyle = N;
                }
                this.context.lineWidth = p, x && o(this.context, p, p, L - 2 * p, z - 2 * p, 6, p > 0), y.backgroundImage && this.context.drawImage(F, 0, 0, L, z), this.context.fillStyle = "rgba(" + l.r + "," + l.g + "," + l.b + "," + l.a + ")", this.context.fillText(this.text, p + u, m + p + u, $);
                var U = new r.Texture(this.canvas);
                U.needsUpdate = !0, this.sprite.material = new r.SpriteMaterial({
                  map: U,
                  useScreenCoordinates: A,
                  alignment: E,
                  depthTest: !_,
                  screenOffset: y.screenOffset || null
                }), this.sprite.scale.set(1, 1, 1), this.sprite.position.set(c.x, c.y, c.z);
              }
              // clean up material and texture
              dispose() {
                this.sprite.material.map !== void 0 && this.sprite.material.map.dispose(), this.sprite.material !== void 0 && this.sprite.material.dispose();
              }
            }
          }
        ),
        /***/
        "./src/ProteinSurface4.ts": (
          /*!********************************!*\
            !*** ./src/ProteinSurface4.ts ***!
            \********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MarchingCube: () => (
                /* binding */
                d
              ),
              /* harmony export */
              MarchingCubeInitializer: () => (
                /* binding */
                o
              ),
              /* harmony export */
              PointGrid: () => (
                /* binding */
                v
              ),
              /* harmony export */
              ProteinSurface: () => (
                /* binding */
                f
              ),
              /* harmony export */
              SurfaceType: () => (
                /* binding */
                a
              ),
              /* harmony export */
              setSyncSurface: () => (
                /* binding */
                h
              ),
              /* harmony export */
              syncSurface: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), a;
            (function(y) {
              y[y.VDW = 1] = "VDW", y[y.MS = 2] = "MS", y[y.SAS = 3] = "SAS", y[y.SES = 4] = "SES";
            })(a || (a = {}));
            var s = !1;
            function h(y) {
              s = y;
            }
            (window.navigator.userAgent.indexOf("MSIE ") >= 0 || window.navigator.userAgent.indexOf("Trident/") >= 0) && (s = !0);
            class o {
              constructor() {
                this.ISDONE = 2, this.edgeTable = new Uint32Array([
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  2816,
                  0,
                  0,
                  0,
                  1792,
                  0,
                  3328,
                  3584,
                  3840,
                  0,
                  0,
                  0,
                  138,
                  0,
                  21,
                  0,
                  134,
                  0,
                  0,
                  0,
                  652,
                  0,
                  2067,
                  3865,
                  3600,
                  0,
                  0,
                  0,
                  42,
                  0,
                  0,
                  0,
                  294,
                  0,
                  0,
                  21,
                  28,
                  0,
                  3875,
                  1049,
                  3360,
                  0,
                  168,
                  162,
                  170,
                  0,
                  645,
                  2475,
                  2210,
                  0,
                  687,
                  293,
                  172,
                  4010,
                  3747,
                  3497,
                  3232,
                  0,
                  0,
                  0,
                  0,
                  0,
                  69,
                  0,
                  900,
                  0,
                  0,
                  0,
                  1792,
                  138,
                  131,
                  1608,
                  1920,
                  0,
                  81,
                  0,
                  2074,
                  84,
                  85,
                  84,
                  86,
                  0,
                  81,
                  0,
                  3676,
                  330,
                  1105,
                  1881,
                  1616,
                  0,
                  0,
                  0,
                  42,
                  0,
                  69,
                  0,
                  502,
                  0,
                  0,
                  21,
                  3580,
                  138,
                  2035,
                  1273,
                  1520,
                  2816,
                  104,
                  2337,
                  106,
                  840,
                  581,
                  367,
                  102,
                  2816,
                  3695,
                  3429,
                  3180,
                  1898,
                  1635,
                  1385,
                  1120,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  0,
                  3910,
                  0,
                  0,
                  69,
                  588,
                  42,
                  2083,
                  41,
                  2880,
                  0,
                  0,
                  0,
                  1722,
                  0,
                  2293,
                  4095,
                  3830,
                  0,
                  255,
                  757,
                  764,
                  2538,
                  2291,
                  3065,
                  2800,
                  0,
                  0,
                  81,
                  338,
                  0,
                  3925,
                  1119,
                  3414,
                  84,
                  855,
                  85,
                  340,
                  2130,
                  2899,
                  89,
                  2384,
                  1792,
                  712,
                  194,
                  1162,
                  4036,
                  3781,
                  3535,
                  3270,
                  708,
                  719,
                  197,
                  204,
                  3018,
                  2755,
                  2505,
                  2240,
                  0,
                  0,
                  0,
                  0,
                  168,
                  420,
                  168,
                  1958,
                  162,
                  162,
                  676,
                  2988,
                  170,
                  163,
                  680,
                  928,
                  3328,
                  3096,
                  3328,
                  3642,
                  52,
                  53,
                  1855,
                  1590,
                  2340,
                  2111,
                  2869,
                  2620,
                  298,
                  51,
                  825,
                  560,
                  3584,
                  3584,
                  3090,
                  3482,
                  1668,
                  1941,
                  1183,
                  1430,
                  146,
                  2975,
                  2069,
                  2460,
                  154,
                  915,
                  153,
                  400,
                  3840,
                  3592,
                  3329,
                  3082,
                  1796,
                  1541,
                  1295,
                  1030,
                  2818,
                  2575,
                  2309,
                  2060,
                  778,
                  515,
                  265,
                  0
                ]), this.triTable = [
                  [],
                  [],
                  [],
                  [],
                  [],
                  [],
                  [],
                  [11, 9, 8],
                  [],
                  [],
                  [],
                  [8, 10, 9],
                  [],
                  [10, 8, 11],
                  [9, 11, 10],
                  [8, 10, 9, 8, 11, 10],
                  [],
                  [],
                  [],
                  [1, 7, 3],
                  [],
                  [4, 2, 0],
                  [],
                  [2, 1, 7],
                  [],
                  [],
                  [],
                  [2, 7, 3, 2, 9, 7],
                  [],
                  [1, 4, 11, 1, 0, 4],
                  [3, 8, 0, 11, 9, 4, 11, 10, 9],
                  [4, 11, 9, 11, 10, 9],
                  [],
                  [],
                  [],
                  [5, 3, 1],
                  [],
                  [],
                  [],
                  [2, 5, 8, 2, 1, 5],
                  [],
                  [],
                  [2, 4, 0],
                  [3, 2, 4],
                  [],
                  [0, 9, 1, 8, 10, 5, 8, 11, 10],
                  [3, 4, 0, 3, 10, 4],
                  [5, 8, 10, 8, 11, 10],
                  [],
                  [3, 5, 7],
                  [7, 1, 5],
                  [1, 7, 3, 1, 5, 7],
                  [],
                  [9, 2, 0, 9, 7, 2],
                  [0, 3, 8, 1, 7, 11, 1, 5, 7],
                  [11, 1, 7, 1, 5, 7],
                  [],
                  [9, 1, 0, 5, 3, 2, 5, 7, 3],
                  [8, 2, 5, 8, 0, 2],
                  [2, 5, 3, 5, 7, 3],
                  [3, 9, 1, 3, 8, 9, 7, 11, 10, 7, 10, 5],
                  [9, 1, 0, 10, 7, 11, 10, 5, 7],
                  [3, 8, 0, 7, 10, 5, 7, 11, 10],
                  [11, 5, 7, 11, 10, 5],
                  [],
                  [],
                  [],
                  [],
                  [],
                  [0, 6, 2],
                  [],
                  [7, 2, 9, 7, 9, 8],
                  [],
                  [],
                  [],
                  [8, 10, 9],
                  [7, 1, 3],
                  [7, 1, 0],
                  [6, 9, 3, 6, 10, 9],
                  [7, 10, 8, 10, 9, 8],
                  [],
                  [6, 0, 4],
                  [],
                  [11, 1, 4, 11, 3, 1],
                  [2, 4, 6],
                  [2, 0, 4, 2, 4, 6],
                  [2, 4, 6],
                  [1, 4, 2, 4, 6, 2],
                  [],
                  [6, 0, 4],
                  [],
                  [2, 11, 3, 6, 9, 4, 6, 10, 9],
                  [8, 6, 1, 8, 1, 3],
                  [10, 0, 6, 0, 4, 6],
                  [8, 0, 3, 9, 6, 10, 9, 4, 6],
                  [10, 4, 6, 10, 9, 4],
                  [],
                  [],
                  [],
                  [5, 3, 1],
                  [],
                  [0, 6, 2],
                  [],
                  [7, 4, 8, 5, 2, 1, 5, 6, 2],
                  [],
                  [],
                  [2, 4, 0],
                  [7, 4, 8, 2, 11, 3, 10, 5, 6],
                  [7, 1, 3],
                  [5, 6, 10, 0, 9, 1, 8, 7, 4],
                  [5, 6, 10, 7, 0, 3, 7, 4, 0],
                  [10, 5, 6, 4, 8, 7],
                  [9, 11, 8],
                  [3, 5, 6],
                  [0, 5, 11, 0, 11, 8],
                  [6, 3, 5, 3, 1, 5],
                  [3, 9, 6, 3, 8, 9],
                  [9, 6, 0, 6, 2, 0],
                  [0, 3, 8, 2, 5, 6, 2, 1, 5],
                  [1, 6, 2, 1, 5, 6],
                  [9, 11, 8],
                  [1, 0, 9, 6, 10, 5, 11, 3, 2],
                  [6, 10, 5, 2, 8, 0, 2, 11, 8],
                  [3, 2, 11, 10, 5, 6],
                  [10, 5, 6, 9, 3, 8, 9, 1, 3],
                  [0, 9, 1, 5, 6, 10],
                  [8, 0, 3, 10, 5, 6],
                  [10, 5, 6],
                  [],
                  [],
                  [],
                  [],
                  [],
                  [],
                  [],
                  [1, 10, 2, 9, 11, 6, 9, 8, 11],
                  [],
                  [],
                  [6, 0, 2],
                  [3, 6, 9, 3, 2, 6],
                  [3, 5, 1],
                  [0, 5, 1, 0, 11, 5],
                  [0, 3, 5],
                  [6, 9, 11, 9, 8, 11],
                  [],
                  [],
                  [],
                  [4, 5, 9, 7, 1, 10, 7, 3, 1],
                  [],
                  [11, 6, 7, 2, 4, 5, 2, 0, 4],
                  [11, 6, 7, 8, 0, 3, 1, 10, 2, 9, 4, 5],
                  [6, 7, 11, 1, 10, 2, 9, 4, 5],
                  [],
                  [4, 1, 0, 4, 5, 1, 6, 7, 3, 6, 3, 2],
                  [9, 4, 5, 0, 6, 7, 0, 2, 6],
                  [4, 5, 9, 6, 3, 2, 6, 7, 3],
                  [6, 7, 11, 5, 3, 8, 5, 1, 3],
                  [6, 7, 11, 4, 1, 0, 4, 5, 1],
                  [4, 5, 9, 3, 8, 0, 11, 6, 7],
                  [9, 4, 5, 7, 11, 6],
                  [],
                  [],
                  [0, 6, 4],
                  [8, 6, 4, 8, 1, 6],
                  [],
                  [0, 10, 2, 0, 9, 10, 4, 8, 11, 4, 11, 6],
                  [10, 2, 1, 6, 0, 3, 6, 4, 0],
                  [10, 2, 1, 11, 4, 8, 11, 6, 4],
                  [4, 2, 6],
                  [1, 0, 9, 2, 4, 8, 2, 6, 4],
                  [2, 4, 0, 2, 6, 4],
                  [8, 2, 4, 2, 6, 4],
                  [11, 4, 1, 11, 6, 4],
                  [0, 9, 1, 4, 11, 6, 4, 8, 11],
                  [3, 6, 0, 6, 4, 0],
                  [8, 6, 4, 8, 11, 6],
                  [10, 8, 9],
                  [6, 3, 9, 6, 7, 3],
                  [6, 7, 1],
                  [10, 7, 1, 7, 3, 1],
                  [7, 11, 6, 8, 10, 2, 8, 9, 10],
                  [11, 6, 7, 10, 0, 9, 10, 2, 0],
                  [2, 1, 10, 7, 11, 6, 8, 0, 3],
                  [1, 10, 2, 6, 7, 11],
                  [7, 2, 6, 7, 9, 2],
                  [1, 0, 9, 3, 6, 7, 3, 2, 6],
                  [7, 0, 6, 0, 2, 6],
                  [2, 7, 3, 2, 6, 7],
                  [7, 11, 6, 3, 9, 1, 3, 8, 9],
                  [9, 1, 0, 11, 6, 7],
                  [0, 3, 8, 11, 6, 7],
                  [11, 6, 7],
                  [],
                  [],
                  [],
                  [],
                  [5, 3, 7],
                  [8, 5, 2, 8, 7, 5],
                  [5, 3, 7],
                  [1, 10, 2, 5, 8, 7, 5, 9, 8],
                  [1, 7, 5],
                  [1, 7, 5],
                  [9, 2, 7, 9, 7, 5],
                  [11, 3, 2, 8, 5, 9, 8, 7, 5],
                  [1, 3, 7, 1, 7, 5],
                  [0, 7, 1, 7, 5, 1],
                  [9, 3, 5, 3, 7, 5],
                  [9, 7, 5, 9, 8, 7],
                  [8, 10, 11],
                  [3, 4, 10, 3, 10, 11],
                  [8, 10, 11],
                  [5, 9, 4, 1, 11, 3, 1, 10, 11],
                  [2, 4, 5],
                  [5, 2, 4, 2, 0, 4],
                  [0, 3, 8, 5, 9, 4, 10, 2, 1],
                  [2, 1, 10, 9, 4, 5],
                  [2, 8, 5, 2, 11, 8],
                  [3, 2, 11, 1, 4, 5, 1, 0, 4],
                  [9, 4, 5, 8, 2, 11, 8, 0, 2],
                  [11, 3, 2, 9, 4, 5],
                  [8, 5, 3, 5, 1, 3],
                  [5, 0, 4, 5, 1, 0],
                  [3, 8, 0, 4, 5, 9],
                  [9, 4, 5],
                  [11, 9, 10],
                  [11, 9, 10],
                  [1, 11, 4, 1, 10, 11],
                  [8, 7, 4, 11, 1, 10, 11, 3, 1],
                  [2, 7, 9, 2, 9, 10],
                  [4, 8, 7, 0, 10, 2, 0, 9, 10],
                  [2, 1, 10, 0, 7, 4, 0, 3, 7],
                  [10, 2, 1, 8, 7, 4],
                  [1, 7, 4],
                  [3, 2, 11, 4, 8, 7, 9, 1, 0],
                  [11, 4, 2, 4, 0, 2],
                  [2, 11, 3, 7, 4, 8],
                  [4, 1, 7, 1, 3, 7],
                  [1, 0, 9, 8, 7, 4],
                  [3, 4, 0, 3, 7, 4],
                  [8, 7, 4],
                  [8, 9, 10, 8, 10, 11],
                  [3, 9, 11, 9, 10, 11],
                  [0, 10, 8, 10, 11, 8],
                  [10, 3, 1, 10, 11, 3],
                  [2, 8, 10, 8, 9, 10],
                  [9, 2, 0, 9, 10, 2],
                  [8, 0, 3, 1, 10, 2],
                  [10, 2, 1],
                  [1, 11, 9, 11, 8, 9],
                  [11, 3, 2, 0, 9, 1],
                  [11, 0, 2, 11, 8, 0],
                  [11, 3, 2],
                  [8, 1, 3, 8, 9, 1],
                  [9, 1, 0],
                  [8, 0, 3],
                  []
                ], this.edgeTable2 = [
                  0,
                  265,
                  515,
                  778,
                  2060,
                  2309,
                  2575,
                  2822,
                  1030,
                  1295,
                  1541,
                  1804,
                  3082,
                  3331,
                  3593,
                  3840,
                  400,
                  153,
                  915,
                  666,
                  2460,
                  2197,
                  2975,
                  2710,
                  1430,
                  1183,
                  1941,
                  1692,
                  3482,
                  3219,
                  3993,
                  3728,
                  560,
                  825,
                  51,
                  314,
                  2620,
                  2869,
                  2111,
                  2358,
                  1590,
                  1855,
                  1077,
                  1340,
                  3642,
                  3891,
                  3129,
                  3376,
                  928,
                  681,
                  419,
                  170,
                  2988,
                  2725,
                  2479,
                  2214,
                  1958,
                  1711,
                  1445,
                  1196,
                  4010,
                  3747,
                  3497,
                  3232,
                  2240,
                  2505,
                  2755,
                  3018,
                  204,
                  453,
                  719,
                  966,
                  3270,
                  3535,
                  3781,
                  4044,
                  1226,
                  1475,
                  1737,
                  1984,
                  2384,
                  2137,
                  2899,
                  2650,
                  348,
                  85,
                  863,
                  598,
                  3414,
                  3167,
                  3925,
                  3676,
                  1370,
                  1107,
                  1881,
                  1616,
                  2800,
                  3065,
                  2291,
                  2554,
                  764,
                  1013,
                  255,
                  502,
                  3830,
                  4095,
                  3317,
                  3580,
                  1786,
                  2035,
                  1273,
                  1520,
                  2912,
                  2665,
                  2403,
                  2154,
                  876,
                  613,
                  367,
                  102,
                  3942,
                  3695,
                  3429,
                  3180,
                  1898,
                  1635,
                  1385,
                  1120,
                  1120,
                  1385,
                  1635,
                  1898,
                  3180,
                  3429,
                  3695,
                  3942,
                  102,
                  367,
                  613,
                  876,
                  2154,
                  2403,
                  2665,
                  2912,
                  1520,
                  1273,
                  2035,
                  1786,
                  3580,
                  3317,
                  4095,
                  3830,
                  502,
                  255,
                  1013,
                  764,
                  2554,
                  2291,
                  3065,
                  2800,
                  1616,
                  1881,
                  1107,
                  1370,
                  3676,
                  3925,
                  3167,
                  3414,
                  598,
                  863,
                  85,
                  348,
                  2650,
                  2899,
                  2137,
                  2384,
                  1984,
                  1737,
                  1475,
                  1226,
                  4044,
                  3781,
                  3535,
                  3270,
                  966,
                  719,
                  453,
                  204,
                  3018,
                  2755,
                  2505,
                  2240,
                  3232,
                  3497,
                  3747,
                  4010,
                  1196,
                  1445,
                  1711,
                  1958,
                  2214,
                  2479,
                  2725,
                  2988,
                  170,
                  419,
                  681,
                  928,
                  3376,
                  3129,
                  3891,
                  3642,
                  1340,
                  1077,
                  1855,
                  1590,
                  2358,
                  2111,
                  2869,
                  2620,
                  314,
                  51,
                  825,
                  560,
                  3728,
                  3993,
                  3219,
                  3482,
                  1692,
                  1941,
                  1183,
                  1430,
                  2710,
                  2975,
                  2197,
                  2460,
                  666,
                  915,
                  153,
                  400,
                  3840,
                  3593,
                  3331,
                  3082,
                  1804,
                  1541,
                  1295,
                  1030,
                  2822,
                  2575,
                  2309,
                  2060,
                  778,
                  515,
                  265,
                  0
                ], this.triTable2 = [
                  [],
                  [8, 3, 0],
                  [9, 0, 1],
                  [8, 3, 1, 8, 1, 9],
                  [11, 2, 3],
                  [11, 2, 0, 11, 0, 8],
                  [11, 2, 3, 0, 1, 9],
                  [2, 1, 11, 1, 9, 11, 11, 9, 8],
                  [10, 1, 2],
                  [8, 3, 0, 1, 2, 10],
                  [9, 0, 2, 9, 2, 10],
                  [3, 2, 8, 2, 10, 8, 8, 10, 9],
                  [10, 1, 3, 10, 3, 11],
                  [1, 0, 10, 0, 8, 10, 10, 8, 11],
                  [0, 3, 9, 3, 11, 9, 9, 11, 10],
                  [8, 10, 9, 8, 11, 10],
                  [8, 4, 7],
                  [3, 0, 4, 3, 4, 7],
                  [1, 9, 0, 8, 4, 7],
                  [9, 4, 1, 4, 7, 1, 1, 7, 3],
                  [2, 3, 11, 7, 8, 4],
                  [7, 11, 4, 11, 2, 4, 4, 2, 0],
                  [3, 11, 2, 4, 7, 8, 9, 0, 1],
                  [2, 7, 11, 2, 1, 7, 1, 4, 7, 1, 9, 4],
                  [10, 1, 2, 8, 4, 7],
                  [2, 10, 1, 0, 4, 7, 0, 7, 3],
                  [4, 7, 8, 0, 2, 10, 0, 10, 9],
                  [2, 7, 3, 2, 9, 7, 7, 9, 4, 2, 10, 9],
                  [8, 4, 7, 11, 10, 1, 11, 1, 3],
                  [11, 4, 7, 1, 4, 11, 1, 11, 10, 1, 0, 4],
                  [3, 8, 0, 7, 11, 4, 11, 9, 4, 11, 10, 9],
                  [7, 11, 4, 4, 11, 9, 11, 10, 9],
                  [9, 5, 4],
                  [3, 0, 8, 4, 9, 5],
                  [5, 4, 0, 5, 0, 1],
                  [4, 8, 5, 8, 3, 5, 5, 3, 1],
                  [11, 2, 3, 9, 5, 4],
                  [9, 5, 4, 8, 11, 2, 8, 2, 0],
                  [3, 11, 2, 1, 5, 4, 1, 4, 0],
                  [8, 5, 4, 2, 5, 8, 2, 8, 11, 2, 1, 5],
                  [2, 10, 1, 9, 5, 4],
                  [0, 8, 3, 5, 4, 9, 10, 1, 2],
                  [10, 5, 2, 5, 4, 2, 2, 4, 0],
                  [3, 4, 8, 3, 2, 4, 2, 5, 4, 2, 10, 5],
                  [5, 4, 9, 1, 3, 11, 1, 11, 10],
                  [0, 9, 1, 4, 8, 5, 8, 10, 5, 8, 11, 10],
                  [3, 4, 0, 3, 10, 4, 4, 10, 5, 3, 11, 10],
                  [4, 8, 5, 5, 8, 10, 8, 11, 10],
                  [9, 5, 7, 9, 7, 8],
                  [0, 9, 3, 9, 5, 3, 3, 5, 7],
                  [8, 0, 7, 0, 1, 7, 7, 1, 5],
                  [1, 7, 3, 1, 5, 7],
                  [11, 2, 3, 8, 9, 5, 8, 5, 7],
                  [9, 2, 0, 9, 7, 2, 2, 7, 11, 9, 5, 7],
                  [0, 3, 8, 2, 1, 11, 1, 7, 11, 1, 5, 7],
                  [2, 1, 11, 11, 1, 7, 1, 5, 7],
                  [1, 2, 10, 5, 7, 8, 5, 8, 9],
                  [9, 1, 0, 10, 5, 2, 5, 3, 2, 5, 7, 3],
                  [5, 2, 10, 8, 2, 5, 8, 5, 7, 8, 0, 2],
                  [10, 5, 2, 2, 5, 3, 5, 7, 3],
                  [3, 9, 1, 3, 8, 9, 7, 11, 10, 7, 10, 5],
                  [9, 1, 0, 10, 7, 11, 10, 5, 7],
                  [3, 8, 0, 7, 10, 5, 7, 11, 10],
                  [11, 5, 7, 11, 10, 5],
                  [11, 7, 6],
                  [0, 8, 3, 11, 7, 6],
                  [9, 0, 1, 11, 7, 6],
                  [7, 6, 11, 3, 1, 9, 3, 9, 8],
                  [2, 3, 7, 2, 7, 6],
                  [8, 7, 0, 7, 6, 0, 0, 6, 2],
                  [1, 9, 0, 3, 7, 6, 3, 6, 2],
                  [7, 6, 2, 7, 2, 9, 2, 1, 9, 7, 9, 8],
                  [1, 2, 10, 6, 11, 7],
                  [2, 10, 1, 7, 6, 11, 8, 3, 0],
                  [11, 7, 6, 10, 9, 0, 10, 0, 2],
                  [7, 6, 11, 3, 2, 8, 8, 2, 10, 8, 10, 9],
                  [6, 10, 7, 10, 1, 7, 7, 1, 3],
                  [6, 10, 1, 6, 1, 7, 7, 1, 0, 7, 0, 8],
                  [9, 0, 3, 6, 9, 3, 6, 10, 9, 6, 3, 7],
                  [6, 10, 7, 7, 10, 8, 10, 9, 8],
                  [8, 4, 6, 8, 6, 11],
                  [11, 3, 6, 3, 0, 6, 6, 0, 4],
                  [0, 1, 9, 4, 6, 11, 4, 11, 8],
                  [1, 9, 4, 11, 1, 4, 11, 3, 1, 11, 4, 6],
                  [3, 8, 2, 8, 4, 2, 2, 4, 6],
                  [2, 0, 4, 2, 4, 6],
                  [1, 9, 0, 3, 8, 2, 2, 8, 4, 2, 4, 6],
                  [9, 4, 1, 1, 4, 2, 4, 6, 2],
                  [10, 1, 2, 11, 8, 4, 11, 4, 6],
                  [10, 1, 2, 11, 3, 6, 6, 3, 0, 6, 0, 4],
                  [0, 2, 10, 0, 10, 9, 4, 11, 8, 4, 6, 11],
                  [2, 11, 3, 6, 9, 4, 6, 10, 9],
                  [8, 4, 6, 8, 6, 1, 6, 10, 1, 8, 1, 3],
                  [1, 0, 10, 10, 0, 6, 0, 4, 6],
                  [8, 0, 3, 9, 6, 10, 9, 4, 6],
                  [10, 4, 6, 10, 9, 4],
                  [9, 5, 4, 7, 6, 11],
                  [4, 9, 5, 3, 0, 8, 11, 7, 6],
                  [6, 11, 7, 4, 0, 1, 4, 1, 5],
                  [6, 11, 7, 4, 8, 5, 5, 8, 3, 5, 3, 1],
                  [4, 9, 5, 6, 2, 3, 6, 3, 7],
                  [9, 5, 4, 8, 7, 0, 0, 7, 6, 0, 6, 2],
                  [4, 0, 1, 4, 1, 5, 6, 3, 7, 6, 2, 3],
                  [7, 4, 8, 5, 2, 1, 5, 6, 2],
                  [6, 11, 7, 1, 2, 10, 9, 5, 4],
                  [11, 7, 6, 8, 3, 0, 1, 2, 10, 9, 5, 4],
                  [11, 7, 6, 10, 5, 2, 2, 5, 4, 2, 4, 0],
                  [7, 4, 8, 2, 11, 3, 10, 5, 6],
                  [4, 9, 5, 6, 10, 7, 7, 10, 1, 7, 1, 3],
                  [5, 6, 10, 0, 9, 1, 8, 7, 4],
                  [5, 6, 10, 7, 0, 3, 7, 4, 0],
                  [10, 5, 6, 4, 8, 7],
                  [5, 6, 9, 6, 11, 9, 9, 11, 8],
                  [0, 9, 5, 0, 5, 3, 3, 5, 6, 3, 6, 11],
                  [0, 1, 5, 0, 5, 11, 5, 6, 11, 0, 11, 8],
                  [11, 3, 6, 6, 3, 5, 3, 1, 5],
                  [9, 5, 6, 3, 9, 6, 3, 8, 9, 3, 6, 2],
                  [5, 6, 9, 9, 6, 0, 6, 2, 0],
                  [0, 3, 8, 2, 5, 6, 2, 1, 5],
                  [1, 6, 2, 1, 5, 6],
                  [1, 2, 10, 5, 6, 9, 9, 6, 11, 9, 11, 8],
                  [1, 0, 9, 6, 10, 5, 11, 3, 2],
                  [6, 10, 5, 2, 8, 0, 2, 11, 8],
                  [3, 2, 11, 10, 5, 6],
                  [10, 5, 6, 9, 3, 8, 9, 1, 3],
                  [0, 9, 1, 5, 6, 10],
                  [8, 0, 3, 10, 5, 6],
                  [10, 5, 6],
                  [10, 6, 5],
                  [8, 3, 0, 10, 6, 5],
                  [0, 1, 9, 5, 10, 6],
                  [10, 6, 5, 9, 8, 3, 9, 3, 1],
                  [3, 11, 2, 10, 6, 5],
                  [6, 5, 10, 2, 0, 8, 2, 8, 11],
                  [1, 9, 0, 6, 5, 10, 11, 2, 3],
                  [1, 10, 2, 5, 9, 6, 9, 11, 6, 9, 8, 11],
                  [1, 2, 6, 1, 6, 5],
                  [0, 8, 3, 2, 6, 5, 2, 5, 1],
                  [5, 9, 6, 9, 0, 6, 6, 0, 2],
                  [9, 6, 5, 3, 6, 9, 3, 9, 8, 3, 2, 6],
                  [11, 6, 3, 6, 5, 3, 3, 5, 1],
                  [0, 5, 1, 0, 11, 5, 5, 11, 6, 0, 8, 11],
                  [0, 5, 9, 0, 3, 5, 3, 6, 5, 3, 11, 6],
                  [5, 9, 6, 6, 9, 11, 9, 8, 11],
                  [10, 6, 5, 4, 7, 8],
                  [5, 10, 6, 7, 3, 0, 7, 0, 4],
                  [5, 10, 6, 0, 1, 9, 8, 4, 7],
                  [4, 5, 9, 6, 7, 10, 7, 1, 10, 7, 3, 1],
                  [7, 8, 4, 2, 3, 11, 10, 6, 5],
                  [11, 6, 7, 10, 2, 5, 2, 4, 5, 2, 0, 4],
                  [11, 6, 7, 8, 0, 3, 1, 10, 2, 9, 4, 5],
                  [6, 7, 11, 1, 10, 2, 9, 4, 5],
                  [7, 8, 4, 5, 1, 2, 5, 2, 6],
                  [4, 1, 0, 4, 5, 1, 6, 7, 3, 6, 3, 2],
                  [9, 4, 5, 8, 0, 7, 0, 6, 7, 0, 2, 6],
                  [4, 5, 9, 6, 3, 2, 6, 7, 3],
                  [6, 7, 11, 4, 5, 8, 5, 3, 8, 5, 1, 3],
                  [6, 7, 11, 4, 1, 0, 4, 5, 1],
                  [4, 5, 9, 3, 8, 0, 11, 6, 7],
                  [9, 4, 5, 7, 11, 6],
                  [10, 6, 4, 10, 4, 9],
                  [8, 3, 0, 9, 10, 6, 9, 6, 4],
                  [1, 10, 0, 10, 6, 0, 0, 6, 4],
                  [8, 6, 4, 8, 1, 6, 6, 1, 10, 8, 3, 1],
                  [2, 3, 11, 6, 4, 9, 6, 9, 10],
                  [0, 10, 2, 0, 9, 10, 4, 8, 11, 4, 11, 6],
                  [10, 2, 1, 11, 6, 3, 6, 0, 3, 6, 4, 0],
                  [10, 2, 1, 11, 4, 8, 11, 6, 4],
                  [9, 1, 4, 1, 2, 4, 4, 2, 6],
                  [1, 0, 9, 3, 2, 8, 2, 4, 8, 2, 6, 4],
                  [2, 4, 0, 2, 6, 4],
                  [3, 2, 8, 8, 2, 4, 2, 6, 4],
                  [1, 4, 9, 11, 4, 1, 11, 1, 3, 11, 6, 4],
                  [0, 9, 1, 4, 11, 6, 4, 8, 11],
                  [11, 6, 3, 3, 6, 0, 6, 4, 0],
                  [8, 6, 4, 8, 11, 6],
                  [6, 7, 10, 7, 8, 10, 10, 8, 9],
                  [9, 3, 0, 6, 3, 9, 6, 9, 10, 6, 7, 3],
                  [6, 1, 10, 6, 7, 1, 7, 0, 1, 7, 8, 0],
                  [6, 7, 10, 10, 7, 1, 7, 3, 1],
                  [7, 11, 6, 3, 8, 2, 8, 10, 2, 8, 9, 10],
                  [11, 6, 7, 10, 0, 9, 10, 2, 0],
                  [2, 1, 10, 7, 11, 6, 8, 0, 3],
                  [1, 10, 2, 6, 7, 11],
                  [7, 2, 6, 7, 9, 2, 2, 9, 1, 7, 8, 9],
                  [1, 0, 9, 3, 6, 7, 3, 2, 6],
                  [8, 0, 7, 7, 0, 6, 0, 2, 6],
                  [2, 7, 3, 2, 6, 7],
                  [7, 11, 6, 3, 9, 1, 3, 8, 9],
                  [9, 1, 0, 11, 6, 7],
                  [0, 3, 8, 11, 6, 7],
                  [11, 6, 7],
                  [11, 7, 5, 11, 5, 10],
                  [3, 0, 8, 7, 5, 10, 7, 10, 11],
                  [9, 0, 1, 10, 11, 7, 10, 7, 5],
                  [3, 1, 9, 3, 9, 8, 7, 10, 11, 7, 5, 10],
                  [10, 2, 5, 2, 3, 5, 5, 3, 7],
                  [5, 10, 2, 8, 5, 2, 8, 7, 5, 8, 2, 0],
                  [9, 0, 1, 10, 2, 5, 5, 2, 3, 5, 3, 7],
                  [1, 10, 2, 5, 8, 7, 5, 9, 8],
                  [2, 11, 1, 11, 7, 1, 1, 7, 5],
                  [0, 8, 3, 2, 11, 1, 1, 11, 7, 1, 7, 5],
                  [9, 0, 2, 9, 2, 7, 2, 11, 7, 9, 7, 5],
                  [11, 3, 2, 8, 5, 9, 8, 7, 5],
                  [1, 3, 7, 1, 7, 5],
                  [8, 7, 0, 0, 7, 1, 7, 5, 1],
                  [0, 3, 9, 9, 3, 5, 3, 7, 5],
                  [9, 7, 5, 9, 8, 7],
                  [4, 5, 8, 5, 10, 8, 8, 10, 11],
                  [3, 0, 4, 3, 4, 10, 4, 5, 10, 3, 10, 11],
                  [0, 1, 9, 4, 5, 8, 8, 5, 10, 8, 10, 11],
                  [5, 9, 4, 1, 11, 3, 1, 10, 11],
                  [3, 8, 4, 3, 4, 2, 2, 4, 5, 2, 5, 10],
                  [10, 2, 5, 5, 2, 4, 2, 0, 4],
                  [0, 3, 8, 5, 9, 4, 10, 2, 1],
                  [2, 1, 10, 9, 4, 5],
                  [8, 4, 5, 2, 8, 5, 2, 11, 8, 2, 5, 1],
                  [3, 2, 11, 1, 4, 5, 1, 0, 4],
                  [9, 4, 5, 8, 2, 11, 8, 0, 2],
                  [11, 3, 2, 9, 4, 5],
                  [4, 5, 8, 8, 5, 3, 5, 1, 3],
                  [5, 0, 4, 5, 1, 0],
                  [3, 8, 0, 4, 5, 9],
                  [9, 4, 5],
                  [7, 4, 11, 4, 9, 11, 11, 9, 10],
                  [3, 0, 8, 7, 4, 11, 11, 4, 9, 11, 9, 10],
                  [11, 7, 4, 1, 11, 4, 1, 10, 11, 1, 4, 0],
                  [8, 7, 4, 11, 1, 10, 11, 3, 1],
                  [2, 3, 7, 2, 7, 9, 7, 4, 9, 2, 9, 10],
                  [4, 8, 7, 0, 10, 2, 0, 9, 10],
                  [2, 1, 10, 0, 7, 4, 0, 3, 7],
                  [10, 2, 1, 8, 7, 4],
                  [2, 11, 7, 2, 7, 1, 1, 7, 4, 1, 4, 9],
                  [3, 2, 11, 4, 8, 7, 9, 1, 0],
                  [7, 4, 11, 11, 4, 2, 4, 0, 2],
                  [2, 11, 3, 7, 4, 8],
                  [9, 1, 4, 4, 1, 7, 1, 3, 7],
                  [1, 0, 9, 8, 7, 4],
                  [3, 4, 0, 3, 7, 4],
                  [8, 7, 4],
                  [8, 9, 10, 8, 10, 11],
                  [0, 9, 3, 3, 9, 11, 9, 10, 11],
                  [1, 10, 0, 0, 10, 8, 10, 11, 8],
                  [10, 3, 1, 10, 11, 3],
                  [3, 8, 2, 2, 8, 10, 8, 9, 10],
                  [9, 2, 0, 9, 10, 2],
                  [8, 0, 3, 1, 10, 2],
                  [10, 2, 1],
                  [2, 11, 1, 1, 11, 9, 11, 8, 9],
                  [11, 3, 2, 0, 9, 1],
                  [11, 0, 2, 11, 8, 0],
                  [11, 3, 2],
                  [8, 1, 3, 8, 9, 1],
                  [9, 1, 0],
                  [8, 0, 3],
                  []
                ];
              }
              march(A, x, M, m) {
                let l = !!m.fulltable, u = m.hasOwnProperty("origin") && m.origin.hasOwnProperty("x") ? m.origin : { x: 0, y: 0, z: 0 }, p = !!m.voxel, g = m.matrix, b = m.nX || 0, c = m.nY || 0, _ = m.nZ || 0, E = m.scale || 1, w = null;
                m.unitCube ? w = m.unitCube : w = { x: E, y: E, z: E };
                let k = new Int32Array(b * c * _), $, L;
                for ($ = 0, L = k.length; $ < L; ++$)
                  k[$] = -1;
                let z = function(U, N, B, W, V, G) {
                  let H = { x: 0, y: 0, z: 0 }, Q = !!(W & 1 << V), te = !!(W & 1 << G), ee = V;
                  if (!Q && te && (ee = G), ee & 1 && B++, ee & 2 && N++, ee & 4 && U++, g) {
                    let fe = new r.Vector3(U, N, B);
                    fe = fe.applyMatrix4(g), H = { x: fe.x, y: fe.y, z: fe.z };
                  } else
                    H.x = u.x + w.x * U, H.y = u.y + w.y * N, H.z = u.z + w.z * B;
                  let ce = (c * U + N) * _ + B;
                  return p ? (x.push(H), x.length - 1) : (k[ce] < 0 && (k[ce] = x.length, x.push(H)), k[ce]);
                }, F = new Int32Array(12), R = l ? this.edgeTable2 : this.edgeTable, P = l ? this.triTable2 : this.triTable;
                for ($ = 0; $ < b - 1; ++$)
                  for (let U = 0; U < c - 1; ++U)
                    for (let N = 0; N < _ - 1; ++N) {
                      let B = 0;
                      for (let G = 0; G < 8; ++G) {
                        let H = (c * ($ + ((G & 4) >> 2)) + U + ((G & 2) >> 1)) * _ + N + (G & 1), Q = !!(A[H] & this.ISDONE);
                        B |= Q << G;
                      }
                      if (B === 0 || B === 255)
                        continue;
                      let W = R[B];
                      if (W === 0)
                        continue;
                      let V = P[B];
                      W & 1 && (F[0] = z($, U, N, B, 0, 1)), W & 2 && (F[1] = z($, U, N, B, 1, 3)), W & 4 && (F[2] = z($, U, N, B, 3, 2)), W & 8 && (F[3] = z($, U, N, B, 2, 0)), W & 16 && (F[4] = z($, U, N, B, 4, 5)), W & 32 && (F[5] = z($, U, N, B, 5, 7)), W & 64 && (F[6] = z($, U, N, B, 7, 6)), W & 128 && (F[7] = z($, U, N, B, 6, 4)), W & 256 && (F[8] = z($, U, N, B, 0, 4)), W & 512 && (F[9] = z($, U, N, B, 1, 5)), W & 1024 && (F[10] = z($, U, N, B, 3, 7)), W & 2048 && (F[11] = z($, U, N, B, 2, 6));
                      for (let G = 0; G < V.length; G += 3) {
                        let H = F[V[G]], Q = F[V[G + 1]], te = F[V[G + 2]];
                        p && G >= 3 && (x.push(x[H]), H = x.length - 1, x.push(x[Q]), Q = x.length - 1, x.push(x[te]), te = x.length - 1), M.push(H), M.push(Q), M.push(te);
                      }
                    }
              }
              laplacianSmooth(A, x, M) {
                let m = new Array(x.length), l, u, p, g, b;
                for (l = 0, u = x.length; l < u; l++)
                  m[l] = {
                    x: 0,
                    y: 0,
                    z: 0
                  };
                let c = new Array(20), _;
                for (l = 0; l < 20; l++)
                  c[l] = new Array(x.length);
                for (l = 0, u = x.length; l < u; l++)
                  c[0][l] = 0;
                for (l = 0, u = M.length / 3; l < u; l++) {
                  let k = l * 3, $ = l * 3 + 1, L = l * 3 + 2;
                  for (_ = !0, p = 0, g = c[0][M[k]]; p < g; p++)
                    if (M[$] == c[p + 1][M[k]]) {
                      _ = !1;
                      break;
                    }
                  for (_ && (c[0][M[k]]++, c[c[0][M[k]]][M[k]] = M[$]), _ = !0, p = 0, g = c[0][M[k]]; p < g; p++)
                    if (M[L] == c[p + 1][M[k]]) {
                      _ = !1;
                      break;
                    }
                  for (_ && (c[0][M[k]]++, c[c[0][M[k]]][M[k]] = M[L]), _ = !0, p = 0, g = c[0][M[$]]; p < g; p++)
                    if (M[k] == c[p + 1][M[$]]) {
                      _ = !1;
                      break;
                    }
                  for (_ && (c[0][M[$]]++, c[c[0][M[$]]][M[$]] = M[k]), _ = !0, p = 0, g = c[0][M[$]]; p < g; p++)
                    if (M[L] == c[p + 1][M[$]]) {
                      _ = !1;
                      break;
                    }
                  for (_ && (c[0][M[$]]++, c[c[0][M[$]]][M[$]] = M[L]), _ = !0, p = 0; p < c[0][M[L]]; p++)
                    if (M[k] == c[p + 1][M[L]]) {
                      _ = !1;
                      break;
                    }
                  for (_ && (c[0][M[L]]++, c[c[0][M[L]]][M[L]] = M[k]), _ = !0, p = 0, g = c[0][M[L]]; p < g; p++)
                    if (M[$] == c[p + 1][M[L]]) {
                      _ = !1;
                      break;
                    }
                  _ && (c[0][M[L]]++, c[c[0][M[L]]][M[L]] = M[$]);
                }
                let E = 1, w = 0.5;
                for (b = 0; b < A; b++) {
                  for (l = 0, u = x.length; l < u; l++)
                    if (c[0][l] < 3)
                      m[l].x = x[l].x, m[l].y = x[l].y, m[l].z = x[l].z;
                    else if (c[0][l] == 3 || c[0][l] == 4) {
                      for (m[l].x = 0, m[l].y = 0, m[l].z = 0, p = 0, g = c[0][l]; p < g; p++)
                        m[l].x += x[c[p + 1][l]].x, m[l].y += x[c[p + 1][l]].y, m[l].z += x[c[p + 1][l]].z;
                      m[l].x += w * x[l].x, m[l].y += w * x[l].y, m[l].z += w * x[l].z, m[l].x /= w + c[0][l], m[l].y /= w + c[0][l], m[l].z /= w + c[0][l];
                    } else {
                      for (m[l].x = 0, m[l].y = 0, m[l].z = 0, p = 0, g = c[0][l]; p < g; p++)
                        m[l].x += x[c[p + 1][l]].x, m[l].y += x[c[p + 1][l]].y, m[l].z += x[c[p + 1][l]].z;
                      m[l].x += E * x[l].x, m[l].y += E * x[l].y, m[l].z += E * x[l].z, m[l].x /= E + c[0][l], m[l].y /= E + c[0][l], m[l].z /= E + c[0][l];
                    }
                  for (l = 0, u = x.length; l < u; l++)
                    x[l].x = m[l].x, x[l].y = m[l].y, x[l].z = m[l].z;
                }
              }
            }
            let d = new o();
            class v {
              constructor(A, x, M) {
                this.data = new Int32Array(A * x * M * 3), this.width = x, this.height = M;
              }
              // set position x,y,z to pt, which has ix,iy,and iz
              set(A, x, M, m) {
                let l = ((A * this.width + x) * this.height + M) * 3;
                this.data[l] = m.ix, this.data[l + 1] = m.iy, this.data[l + 2] = m.iz;
              }
              // return point at x,y,z
              get(A, x, M) {
                let m = ((A * this.width + x) * this.height + M) * 3;
                return {
                  ix: this.data[m],
                  iy: this.data[m + 1],
                  iz: this.data[m + 2]
                };
              }
            }
            class f {
              constructor() {
                this.INOUT = 1, this.ISDONE = 2, this.ISBOUND = 4, this.ptranx = 0, this.ptrany = 0, this.ptranz = 0, this.probeRadius = 1.4, this.defaultScaleFactor = 2, this.scaleFactor = this.defaultScaleFactor, this.pHeight = 0, this.pWidth = 0, this.pLength = 0, this.cutRadius = 0, this.vpBits = null, this.vpDistance = null, this.vpAtomID = null, this.pminx = 0, this.pminy = 0, this.pminz = 0, this.pmaxx = 0, this.pmaxy = 0, this.pmaxz = 0, this.depty = {}, this.widxz = {}, this.faces = [], this.verts = [], this.vdwRadii = {
                  H: 1.2,
                  Li: 1.82,
                  Na: 2.27,
                  K: 2.75,
                  C: 1.7,
                  N: 1.55,
                  O: 1.52,
                  F: 1.47,
                  P: 1.8,
                  S: 1.8,
                  CL: 1.75,
                  BR: 1.85,
                  SE: 1.9,
                  ZN: 1.39,
                  CU: 1.4,
                  NI: 1.63,
                  X: 2
                }, this.nb = [
                  new Int32Array([1, 0, 0]),
                  new Int32Array([-1, 0, 0]),
                  new Int32Array([0, 1, 0]),
                  new Int32Array([0, -1, 0]),
                  new Int32Array([0, 0, 1]),
                  new Int32Array([0, 0, -1]),
                  new Int32Array([1, 1, 0]),
                  new Int32Array([1, -1, 0]),
                  new Int32Array([-1, 1, 0]),
                  new Int32Array([-1, -1, 0]),
                  new Int32Array([1, 0, 1]),
                  new Int32Array([1, 0, -1]),
                  new Int32Array([-1, 0, 1]),
                  new Int32Array([-1, 0, -1]),
                  new Int32Array([0, 1, 1]),
                  new Int32Array([0, 1, -1]),
                  new Int32Array([0, -1, 1]),
                  new Int32Array([0, -1, -1]),
                  new Int32Array([1, 1, 1]),
                  new Int32Array([1, 1, -1]),
                  new Int32Array([1, -1, 1]),
                  new Int32Array([-1, 1, 1]),
                  new Int32Array([1, -1, -1]),
                  new Int32Array([-1, -1, 1]),
                  new Int32Array([-1, 1, -1]),
                  new Int32Array([-1, -1, -1])
                ], f.MarchingCube || (f.MarchingCube = new o());
              }
              getVDWIndex(A) {
                return !A.elem || typeof this.vdwRadii[A.elem] > "u" ? "X" : A.elem;
              }
              getFacesAndVertices(A) {
                let x = {};
                for (let l = 0, u = A.length; l < u; l++)
                  x[A[l]] = !0;
                let M = this.verts;
                for (let l = 0, u = M.length; l < u; l++)
                  M[l].x = M[l].x / this.scaleFactor - this.ptranx, M[l].y = M[l].y / this.scaleFactor - this.ptrany, M[l].z = M[l].z / this.scaleFactor - this.ptranz;
                let m = [];
                for (let l = 0, u = this.faces.length; l < u; l += 3) {
                  let p = this.faces[l], g = this.faces[l + 1], b = this.faces[l + 2], c = M[p].atomid, _ = M[g].atomid, E = M[b].atomid, w = c;
                  _ < w && (w = _), E < w && (w = E), x[w] && p !== g && g !== b && p !== b && (m.push(p), m.push(g), m.push(b));
                }
                return this.vpBits = null, this.vpDistance = null, this.vpAtomID = null, {
                  vertices: M,
                  faces: m
                };
              }
              initparm(A, x, M) {
                M > 1e6 && (this.scaleFactor = this.defaultScaleFactor / 2);
                let m = 1 / this.scaleFactor * 5.5;
                this.pminx = A[0][0], this.pmaxx = A[1][0], this.pminy = A[0][1], this.pmaxy = A[1][1], this.pminz = A[0][2], this.pmaxz = A[1][2], x ? (this.pminx -= this.probeRadius + m, this.pminy -= this.probeRadius + m, this.pminz -= this.probeRadius + m, this.pmaxx += this.probeRadius + m, this.pmaxy += this.probeRadius + m, this.pmaxz += this.probeRadius + m) : (this.pminx -= m, this.pminy -= m, this.pminz -= m, this.pmaxx += m, this.pmaxy += m, this.pmaxz += m), this.pminx = Math.floor(this.pminx * this.scaleFactor) / this.scaleFactor, this.pminy = Math.floor(this.pminy * this.scaleFactor) / this.scaleFactor, this.pminz = Math.floor(this.pminz * this.scaleFactor) / this.scaleFactor, this.pmaxx = Math.ceil(this.pmaxx * this.scaleFactor) / this.scaleFactor, this.pmaxy = Math.ceil(this.pmaxy * this.scaleFactor) / this.scaleFactor, this.pmaxz = Math.ceil(this.pmaxz * this.scaleFactor) / this.scaleFactor, this.ptranx = -this.pminx, this.ptrany = -this.pminy, this.ptranz = -this.pminz, this.pLength = Math.ceil(this.scaleFactor * (this.pmaxx - this.pminx)) + 1, this.pWidth = Math.ceil(this.scaleFactor * (this.pmaxy - this.pminy)) + 1, this.pHeight = Math.ceil(this.scaleFactor * (this.pmaxz - this.pminz)) + 1, this.boundingatom(x), this.cutRadius = this.probeRadius * this.scaleFactor, this.vpBits = new Uint8Array(this.pLength * this.pWidth * this.pHeight), this.vpDistance = new Float64Array(this.pLength * this.pWidth * this.pHeight), this.vpAtomID = new Int32Array(this.pLength * this.pWidth * this.pHeight);
              }
              boundingatom(A) {
                let x = {};
                for (const M in this.vdwRadii) {
                  let m = this.vdwRadii[M];
                  A ? x[M] = (m + this.probeRadius) * this.scaleFactor + 0.5 : x[M] = m * this.scaleFactor + 0.5;
                  let l = x[M] * x[M];
                  this.widxz[M] = Math.floor(x[M]) + 1, this.depty[M] = new Int32Array(this.widxz[M] * this.widxz[M]);
                  let u = 0;
                  for (let p = 0; p < this.widxz[M]; p++)
                    for (let g = 0; g < this.widxz[M]; g++) {
                      let b = p * p + g * g;
                      if (b > l)
                        this.depty[M][u] = -1;
                      else {
                        let c = Math.sqrt(l - b);
                        this.depty[M][u] = Math.floor(c);
                      }
                      u++;
                    }
                }
              }
              fillvoxels(A, x) {
                for (let M = 0, m = this.vpBits.length; M < m; M++)
                  this.vpBits[M] = 0, this.vpDistance[M] = -1, this.vpAtomID[M] = -1;
                for (let M in x) {
                  let m = A[x[M]];
                  m !== void 0 && this.fillAtom(m, A);
                }
                for (let M = 0, m = this.vpBits.length; M < m; M++)
                  this.vpBits[M] & this.INOUT && (this.vpBits[M] |= this.ISDONE);
              }
              fillAtom(A, x) {
                let M = Math.floor(0.5 + this.scaleFactor * (A.x + this.ptranx)), m = Math.floor(0.5 + this.scaleFactor * (A.y + this.ptrany)), l = Math.floor(0.5 + this.scaleFactor * (A.z + this.ptranz)), u = this.getVDWIndex(A), p = 0, g = this.pWidth * this.pHeight;
                for (let b = 0, c = this.widxz[u]; b < c; b++)
                  for (let _ = 0; _ < c; _++) {
                    if (this.depty[u][p] != -1) {
                      for (let E = -1; E < 2; E++)
                        for (let w = -1; w < 2; w++)
                          for (let k = -1; k < 2; k++)
                            if (E !== 0 && w !== 0 && k !== 0) {
                              let $ = E * b, L = k * _;
                              for (let z = 0; z <= this.depty[u][p]; z++) {
                                let F = z * w, R = M + $, P = m + F, U = l + L;
                                if (R < 0 || P < 0 || U < 0 || R >= this.pLength || P >= this.pWidth || U >= this.pHeight)
                                  continue;
                                let N = R * g + P * this.pHeight + U;
                                if (!(this.vpBits[N] & this.INOUT))
                                  this.vpBits[N] |= this.INOUT, this.vpAtomID[N] = A.serial;
                                else {
                                  let B = x[this.vpAtomID[N]];
                                  if (B.serial != A.serial) {
                                    let W = M + $ - Math.floor(0.5 + this.scaleFactor * (B.x + this.ptranx)), V = m + F - Math.floor(0.5 + this.scaleFactor * (B.y + this.ptrany)), G = l + L - Math.floor(0.5 + this.scaleFactor * (B.z + this.ptranz));
                                    $ * $ + F * F + L * L < W * W + V * V + G * G && (this.vpAtomID[N] = A.serial);
                                  }
                                }
                              }
                            }
                    }
                    p++;
                  }
              }
              fillvoxelswaals(A, x) {
                for (let M = 0, m = this.vpBits.length; M < m; M++)
                  this.vpBits[M] &= ~this.ISDONE;
                for (let M in x) {
                  let m = A[x[M]];
                  m !== void 0 && this.fillAtomWaals(m, A);
                }
              }
              fillAtomWaals(A, x) {
                let M = 0, m = Math.floor(0.5 + this.scaleFactor * (A.x + this.ptranx)), l = Math.floor(0.5 + this.scaleFactor * (A.y + this.ptrany)), u = Math.floor(0.5 + this.scaleFactor * (A.z + this.ptranz)), p = this.getVDWIndex(A), g = this.pWidth * this.pHeight;
                for (let b = 0, c = this.widxz[p]; b < c; b++)
                  for (let _ = 0; _ < c; _++) {
                    if (this.depty[p][M] != -1) {
                      for (let E = -1; E < 2; E++)
                        for (let w = -1; w < 2; w++)
                          for (let k = -1; k < 2; k++)
                            if (E !== 0 && w !== 0 && k !== 0) {
                              let $ = E * b, L = k * _;
                              for (let z = 0; z <= this.depty[p][M]; z++) {
                                let F = z * w, R = m + $, P = l + F, U = u + L;
                                if (R < 0 || P < 0 || U < 0 || R >= this.pLength || P >= this.pWidth || U >= this.pHeight)
                                  continue;
                                let N = R * g + P * this.pHeight + U;
                                if (!(this.vpBits[N] & this.ISDONE))
                                  this.vpBits[N] |= this.ISDONE, this.vpAtomID[N] = A.serial;
                                else {
                                  let B = x[this.vpAtomID[N]];
                                  if (B.serial != A.serial) {
                                    let W = m + $ - Math.floor(0.5 + this.scaleFactor * (B.x + this.ptranx)), V = l + F - Math.floor(0.5 + this.scaleFactor * (B.y + this.ptrany)), G = u + L - Math.floor(0.5 + this.scaleFactor * (B.z + this.ptranz));
                                    $ * $ + F * F + L * L < W * W + V * V + G * G && (this.vpAtomID[N] = A.serial);
                                  }
                                }
                              }
                            }
                    }
                    M++;
                  }
              }
              buildboundary() {
                let A = this.pWidth * this.pHeight;
                for (let x = 0; x < this.pLength; x++)
                  for (let M = 0; M < this.pHeight; M++)
                    for (let m = 0; m < this.pWidth; m++) {
                      let l = x * A + m * this.pHeight + M;
                      if (this.vpBits[l] & this.INOUT) {
                        let u = 0;
                        for (; u < 26; ) {
                          let p = x + this.nb[u][0], g = M + this.nb[u][2], b = m + this.nb[u][1];
                          if (p > -1 && p < this.pLength && b > -1 && b < this.pWidth && g > -1 && g < this.pHeight && !(this.vpBits[p * A + b * this.pHeight + g] & this.INOUT)) {
                            this.vpBits[l] |= this.ISBOUND;
                            break;
                          } else
                            u++;
                        }
                      }
                    }
              }
              fastdistancemap() {
                let A = new v(this.pLength, this.pWidth, this.pHeight), x = this.pWidth * this.pHeight, M = this.cutRadius * this.cutRadius, m = [], l = [], u;
                for (let b = 0; b < this.pLength; b++)
                  for (let c = 0; c < this.pWidth; c++)
                    for (let _ = 0; _ < this.pHeight; _++)
                      if (u = b * x + c * this.pHeight + _, this.vpBits[u] &= ~this.ISDONE, this.vpBits[u] & this.INOUT && this.vpBits[u] & this.ISBOUND) {
                        let E = {
                          ix: b,
                          iy: c,
                          iz: _
                        };
                        A.set(b, c, _, E), m.push(E), this.vpDistance[u] = 0, this.vpBits[u] |= this.ISDONE, this.vpBits[u] &= ~this.ISBOUND;
                      }
                do {
                  l = this.fastoneshell(m, A), m = [];
                  for (let b = 0, c = l.length; b < c; b++)
                    u = x * l[b].ix + this.pHeight * l[b].iy + l[b].iz, this.vpBits[u] &= ~this.ISBOUND, this.vpDistance[u] <= 1.0404 * M && m.push({
                      ix: l[b].ix,
                      iy: l[b].iy,
                      iz: l[b].iz
                    });
                } while (m.length !== 0);
                m = [], l = [], A = null;
                let p = this.scaleFactor - 0.5;
                p < 0 && (p = 0);
                let g = M - 0.5 / (0.1 + p);
                for (let b = 0; b < this.pLength; b++)
                  for (let c = 0; c < this.pWidth; c++)
                    for (let _ = 0; _ < this.pHeight; _++)
                      u = b * x + c * this.pHeight + _, this.vpBits[u] &= ~this.ISBOUND, this.vpBits[u] & this.INOUT && (!(this.vpBits[u] & this.ISDONE) || this.vpBits[u] & this.ISDONE && this.vpDistance[u] >= g) && (this.vpBits[u] |= this.ISBOUND);
              }
              fastoneshell(A, x) {
                let M, m, l, u, p, g, b, c, _, E = [];
                if (A.length === 0)
                  return E;
                let w = {
                  ix: -1,
                  iy: -1,
                  iz: -1
                }, k = this.pWidth * this.pHeight;
                for (let $ = 0, L = A.length; $ < L; $++) {
                  M = A[$].ix, m = A[$].iy, l = A[$].iz, c = x.get(M, m, l);
                  for (let z = 0; z < 6; z++)
                    w.ix = M + this.nb[z][0], w.iy = m + this.nb[z][1], w.iz = l + this.nb[z][2], w.ix < this.pLength && w.ix > -1 && w.iy < this.pWidth && w.iy > -1 && w.iz < this.pHeight && w.iz > -1 && (_ = w.ix * k + this.pHeight * w.iy + w.iz, this.vpBits[_] & this.INOUT && !(this.vpBits[_] & this.ISDONE) ? (x.set(w.ix, w.iy, l + this.nb[z][2], c), u = w.ix - c.ix, p = w.iy - c.iy, g = w.iz - c.iz, b = u * u + p * p + g * g, this.vpDistance[_] = b, this.vpBits[_] |= this.ISDONE, this.vpBits[_] |= this.ISBOUND, E.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })) : this.vpBits[_] & this.INOUT && this.vpBits[_] & this.ISDONE && (u = w.ix - c.ix, p = w.iy - c.iy, g = w.iz - c.iz, b = u * u + p * p + g * g, b < this.vpDistance[_] && (x.set(w.ix, w.iy, w.iz, c), this.vpDistance[_] = b, this.vpBits[_] & this.ISBOUND || (this.vpBits[_] |= this.ISBOUND, E.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })))));
                }
                for (let $ = 0, L = A.length; $ < L; $++) {
                  M = A[$].ix, m = A[$].iy, l = A[$].iz, c = x.get(M, m, l);
                  for (let z = 6; z < 18; z++)
                    w.ix = M + this.nb[z][0], w.iy = m + this.nb[z][1], w.iz = l + this.nb[z][2], w.ix < this.pLength && w.ix > -1 && w.iy < this.pWidth && w.iy > -1 && w.iz < this.pHeight && w.iz > -1 && (_ = w.ix * k + this.pHeight * w.iy + w.iz, this.vpBits[_] & this.INOUT && !(this.vpBits[_] & this.ISDONE) ? (x.set(w.ix, w.iy, l + this.nb[z][2], c), u = w.ix - c.ix, p = w.iy - c.iy, g = w.iz - c.iz, b = u * u + p * p + g * g, this.vpDistance[_] = b, this.vpBits[_] |= this.ISDONE, this.vpBits[_] |= this.ISBOUND, E.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })) : this.vpBits[_] & this.INOUT && this.vpBits[_] & this.ISDONE && (u = w.ix - c.ix, p = w.iy - c.iy, g = w.iz - c.iz, b = u * u + p * p + g * g, b < this.vpDistance[_] && (x.set(w.ix, w.iy, w.iz, c), this.vpDistance[_] = b, this.vpBits[_] & this.ISBOUND || (this.vpBits[_] |= this.ISBOUND, E.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })))));
                }
                for (let $ = 0, L = A.length; $ < L; $++) {
                  M = A[$].ix, m = A[$].iy, l = A[$].iz, c = x.get(M, m, l);
                  for (let z = 18; z < 26; z++)
                    w.ix = M + this.nb[z][0], w.iy = m + this.nb[z][1], w.iz = l + this.nb[z][2], w.ix < this.pLength && w.ix > -1 && w.iy < this.pWidth && w.iy > -1 && w.iz < this.pHeight && w.iz > -1 && (_ = w.ix * k + this.pHeight * w.iy + w.iz, this.vpBits[_] & this.INOUT && !(this.vpBits[_] & this.ISDONE) ? (x.set(w.ix, w.iy, l + this.nb[z][2], c), u = w.ix - c.ix, p = w.iy - c.iy, g = w.iz - c.iz, b = u * u + p * p + g * g, this.vpDistance[_] = b, this.vpBits[_] |= this.ISDONE, this.vpBits[_] |= this.ISBOUND, E.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })) : this.vpBits[_] & this.INOUT && this.vpBits[_] & this.ISDONE && (u = w.ix - c.ix, p = w.iy - c.iy, g = w.iz - c.iz, b = u * u + p * p + g * g, b < this.vpDistance[_] && (x.set(w.ix, w.iy, w.iz, c), this.vpDistance[_] = b, this.vpBits[_] & this.ISBOUND || (this.vpBits[_] |= this.ISBOUND, E.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })))));
                }
                return E;
              }
              marchingcubeinit(A) {
                for (let x = 0, M = this.vpBits.length; x < M; x++)
                  A == 1 ? this.vpBits[x] &= ~this.ISBOUND : A == 4 ? (this.vpBits[x] &= ~this.ISDONE, this.vpBits[x] & this.ISBOUND && (this.vpBits[x] |= this.ISDONE), this.vpBits[x] &= ~this.ISBOUND) : A == 2 ? this.vpBits[x] & this.ISBOUND && this.vpBits[x] & this.ISDONE ? this.vpBits[x] &= ~this.ISBOUND : this.vpBits[x] & this.ISBOUND && !(this.vpBits[x] & this.ISDONE) && (this.vpBits[x] |= this.ISDONE) : A == 3 && (this.vpBits[x] &= ~this.ISBOUND);
              }
              marchingcube(A) {
                this.marchingcubeinit(A), this.verts = [], this.faces = [], f.MarchingCube.march(this.vpBits, this.verts, this.faces, {
                  smooth: 1,
                  nX: this.pLength,
                  nY: this.pWidth,
                  nZ: this.pHeight
                });
                let x = this.pWidth * this.pHeight;
                for (let M = 0, m = this.verts.length; M < m; M++)
                  this.verts[M].atomid = this.vpAtomID[this.verts[M].x * x + this.pHeight * this.verts[M].y + this.verts[M].z];
                f.MarchingCube.laplacianSmooth(1, this.verts, this.faces);
              }
            }
            f.MarchingCube = new o();
          }
        ),
        /***/
        "./src/VolumeData.ts": (
          /*!***************************!*\
            !*** ./src/VolumeData.ts ***!
            \***************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              VolumeData: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), a = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), s = t(
              /*! ./parsers/VASP */
              "./src/parsers/VASP.ts"
            ), h = t(
              /*! ./parsers/CUBE */
              "./src/parsers/CUBE.ts"
            ), o = t(
              /*! pako */
              "./node_modules/pako/dist/pako.esm.mjs"
            );
            class d {
              constructor(f, y, A) {
                if (this.unit = {
                  x: 1,
                  y: 1,
                  z: 1
                }, this.origin = {
                  x: 0,
                  y: 0,
                  z: 0
                }, this.size = {
                  x: 0,
                  y: 0,
                  z: 0
                }, this.data = new Float32Array([]), this.matrix = null, this.inversematrix = null, this.isbinary = /* @__PURE__ */ new Set(["ccp4", "CCP4"]), this.getCoordinates = function(u) {
                  var p = u / (this.size.y * this.size.z), g = u % (this.size.y * this.size.z), b = u % this.size.z;
                  return p *= this.unit.x, g *= this.unit.y, b *= this.unit.z, p += this.origin.x, g += this.origin.y, b += this.origin.z, { x: p, y: g, z: b };
                }, this.vasp = function(u) {
                  var p = u.replace(/^\s+/, "").split(/[\n\r]/), g = (0, s.VASP)(u)[0], b = g.length;
                  if (b == 0) {
                    console.warn("No good formating of CHG or CHGCAR file, not atomic information provided in the file."), this.data = [];
                    return;
                  }
                  var c = 1.889725992, _ = 0.036749309, E = parseFloat(p[1]), w;
                  w = p[2].replace(/^\s+/, "").split(/\s+/);
                  var k = new a.Vector3(parseFloat(w[0]), parseFloat(w[1]), parseFloat(w[2])).multiplyScalar(E * c);
                  w = p[3].replace(/^\s+/, "").split(/\s+/);
                  var $ = new a.Vector3(parseFloat(w[0]), parseFloat(w[1]), parseFloat(w[2])).multiplyScalar(E * c);
                  w = p[4].replace(/^\s+/, "").split(/\s+/);
                  var L = new a.Vector3(parseFloat(w[0]), parseFloat(w[1]), parseFloat(w[2])).multiplyScalar(E * c), z = k.x * ($.y * L.z - L.y * $.z) - $.x * (k.y * L.z - L.y * k.z) + L.x * (k.y * $.z - $.y * k.z);
                  z = Math.abs(z) / Math.pow(c, 3);
                  var F = 1 / z;
                  p.splice(0, 8 + b + 1);
                  var R = p[0].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), P = Math.abs(parseFloat(R[0])), U = Math.abs(parseFloat(R[1])), N = Math.abs(parseFloat(R[2])), B = this.origin = new a.Vector3(0, 0, 0);
                  this.size = { x: P, y: U, z: N }, this.unit = new a.Vector3(k.x, $.y, L.z), k = k.multiplyScalar(1 / (c * P)), $ = $.multiplyScalar(1 / (c * U)), L = L.multiplyScalar(1 / (c * N)), (k.y != 0 || k.z != 0 || $.x != 0 || $.z != 0 || L.x != 0 || L.y != 0) && (this.matrix = new a.Matrix4(k.x, $.x, L.x, 0, k.y, $.y, L.y, 0, k.z, $.z, L.z, 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new a.Matrix4().makeTranslation(B.x, B.y, B.z)), this.origin = new a.Vector3(0, 0, 0), this.unit = new a.Vector3(1, 1, 1)), p.splice(0, 1);
                  var W = p.join(" ");
                  W = W.replace(/^\s+/, "");
                  var V = W.split(/[\s\r]+/);
                  V.splice(P * U * N + 1);
                  for (var G = Float32Array.from(V, parseFloat), H = 0; H < G.length; H++)
                    G[H] = G[H] * F * _;
                  this.data = G;
                }, this.dx = function(u) {
                  var p = u.split(/[\n\r]+/), g, b = /gridpositions\s+counts\s+(\d+)\s+(\d+)\s+(\d+)/, c = /^origin\s+(\S+)\s+(\S+)\s+(\S+)/, _ = /^delta\s+(\S+)\s+(\S+)\s+(\S+)/, E = /data follows/, w = 0;
                  for (w = 0; w < p.length; w++) {
                    var k = p[w];
                    if (g = b.exec(k)) {
                      var $ = parseInt(g[1]), L = parseInt(g[2]), z = parseInt(g[3]);
                      this.size = { x: $, y: L, z };
                    } else if (g = _.exec(k)) {
                      var F = parseFloat(g[1]);
                      if ((parseFloat(g[2]) != 0 || parseFloat(g[3]) != 0) && console.warn("Non-orthogonal delta matrix not currently supported in dx format"), w += 1, k = p[w], g = _.exec(k), g == null) {
                        console.error("Parse error in dx delta matrix");
                        return;
                      }
                      var R = parseFloat(g[2]);
                      if ((parseFloat(g[1]) != 0 || parseFloat(g[3]) != 0) && console.warn("Non-orthogonal delta matrix not currently supported in dx format"), w += 1, k = p[w], g = _.exec(k), g == null) {
                        console.error("Parse error in dx delta matrix");
                        return;
                      }
                      var P = parseFloat(g[3]);
                      (parseFloat(g[1]) != 0 || parseFloat(g[2]) != 0) && console.warn("Non-orthogonal delta matrix not currently supported in dx format"), this.unit = new a.Vector3(F, R, P);
                    } else if (g = c.exec(k)) {
                      var U = parseFloat(g[1]), N = parseFloat(g[2]), B = parseFloat(g[3]);
                      this.origin = new a.Vector3(U, N, B);
                    } else if (g = E.exec(k))
                      break;
                  }
                  if (w += 1, !this.size || !this.origin || !this.unit || !this.size) {
                    console.error("Error parsing dx format");
                    return;
                  }
                  var W = p.splice(w).join(" "), V = W.split(/[\s\r]+/);
                  this.data = Float32Array.from(V, parseFloat);
                }, y = y.toLowerCase(), /\.gz$/.test(y)) {
                  y = y.replace(/\.gz$/, "");
                  try {
                    this[y] && this.isbinary.has(y) ? (typeof f == "string" && (f = (0, r.base64ToArray)(f)), f = (0, o.inflate)(f)) : f = new TextDecoder("utf-8").decode((0, o.inflate)(f));
                  } catch (u) {
                    console.error(u);
                  }
                }
                if (this[y] && (this.isbinary.has(y) && typeof f == "string" && (f = (0, r.base64ToArray)(f)), this[y](f)), A) {
                  if (A.negate)
                    for (let u = 0, p = this.data.length; u < p; u++)
                      this.data[u] = -this.data[u];
                  if (A.normalize) {
                    var x = 0;
                    for (let u = 0, p = this.data.length; u < p; u++)
                      x += this.data[u];
                    var M = x / this.data.length;
                    x = 0;
                    for (let u = 0, p = this.data.length; u < p; u++) {
                      var m = this.data[u] - M;
                      x += m * m;
                    }
                    var l = x / this.data.length;
                    for (let u = 0, p = this.data.length; u < p; u++)
                      this.data[u] = (this.data[u] - M) / l;
                  }
                }
              }
              /**
               * @function $3Dmol.VolumeData.getIndex
               * @param {number} x,y,z - the coordinates
               * @returns - index into flat array closest to provided coordinate; -1 if invalid
               */
              getIndex(f, y, A) {
                if (this.matrix) {
                  this.inversematrix == null && (this.inversematrix = new a.Matrix4().getInverse(this.matrix));
                  var x = new a.Vector3(f, y, A);
                  x = x.applyMatrix4(this.inversematrix), f = x.x, y = x.y, A = x.z;
                } else
                  f -= this.origin.x, y -= this.origin.y, A -= this.origin.z, f /= this.unit.x, y /= this.unit.y, A /= this.unit.z;
                return f = Math.round(f), y = Math.round(y), A = Math.round(A), f < 0 || f >= this.size.x || y < 0 || y >= this.size.y || A < 0 || A >= this.size.z ? -1 : f * this.size.y * this.size.z + y * this.size.z + A;
              }
              /**
               * @function $3Dmol.VolumeData.getVal
               * @param {number} x,y,z - the coordinates
               * @returns - value closest to provided coordinate; zero if coordinate invalid
               */
              getVal(f, y, A) {
                let x = this.getIndex(f, y, A);
                return x < 0 ? 0 : this.data[x];
              }
              // parse cube data
              cube(f) {
                var y = f.split(/\r?\n/);
                if (!(y.length < 6)) {
                  var A = (0, h.CUBE)(f, {}).modelData[0].cryst, x = y[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), M = parseFloat(x[0]), m = Math.abs(M);
                  this.origin = A.origin, this.size = A.size, this.unit = A.unit, this.matrix = A.matrix4;
                  var l = 6;
                  M < 0 && l++;
                  var u = y.splice(m + l).join(" ");
                  u = u.replace(/^\s+/, "");
                  var p = u.split(/[\s\r]+/);
                  this.data = Float32Array.from(p, parseFloat);
                }
              }
              //parse cp4 files
              ccp4(f) {
                var y = {};
                f = new Int8Array(f);
                var A = new Int32Array(f.buffer, 0, 56), x = new Float32Array(f.buffer, 0, 56), M = new DataView(f.buffer);
                if (y.MAP = String.fromCharCode(M.getUint8(208), M.getUint8(209), M.getUint8(210), M.getUint8(211)), y.MACHST = [M.getUint8(212), M.getUint8(213)], y.MACHST[0] === 17 && y.MACHST[1] === 17)
                  for (var m = f.byteLength, l = 0; l < m; l += 4)
                    M.setFloat32(l, M.getFloat32(l), !0);
                y.NX = A[0], y.NY = A[1], y.NZ = A[2], y.MODE = A[3], y.NXSTART = A[4], y.NYSTART = A[5], y.NZSTART = A[6], y.MX = A[7], y.MY = A[8], y.MZ = A[9], y.xlen = x[10], y.ylen = x[11], y.zlen = x[12], y.alpha = x[13], y.beta = x[14], y.gamma = x[15], y.MAPC = A[16], y.MAPR = A[17], y.MAPS = A[18], y.DMIN = x[19], y.DMAX = x[20], y.DMEAN = x[21], y.ISPG = A[22], y.NSYMBT = A[23], y.LSKFLG = A[24], y.originX = x[49], y.originY = x[50], y.originZ = x[51], y.ARMS = x[54];
                var u = y, p = [
                  u.xlen,
                  0,
                  0
                ], g = [
                  u.ylen * Math.cos(Math.PI / 180 * u.gamma),
                  u.ylen * Math.sin(Math.PI / 180 * u.gamma),
                  0
                ], b = [
                  u.zlen * Math.cos(Math.PI / 180 * u.beta),
                  u.zlen * (Math.cos(Math.PI / 180 * u.alpha) - Math.cos(Math.PI / 180 * u.gamma) * Math.cos(Math.PI / 180 * u.beta)) / Math.sin(Math.PI / 180 * u.gamma),
                  0
                ];
                b[2] = Math.sqrt(u.zlen * u.zlen * Math.sin(Math.PI / 180 * u.beta) * Math.sin(Math.PI / 180 * u.beta) - b[1] * b[1]);
                var c = [0, p, g, b], _ = [0, u.MX, u.MY, u.MZ], E = [0, u.MAPC, u.MAPR, u.MAPS];
                this.matrix = new a.Matrix4(), this.matrix.set(c[E[1]][0] / _[E[1]], c[E[2]][0] / _[E[2]], c[E[3]][0] / _[E[3]], 0, c[E[1]][1] / _[E[1]], c[E[2]][1] / _[E[2]], c[E[3]][1] / _[E[3]], 0, c[E[1]][2] / _[E[1]], c[E[2]][2] / _[E[2]], c[E[3]][2] / _[E[3]], 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new a.Matrix4().makeTranslation(u.NXSTART + u.originX, u.NYSTART + u.originY, u.NZSTART + u.originZ)), this.origin = new a.Vector3(0, 0, 0), this.unit = new a.Vector3(1, 1, 1), this.size = { x: y.NX, y: y.NY, z: y.NZ }, this.dimensionorder = [y.MAPC, y.MAPR, y.MAPS];
                var w = new Float32Array(f.buffer, 1024 + y.NSYMBT), k = y.NX, $ = y.NY, L = y.NZ;
                this.data = new Float32Array(k * $ * L);
                for (let z = 0; z < k; z++)
                  for (let F = 0; F < $; F++)
                    for (let R = 0; R < L; R++)
                      this.data[(z * $ + F) * L + R] = w[(R * $ + F) * k + z];
              }
            }
          }
        ),
        /***/
        "./src/VolumetricRender.ts": (
          /*!*********************************!*\
            !*** ./src/VolumetricRender.ts ***!
            \*********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLVolumetricRender: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), a = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), s = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), h = t(
              /*! ./colors */
              "./src/colors.ts"
            ), o = t(
              /*! ./GLShape */
              "./src/GLShape.ts"
            );
            class d {
              static interpolateArray(f, y) {
                function A(b, c, _) {
                  return b + (c - b) * _;
                }
                var x = [], M = (f.length - 1) / (y - 1);
                x[0] = f[0];
                for (var m = 1; m < y - 1; m++) {
                  var l = m * M, u = Math.floor(l), p = Math.ceil(l), g = l - u;
                  x[m] = A(f[u], f[p], g);
                }
                return x[y - 1] = f[f.length - 1], x;
              }
              constructor(f, y, A) {
                this.hidden = !1, this.boundingSphere = new r.Sphere(), this.renderedShapeObj = null, this.shapeObj = null, this.subsamples = 5, this.data = null, this.transferfunctionbuffer = [], this.min = 0, this.max = 0, y = y || {};
                var x = Object.assign([], y.transferfn);
                this.subsamples = y.subsamples || 5;
                let M = 256;
                x.forEach(function($) {
                  $.value = parseFloat($.value);
                }), x.sort(function($, L) {
                  return $.value - L.value;
                }), this.min = x[0].value, x.length == 0 && x.push(x[0]), this.max = x[x.length - 1].value;
                var m, l, u, p, g, b, c, _, E, w;
                for (let $ = 0; $ < x.length - 1; $++)
                  if (u = h.CC.color(x[$].color), p = h.CC.color(x[$ + 1].color), E = x[$].opacity, w = x[$ + 1].opacity, m = Math.floor((x[$].value - this.min) * M / (this.max - this.min)), l = Math.floor((x[$ + 1].value - this.min) * M / (this.max - this.min)), m != l) {
                    g = d.interpolateArray([u.r * 255, p.r * 255], l - m), b = d.interpolateArray([u.g * 255, p.g * 255], l - m), c = d.interpolateArray([u.b * 255, p.b * 255], l - m), _ = d.interpolateArray([E * 255, w * 255], l - m);
                    for (let L = 0; L < g.length; L++)
                      this.transferfunctionbuffer.push(g[L]), this.transferfunctionbuffer.push(b[L]), this.transferfunctionbuffer.push(c[L]), this.transferfunctionbuffer.push(_[L]);
                  }
                if (this.transferfunctionbuffer = new Uint8ClampedArray(this.transferfunctionbuffer), f.matrix) {
                  let $ = new a.Vector3(0, 0, 0), L = new a.Vector3(f.size.x, f.size.y, f.size.z), z = new a.Vector3(1, 1, 1);
                  $.applyMatrix4(f.matrix), L.applyMatrix4(f.matrix), z.applyMatrix4(f.matrix).sub($), this.extent = [[$.x, $.y, $.z], [L.x, L.y, L.z]];
                  for (let U = 1; U < 7; U++)
                    L.x = U & 1 ? f.size.x : 0, L.y = U & 2 ? f.size.y : 0, L.z = U & 4 ? f.size.z : 0, L.applyMatrix4(f.matrix), this.extent[0][0] = Math.min(this.extent[0][0], L.x), this.extent[0][1] = Math.min(this.extent[0][1], L.y), this.extent[0][2] = Math.min(this.extent[0][2], L.z), this.extent[1][0] = Math.max(this.extent[1][0], L.x), this.extent[1][1] = Math.max(this.extent[1][1], L.y), this.extent[1][2] = Math.max(this.extent[1][2], L.z);
                  let F = L.x - $.x, R = L.y - $.y, P = L.z - $.z;
                  this.maxdepth = Math.sqrt(F * F + R * R + P * P), this.minunit = Math.min(Math.min(z.x, z.y), z.z), this.texmatrix = new a.Matrix4().identity().scale({ x: f.size.x, y: f.size.y, z: f.size.z }), this.texmatrix = this.texmatrix.multiplyMatrices(f.matrix, this.texmatrix), this.texmatrix = this.texmatrix.getInverse(this.texmatrix);
                } else {
                  this.texmatrix = new a.Matrix4().identity();
                  let $ = f.unit.x * f.size.x, L = f.unit.y * f.size.y, z = f.unit.z * f.size.z;
                  this.texmatrix.makeTranslation(-f.origin.x / $, -f.origin.y / L, -f.origin.z / z), this.texmatrix.scale({ x: 1 / $, y: 1 / L, z: 1 / z }), this.minunit = Math.min(Math.min(f.unit.x, f.unit.y), f.unit.z), this.extent = [
                    [f.origin.x, f.origin.y, f.origin.z],
                    [f.origin.x + $, f.origin.y + L, f.origin.z + z]
                  ], this.maxdepth = Math.sqrt($ * $ + L * L + z * z);
                }
                var k = new o.GLShape({});
                if (k.addBox({
                  corner: { x: this.extent[0][0], y: this.extent[0][1], z: this.extent[0][2] },
                  dimensions: {
                    w: this.extent[1][0] - this.extent[0][0],
                    h: this.extent[1][1] - this.extent[0][1],
                    d: this.extent[1][2] - this.extent[0][2]
                  }
                }), this.geo = k.finalize(), this.boundingSphere.center = new a.Vector3((this.extent[0][0] + this.extent[1][0]) / 2, (this.extent[0][1] + this.extent[1][1]) / 2, (this.extent[0][2] + this.extent[1][2]) / 2), this.boundingSphere.radius = this.maxdepth / 2, y.coords === void 0 && y.selection !== void 0 && (A ? y.coords = A.selectedAtoms(y.selection) : console.log("Need to provide viewer to volumetric renderer if selection specified.")), y.coords !== void 0 && y.seldist !== void 0) {
                  let $ = new Uint8Array(f.data.length), L = y.seldist, z = L * L;
                  for (let F = 0, R = y.coords.length; F < R; F++) {
                    let P = y.coords[F], U = P.x - L, N = P.y - L, B = P.z - L, W = P.x + L, V = P.y + L, G = P.z + L;
                    if (f.getIndex(U, N, B) >= 0 || f.getIndex(W, V, G) >= 0)
                      for (let H = U; H < W; H += this.minunit)
                        for (let Q = N; Q < V; Q += this.minunit)
                          for (let te = B; te < G; te += this.minunit) {
                            let ee = f.getIndex(H, Q, te);
                            ee >= 0 && !$[ee] && (H - P.x) * (H - P.x) + (Q - P.y) * (Q - P.y) + (te - P.z) * (te - P.z) < z && ($[ee] = 1);
                          }
                  }
                  for (let F = 0, R = f.data.length; F < R; F++)
                    $[F] == 0 && (f.data[F] = 1 / 0);
                }
                this.data = f;
              }
              /**
               * Initialize webgl objects for rendering
               * @param {Object3D} group
               *
               */
              globj(f) {
                if (this.renderedShapeObj && (f.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) {
                  this.shapeObj = new s.Object3D();
                  var y = null, A = new s.Texture(this.data, !0), x = new s.Texture(this.transferfunctionbuffer, !1);
                  A.needsUpdate = !0, x.needsUpdate = !0, x.flipY = !1, y = new s.VolumetricMaterial({
                    transferfn: x,
                    transfermin: this.min,
                    transfermax: this.max,
                    map: A,
                    extent: this.extent,
                    maxdepth: this.maxdepth,
                    texmatrix: this.texmatrix,
                    unit: this.minunit,
                    subsamples: this.subsamples
                  });
                  var M = new s.Mesh(this.geo, y);
                  this.shapeObj.add(M), this.renderedShapeObj = this.shapeObj.clone(), f.add(this.renderedShapeObj);
                }
              }
              removegl(f) {
                this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), f.remove(this.renderedShapeObj), this.renderedShapeObj = null), this.shapeObj = null;
              }
              get position() {
                return this.boundingSphere.center;
              }
              get x() {
                return this.boundingSphere.center.x;
              }
              get y() {
                return this.boundingSphere.center.y;
              }
              get z() {
                return this.boundingSphere.center.z;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/Camera.ts": (
          /*!*****************************!*\
            !*** ./src/WebGL/Camera.ts ***!
            \*****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Camera: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), a = t(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            );
            class s extends r.Object3D {
              constructor(o = 50, d = 1, v = 0.1, f = 2e3, y = !1) {
                super(), this.projectionMatrix = new a.Matrix4(), this.projectionMatrixInverse = new a.Matrix4(), this.matrixWorldInverse = new a.Matrix4(), this.fov = o, this.aspect = d, this.near = v, this.far = f;
                var A = this.position.z;
                this.right = A * Math.tan(Math.PI / 180 * o), this.left = -this.right, this.top = this.right / this.aspect, this.bottom = -this.top, this.ortho = !!y, this.updateProjectionMatrix();
              }
              lookAt(o) {
                this.matrix.lookAt(this.position, o, this.up), this.rotationAutoUpdate && (this.useQuaternion === !1 && this.rotation instanceof a.Vector3 ? this.rotation.setEulerFromRotationMatrix(this.matrix, this.eulerOrder) : console.error("Unimplemented math operation."));
              }
              updateProjectionMatrix() {
                this.ortho ? this.projectionMatrix.makeOrthographic(this.left, this.right, this.top, this.bottom, this.near, this.far) : this.projectionMatrix.makePerspective(this.fov, this.aspect, this.near, this.far), this.projectionMatrixInverse.getInverse(this.projectionMatrix);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/Fog.ts": (
          /*!**************************!*\
            !*** ./src/WebGL/Fog.ts ***!
            \**************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Fog: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../colors */
              "./src/colors.ts"
            );
            class a {
              constructor(h, o = 1, d = 1e3) {
                this.name = "", this.color = new r.Color(h), this.near = o, this.far = d;
              }
              clone() {
                return new a(this.color.getHex(), this.near, this.far);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/Renderer.ts": (
          /*!*******************************!*\
            !*** ./src/WebGL/Renderer.ts ***!
            \*******************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Renderer: () => (
                /* binding */
                m
              )
              /* harmony export */
            });
            var r = t(
              /*! ./Camera */
              "./src/WebGL/Camera.ts"
            ), a = t(
              /*! ./constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), s = t(
              /*! ./constants/TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), h = t(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), o = t(
              /*! ../colors */
              "./src/colors.ts"
            ), d = t(
              /*! ./materials */
              "./src/WebGL/materials/index.ts"
            ), v = t(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            ), f = t(
              /*! ./objects */
              "./src/WebGL/objects/index.ts"
            ), y = t(
              /*! ./shaders */
              "./src/WebGL/shaders/index.ts"
            ), A = t(
              /*! ./SpritePlugin */
              "./src/WebGL/SpritePlugin.ts"
            ), x = null, M = null;
            class m {
              constructor(u) {
                this.context = null, this.devicePixelRatio = 1, this.sortObjects = !0, this.autoUpdateObjects = !0, this.autoUpdateScene = !0, this.info = {
                  memory: {
                    programs: 0,
                    geometries: 0,
                    textures: 0
                  },
                  render: {
                    calls: 0,
                    vertices: 0,
                    faces: 0,
                    points: 0
                  }
                }, this._offscreen = null, this._bitmap = null, this._programs = [], this._programs_counter = 0, this._webglversion = 1, this._currentProgram = null, this._currentMaterialId = -1, this._currentGeometryGroupHash = null, this._currentCamera = null, this._geometryGroupCounter = 0, this._oldDoubleSided = -1, this._oldFlipSided = -1, this._oldDepthTest = -1, this._oldDepthWrite = -1, this._oldPolygonOffset = null, this._oldLineWidth = null, this._viewportWidth = 0, this._viewportHeight = 0, this._currentWidth = 0, this._currentHeight = 0, this._enabledAttributes = {}, this._vector3 = new v.Vector3(), this._worldInverse = new v.Matrix4(), this._projInverse = new v.Matrix4(), this._textureMatrix = new v.Matrix4(), this._fullProjModelMatrix = new v.Matrix4(), this._fullProjModelMatrixInv = new v.Matrix4(), this._direction = new v.Vector3(), this._lightsNeedUpdate = !0, this._lights = {
                  ambient: [0, 0, 0],
                  directional: {
                    length: 0,
                    colors: [],
                    positions: []
                  },
                  point: {
                    length: 0,
                    colors: [],
                    positions: [],
                    distances: []
                  },
                  spot: {
                    length: 0,
                    colors: [],
                    positions: [],
                    distances: [],
                    directions: [],
                    anglesCos: [],
                    exponents: []
                  },
                  hemi: {
                    length: 0,
                    skyColors: [],
                    groundColors: [],
                    positions: []
                  }
                }, this.sprites = new A.SpritePlugin(), this._screenshader = null, this._AOshader = null, this._blurshader = null, this._vertexattribpos = null, this._aovertexattribpos = null, this._blurvertexattribpos = null, this._screenQuadVBO = null, this._fb = null, this._targetTexture = null, this._depthTexture = null, this._shadingTexture = null, this._scratchTexture = null, this._AOstrength = 1, this._AOradius = 5, this.SHADE_TEXTURE = 3, u = u || {}, this.row = u.row, this.col = u.col, this.rows = u.rows, this.cols = u.cols, this._canvas = u.canvas !== void 0 ? u.canvas : document.createElement("canvas"), this._precision = u.precision !== void 0 ? u.precision : "highp", this._alpha = u.alpha !== void 0 ? u.alpha : !0, this._premultipliedAlpha = u.premultipliedAlpha !== void 0 ? u.premultipliedAlpha : !0, this._antialias = u.antialias !== void 0 ? u.antialias : !1, this._preserveDrawingBuffer = u.preserveDrawingBuffer !== void 0 ? u.preserveDrawingBuffer : !1, this._clearColor = u.clearColor !== void 0 ? new o.Color(u.clearColor) : new o.Color(0), this._clearAlpha = u.clearAlpha !== void 0 ? u.clearAlpha : 0, this._outlineMaterial = new d.MeshOutlineMaterial(u.outline), this._outlineSphereImposterMaterial = new d.SphereImposterOutlineMaterial(u.outline), this._outlineStickImposterMaterial = new d.StickImposterOutlineMaterial(u.outline), this._outlineEnabled = !!u.outline, this._AOEnabled = !!u.ambientOcclusion, u.ambientOcclusion && typeof u.ambientOcclusion.strength < "u" && (this._AOstrength = parseFloat(u.ambientOcclusion.strength)), this._AOstrength == 0 && (this._AOEnabled = !1), u.ambientOcclusion && typeof u.ambientOcclusion.radius < "u" && (this._AOradius = parseFloat(u.ambientOcclusion.radius)), this.domElement = this._canvas, this._canvas.id = u.id, !(u.containerWidth == 0 || u.containerHeight == 0) && (this.initGL(), this.setDefaultGLState(), this.context = this._gl, this.isWebGL1() ? this._extInstanced = this._gl.getExtension("ANGLE_instanced_arrays") : this._extInstanced = {
                  vertexAttribDivisorANGLE: this._gl.vertexAttribDivisor.bind(this._gl),
                  drawElementsInstancedANGLE: this._gl.drawElementsInstanced.bind(this._gl)
                }, this._extFragDepth = this._gl.getExtension("EXT_frag_depth"), this._extFloatLinear = this._gl.getExtension("OES_texture_float_linear"), this._extColorBufferFloat = this._gl.getExtension("EXT_color_buffer_float"), this.sprites.init(this));
              }
              // API
              supportedExtensions() {
                return {
                  supportsAIA: !!this._extInstanced,
                  supportsImposters: !!this._extFragDepth || !this.isWebGL1(),
                  regen: !1
                };
              }
              getContext() {
                return this._gl;
              }
              getCanvas() {
                return this._canvas;
              }
              isLost() {
                return this._gl == null || this._gl.isContextLost();
              }
              getPrecision() {
                return this._precision;
              }
              setClearColorHex(u, p) {
                this._clearColor.setHex(u), this._clearAlpha = p, this.isLost() || this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha);
              }
              enableOutline(u) {
                this._outlineMaterial = new d.MeshOutlineMaterial(u), this._outlineSphereImposterMaterial = new d.SphereImposterOutlineMaterial(u), this._outlineStickImposterMaterial = new d.StickImposterOutlineMaterial(u), this._outlineEnabled = !0;
              }
              disableOutline() {
                this._outlineEnabled = !1;
              }
              enableAmbientOcclusion(u) {
                u && (u.strength && (this._AOstrength = u.strength), u.scale && (this._AOradius = u.scale)), this._AOEnabled = this._AOstrength > 0;
              }
              disableAmbientOcclusion() {
                this._AOEnabled = !1;
              }
              setViewport() {
                if (this._offscreen && (this._offscreen.width = this._canvas.width, this._offscreen.height = this._canvas.height), this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var u = this._canvas.width / this.cols, p = this._canvas.height / this.rows;
                  this._viewportWidth = u, this._viewportHeight = p, this.isLost() || (this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(u * this.col, p * this.row, u, p), this._gl.viewport(u * this.col, p * this.row, u, p));
                }
              }
              setSize(u, p) {
                if (this.devicePixelRatio = window.devicePixelRatio !== void 0 ? window.devicePixelRatio : 1, this._antialias && this.devicePixelRatio < 2 && (this.devicePixelRatio *= 2), this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var g = u / this.cols, b = p / this.rows;
                  this._canvas.width = u * this.devicePixelRatio, this._canvas.height = p * this.devicePixelRatio, this._viewportWidth = g * this.devicePixelRatio, this._viewportHeight = b * this.devicePixelRatio, this._canvas.style.width = u + "px", this._canvas.style.height = p + "px", this.setViewport();
                } else
                  this._viewportWidth = this._canvas.width = u * this.devicePixelRatio, this._viewportHeight = this._canvas.height = p * this.devicePixelRatio, this._canvas.style.width = u + "px", this._canvas.style.height = p + "px", this.isLost() || this._gl.viewport(0, 0, this._gl.drawingBufferWidth, this._gl.drawingBufferHeight);
                this.initFrameBuffer();
              }
              clear(u, p, g) {
                var b = 0;
                (u === void 0 || u) && (b |= this._gl.COLOR_BUFFER_BIT), (p === void 0 || p) && (b |= this._gl.DEPTH_BUFFER_BIT), (g === void 0 || g) && (b |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(b);
              }
              setMaterialFaces(u, p) {
                var g = u.side === a.DoubleSide, b = u.side === a.BackSide;
                u.imposter || (b = p ? !b : b), this._oldDoubleSided !== g && (g ? this._gl.disable(this._gl.CULL_FACE) : this._gl.enable(this._gl.CULL_FACE), this._oldDoubleSided = g), this._oldFlipSided !== b && (b ? this._gl.frontFace(this._gl.CW) : this._gl.frontFace(this._gl.CCW), this._oldFlipSided = b), this._gl.cullFace(this._gl.BACK);
              }
              setDepthTest(u) {
                this._oldDepthTest !== u && (u ? this._gl.enable(this._gl.DEPTH_TEST) : this._gl.disable(this._gl.DEPTH_TEST), this._oldDepthTest = u);
              }
              setDepthWrite(u) {
                this._oldDepthWrite !== u && (this._gl.depthMask(u), this._oldDepthWrite = u);
              }
              setBlending(u) {
                u ? (this._gl.enable(this._gl.BLEND), this._gl.blendEquationSeparate(this._gl.FUNC_ADD, this._gl.FUNC_ADD), this._gl.blendFuncSeparate(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA)) : this._gl.disable(this._gl.BLEND);
              }
              // TODO: need to set up shader attributes and uniforms as attributes on
              // material object after attaching prgm
              // We need to attach appropriate uniform variables to material after shaders
              // have been chosen
              initMaterial(u, p, g, b) {
                u.addEventListener("dispose", this.onMaterialDispose.bind(this));
                var c, _;
                if (_ = u.shaderID, _) {
                  var E = y.ShaderLib[_];
                  u.vertexShader = E.vertexShader, u.fragmentShader = E.fragmentShader, u.uniforms = y.ShaderUtils.clone(E.uniforms), u.shaded && u.makeShaded(this.SHADE_TEXTURE);
                }
                c = {
                  wireframe: u.wireframe,
                  fragdepth: u.imposter,
                  volumetric: u.volumetric,
                  shaded: u.shaded
                }, u.program = this.buildProgram(u.fragmentShader, u.vertexShader, u.uniforms, c);
              }
              renderBuffer(u, p, g, b, c, _) {
                if (b.visible) {
                  var E, w;
                  if (E = this.setProgram(u, p, g, b, _, this), !!E) {
                    w = E.attributes;
                    var k = !1, $ = b.wireframe ? 1 : 0, L = c.id * 16777215 + E.id * 2 + $;
                    L !== this._currentGeometryGroupHash && (this._currentGeometryGroupHash = L, k = !0), k && (this.disableAttributes(), w.position >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglVertexBuffer), this.enableAttribute(w.position), this._gl.vertexAttribPointer(w.position, 3, this._gl.FLOAT, !1, 0, 0)), w.color >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglColorBuffer), this.enableAttribute(w.color), this._gl.vertexAttribPointer(w.color, 3, this._gl.FLOAT, !1, 0, 0)), w.normal >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglNormalBuffer), this.enableAttribute(w.normal), this._gl.vertexAttribPointer(w.normal, 3, this._gl.FLOAT, !1, 0, 0)), w.offset >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglOffsetBuffer), this.enableAttribute(w.offset), this._gl.vertexAttribPointer(w.offset, 3, this._gl.FLOAT, !1, 0, 0)), w.radius >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglRadiusBuffer), this.enableAttribute(w.radius), this._gl.vertexAttribPointer(w.radius, 1, this._gl.FLOAT, !1, 0, 0)));
                    var z, F;
                    if (_ instanceof f.Mesh) {
                      if (b.shaderID === "instanced") {
                        var R = b.sphere.geometryGroups[0];
                        k && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, R.vertexArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, R.normalArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, c.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, R.faceArray, this._gl.STATIC_DRAW)), z = R.faceidx, this._extInstanced.vertexAttribDivisorANGLE(w.offset, 1), this._extInstanced.vertexAttribDivisorANGLE(w.radius, 1), this._extInstanced.vertexAttribDivisorANGLE(w.color, 1), this._extInstanced.drawElementsInstancedANGLE(this._gl.TRIANGLES, z, this._gl.UNSIGNED_SHORT, 0, c.radiusArray.length), this._extInstanced.vertexAttribDivisorANGLE(w.offset, 0), this._extInstanced.vertexAttribDivisorANGLE(w.radius, 0), this._extInstanced.vertexAttribDivisorANGLE(w.color, 0);
                      } else b.wireframe ? (F = c.lineidx, this.setLineWidth(b.wireframeLinewidth), k && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, c.__webglLineBuffer), this._gl.drawElements(this._gl.LINES, F, this._gl.UNSIGNED_SHORT, 0)) : (z = c.faceidx, k && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, c.__webglFaceBuffer), this._gl.drawElements(this._gl.TRIANGLES, z, this._gl.UNSIGNED_SHORT, 0));
                      this.info.render.calls++, this.info.render.vertices += z, this.info.render.faces += z / 3;
                    } else _ instanceof f.Line && (F = c.vertices, this.setLineWidth(b.linewidth), this._gl.drawArrays(this._gl.LINES, 0, F), this.info.render.calls++);
                  }
                }
              }
              /* clear out the shading textures */
              clearShading() {
                this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadingTexture, 0), this.clear(!1, !0, !1), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._depthTexture, 0);
              }
              /* Setup the shading buffer to reflect desired shading (ambient occlusion) values.
                Only the matching object with materialType are considered. */
              setShading(u, p, g) {
                let b = u.__lights, c = u.fog, _ = [];
                for (let k = 0, $ = u.__webglObjects.length; k < $; k++) {
                  let L = u.__webglObjects[k];
                  L.render && L[g] && _.push(L);
                }
                if (_.length == 0)
                  return;
                this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadingTexture, 0), this._gl.framebufferTexture2D(
                  this._gl.FRAMEBUFFER,
                  this._gl.COLOR_ATTACHMENT0,
                  this._gl.TEXTURE_2D,
                  null,
                  //don't write colors (can we do this?)
                  0
                ), this.renderObjects(u.__webglObjects, !0, g + "Depth", p, b, c, !1), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._scratchTexture, 0), this.clear(!1, !0, !1), this._gl.useProgram(this._AOshader), this._currentProgram = this._AOshader, this.setDepthTest(-1), this.setDepthWrite(-1);
                let E = this._AOshader.uniforms;
                this._gl.uniform1f(E.total_strength, this._AOstrength), this._gl.uniform1f(E.radius, this._AOradius), this._fullProjModelMatrix = new v.Matrix4(), this._fullProjModelMatrixInv = new v.Matrix4();
                let w = _[0].object;
                this._fullProjModelMatrix.multiplyMatrices(p.projectionMatrix, w._modelViewMatrix), this._fullProjModelMatrixInv.getInverse(this._fullProjModelMatrix), this._gl.uniformMatrix4fv(E.projectionMatrix, !1, this._fullProjModelMatrix.elements), this._gl.uniformMatrix4fv(E.projinv, !1, this._fullProjModelMatrixInv.elements), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._screenQuadVBO), this._gl.enableVertexAttribArray(this._aovertexattribpos), this._gl.vertexAttribPointer(this._aovertexattribpos, 2, this._gl.FLOAT, !1, 0, 0), this._gl.activeTexture(this._gl.TEXTURE0), this._gl.bindTexture(this._gl.TEXTURE_2D, this._shadingTexture), this._gl.drawArrays(this._gl.TRIANGLES, 0, 6), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadingTexture, 0), this.clear(!1, !0, !1), this._gl.useProgram(this._blurshader), this._currentProgram = this._blurshader, this.setDepthTest(-1), this.setDepthWrite(-1), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._screenQuadVBO), this._gl.enableVertexAttribArray(this._blurvertexattribpos), this._gl.vertexAttribPointer(this._blurvertexattribpos, 2, this._gl.FLOAT, !1, 0, 0), this._gl.activeTexture(this._gl.TEXTURE0), this._gl.bindTexture(this._gl.TEXTURE_2D, this._scratchTexture), this._gl.drawArrays(this._gl.TRIANGLES, 0, 6), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._targetTexture, 0), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._depthTexture, 0);
              }
              render(u, p) {
                if (!(p instanceof r.Camera)) {
                  console.error("Renderer.render: camera is not an instance of Camera.");
                  return;
                }
                var g, b, c, _, E, w = u.__lights, k = u.fog;
                if (this._currentMaterialId = -1, this._lightsNeedUpdate = !0, this.autoUpdateScene && u.updateMatrixWorld(), p.parent === void 0 && p.updateMatrixWorld(), p.matrixWorldInverse.getInverse(p.matrixWorld), this.isLost())
                  return;
                this.autoUpdateObjects && this.initWebGLObjects(u), this.info.render.calls = 0, this.info.render.vertices = 0, this.info.render.faces = 0, this.info.render.points = 0, this._currentWidth = this._viewportWidth, this._currentHeight = this._viewportHeight, this.setViewport(), this.setFrameBuffer(), this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha), this.clear(!0, !0, !0), E = u.__webglObjects;
                let $ = !1, L = this._AOEnabled;
                for (g = 0, b = E.length; g < b; g++)
                  c = E[g], _ = c.object, c.render = !1, _.visible && (this.setupMatrices(_, p), this.unrollBufferMaterial(c), c.render = !0, c.volumetric && ($ = !0), c.hasAO && (L = !0));
                if (this.setBlending(!1), L && this.setShading(u, p, "opaque"), this.renderObjects(u.__webglObjects, !0, "opaque", p, w, k, !1), L && this.clearShading(), this.renderSprites(u, p, !1), this.renderObjects(u.__webglObjects, !0, "transparentDepth", p, w, k, !0), this.renderObjects(u.__webglObjects, !1, "transparent", p, w, k, !0), $ && this._fb && (this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, null, 0), this.renderObjects(u.__webglObjects, !1, "volumetric", p, w, k, !0)), this.renderFrameBuffertoScreen(), this.setDepthTest(!0), this.setDepthWrite(!0), this.renderSprites(u, p, !0), this._bitmap) {
                  const z = this._offscreen.transferToImageBitmap();
                  this._bitmap.transferFromImageBitmap(z);
                }
              }
              //setup framebuffer for drawing into, assumes buffers already allocated
              setFrameBuffer() {
                if (this.isWebGL1() || !this._fb)
                  return;
                let u = this._viewportWidth, p = this._viewportHeight;
                this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, u, p), this._gl.viewport(0, 0, u, p), this._gl.bindTexture(this._gl.TEXTURE_2D, this._targetTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, u, p, 0, this._gl.RGBA, this._gl.UNSIGNED_BYTE, null), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.bindTexture(this._gl.TEXTURE_2D, this._depthTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.DEPTH_COMPONENT32F, u, p, 0, this._gl.DEPTH_COMPONENT, this._gl.FLOAT, null), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._shadingTexture && (this._gl.deleteTexture(this._shadingTexture), this._shadingTexture = this._gl.createTexture(), this._gl.bindTexture(this._gl.TEXTURE_2D, this._shadingTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.DEPTH_COMPONENT32F, u, p, 0, this._gl.DEPTH_COMPONENT, this._gl.FLOAT, null), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.deleteTexture(this._scratchTexture), this._scratchTexture = this._gl.createTexture(), this._gl.bindTexture(this._gl.TEXTURE_2D, this._scratchTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.DEPTH_COMPONENT32F, u, p, 0, this._gl.DEPTH_COMPONENT, this._gl.FLOAT, null), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE)), this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._fb), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._targetTexture, 0), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadingTexture, 0), this._gl.clearDepth(1), this._gl.clear(this._gl.DEPTH_BUFFER_BIT), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._depthTexture, 0);
              }
              //allocate buffers for framebuffer, needs to be called with every resize
              initFrameBuffer() {
                if (this.isWebGL1())
                  return;
                let u = this._viewportWidth, p = this._viewportHeight;
                this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, u, p), this._gl.viewport(0, 0, u, p), this._targetTexture = this._gl.createTexture(), this._depthTexture = this._gl.createTexture(), this._shadingTexture = this._gl.createTexture(), this._scratchTexture = this._gl.createTexture(), this._fb = this._gl.createFramebuffer();
                var g = this._antialias ? y.ShaderLib.screenaa : y.ShaderLib.screen;
                this._screenshader = this.buildProgram(g.fragmentShader, g.vertexShader, g.uniforms, {}), this._vertexattribpos = this._gl.getAttribLocation(this._screenshader, "vertexPosition");
                var b = [
                  // First triangle:
                  1,
                  1,
                  -1,
                  1,
                  -1,
                  -1,
                  // Second triangle:
                  -1,
                  -1,
                  1,
                  -1,
                  1,
                  1
                ];
                this._screenQuadVBO = this._gl.createBuffer(), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._screenQuadVBO), this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(b), this._gl.STATIC_DRAW);
                let c = y.ShaderLib.ssao;
                this._AOshader = this.buildProgram(c.fragmentShader, c.vertexShader, c.uniforms, {}), this._aovertexattribpos = this._gl.getAttribLocation(this._AOshader, "vertexPosition");
                let _ = y.ShaderLib.blur;
                this._blurshader = this.buildProgram(_.fragmentShader, _.vertexShader, _.uniforms, {}), this._blurvertexattribpos = this._gl.getAttribLocation(this._blurshader, "vertexPosition");
              }
              renderFrameBuffertoScreen() {
                this.isWebGL1() || this._fb === null || (this.setViewport(), this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, null), this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT), this._gl.frontFace(this._gl.CCW), this._gl.cullFace(this._gl.BACK), this._gl.useProgram(this._screenshader), this._currentProgram = this._screenshader, this.setDepthTest(-1), this.setDepthWrite(-1), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._screenQuadVBO), this._gl.enableVertexAttribArray(this._vertexattribpos), this._gl.vertexAttribPointer(this._vertexattribpos, 2, this._gl.FLOAT, !1, 0, 0), this._gl.activeTexture(this._gl.TEXTURE0), this._gl.bindTexture(this._gl.TEXTURE_2D, this._targetTexture), this._gl.drawArrays(this._gl.TRIANGLES, 0, 6));
              }
              initWebGLObjects(u) {
                if (u.__webglObjects || (u.__webglObjects = [], u.__webglObjectsImmediate = [], u.__webglSprites = [], u.__webglFlares = []), u.__objectsAdded.length) {
                  for (; u.__objectsAdded.length; )
                    this.addObject(u.__objectsAdded[0], u), u.__objectsAdded.splice(0, 1);
                  this._currentGeometryGroupHash = -1;
                }
                for (; u.__objectsRemoved.length; )
                  this.removeObject(u.__objectsRemoved[0], u), u.__objectsRemoved.splice(0, 1);
                for (var p = 0, g = u.__webglObjects.length; p < g; p++)
                  this.updateObject(u.__webglObjects[p].object);
              }
              getYRatio() {
                return this.rows !== void 0 && this.row !== void 0 ? this.rows : 1;
              }
              getXRatio() {
                return this.cols !== void 0 && this.col !== void 0 ? this.cols : 1;
              }
              getAspect(u, p) {
                (u == null || p == null) && (u = this._canvas.width, p = this._canvas.height);
                var g = u / p;
                if (this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var b = u / this.cols, c = p / this.rows;
                  g = b / c;
                }
                return g;
              }
              setTexture(u, p, g) {
                if (u.needsUpdate) {
                  u.__webglInit || (u.__webglInit = !0, u.addEventListener("dispose", this.onTextureDispose.bind(this)), u.__webglTexture = this._gl.createTexture(), this.info.memory.textures++), this._gl.activeTexture(this._gl.TEXTURE0 + p);
                  var b = g ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D;
                  this._gl.bindTexture(b, u.__webglTexture), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, u.flipY), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, u.premultiplyAlpha), this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, u.unpackAlignment), this._gl.pixelStorei(this._gl.PACK_ALIGNMENT, u.unpackAlignment);
                  var c = this.paramToGL(u.format), _ = this.paramToGL(u.type);
                  if (g)
                    this.setTextureParameters(this._gl.TEXTURE_3D, u), this._gl.texImage3D(this._gl.TEXTURE_3D, 0, this._gl.R32F, u.image.size.z, u.image.size.y, u.image.size.x, 0, this._gl.RED, this._gl.FLOAT, u.image.data);
                  else {
                    var E = u.image, w = E.width, k = E.height;
                    typeof w > "u" && (w = E.length, c == this._gl.RGBA && (w /= 4), k = 1), this.setTextureParameters(this._gl.TEXTURE_2D, u), this.isWebGL1() ? this._gl.texImage2D(this._gl.TEXTURE_2D, 0, c, c, _, u.image) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, c, w, k, 0, c, _, u.image);
                  }
                  u.needsUpdate = !1, u.onUpdate && u.onUpdate();
                } else
                  this._gl.activeTexture(this._gl.TEXTURE0 + p), g ? this._gl.bindTexture(this._gl.TEXTURE_3D, u.__webglTexture) : this._gl.bindTexture(this._gl.TEXTURE_2D, u.__webglTexture);
              }
              supportsVolumetric() {
                return !this.isWebGL1();
              }
              enableAttribute(u) {
                this._enabledAttributes[u] || (this._gl.enableVertexAttribArray(u), this._enabledAttributes[u] = !0);
              }
              disableAttributes() {
                for (let u in this._enabledAttributes)
                  this._enabledAttributes[u] && (this._gl.disableVertexAttribArray(u), this._enabledAttributes[u] = !1);
              }
              setPolygonOffset(u, p, g) {
                this._oldPolygonOffset !== u && (u ? this._gl.enable(this._gl.POLYGON_OFFSET_FILL) : this._gl.disable(this._gl.POLYGON_OFFSET_FILL));
              }
              setLineWidth(u) {
                u !== this._oldLineWidth && (this._gl.lineWidth(u), this._oldLineWidth = u);
              }
              deallocateGeometry(u) {
                if (u.__webglInit = void 0, u.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(u.__webglVertexBuffer), u.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(u.__webglColorBuffer), u.geometryGroups !== void 0)
                  for (var p = 0, g = u.groups; p < g; p++) {
                    var b = u.geometryGroups[p];
                    b.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(b.__webglVertexBuffer), b.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(b.__webglColorBuffer), b.__webglNormalBuffer !== void 0 && this._gl.deleteBuffer(b.__webglNormalBuffer), b.__webglFaceBuffer !== void 0 && this._gl.deleteBuffer(b.__webglFaceBuffer), b.__webglLineBuffer !== void 0 && this._gl.deleteBuffer(b.__webglLineBuffer);
                  }
              }
              deallocateMaterial(u) {
                var p = u.program;
                if (p !== void 0) {
                  u.program = void 0;
                  var g, b, c, _ = !1;
                  for (g = 0, b = this._programs.length; g < b; g++)
                    if (c = this._programs[g], c.program === p) {
                      c.usedTimes--, c.usedTimes === 0 && (_ = !0);
                      break;
                    }
                  if (_ === !0) {
                    var E = [];
                    for (g = 0, b = this._programs.length; g < b; g++)
                      c = this._programs[g], c.program !== p && E.push(c);
                    this._programs = E, this._gl.deleteProgram(p), this.info.memory.programs--;
                  }
                }
              }
              deallocateTexture(u) {
                if (u.image && u.image.__webglTextureCube)
                  this._gl.deleteTexture(u.image.__webglTextureCube);
                else {
                  if (!u.__webglInit)
                    return;
                  u.__webglInit = !1, this._gl.deleteTexture(u.__webglTexture);
                }
              }
              onGeometryDispose(u) {
                var p = u.target;
                p.removeEventListener("dispose", this.onGeometryDispose), this.deallocateGeometry(p), this.info.memory.geometries--;
              }
              onTextureDispose(u) {
                var p = u.target;
                p.removeEventListener("dispose", this.onTextureDispose), this.deallocateTexture(p), this.info.memory.textures--;
              }
              onMaterialDispose(u) {
                var p = u.target;
                p.removeEventListener("dispose", this.onMaterialDispose), this.deallocateMaterial(p);
              }
              // Compile and return shader
              getShader(u, p) {
                var g;
                return !this.isWebGL1() && !p.startsWith("#version") && (p = p.replace(/gl_FragDepthEXT/g, "gl_FragDepth"), u == "fragment" ? p = p.replace(/varying/g, "in") : p = p.replace(/varying/g, "out"), p = p.replace(/attribute/g, "in"), p = p.replace(/texture2D/g, "texture"), p = p.replace(/\/\/DEFINEFRAGCOLOR/g, "out vec4 glFragColor;"), p = p.replace(/gl_FragColor/g, "glFragColor"), p = `#version 300 es
` + p), u === "fragment" ? g = this._gl.createShader(this._gl.FRAGMENT_SHADER) : u === "vertex" && (g = this._gl.createShader(this._gl.VERTEX_SHADER)), g == null ? null : (this._gl.shaderSource(g, p), this._gl.compileShader(g), this._gl.getShaderParameter(g, this._gl.COMPILE_STATUS) ? g : (console.error(this._gl.getShaderInfoLog(g)), console.error("could not initialize shader"), null));
              }
              // Compile appropriate shaders (if necessary) from source code and attach to
              // gl program.
              buildProgram(u, p, g, b) {
                var c, _, E, w, k = [];
                k.push(u), k.push(p);
                for (c in b)
                  k.push(c), k.push(b[c]);
                for (w = k.join(), c = 0, _ = this._programs.length; c < _; c++) {
                  var $ = this._programs[c];
                  if ($.code === w)
                    return $.usedTimes++, $.program;
                }
                if (this.isWebGL1() && b.volumetric)
                  throw new Error("Volumetric rendering requires webgl2 which is not supported by your hardware.");
                if (E = this._gl.createProgram(), E == null)
                  return null;
                var L = this._precision, z = "precision " + L + " float;", F = [
                  b.volumetric ? "#version 300 es" : "",
                  z
                ].join(`
`), R = [
                  b.volumetric ? "#version 300 es" : "",
                  b.fragdepth && this.isWebGL1() ? "#extension GL_EXT_frag_depth: enable" : "",
                  b.shaded ? "#define SHADED 1" : "",
                  b.wireframe ? "#define WIREFRAME 1" : "",
                  z
                ].join(`
`), P = this.getShader("fragment", R + u), U = this.getShader("vertex", F + p);
                U != null && this._gl.attachShader(E, U), P != null && this._gl.attachShader(E, P), this._gl.linkProgram(E), this._gl.getProgramParameter(E, this._gl.LINK_STATUS) || console.error("Could not initialize shader"), E.uniforms = {}, E.attributes = {};
                var N, B, W;
                N = [
                  "viewMatrix",
                  "modelViewMatrix",
                  "projectionMatrix",
                  "normalMatrix",
                  "vWidth",
                  "vHeight"
                ];
                for (B in g)
                  N.push(B);
                for (W = 0; W < N.length; W++) {
                  var V = N[W];
                  E.uniforms[V] = this._gl.getUniformLocation(E, V);
                }
                for (N = [
                  "position",
                  "normal",
                  "color",
                  "lineDistance",
                  "offset",
                  "radius"
                ], W = 0; W < N.length; W++) {
                  var G = N[W];
                  E.attributes[G] = this._gl.getAttribLocation(E, G);
                }
                return E.id = this._programs_counter++, this._programs.push({
                  program: E,
                  code: w,
                  usedTimes: 1
                }), this.info.memory.programs = this._programs.length, E;
              }
              setProgram(u, p, g, b, c, _) {
                if (b.needsUpdate && (b.program && this.deallocateMaterial(b), this.initMaterial(b, p, g, c), b.needsUpdate = !1), b.program == null)
                  return null;
                var E = !1, w = b.program, k = w.uniforms, $ = b.uniforms;
                if (w != this._currentProgram && (this._gl.useProgram(w), this._currentProgram = w, E = !0), b.id != this._currentMaterialId && (this._currentMaterialId = b.id, E = !0), u != this._currentCamera && (this._currentCamera = u, E = !0), k.projectionMatrix && this._gl.uniformMatrix4fv(k.projectionMatrix, !1, u.projectionMatrix.elements), k.modelViewMatrix && this._gl.uniformMatrix4fv(k.modelViewMatrix, !1, c._modelViewMatrix.elements), k.normalMatrix && this._gl.uniformMatrix3fv(k.normalMatrix, !1, c._normalMatrix.elements), k.projinv && (this._projInverse.getInverse(u.projectionMatrix), this._gl.uniformMatrix4fv(k.projinv, !1, this._projInverse.elements)), k.viewMatrix && this._gl.uniformMatrix4fv(k.viewMatrix, !1, u.matrixWorldInverse.elements), k.vWidth && this._gl.uniform1f(k.vWidth, this._viewportWidth), k.vHeight && this._gl.uniform1f(k.vHeight, this._viewportHeight), E) {
                  if ($.fogColor.value = g.color, $.fogNear.value = g.near, $.fogFar.value = g.far, b.shaderID.startsWith("lambert") || b.shaderID === "instanced" || b.shaderID.endsWith("imposter"))
                    this._lightsNeedUpdate && (this.setupLights(w, p), this._lightsNeedUpdate = !1), $.directionalLightColor.value = this._lights.directional.colors, $.directionalLightDirection.value = this._lights.directional.positions;
                  else if (b.shaderID.endsWith("outline"))
                    $.outlineColor.value = b.outlineColor, $.outlineWidth.value = b.outlineWidth, $.outlinePushback.value = b.outlinePushback, $.outlineMaxPixels.value = b.outlineMaxPixels * this.devicePixelRatio;
                  else if (b.shaderID === "volumetric") {
                    c._modelViewMatrix.getScale(this._direction), this._worldInverse.getInverse(c._modelViewMatrix), this._projInverse.getInverse(u.projectionMatrix), this._textureMatrix.multiplyMatrices(c.material.texmatrix, this._worldInverse), this._gl.uniformMatrix4fv(k.textmat, !1, this._textureMatrix.elements), this._gl.uniformMatrix4fv(k.projinv, !1, this._projInverse.elements);
                    let L = Math.min(Math.min(this._direction.x, this._direction.y), this._direction.z);
                    $.step.value = c.material.unit * L, $.maxdepth.value = c.material.maxdepth * L, $.transfermax.value = c.material.transfermax, $.transfermin.value = c.material.transfermin, $.subsamples.value = c.material.subsamples, _.setTexture(c.material.transferfn, 4, !1), _.setTexture(c.material.map, 3, !0), this._gl.activeTexture(this._gl.TEXTURE5), this._gl.bindTexture(this._gl.TEXTURE_2D, this._depthTexture);
                  }
                  $.opacity.value = b.opacity, this.loadMaterialUniforms(k, $);
                }
                return $.shading && ($.shading.value == 3 ? (this._gl.activeTexture(this._gl.TEXTURE0 + this.SHADE_TEXTURE), this._gl.bindTexture(this._gl.TEXTURE_2D, this._shadingTexture)) : console.error("Invalid shading textures.")), w;
              }
              loadMaterialUniforms(u, p) {
                var g, b, c, _;
                for (g in p)
                  u[g] && (b = p[g].type, c = p[g].value, _ = u[g], b === "f" ? this._gl.uniform1f(_, c) : b === "i" ? this._gl.uniform1i(_, c) : b === "fv" ? this._gl.uniform3fv(_, c) : b === "c" ? this._gl.uniform3f(_, c.r, c.g, c.b) : b === "f4" && this._gl.uniform4f(_, c[0], c[1], c[2], c[3]));
              }
              // Objects adding
              addObject(u, p) {
                var g, b, c, _;
                if (!u.__webglInit && (u.__webglInit = !0, u._modelViewMatrix = new v.Matrix4(), u._normalMatrix = new v.Matrix3(), u.geometry !== void 0 && u.geometry.__webglInit === void 0 && (u.geometry.__webglInit = !0, u.geometry.addEventListener("dispose", this.onGeometryDispose.bind(this))), u instanceof f.Mesh || u instanceof f.Line))
                  for (c = u.geometry, g = 0, b = c.geometryGroups.length; g < b; g++)
                    _ = c.geometryGroups[g], _.id = this._geometryGroupCounter++, _.__webglVertexBuffer || (u instanceof f.Mesh ? (this.createMeshBuffers(_), c.elementsNeedUpdate = !0, c.normalsNeedUpdate = !0) : u instanceof f.Line && this.createLineBuffers(_), c.verticesNeedUpdate = !0, c.colorsNeedUpdate = !0);
                if (!u.__webglActive) {
                  if (u instanceof f.Mesh || u instanceof f.Line)
                    for (c = u.geometry, g = 0, b = c.geometryGroups.length; g < b; g++)
                      _ = c.geometryGroups[g], this.addBuffer(p.__webglObjects, _, u);
                  else u instanceof f.Sprite && p.__webglSprites.push(u);
                  u.__webglActive = !0;
                }
              }
              updateObject(u) {
                var p = u.geometry, g;
                if (u instanceof f.Mesh || u instanceof f.Line) {
                  for (var b = 0, c = p.geometryGroups.length; b < c; b++)
                    g = p.geometryGroups[b], (p.verticesNeedUpdate || p.elementsNeedUpdate || p.colorsNeedUpdate || p.normalsNeedUpdate) && this.setBuffers(g, this._gl.STATIC_DRAW);
                  p.verticesNeedUpdate = !1, p.elementsNeedUpdate = !1, p.normalsNeedUpdate = !1, p.colorsNeedUpdate = !1, p.buffersNeedUpdate = !1;
                }
              }
              removeObject(u, p) {
                u instanceof f.Mesh || u instanceof f.Line ? this.removeInstances(p.__webglObjects, u) : u instanceof f.Sprite && this.removeInstancesDirect(p.__webglSprites, u), u.__webglActive = !1;
              }
              removeInstances(u, p) {
                for (var g = u.length - 1; g >= 0; --g)
                  u[g].object === p && u.splice(g, 1);
              }
              removeInstancesDirect(u, p) {
                for (var g = u.length - 1; g >= 0; --g)
                  u[g] === p && u.splice(g, 1);
              }
              unrollBufferMaterial(u) {
                var p = u.object, g = p.material;
                if (g.volumetric)
                  u.opaque = null, u.transparent = null, u.volumetric = g;
                else if (g.transparent) {
                  if (u.opaque = null, u.volumetric = null, u.transparent = g, !g.wireframe) {
                    let b = g.clone();
                    b.opacity = 0, u.transparentDepth = b;
                  }
                } else {
                  if (u.opaque = g, u.transparent = null, u.volumetric = null, !g.wireframe) {
                    let b = g.clone();
                    b.opacity = 0, u.opaqueDepth = b;
                  }
                  g.hasAO && (u.hasAO = !0), (this._AOEnabled || u.hasAO) && (u.opaqueShaded = g.clone(), u.opaqueShaded.shaded = !0);
                }
              }
              setBuffers(u, p) {
                var g = u.vertexArray, b = u.colorArray;
                if (u.__webglOffsetBuffer !== void 0 ? (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, u.__webglOffsetBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, g, p)) : (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, u.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, g, p)), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, u.__webglColorBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, b, p), u.normalArray && u.__webglNormalBuffer !== void 0) {
                  var c = u.normalArray;
                  this._gl.bindBuffer(this._gl.ARRAY_BUFFER, u.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, c, p);
                }
                if (u.radiusArray && u.__webglRadiusBuffer !== void 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, u.__webglRadiusBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, u.radiusArray, p)), u.faceArray && u.__webglFaceBuffer !== void 0) {
                  var _ = u.faceArray;
                  this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, u.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, _, p);
                }
                if (u.lineArray && u.__webglLineBuffer !== void 0) {
                  var E = u.lineArray;
                  this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, u.__webglLineBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, E, p);
                }
              }
              // Creates appropriate gl buffers for geometry chunk
              // TODO: do we need line buffer for mesh objects?
              // Also, can we integrate this with createLineBuffers?
              createMeshBuffers(u) {
                u.radiusArray && (u.__webglRadiusBuffer = this._gl.createBuffer()), u.useOffset && (u.__webglOffsetBuffer = this._gl.createBuffer()), u.__webglVertexBuffer = this._gl.createBuffer(), u.__webglNormalBuffer = this._gl.createBuffer(), u.__webglColorBuffer = this._gl.createBuffer(), u.__webglFaceBuffer = this._gl.createBuffer(), u.__webglLineBuffer = this._gl.createBuffer(), this.info.memory.geometries++;
              }
              createLineBuffers(u) {
                u.__webglVertexBuffer = this._gl.createBuffer(), u.__webglColorBuffer = this._gl.createBuffer(), this.info.memory.geometries++;
              }
              addBuffer(u, p, g) {
                u.push({
                  buffer: p,
                  object: g,
                  opaque: null,
                  transparent: null
                });
              }
              setupMatrices(u, p) {
                u._modelViewMatrix.multiplyMatrices(p.matrixWorldInverse, u.matrixWorld), u._normalMatrix.getInverse(u._modelViewMatrix), u._normalMatrix.transpose();
              }
              // Fallback filters for non-power-of-2 textures
              filterFallback(u) {
                return this._gl.LINEAR;
              }
              setTextureParameters(u, p) {
                u == this._gl.TEXTURE_2D ? (this._gl.texParameteri(u, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(u, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(u, this._gl.TEXTURE_MAG_FILTER, this.filterFallback(p.magFilter)), this._gl.texParameteri(u, this._gl.TEXTURE_MIN_FILTER, this.filterFallback(p.minFilter))) : (this._gl.texParameteri(u, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(u, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(u, this._gl.TEXTURE_WRAP_R, this._gl.CLAMP_TO_EDGE), this._extColorBufferFloat && this._extFloatLinear ? (this._gl.texParameteri(u, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(u, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR)) : (this._gl.texParameteri(u, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(u, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST)));
              }
              // Map constants to WebGL constants
              paramToGL(u) {
                return u === s.UnsignedByteType ? this._gl.UNSIGNED_BYTE : u === s.RGBAFormat ? this._gl.RGBA : u === s.NearestFilter ? this._gl.NEAREST : 0;
              }
              setupLights(u, p) {
                var g, b, c, _ = 0, E = 0, w = 0, k, $, L = this._lights, z = L.directional.colors, F = L.directional.positions, R = 0, P = 0;
                for (g = 0, b = p.length; g < b; g++)
                  if (c = p[g], k = c.color, $ = c.intensity, c instanceof h.Light) {
                    if (this._direction.getPositionFromMatrix(c.matrixWorld), this._vector3.getPositionFromMatrix(c.target.matrixWorld), this._direction.sub(this._vector3), this._direction.normalize(), this._direction.x === 0 && this._direction.y === 0 && this._direction.z === 0)
                      continue;
                    F[P] = this._direction.x, F[P + 1] = this._direction.y, F[P + 2] = this._direction.z, z[P] = k.r * $, z[P + 1] = k.g * $, z[P + 2] = k.b * $, P += 3, R++;
                  }
                L.ambient[0] = _, L.ambient[1] = E, L.ambient[2] = w, L.directional.length = R;
              }
              initGL() {
                try {
                  if (OffscreenCanvas && !(this.rows != null && this.cols != null && this.row != null && this.col != null))
                    (M == null || M.isContextLost()) && (x = new OffscreenCanvas(this._canvas.width, this._canvas.height), M = x.getContext("webgl2", {
                      alpha: !0,
                      premultipliedAlpha: this._premultipliedAlpha,
                      antialias: this._antialias,
                      preserveDrawingBuffer: this._preserveDrawingBuffer
                    })), this._offscreen = x, this._gl = M, this._bitmap = this._canvas.getContext("bitmaprenderer", {
                      alpha: !0
                    });
                  else if (!(this._gl = this._canvas.getContext("webgl2", {
                    alpha: this._alpha,
                    premultipliedAlpha: this._premultipliedAlpha,
                    antialias: this._antialias,
                    preserveDrawingBuffer: this._preserveDrawingBuffer
                  })) && !(this._gl = this._canvas.getContext("experimental-webgl", {
                    alpha: this._alpha,
                    premultipliedAlpha: this._premultipliedAlpha,
                    antialias: this._antialias,
                    preserveDrawingBuffer: this._preserveDrawingBuffer
                  })) && !(this._gl = this._canvas.getContext("webgl", {
                    alpha: this._alpha,
                    premultipliedAlpha: this._premultipliedAlpha,
                    antialias: this._antialias,
                    preserveDrawingBuffer: this._preserveDrawingBuffer
                  })))
                    throw "Error creating WebGL context.";
                  var u = this._gl.getParameter(this._gl.VERSION);
                  this._webglversion = parseInt(u[6]);
                } catch (p) {
                  console.error(p);
                }
              }
              isWebGL1() {
                return this._webglversion == 1;
              }
              setDefaultGLState() {
                this._gl.clearDepth(1), this._gl.clearStencil(0), this._gl.enable(this._gl.DEPTH_TEST), this._gl.depthFunc(this._gl.LEQUAL), this._gl.frontFace(this._gl.CCW), this._gl.cullFace(this._gl.BACK), this._gl.enable(this._gl.CULL_FACE), this._gl.enable(this._gl.BLEND), this._gl.blendEquation(this._gl.FUNC_ADD), this._gl.blendFunc(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA), this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha);
              }
              // rendering
              renderObjects(u, p, g, b, c, _, E) {
                var w, k, $, L, z, F, R;
                p ? (z = u.length - 1, F = -1, R = -1) : (z = 0, F = u.length, R = 1);
                for (var P = z; P !== F; P += R)
                  if (w = u[P], w.render) {
                    if (k = w.object, $ = w.buffer, L = w[g], (w.hasAO || this._AOEnabled) && w[g + "Shaded"] && (L = w[g + "Shaded"]), !L)
                      continue;
                    E && this.setBlending(!0), this.setDepthTest(L.depthTest), this.setDepthWrite(L.depthWrite), this.setPolygonOffset(L.polygonOffset, L.polygonOffsetFactor, L.polygonOffsetUnits);
                    var U = k._modelViewMatrix.isReflected();
                    if (this.setMaterialFaces(L, U), this.renderBuffer(b, c, _, L, $, k), (this._outlineEnabled || L.outline) && !L.wireframe && L.shaderID !== "basic" && L.opacity !== 0) {
                      let N = this._outlineMaterial;
                      L.shaderID == "sphereimposter" ? N = this._outlineSphereImposterMaterial : L.shaderID == "stickimposter" && (N = this._outlineStickImposterMaterial), this.renderBuffer(b, c, _, N, $, k);
                    }
                  }
              }
              renderSprites(u, p, g) {
                this._currentGeometryGroupHash = -1, this._currentProgram = null, this._currentCamera = null, this._oldDepthWrite = -1, this._oldDepthTest = -1, this._oldDoubleSided = -1, this._currentMaterialId = -1, this._oldFlipSided = -1, this._lightsNeedUpdate = !0, this.sprites.render(u, p, this._currentWidth, this._currentHeight, g), this._currentGeometryGroupHash = -1, this._currentProgram = null, this._currentCamera = null, this._oldDepthWrite = -1, this._oldDepthTest = -1, this._oldDoubleSided = -1, this._currentMaterialId = -1, this._oldFlipSided = -1;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/SpritePlugin.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/SpritePlugin.ts ***!
            \***********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SpritePlugin: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./shaders/index */
              "./src/WebGL/shaders/index.ts"
            );
            class a {
              constructor() {
                this.sprite = {
                  vertices: null,
                  faces: null,
                  vertexBuffer: null,
                  elementBuffer: null,
                  program: null,
                  attributes: {},
                  uniforms: null
                };
              }
              init(o) {
                this.gl = o.context, this.renderer = o, this.precision = o.getPrecision(), this.sprite.vertices = new Float32Array(16), this.sprite.faces = new Uint16Array(6);
                var d = 0;
                this.sprite.vertices[d++] = -1, this.sprite.vertices[d++] = -1, this.sprite.vertices[d++] = 0, this.sprite.vertices[d++] = 0, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = -1, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = 0, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = -1, this.sprite.vertices[d++] = 1, this.sprite.vertices[d++] = 0, this.sprite.vertices[d++] = 1, d = 0, this.sprite.faces[d++] = 0, this.sprite.faces[d++] = 1, this.sprite.faces[d++] = 2, this.sprite.faces[d++] = 0, this.sprite.faces[d++] = 2, this.sprite.faces[d++] = 3, this.sprite.vertexBuffer = this.gl.createBuffer(), this.sprite.elementBuffer = this.gl.createBuffer(), this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.sprite.vertexBuffer), this.gl.bufferData(this.gl.ARRAY_BUFFER, this.sprite.vertices, this.gl.STATIC_DRAW), this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.elementBuffer), this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.faces, this.gl.STATIC_DRAW), this.sprite.program = this.createProgram(
                  r.ShaderLib.sprite,
                  this.precision || 1
                  /** added default to single precision */
                ), this.sprite.attributes = {};
                const v = {};
                this.sprite.attributes.position = this.gl.getAttribLocation(this.sprite.program, "position"), this.sprite.attributes.uv = this.gl.getAttribLocation(this.sprite.program, "uv"), v.uvOffset = this.gl.getUniformLocation(this.sprite.program, "uvOffset"), v.uvScale = this.gl.getUniformLocation(this.sprite.program, "uvScale"), v.rotation = this.gl.getUniformLocation(this.sprite.program, "rotation"), v.scale = this.gl.getUniformLocation(this.sprite.program, "scale"), v.alignment = this.gl.getUniformLocation(this.sprite.program, "alignment"), v.color = this.gl.getUniformLocation(this.sprite.program, "color"), v.map = this.gl.getUniformLocation(this.sprite.program, "map"), v.opacity = this.gl.getUniformLocation(this.sprite.program, "opacity"), v.useScreenCoordinates = this.gl.getUniformLocation(this.sprite.program, "useScreenCoordinates"), v.screenPosition = this.gl.getUniformLocation(this.sprite.program, "screenPosition"), v.modelViewMatrix = this.gl.getUniformLocation(this.sprite.program, "modelViewMatrix"), v.projectionMatrix = this.gl.getUniformLocation(this.sprite.program, "projectionMatrix"), v.fogType = this.gl.getUniformLocation(this.sprite.program, "fogType"), v.fogDensity = this.gl.getUniformLocation(this.sprite.program, "fogDensity"), v.fogNear = this.gl.getUniformLocation(this.sprite.program, "fogNear"), v.fogFar = this.gl.getUniformLocation(this.sprite.program, "fogFar"), v.fogColor = this.gl.getUniformLocation(this.sprite.program, "fogColor"), v.alphaTest = this.gl.getUniformLocation(this.sprite.program, "alphaTest"), this.sprite.uniforms = v;
              }
              render(o, d, v, f, y) {
                var A, x, M, m, l, u, p, g, b, c;
                if (!this.gl)
                  throw new Error("WebGLRenderer not initialized");
                let _ = [];
                (A = o?.__webglSprites) === null || A === void 0 || A.forEach((Q) => {
                  (y && Q.material.depthTest == !1 || !y && Q.material.depthTest) && _.push(Q);
                });
                let E = _.length;
                if (!E)
                  return;
                const w = this.sprite.attributes, k = this.sprite.uniforms;
                if (!k)
                  throw new Error("Uniforms not defined");
                var $ = v * 0.5, L = f * 0.5;
                this.gl.useProgram(this.sprite.program), this.gl.enableVertexAttribArray(w.position), this.gl.enableVertexAttribArray(w.uv), this.gl.disable(this.gl.CULL_FACE), this.gl.enable(this.gl.BLEND), this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.sprite.vertexBuffer), this.gl.vertexAttribPointer(w.position, 2, this.gl.FLOAT, !1, 16, 0), this.gl.vertexAttribPointer(w.uv, 2, this.gl.FLOAT, !1, 16, 8), this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.elementBuffer), this.gl.uniformMatrix4fv(k.projectionMatrix, !1, d.projectionMatrix.elements), this.gl.activeTexture(this.gl.TEXTURE0), this.gl.uniform1i(k.map, 0);
                var z = 0, F = 0, R = o.fog;
                R ? (this.gl.uniform3f(k.fogColor, R.color.r, R.color.g, R.color.b), this.gl.uniform1f(k.fogNear, R.near), this.gl.uniform1f(k.fogFar, R.far), this.gl.uniform1i(k.fogType, 1), z = 1, F = 1) : (this.gl.uniform1i(k.fogType, 0), z = 0, F = 0);
                var P;
                let U, N, B, W, V = [];
                for (P = 0; P < E; P++)
                  U = _[P], N = U.material, N && (N.depthTest == !1 && !y || !U.visible || N.opacity === 0 || (N.useScreenCoordinates ? U.z = -U.position.z : (U._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse, U.matrixWorld), U.z = -U._modelViewMatrix.elements[14])));
                for (_.sort(s), P = 0; P < E; P++)
                  if (U = _[P], N = U.material, !!N && !(!U.visible || N.opacity === 0) && N.map && N.map.image && N.map.image.width) {
                    this.gl.uniform1f(k?.alphaTest || null, N.alphaTest);
                    var G = N.map.image.width, H = N.map.image.height;
                    V[0] = G * this.renderer.devicePixelRatio / v, V[1] = H * this.renderer.devicePixelRatio / f, N.useScreenCoordinates === !0 ? (this.gl.uniform1i(k.useScreenCoordinates, 1), this.gl.uniform3f(k.screenPosition, (U.position.x * this.renderer.devicePixelRatio - $) / $, (L - U.position.y * this.renderer.devicePixelRatio) / L, Math.max(0, Math.min(1, U.position.z)))) : (this.gl.uniform1i(k.useScreenCoordinates, 0), this.gl.uniformMatrix4fv(k.modelViewMatrix, !1, U._modelViewMatrix.elements)), o.fog && N.fog ? W = F : W = 0, z !== W && (this.gl.uniform1i(k.fogType, W), z = W), B = 1 / (N.scaleByViewport ? f : 1), V[0] *= B * U.scale.x, V[1] *= B * U.scale.y;
                    let Q = (x = N?.alignment) === null || x === void 0 ? void 0 : x.x, te = (M = N?.alignment) === null || M === void 0 ? void 0 : M.y;
                    N.screenOffset && (Q = (Q || 0) + 2 * N.screenOffset.x / G, te = (te || 0) + 2 * N.screenOffset.y / H), this.gl.uniform2f(k.uvScale, ((m = N?.uvScale) === null || m === void 0 ? void 0 : m.x) || 1, ((l = N?.uvScale) === null || l === void 0 ? void 0 : l.y) || 1), this.gl.uniform2f(k.uvOffset, ((u = N?.uvOffset) === null || u === void 0 ? void 0 : u.x) || 0, ((p = N?.uvOffset) === null || p === void 0 ? void 0 : p.y) || 0), this.gl.uniform2f(k.alignment, Q || 0, te || 0), this.gl.uniform1f(k.opacity, N.opacity), this.gl.uniform3f(k.color, ((g = N?.color) === null || g === void 0 ? void 0 : g.r) || 0, ((b = N?.color) === null || b === void 0 ? void 0 : b.g) || 0, ((c = N?.color) === null || c === void 0 ? void 0 : c.b) || 0), this.gl.uniform1f(k.rotation, U.rotation), this.gl.uniform2fv(k.scale, V), this.renderer.setDepthTest(N.depthTest), this.renderer.setDepthWrite(N.depthWrite), this.renderer.setTexture(N.map, 0), this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);
                  }
                this.gl.enable(this.gl.CULL_FACE);
              }
              createProgram(o, d) {
                if (!this.gl)
                  throw new Error("WebGL Rendering context not found");
                var v = this.gl.createProgram();
                if (!v)
                  throw new Error("Error creating webgl program");
                var f = this.gl.createShader(this.gl.FRAGMENT_SHADER), y = this.gl.createShader(this.gl.VERTEX_SHADER);
                if (!f)
                  throw new Error("Unable to create fragment shader SpritePlugin.createProgram");
                if (!y)
                  throw new Error("Unable to create vertex shader SpritePlugin.createProgram");
                var A = "precision " + d + ` float;
`;
                if (this.gl.shaderSource(f, A + o.fragmentShader), this.gl.shaderSource(y, A + o.vertexShader), this.gl.compileShader(f), this.gl.compileShader(y), !this.gl.getShaderParameter(f, this.gl.COMPILE_STATUS) || !this.gl.getShaderParameter(y, this.gl.COMPILE_STATUS))
                  throw new Error(`Error compiling shader: 
      ${this.gl.getShaderInfoLog(f)} 
      ${this.gl.getShaderInfoLog(y)}`);
                return this.gl.attachShader(v, f), this.gl.attachShader(v, y), this.gl.linkProgram(v), this.gl.getProgramParameter(v, this.gl.LINK_STATUS) || console.error("Could not initialize shader"), v;
              }
            }
            function s(h, o) {
              return h.z !== o.z ? o.z - h.z : o.id - h.id;
            }
          }
        ),
        /***/
        "./src/WebGL/constants/Coloring.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/constants/Coloring.ts ***!
            \*****************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Coloring: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            var r;
            (function(a) {
              a[a.NoColors = 0] = "NoColors", a[a.FaceColors = 1] = "FaceColors", a[a.VertexColors = 2] = "VertexColors";
            })(r || (r = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/Shading.ts": (
          /*!****************************************!*\
            !*** ./src/WebGL/constants/Shading.ts ***!
            \****************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Shading: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            var r;
            (function(a) {
              a[a.NoShading = 0] = "NoShading", a[a.FlatShading = 1] = "FlatShading", a[a.SmoothShading = 2] = "SmoothShading";
            })(r || (r = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/Sides.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/constants/Sides.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BackSide: () => (
                /* binding */
                a
              ),
              /* harmony export */
              DoubleSide: () => (
                /* binding */
                s
              ),
              /* harmony export */
              FrontSide: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = 0, a = 1, s = 2;
          }
        ),
        /***/
        "./src/WebGL/constants/SpriteAlignment.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/constants/SpriteAlignment.ts ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SpriteAlignment: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const a = {
              topLeft: new r.Vector2(1, -1),
              topCenter: new r.Vector2(0, -1),
              topRight: new r.Vector2(-1, -1),
              centerLeft: new r.Vector2(1, 0),
              center: new r.Vector2(0, 0),
              centerRight: new r.Vector2(-1, 0),
              bottomLeft: new r.Vector2(1, 1),
              bottomCenter: new r.Vector2(0, 1),
              bottomRight: new r.Vector2(-1, 1)
            };
          }
        ),
        /***/
        "./src/WebGL/constants/TextureConstants.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/constants/TextureConstants.ts ***!
            \*************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* binding */
                r
              ),
              /* harmony export */
              FloatType: () => (
                /* binding */
                d
              ),
              /* harmony export */
              LinearFilter: () => (
                /* binding */
                a
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* binding */
                h
              ),
              /* harmony export */
              NearestFilter: () => (
                /* binding */
                s
              ),
              /* harmony export */
              R32Format: () => (
                /* binding */
                y
              ),
              /* harmony export */
              RFormat: () => (
                /* binding */
                f
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* binding */
                v
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            const r = 1001, a = 1006, s = 1007, h = 1008, o = 1009, d = 1010, v = 1021, f = 1022, y = 1023;
          }
        ),
        /***/
        "./src/WebGL/constants/TextureOperations.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/constants/TextureOperations.ts ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              TextureOperations: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            var r;
            (function(a) {
              a[a.MultiplyOperation = 0] = "MultiplyOperation", a[a.MixOperation = 1] = "MixOperation", a[a.AddOperation = 2] = "AddOperation";
            })(r || (r = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/index.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/constants/index.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BackSide: () => (
                /* reexport safe */
                a.BackSide
              ),
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* reexport safe */
                o.ClampToEdgeWrapping
              ),
              /* harmony export */
              Coloring: () => (
                /* reexport safe */
                r.Coloring
              ),
              /* harmony export */
              DoubleSide: () => (
                /* reexport safe */
                a.DoubleSide
              ),
              /* harmony export */
              FloatType: () => (
                /* reexport safe */
                o.FloatType
              ),
              /* harmony export */
              FrontSide: () => (
                /* reexport safe */
                a.FrontSide
              ),
              /* harmony export */
              LinearFilter: () => (
                /* reexport safe */
                o.LinearFilter
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* reexport safe */
                o.LinearMipMapLinearFilter
              ),
              /* harmony export */
              NearestFilter: () => (
                /* reexport safe */
                o.NearestFilter
              ),
              /* harmony export */
              R32Format: () => (
                /* reexport safe */
                o.R32Format
              ),
              /* harmony export */
              RFormat: () => (
                /* reexport safe */
                o.RFormat
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* reexport safe */
                o.RGBAFormat
              ),
              /* harmony export */
              Shading: () => (
                /* reexport safe */
                s.Shading
              ),
              /* harmony export */
              SpriteAlignment: () => (
                /* reexport safe */
                h.SpriteAlignment
              ),
              /* harmony export */
              TextureOperations: () => (
                /* reexport safe */
                d.TextureOperations
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* reexport safe */
                o.UnsignedByteType
              )
              /* harmony export */
            });
            var r = t(
              /*! ./Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), a = t(
              /*! ./Sides */
              "./src/WebGL/constants/Sides.ts"
            ), s = t(
              /*! ./Shading */
              "./src/WebGL/constants/Shading.ts"
            ), h = t(
              /*! ./SpriteAlignment */
              "./src/WebGL/constants/SpriteAlignment.ts"
            ), o = t(
              /*! ./TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), d = t(
              /*! ./TextureOperations */
              "./src/WebGL/constants/TextureOperations.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/core/EventDispatcher.ts": (
          /*!*******************************************!*\
            !*** ./src/WebGL/core/EventDispatcher.ts ***!
            \*******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              EventDispatcher: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            class r {
              constructor() {
                this.listeners = {};
              }
              dispatchEvent(s) {
                var h = this.listeners[s.type];
                if (h !== void 0) {
                  s.target = this;
                  for (var o = 0, d = h.length; o < d; o++)
                    h[o].call(this, s);
                }
              }
              removeEventListener(s, h) {
                if (!h)
                  this.listeners[s] = [];
                else {
                  var o = this.listeners[s].indexOf(h);
                  o !== -1 && this.listeners[s].splice(o, 1);
                }
              }
              addEventListener(s, h) {
                this.listeners[s] === void 0 && (this.listeners[s] = []), this.listeners[s].indexOf(h) === -1 && this.listeners[s].push(h);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Geometry.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/core/Geometry.ts ***!
            \************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Geometry: () => (
                /* binding */
                v
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* binding */
                d
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var r = t(
              /*! ../materials/LineBasicMaterial */
              "./src/WebGL/materials/LineBasicMaterial.ts"
            ), a = t(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), s = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ../../colors */
              "./src/colors.ts"
            );
            const o = 65535;
            class d {
              constructor(A = 0) {
                this.vertexArray = null, this.colorArray = null, this.normalArray = null, this.radiusArray = null, this.faceArray = null, this.lineArray = null, this.atomArray = Array(), this.vertices = 0, this.faceidx = 0, this.lineidx = 0, this.__inittedArrays = !1, this.id = A;
              }
              setColor(A) {
                var x = this.vertexArray, M = this.colorArray;
                if (!x)
                  throw new Error("vertex array not initialized");
                if (!M)
                  throw new Error("color array not initialized");
                let m = h.CC.color(A);
                for (var l = 0; l < x.length; l += 3)
                  M[l] = m.r, M[l + 1] = m.g, M[l + 2] = m.b;
              }
              setColors(A) {
                var x = this.vertexArray, M = this.colorArray;
                if (!x)
                  throw new Error("vertex array not initialized");
                if (!M)
                  throw new Error("color array not initialized");
                if (x.length != M.length) {
                  console.log("Cannot re-color geometry group due to mismatched lengths.");
                  return;
                }
                for (var m = 0; m < x.length; m += 3) {
                  var l = A(x[m], x[m + 1], x[m + 2]);
                  l instanceof h.Color || (l = h.CC.color(l)), M[m] = l.r, M[m + 1] = l.g, M[m + 2] = l.b;
                }
              }
              getNumVertices() {
                return this.vertices;
              }
              getVertices() {
                return this.vertexArray;
              }
              getCentroid() {
                if (!this.vertexArray)
                  throw new Error("vertex array not initialized");
                for (var A = new s.Vector3(), x, M, m, l, u = 0; u < this.vertices; ++u)
                  x = u * 3, M = this.vertexArray[x], m = this.vertexArray[x + 1], l = this.vertexArray[x + 2], A.x += M, A.y += m, A.z += l;
                return A.divideScalar(this.vertices), A;
              }
              //setup normals - vertex and face array must exist
              setNormals() {
                var A = this.faceArray, x = this.vertexArray, M = this.normalArray;
                if (!(!this.vertices || !this.faceidx)) {
                  if (!A)
                    throw new Error("face array not initialized");
                  if (!x)
                    throw new Error("vertex array not initialized");
                  if (!M)
                    throw new Error("normal array not initialized");
                  for (var m, l, u, p, g, b, c, _ = 0; _ < A.length / 3; ++_)
                    m = A[_ * 3] * 3, l = A[_ * 3 + 1] * 3, u = A[_ * 3 + 2] * 3, p = new s.Vector3(x[m], x[m + 1], x[m + 2]), g = new s.Vector3(x[l], x[l + 1], x[l + 2]), b = new s.Vector3(x[u], x[u + 1], x[u + 2]), p.subVectors(p, g), b.subVectors(b, g), b.cross(p), c = b, c.normalize(), M[m] += c.x, M[l] += c.x, M[u] += c.x, M[m + 1] += c.y, M[l + 1] += c.y, M[u + 1] += c.y, M[m + 2] += c.z, M[l + 2] += c.z, M[u + 2] += c.z;
                }
              }
              /* sets line index array from face arr
              Note - assumes all faces are triangles (i.e. there will
              be an extra diagonal for four-sided faces - user should
              specify linearr for custom shape generation to show wireframe squares
              as rectangles rather than two triangles) */
              setLineIndices() {
                if (this.faceidx && !(this.lineArray && this.lineArray.length == this.faceidx * 2 && this.lineidx == this.faceidx * 2)) {
                  var A = this.faceArray, x = this.lineArray = new Uint16Array(this.faceidx * 2);
                  if (this.lineidx = this.faceidx * 2, !A)
                    throw new Error("face array not initialized");
                  for (var M = 0; M < this.faceidx / 3; ++M) {
                    var m = M * 3, l = m * 2, u = A[m], p = A[m + 1], g = A[m + 2];
                    x[l] = u, x[l + 1] = p, x[l + 2] = u, x[l + 3] = g, x[l + 4] = p, x[l + 5] = g;
                  }
                }
              }
              vrml(A, x) {
                var M, m, l, u, p, g, b, c, _, E, w, k, $, L, z, F, R, P, U = "";
                if (U += A + `Shape {
` + A + ` appearance Appearance {
` + A + `  material Material {
` + A + "   diffuseColor " + ((M = x?.color) === null || M === void 0 ? void 0 : M.r) + " " + ((m = x?.color) === null || m === void 0 ? void 0 : m.g) + " " + ((l = x?.color) === null || l === void 0 ? void 0 : l.b) + `
`, x.wireframe && this.colorArray) {
                  let B = this.colorArray;
                  U += A + "    emissiveColor " + B[0] + " " + B[1] + " " + B[2] + `
`;
                }
                x?.transparent && (U += A + "   transparency " + (1 - x.opacity) + `
`), U += A + `  }
`, U += A + ` }
`;
                var N = A;
                if (A += " ", x instanceof r.LineBasicMaterial || x.wireframe) {
                  U += A + `geometry IndexedLineSet {
` + A + ` colorPerVertex TRUE
` + A + ` coord Coordinate {
` + A + `  point [
`;
                  let B, W, V;
                  for (let G = 0; G < this.vertices; ++G) {
                    let H = G * 3;
                    B = (u = this.vertexArray) === null || u === void 0 ? void 0 : u[H], W = (p = this.vertexArray) === null || p === void 0 ? void 0 : p[H + 1], V = (g = this.vertexArray) === null || g === void 0 ? void 0 : g[H + 2], U += A + "   " + B + " " + W + " " + V + `,
`;
                  }
                  if (U += A + `  ]
`, U += A + ` }
`, this.colorArray && !x.wireframe) {
                    U += A + ` color Color {
` + A + `  color [
`;
                    for (let G = 0; G < this.vertices; ++G) {
                      let H = G * 3;
                      B = this.colorArray[H], W = this.colorArray[H + 1], V = this.colorArray[H + 2], U += A + "   " + B + " " + W + " " + V + `,
`;
                    }
                    U += A + `  ]
`, U += A + ` }
`;
                  }
                  if (U += A + ` coordIndex [
`, x.wireframe && this.faceArray)
                    for (let G = 0; G < this.faceidx; G += 3)
                      B = (b = this.faceArray) === null || b === void 0 ? void 0 : b[G], W = (c = this.faceArray) === null || c === void 0 ? void 0 : c[G + 1], V = (_ = this.faceArray) === null || _ === void 0 ? void 0 : _[G + 2], U += A + "  " + B + ", " + W + ", " + V + `, -1,
`;
                  else
                    for (let G = 0; G < this.vertices - 1; G += 2)
                      U += A + "  " + G + ", " + (G + 1) + `, -1,
`;
                  U += A + ` ]
`, U += A + `}
`;
                } else {
                  U += A + `geometry IndexedFaceSet {
` + A + ` colorPerVertex TRUE
` + A + ` normalPerVertex TRUE
` + A + ` solid FALSE
`, U += A + ` coord Coordinate {
` + A + `  point [
`;
                  let B, W, V;
                  for (let G = 0; G < this.vertices; ++G) {
                    let H = G * 3;
                    B = (E = this.vertexArray) === null || E === void 0 ? void 0 : E[H], W = (w = this.vertexArray) === null || w === void 0 ? void 0 : w[H + 1], V = (k = this.vertexArray) === null || k === void 0 ? void 0 : k[H + 2], U += A + "   " + B + " " + W + " " + V + `,
`;
                  }
                  U += A + `  ]
`, U += A + ` }
`, U += A + ` normal Normal {
` + A + `  vector [
`;
                  for (let G = 0; G < this.vertices; ++G) {
                    let H = G * 3;
                    B = ($ = this.normalArray) === null || $ === void 0 ? void 0 : $[H], W = (L = this.normalArray) === null || L === void 0 ? void 0 : L[H + 1], V = (z = this.normalArray) === null || z === void 0 ? void 0 : z[H + 2], U += A + "   " + B + " " + W + " " + V + `,
`;
                  }
                  if (U += A + `  ]
`, U += A + ` }
`, this.colorArray) {
                    U += A + ` color Color {
` + A + `  color [
`;
                    for (let G = 0; G < this.vertices; ++G) {
                      let H = G * 3;
                      B = this.colorArray[H], W = this.colorArray[H + 1], V = this.colorArray[H + 2], U += A + "   " + B + " " + W + " " + V + `,
`;
                    }
                    U += A + `  ]
`, U += A + ` }
`;
                  }
                  U += A + ` coordIndex [
`;
                  for (let G = 0; G < this.faceidx; G += 3)
                    B = (F = this.faceArray) === null || F === void 0 ? void 0 : F[G], W = (R = this.faceArray) === null || R === void 0 ? void 0 : R[G + 1], V = (P = this.faceArray) === null || P === void 0 ? void 0 : P[G + 2], U += A + "  " + B + ", " + W + ", " + V + `, -1,
`;
                  U += A + ` ]
`, U += A + `}
`;
                }
                return U += N + "}", U;
              }
              truncateArrayBuffers(A = !0, x = !1) {
                var M = this.vertexArray, m = this.colorArray, l = this.normalArray, u = this.faceArray, p = this.lineArray, g = this.radiusArray;
                this.vertexArray = M?.subarray(0, this.vertices * 3) || null, this.colorArray = m?.subarray(0, this.vertices * 3) || null, A ? (this.normalArray = l?.subarray(0, this.vertices * 3) || null, this.faceArray = u?.subarray(0, this.faceidx) || null, this.lineidx > 0 ? this.lineArray = p?.subarray(0, this.lineidx) || null : this.lineArray = new Uint16Array(0)) : (this.normalArray = new Float32Array(0), this.faceArray = new Uint16Array(0), this.lineArray = new Uint16Array(0)), g && (this.radiusArray = g.subarray(0, this.vertices)), x && (this.normalArray && (this.normalArray = new Float32Array(this.normalArray)), this.faceArray && (this.faceArray = new Uint16Array(this.faceArray)), this.lineArray && (this.lineArray = new Uint16Array(this.lineArray)), this.vertexArray && (this.vertexArray = new Float32Array(this.vertexArray)), this.colorArray && (this.colorArray = new Float32Array(this.colorArray)), this.radiusArray && (this.radiusArray = new Float32Array(this.radiusArray))), this.__inittedArrays = !0;
              }
            }
            class v extends a.EventDispatcher {
              constructor(A = !1, x = !1, M = !1) {
                super(), this.name = "", this.hasTangents = !1, this.dynamic = !0, this.verticesNeedUpdate = !1, this.elementsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.buffersNeedUpdate = !1, this.imposter = !1, this.instanced = !1, this.geometryGroups = [], this.groups = 0, this.id = f++, this.mesh = A, this.radii = x, this.offset = M;
              }
              //Get geometry group to accomodate addVertices new vertices - create
              // new group if necessary
              updateGeoGroup(A = 0) {
                var x, M = this.groups > 0 ? this.geometryGroups[this.groups - 1] : null;
                return (!M || M.vertices + A > (((x = M?.vertexArray) === null || x === void 0 ? void 0 : x.length) || 0) / 3) && (M = this.addGeoGroup()), M;
              }
              //return comma separated list of IndexedFace (or Line) sets from geometry groups
              vrml(A, x) {
                for (var M = "", m = this.geometryGroups.length, l = 0; l < m; l++) {
                  var u = this.geometryGroups[l];
                  M += u.vrml(A, x) + `,
`;
                }
                return M;
              }
              addGeoGroup() {
                var A = new d(this.geometryGroups.length);
                return this.geometryGroups.push(A), this.groups = this.geometryGroups.length, A.vertexArray = new Float32Array(o * 3), A.colorArray = new Float32Array(o * 3), this.mesh && (A.normalArray = new Float32Array(o * 3), A.faceArray = new Uint16Array(o * 6), A.lineArray = new Uint16Array(o * 6)), this.radii && (A.radiusArray = new Float32Array(o)), A.useOffset = this.offset, A;
              }
              setUpNormals(...A) {
                for (var x = 0; x < this.groups; x++) {
                  var M = this.geometryGroups[x];
                  M.setNormals(...A);
                }
              }
              setColors(...A) {
                for (var x = this.geometryGroups.length, M = 0; M < x; M++) {
                  var m = this.geometryGroups[M];
                  m.setColors(...A);
                }
              }
              setColor(...A) {
                for (var x = this.geometryGroups.length, M = 0; M < x; M++) {
                  var m = this.geometryGroups[M];
                  m.setColor(...A);
                }
              }
              setUpWireframe(...A) {
                for (var x = 0; x < this.groups; x++) {
                  var M = this.geometryGroups[x];
                  M.setLineIndices(...A);
                }
              }
              //After vertices, colors, etc are collected in regular or typed arrays,
              //  create typed arrays from regular arrays if they don't already exist,
              initTypedArrays() {
                for (var A = 0; A < this.groups; A++) {
                  var x = this.geometryGroups[A];
                  x.__inittedArrays !== !0 && x.truncateArrayBuffers(this.mesh, !1);
                }
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
              get vertices() {
                for (var A = 0, x = 0; x < this.groups; x++)
                  A += this.geometryGroups[x].vertices;
                return A;
              }
            }
            let f = 0;
          }
        ),
        /***/
        "./src/WebGL/core/Object3D.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/core/Object3D.ts ***!
            \************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Light: () => (
                /* binding */
                d
              ),
              /* harmony export */
              Object3D: () => (
                /* binding */
                h
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* binding */
                s
              ),
              /* harmony export */
              Scene: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), a = t(
              /*! ../../colors */
              "./src/colors.ts"
            );
            let s = 0;
            class h {
              constructor() {
                this.id = s++, this.name = "", this.children = [], this.position = new r.Vector3(), this.rotation = new r.Vector3(), this.matrix = new r.Matrix4(), this.matrixWorld = new r.Matrix4(), this.quaternion = new r.Quaternion(), this.eulerOrder = "XYZ", this.up = new r.Vector3(0, 1, 0), this.scale = new r.Vector3(1, 1, 1), this.matrixAutoUpdate = !0, this.matrixWorldNeedsUpdate = !0, this.rotationAutoUpdate = !0, this.useQuaternion = !1, this.visible = !0;
              }
              lookAt(f) {
                this.matrix.lookAt(f, this.position, this.up), this.rotationAutoUpdate && (this.useQuaternion === !0 ? console.error("Unimplemented math operation.") : this.rotation instanceof r.Vector3 && this.rotation.setEulerFromRotationMatrix(this.matrix, this.eulerOrder));
              }
              //add child object
              add(f) {
                if (f === this) {
                  console.error("Can't add $3Dmol.Object3D to itself");
                  return;
                }
                f.parent = this, this.children.push(f);
                for (var y = this; y.parent !== void 0; )
                  y = y.parent;
                y !== void 0 && y instanceof o && y.__addObject(f);
              }
              remove(f) {
                var y = this.children.indexOf(f);
                if (y !== -1) {
                  f.parent = void 0, this.children.splice(y, 1);
                  for (var A = this; A.parent !== void 0; )
                    A = A.parent;
                  A !== void 0 && A instanceof o && A.__removeObject(f);
                }
              }
              //convert to vrml
              vrml(f) {
                f || (f = " ");
                var y = 2 * Math.atan2(this.quaternion.lengthxyz(), this.quaternion.w), A = 0, x = 0, M = 0;
                if (y != 0) {
                  let u = Math.sin(y / 2);
                  A = this.quaternion.x / u, x = this.quaternion.y / u, M = this.quaternion.z / u;
                }
                var m = f + `Transform {
` + f + " center " + this.position.x + " " + this.position.y + " " + this.position.z + `
` + f + " rotation " + A + " " + x + " " + M + " " + y + `
` + f + ` children [
`;
                this.geometry && (m += this.geometry.vrml(f, this.material));
                for (var l = 0; l < this.children.length; l++)
                  m += this.children[l].vrml(f + " ") + `,
`;
                return m += ` ]
`, m += "}", m;
              }
              updateMatrix() {
                this.matrix.setPosition(this.position), this.useQuaternion === !1 && this.rotation instanceof r.Vector3 ? this.matrix.setRotationFromEuler(this.rotation, this.eulerOrder) : this.matrix.setRotationFromQuaternion(this.quaternion), (this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1) && this.matrix.scale(this.scale), this.matrixWorldNeedsUpdate = !0;
              }
              updateMatrixWorld(f) {
                this.matrixAutoUpdate === !0 && this.updateMatrix(), (this.matrixWorldNeedsUpdate === !0 || f === !0) && (this.parent === void 0 ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1;
                for (var y = 0; y < this.children.length; y++)
                  this.children[y].updateMatrixWorld(!0);
              }
              clone(f) {
                f === void 0 && (f = new h()), f.name = this.name, f.up.copy(this.up), f.position.copy(this.position), f.rotation instanceof r.Vector3 && this.rotation instanceof r.Vector3 ? f.rotation.copy(this.rotation) : f.rotation = this.rotation, f.eulerOrder = this.eulerOrder, f.scale.copy(this.scale), f.rotationAutoUpdate = this.rotationAutoUpdate, f.matrix.copy(this.matrix), f.matrixWorld.copy(this.matrixWorld), f.quaternion.copy(this.quaternion), f.matrixAutoUpdate = this.matrixAutoUpdate, f.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate, f.useQuaternion = this.useQuaternion, f.visible = this.visible;
                for (var y = 0; y < this.children.length; y++) {
                  var A = this.children[y];
                  f.add(A.clone());
                }
                return f;
              }
              setVisible(f) {
                this.visible = f;
                for (var y = 0; y < this.children.length; y++) {
                  var A = this.children[y];
                  A.setVisible(f);
                }
              }
            }
            class o extends h {
              constructor() {
                super(...arguments), this.fog = null, this.overrideMaterial = null, this.matrixAutoUpdate = !1, this.__objects = [], this.__lights = [], this.__objectsAdded = [], this.__objectsRemoved = [];
              }
              __addObject(f) {
                if (f instanceof d)
                  this.__lights.indexOf(f) === -1 && this.__lights.push(f), f.target && f.target.parent === void 0 && this.add(f.target);
                else if (this.__objects.indexOf(f) === -1) {
                  this.__objects.push(f), this.__objectsAdded.push(f);
                  var y = this.__objectsRemoved.indexOf(f);
                  y !== -1 && this.__objectsRemoved.splice(y, 1);
                }
                for (var A = 0; A < f.children.length; A++)
                  this.__addObject(f.children[A]);
              }
              __removeObject(f) {
                var y;
                if (f instanceof d)
                  y = this.__lights.indexOf(f), y !== -1 && this.__lights.splice(y, 1);
                else if (y = this.__objects.indexOf(f), y !== -1) {
                  this.__objects.splice(y, 1), this.__objectsRemoved.push(f);
                  var A = this.__objectsAdded.indexOf(f);
                  A !== -1 && this.__objectsAdded.splice(y, 1);
                }
                for (var x = 0; x < f.children.length; x++)
                  this.__removeObject(f.children[x]);
              }
            }
            class d extends h {
              constructor(f, y = 1) {
                super(), this.position = new r.Vector3(0, 1, 0), this.target = new h(), this.castShadow = !1, this.onlyShadow = !1, this.color = new a.Color(f), this.intensity = y;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Projector.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/Projector.ts ***!
            \*************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Projector: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const a = new r.Matrix4();
            class s {
              static unprojectVector(o, d) {
                return d.projectionMatrixInverse.getInverse(d.projectionMatrix), a.multiplyMatrices(d.matrixWorld, d.projectionMatrixInverse), o.applyProjection(a);
              }
              static projectVector(o, d) {
                return d.matrixWorldInverse.getInverse(d.matrixWorld), a.multiplyMatrices(d.projectionMatrix, d.matrixWorldInverse), o.applyProjection(a);
              }
              projectVector(o, d) {
                return s.projectVector(o, d);
              }
              unprojectVector(o, d) {
                return s.unprojectVector(o, d);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Raycaster.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/Raycaster.ts ***!
            \*************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Raycaster: () => (
                /* binding */
                o
              ),
              /* harmony export */
              intersectObject: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), a = t(
              /*! ../shapes */
              "./src/WebGL/shapes/index.ts"
            );
            const s = (p, g) => p.distance - g.distance, h = new r.Matrix4();
            class o {
              constructor(g, b, c, _) {
                this.precision = 1e-4, this.linePrecision = 0.2, this.ray = new r.Ray(g, b), this.ray.direction.lengthSq() > 0 && this.ray.direction.normalize(), this.near = _ || 0, this.far = c || 1 / 0;
              }
              set(g, b) {
                this.ray.set(g, b);
              }
              setFromCamera(g, b) {
                b.ortho ? (this.ray.origin.set(g.x, g.y, (b.near + b.far) / (b.near - b.far)).unproject(b), this.ray.direction.set(0, 0, -1).transformDirection(b.matrixWorld)) : (this.ray.origin.setFromMatrixPosition(b.matrixWorld), this.ray.direction.set(g.x, g.y, g.z), b.projectionMatrixInverse.getInverse(b.projectionMatrix), h.multiplyMatrices(b.matrixWorld, b.projectionMatrixInverse), this.ray.direction.applyProjection(h), this.ray.direction.sub(this.ray.origin).normalize());
              }
              intersectObjects(g, b) {
                for (var c = [], _ = 0, E = b.length; _ < E; _++)
                  u(g, b[_], this, c);
                return c.sort(s), c;
              }
            }
            const d = (p) => Math.min(Math.max(p, -1), 1);
            var v = new a.Sphere(), f = new a.Cylinder(), y = new a.Triangle(), A = new r.Vector3(), x = new r.Vector3(), M = new r.Vector3(), m = new r.Vector3(), l = new r.Vector3();
            function u(p, g, b, c) {
              if (l.getPositionFromMatrix(p.matrixWorld), g.intersectionShape === void 0)
                return c;
              var _ = g.intersectionShape, E = b.linePrecision;
              E *= p.matrixWorld.getMaxScaleOnAxis();
              var w = E * E;
              if (g.boundingSphere !== void 0 && g.boundingSphere instanceof a.Sphere && (v.copy(g.boundingSphere), v.applyMatrix4(p.matrixWorld), !b.ray.isIntersectionSphere(v)))
                return c;
              var k, $, L, z, F, R, P, U, N, B, W, V, G, H;
              for (k = 0, $ = _.triangle.length; k < $; k++)
                if (_.triangle[k] instanceof a.Triangle) {
                  if (y.copy(_.triangle[k]), y.applyMatrix4(p.matrixWorld), L = y.getNormal(), z = b.ray.direction.dot(L), z >= 0 || (A.subVectors(y.a, b.ray.origin), P = L.dot(A) / z, P < 0))
                    continue;
                  x.copy(b.ray.direction).multiplyScalar(P).add(b.ray.origin), x.sub(y.a), M.copy(y.b).sub(y.a), m.copy(y.c).sub(y.a);
                  var Q = M.dot(m), te = M.lengthSq(), ee = m.lengthSq();
                  if (V = (te * x.dot(m) - Q * x.dot(M)) / (te * ee - Q * Q), V < 0 || V > 1 || (W = (x.dot(M) - V * Q) / te, W < 0 || W > 1 || W + V > 1))
                    continue;
                  c.push({ clickable: g, distance: P });
                }
              for (k = 0, $ = _.cylinder.length; k < $; k++)
                if (_.cylinder[k] instanceof a.Cylinder) {
                  if (f.copy(_.cylinder[k]), f.applyMatrix4(p.matrixWorld), A.subVectors(f.c1, b.ray.origin), F = A.dot(f.direction), R = A.dot(b.ray.direction), z = d(b.ray.direction.dot(f.direction)), N = 1 - z * z, N === 0)
                    continue;
                  G = (z * R - F) / N, H = (R - z * F) / N, x.copy(f.direction).multiplyScalar(G).add(f.c1), M.copy(b.ray.direction).multiplyScalar(H).add(b.ray.origin), U = m.subVectors(x, M).lengthSq();
                  var ce = f.radius * f.radius;
                  if (U <= ce) {
                    if (B = (z * F - R) * (z * F - R) - N * (A.lengthSq() - F * F - ce), B <= 0 ? V = P = Math.sqrt(U) : V = P = (R - z * F - Math.sqrt(B)) / N, W = z * V - F, W < 0 || W * W > f.lengthSq() || V < 0)
                      continue;
                    c.push({ clickable: g, distance: P });
                  }
                }
              for (k = 0, $ = _.line.length; k < $; k += 2) {
                x.copy(_.line[k]), x.applyMatrix4(p.matrixWorld), M.copy(_.line[k + 1]), M.applyMatrix4(p.matrixWorld), m.subVectors(M, x);
                var fe = m.lengthSq();
                m.normalize(), A.subVectors(x, b.ray.origin);
                var oe = A.dot(m);
                R = A.dot(b.ray.direction), z = d(b.ray.direction.dot(m)), N = 1 - z * z, N !== 0 && (G = (z * R - oe) / N, H = (R - z * oe) / N, x.add(m.multiplyScalar(G)), M.copy(b.ray.direction).multiplyScalar(H).add(b.ray.origin), U = m.subVectors(M, x).lengthSq(), U < w && G * G < fe && c.push({ clickable: g, distance: H }));
              }
              for (k = 0, $ = _.sphere.length; k < $; k++)
                if (_.sphere[k] instanceof a.Sphere && (v.copy(_.sphere[k]), v.applyMatrix4(p.matrixWorld), b.ray.isIntersectionSphere(v))) {
                  x.subVectors(v.center, b.ray.origin);
                  var he = x.dot(b.ray.direction);
                  if (B = he * he - (x.lengthSq() - v.radius * v.radius), he < 0)
                    return c;
                  B <= 0 ? P = he : P = he - Math.sqrt(B), c.push({ clickable: g, distance: P });
                }
              return c;
            }
          }
        ),
        /***/
        "./src/WebGL/core/Texture.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/core/Texture.ts ***!
            \***********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Texture: () => (
                /* binding */
                o
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ../constants/TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), a = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), s = t(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), h = t(
              /*! ./UVMapping */
              "./src/WebGL/core/UVMapping.ts"
            );
            class o extends s.EventDispatcher {
              constructor(f, y) {
                super(), this.id = d++, this.name = "", this.image = f, this.mapping = new h.UVMapping(), this.wrapS = r.ClampToEdgeWrapping, this.wrapT = r.ClampToEdgeWrapping, this.anisotropy = 1, y ? (this.format = r.RFormat, this.type = r.FloatType, this.premultiplyAlpha = !1, this.flipY = !1, this.unpackAlignment = 1, this.magFilter = r.NearestFilter, this.minFilter = r.NearestFilter) : (this.format = r.RGBAFormat, this.type = r.UnsignedByteType, this.offset = new a.Vector2(0, 0), this.repeat = new a.Vector2(1, 1), this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.magFilter = r.LinearFilter, this.minFilter = r.LinearMipMapLinearFilter), this.needsUpdate = !1, this.onUpdate = null;
              }
              clone(f = new o()) {
                return f.image = this.image, f.mapping = this.mapping, f.wrapS = this.wrapS, f.wrapT = this.wrapT, f.magFilter = this.magFilter, f.minFilter = this.minFilter, f.anisotropy = this.anisotropy, f.format = this.format, f.type = this.type, f.offset.copy(this.offset), f.repeat.copy(this.repeat), f.premultiplyAlpha = this.premultiplyAlpha, f.flipY = this.flipY, f.unpackAlignment = this.unpackAlignment, f;
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
            }
            let d = 0;
          }
        ),
        /***/
        "./src/WebGL/core/UVMapping.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/UVMapping.ts ***!
            \*************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              UVMapping: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            class r {
            }
          }
        ),
        /***/
        "./src/WebGL/core/index.ts": (
          /*!*********************************!*\
            !*** ./src/WebGL/core/index.ts ***!
            \*********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              EventDispatcher: () => (
                /* reexport safe */
                r.EventDispatcher
              ),
              /* harmony export */
              Geometry: () => (
                /* reexport safe */
                a.Geometry
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* reexport safe */
                a.GeometryGroup
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* reexport safe */
                a.GeometryIDCount
              ),
              /* harmony export */
              Light: () => (
                /* reexport safe */
                s.Light
              ),
              /* harmony export */
              Object3D: () => (
                /* reexport safe */
                s.Object3D
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* reexport safe */
                s.Object3DIDCount
              ),
              /* harmony export */
              Projector: () => (
                /* reexport safe */
                h.Projector
              ),
              /* harmony export */
              Raycaster: () => (
                /* reexport safe */
                o.Raycaster
              ),
              /* harmony export */
              Scene: () => (
                /* reexport safe */
                s.Scene
              ),
              /* harmony export */
              Texture: () => (
                /* reexport safe */
                d.Texture
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* reexport safe */
                d.TextureIdCount
              ),
              /* harmony export */
              UVMapping: () => (
                /* reexport safe */
                v.UVMapping
              ),
              /* harmony export */
              intersectObject: () => (
                /* reexport safe */
                o.intersectObject
              )
              /* harmony export */
            });
            var r = t(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), a = t(
              /*! ./Geometry */
              "./src/WebGL/core/Geometry.ts"
            ), s = t(
              /*! ./Object3D */
              "./src/WebGL/core/Object3D.ts"
            ), h = t(
              /*! ./Projector */
              "./src/WebGL/core/Projector.ts"
            ), o = t(
              /*! ./Raycaster */
              "./src/WebGL/core/Raycaster.ts"
            ), d = t(
              /*! ./Texture */
              "./src/WebGL/core/Texture.ts"
            ), v = t(
              /*! ./UVMapping */
              "./src/WebGL/core/UVMapping.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/index.ts": (
          /*!****************************!*\
            !*** ./src/WebGL/index.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BackSide: () => (
                /* reexport safe */
                r.BackSide
              ),
              /* harmony export */
              Camera: () => (
                /* reexport safe */
                f.Camera
              ),
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* reexport safe */
                r.ClampToEdgeWrapping
              ),
              /* harmony export */
              Coloring: () => (
                /* reexport safe */
                r.Coloring
              ),
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                v.Cylinder
              ),
              /* harmony export */
              DoubleSide: () => (
                /* reexport safe */
                r.DoubleSide
              ),
              /* harmony export */
              EventDispatcher: () => (
                /* reexport safe */
                a.EventDispatcher
              ),
              /* harmony export */
              FloatType: () => (
                /* reexport safe */
                r.FloatType
              ),
              /* harmony export */
              Fog: () => (
                /* reexport safe */
                y.Fog
              ),
              /* harmony export */
              FrontSide: () => (
                /* reexport safe */
                r.FrontSide
              ),
              /* harmony export */
              Geometry: () => (
                /* reexport safe */
                a.Geometry
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* reexport safe */
                a.GeometryGroup
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* reexport safe */
                a.GeometryIDCount
              ),
              /* harmony export */
              ImposterMaterial: () => (
                /* reexport safe */
                s.ImposterMaterial
              ),
              /* harmony export */
              InstancedMaterial: () => (
                /* reexport safe */
                s.InstancedMaterial
              ),
              /* harmony export */
              Light: () => (
                /* reexport safe */
                a.Light
              ),
              /* harmony export */
              Line: () => (
                /* reexport safe */
                o.Line
              ),
              /* harmony export */
              LineBasicMaterial: () => (
                /* reexport safe */
                s.LineBasicMaterial
              ),
              /* harmony export */
              LineStyle: () => (
                /* reexport safe */
                o.LineStyle
              ),
              /* harmony export */
              LinearFilter: () => (
                /* reexport safe */
                r.LinearFilter
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* reexport safe */
                r.LinearMipMapLinearFilter
              ),
              /* harmony export */
              Material: () => (
                /* reexport safe */
                s.Material
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* reexport safe */
                s.MaterialIdCount
              ),
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                h.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                h.Matrix4
              ),
              /* harmony export */
              Mesh: () => (
                /* reexport safe */
                o.Mesh
              ),
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* reexport safe */
                s.MeshDoubleLambertMaterial
              ),
              /* harmony export */
              MeshLambertMaterial: () => (
                /* reexport safe */
                s.MeshLambertMaterial
              ),
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* reexport safe */
                s.MeshOutlineMaterial
              ),
              /* harmony export */
              NearestFilter: () => (
                /* reexport safe */
                r.NearestFilter
              ),
              /* harmony export */
              Object3D: () => (
                /* reexport safe */
                a.Object3D
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* reexport safe */
                a.Object3DIDCount
              ),
              /* harmony export */
              Projector: () => (
                /* reexport safe */
                a.Projector
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                h.Quaternion
              ),
              /* harmony export */
              R32Format: () => (
                /* reexport safe */
                r.R32Format
              ),
              /* harmony export */
              RFormat: () => (
                /* reexport safe */
                r.RFormat
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* reexport safe */
                r.RGBAFormat
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                h.Ray
              ),
              /* harmony export */
              Raycaster: () => (
                /* reexport safe */
                a.Raycaster
              ),
              /* harmony export */
              Renderer: () => (
                /* reexport safe */
                A.Renderer
              ),
              /* harmony export */
              Scene: () => (
                /* reexport safe */
                a.Scene
              ),
              /* harmony export */
              ShaderLib: () => (
                /* reexport safe */
                d.ShaderLib
              ),
              /* harmony export */
              ShaderUtils: () => (
                /* reexport safe */
                d.ShaderUtils
              ),
              /* harmony export */
              Shading: () => (
                /* reexport safe */
                r.Shading
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                v.Sphere
              ),
              /* harmony export */
              SphereImposterMaterial: () => (
                /* reexport safe */
                s.SphereImposterMaterial
              ),
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* reexport safe */
                s.SphereImposterOutlineMaterial
              ),
              /* harmony export */
              Sprite: () => (
                /* reexport safe */
                o.Sprite
              ),
              /* harmony export */
              SpriteAlignment: () => (
                /* reexport safe */
                r.SpriteAlignment
              ),
              /* harmony export */
              SpriteMaterial: () => (
                /* reexport safe */
                s.SpriteMaterial
              ),
              /* harmony export */
              SpritePlugin: () => (
                /* reexport safe */
                x.SpritePlugin
              ),
              /* harmony export */
              StickImposterMaterial: () => (
                /* reexport safe */
                s.StickImposterMaterial
              ),
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* reexport safe */
                s.StickImposterOutlineMaterial
              ),
              /* harmony export */
              Texture: () => (
                /* reexport safe */
                a.Texture
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* reexport safe */
                a.TextureIdCount
              ),
              /* harmony export */
              TextureOperations: () => (
                /* reexport safe */
                r.TextureOperations
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                v.Triangle
              ),
              /* harmony export */
              UVMapping: () => (
                /* reexport safe */
                a.UVMapping
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* reexport safe */
                r.UnsignedByteType
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                h.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                h.Vector3
              ),
              /* harmony export */
              VolumetricMaterial: () => (
                /* reexport safe */
                s.VolumetricMaterial
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                d.basic
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                h.clamp
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                d.clone
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                h.conversionMatrix3
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                h.degToRad
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                d.instanced
              ),
              /* harmony export */
              intersectObject: () => (
                /* reexport safe */
                a.intersectObject
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                d.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                d.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                d.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                d.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                d.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                d.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                d.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                d.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                d.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                d.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                d.volumetric
              )
              /* harmony export */
            });
            var r = t(
              /*! ./constants */
              "./src/WebGL/constants/index.ts"
            ), a = t(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), s = t(
              /*! ./materials */
              "./src/WebGL/materials/index.ts"
            ), h = t(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            ), o = t(
              /*! ./objects */
              "./src/WebGL/objects/index.ts"
            ), d = t(
              /*! ./shaders */
              "./src/WebGL/shaders/index.ts"
            ), v = t(
              /*! ./shapes */
              "./src/WebGL/shapes/index.ts"
            ), f = t(
              /*! ./Camera */
              "./src/WebGL/Camera.ts"
            ), y = t(
              /*! ./Fog */
              "./src/WebGL/Fog.ts"
            ), A = t(
              /*! ./Renderer */
              "./src/WebGL/Renderer.ts"
            ), x = t(
              /*! ./SpritePlugin */
              "./src/WebGL/SpritePlugin.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/materials/ImposterMaterial.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/materials/ImposterMaterial.ts ***!
            \*************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ImposterMaterial: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ./../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), a = t(
              /*! ./../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), s = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), h = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), o = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class d extends o.Material {
              constructor(f) {
                super(), this.color = new s.Color(16777215), this.ambient = new s.Color(1048575), this.emissive = new s.Color(0), this.imposter = !0, this.wrapAround = !1, this.wrapRGB = new h.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = a.Shading.SmoothShading, this.shaderID = null, this.vertexColors = r.Coloring.NoColors, this.skinning = !1, this.setValues(f);
              }
              clone(f = new d()) {
                return super.clone.call(this, f), f.color.copy(this.color), f.ambient.copy(this.ambient), f.emissive.copy(this.emissive), f.wrapAround = this.wrapAround, f.wrapRGB.copy(this.wrapRGB), f.map = this.map, f.lightMap = this.lightMap, f.specularMap = this.specularMap, f.envMap = this.envMap, f.combine = this.combine, f.reflectivity = this.reflectivity, f.refractionRatio = this.refractionRatio, f.fog = this.fog, f.shading = this.shading, f.shaderID = this.shaderID, f.vertexColors = this.vertexColors, f.skinning = this.skinning, f.morphTargets = this.morphTargets, f.morphNormals = this.morphNormals, f;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/InstancedMaterial.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/materials/InstancedMaterial.ts ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              InstancedMaterial: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), a = t(
              /*! ../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), s = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), h = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), o = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class d extends o.Material {
              constructor(f) {
                super(), this.color = new s.Color(16777215), this.ambient = new s.Color(1048575), this.emissive = new s.Color(0), this.wrapAround = !1, this.wrapRGB = new h.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = a.Shading.SmoothShading, this.shaderID = "instanced", this.vertexColors = r.Coloring.NoColors, this.skinning = !1, this.sphere = null, this.setValues(f);
              }
              clone(f = new d()) {
                return super.clone.call(this, f), f.color.copy(this.color), f.ambient.copy(this.ambient), f.emissive.copy(this.emissive), f.wrapAround = this.wrapAround, f.wrapRGB.copy(this.wrapRGB), f.map = this.map, f.lightMap = this.lightMap, f.specularMap = this.specularMap, f.envMap = this.envMap, f.combine = this.combine, f.reflectivity = this.reflectivity, f.refractionRatio = this.refractionRatio, f.fog = this.fog, f.shading = this.shading, f.shaderID = this.shaderID, f.vertexColors = this.vertexColors, f.skinning = this.skinning, f.morphTargets = this.morphTargets, f.morphNormals = this.morphNormals, f.sphere = this.sphere, f;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/LineBasicMaterial.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/materials/LineBasicMaterial.ts ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              LineBasicMaterial: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), a = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class s extends a.Material {
              constructor(o) {
                super(), this.color = new r.Color(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.vertexColors = !1, this.fog = !0, this.shaderID = "basic", this.setValues(o);
              }
              clone(o = new s()) {
                return super.clone.call(this, o), o.color.copy(this.color), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/Material.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/materials/Material.ts ***!
            \*****************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Material: () => (
                /* binding */
                o
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), a = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            ), s = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ../../colors */
              "./src/colors.ts"
            );
            class o extends a.EventDispatcher {
              constructor() {
                super(...arguments), this.id = d++, this.name = "", this.side = r.FrontSide, this.opacity = 1, this.transparent = !1, this.depthTest = !0, this.depthWrite = !0, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.alphaTest = 0, this.visible = !0, this.needsUpdate = !0, this.outline = !1, this.wireframe = !1, this.shaded = !1;
              }
              setValues(f = {}) {
                if (f !== void 0)
                  for (var y in f) {
                    var A = f[y];
                    if (A === void 0) {
                      console.warn("$3Dmol.Material: '" + y + "' parameter is undefined.");
                      continue;
                    }
                    if (y in this) {
                      var x = this[y];
                      x instanceof h.Color && A instanceof h.Color ? x.copy(A) : x instanceof h.Color ? x.set(A) : x instanceof s.Vector3 && A instanceof s.Vector3 ? x.copy(A) : this[y] = A;
                    }
                  }
              }
              //TODO: might want to look into blending equations
              clone(f = new o()) {
                return f.name = this.name, f.side = this.side, f.opacity = this.opacity, f.transparent = this.transparent, f.depthTest = this.depthTest, f.depthWrite = this.depthWrite, f.polygonOffset = this.polygonOffset, f.polygonOffsetFactor = this.polygonOffsetFactor, f.polygonOffsetUnits = this.polygonOffsetUnits, f.alphaTest = this.alphaTest, f.overdraw = this.overdraw, f.visible = this.visible, f;
              }
              makeShaded(f) {
                this.shaded = !0, this.uniforms && (this.uniforms.shading = { type: "i", value: f }, this.uniforms.vWidth = { type: "f", value: 1 }, this.uniforms.vHeight = { type: "f", value: 1 });
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
            }
            let d = 0;
          }
        ),
        /***/
        "./src/WebGL/materials/MeshDoubleLambertMaterial.ts": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/materials/MeshDoubleLambertMaterial.ts ***!
            \**********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), a = t(
              /*! ./MeshLambertMaterial */
              "./src/WebGL/materials/MeshLambertMaterial.ts"
            );
            class s extends a.MeshLambertMaterial {
              constructor(o) {
                super(o), this.shaderID = "lambertdouble", this.side = r.DoubleSide, this.outline = !1;
              }
              clone(o = new s()) {
                return super.clone.call(this, o), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/MeshLambertMaterial.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/materials/MeshLambertMaterial.ts ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MeshLambertMaterial: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ./../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), a = t(
              /*! ./../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), s = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            ), h = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), o = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            class d extends s.Material {
              constructor(f) {
                super(), this.color = new h.Color(16777215), this.ambient = new h.Color(1048575), this.emissive = new h.Color(0), this.wrapAround = !1, this.wrapRGB = new o.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = a.Shading.SmoothShading, this.shaderID = "lambert", this.vertexColors = r.Coloring.NoColors, this.skinning = !1, this.setValues(f);
              }
              clone(f = new d()) {
                return super.clone.call(this, f), f.color.copy(this.color), f.ambient.copy(this.ambient), f.emissive.copy(this.emissive), f.wrapAround = this.wrapAround, f.wrapRGB.copy(this.wrapRGB), f.map = this.map, f.lightMap = this.lightMap, f.specularMap = this.specularMap, f.envMap = this.envMap, f.combine = this.combine, f.reflectivity = this.reflectivity, f.refractionRatio = this.refractionRatio, f.fog = this.fog, f.shading = this.shading, f.shaderID = this.shaderID, f.vertexColors = this.vertexColors, f.skinning = this.skinning, f.morphTargets = this.morphTargets, f.morphNormals = this.morphNormals, f;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/MeshOutlineMaterial.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/materials/MeshOutlineMaterial.ts ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), a = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class s extends a.Material {
              constructor(o) {
                super(), o = o || {}, this.fog = !0, this.shaderID = "outline", this.wireframe = !1, this.outlineColor = r.CC.color(o.color || new r.Color(0, 0, 0)), this.outlineWidth = o.width || 0.1, this.outlinePushback = o.pushback || 1, this.outlineMaxPixels = o.maxpixels || 0;
              }
              clone(o = new s()) {
                return super.clone.call(this, o), o.fog = this.fog, o.shaderID = this.shaderID, o.wireframe = this.wireframe, o.outlineColor = this.outlineColor, o.outlineWidth = this.outlineWidth, o.outlinePushback = this.outlinePushback, o.outlineMaxPixels = this.outlineMaxPixels, o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SphereImposterMaterial.ts": (
          /*!*******************************************************!*\
            !*** ./src/WebGL/materials/SphereImposterMaterial.ts ***!
            \*******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SphereImposterMaterial: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class a extends r.ImposterMaterial {
              constructor(h) {
                super(h), this.shaderID = "sphereimposter", this.setValues(h);
              }
              clone(h = new a()) {
                return super.clone.call(this, h), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SphereImposterOutlineMaterial.ts": (
          /*!**************************************************************!*\
            !*** ./src/WebGL/materials/SphereImposterOutlineMaterial.ts ***!
            \**************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), a = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class s extends a.ImposterMaterial {
              constructor(o) {
                super(o), o = o || {}, this.shaderID = "sphereimposteroutline", this.outlineColor = r.CC.color(o.color || new r.Color(0, 0, 0)), this.outlineWidth = o.width || 0.1, this.outlinePushback = o.pushback || 1, this.outlineMaxPixels = o.maxpixels || 0, this.setValues(o);
              }
              clone(o = new s()) {
                return super.clone.call(this, o), o.outlineColor = this.outlineColor, o.outlineWidth = this.outlineWidth, o.outlinePushback = this.outlinePushback, o.outlineMaxPixels = this.outlineMaxPixels, o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SpriteMaterial.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/materials/SpriteMaterial.ts ***!
            \***********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SpriteMaterial: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ../constants/SpriteAlignment */
              "./src/WebGL/constants/SpriteAlignment.ts"
            ), a = t(
              /*! ../core/Texture */
              "./src/WebGL/core/Texture.ts"
            ), s = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), h = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), o = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class d extends o.Material {
              constructor(f) {
                super(), this.color = new s.Color(16777215), this.map = new a.Texture(), this.useScreenCoordinates = !0, this.fog = !1, this.uvOffset = new h.Vector2(0, 0), this.uvScale = new h.Vector2(1, 1), this.depthTest = !this.useScreenCoordinates, this.sizeAttenuation = !this.useScreenCoordinates, this.screenOffset = this.screenOffset, this.scaleByViewPort = !this.sizeAttenuation, this.alignment = r.SpriteAlignment.center.clone(), this.setValues(f), f = f || {}, f.depthTest === void 0 && (this.depthTest = !this.useScreenCoordinates), f.sizeAttenuation === void 0 && (this.sizeAttenuation = !this.useScreenCoordinates), f.scaleByViewPort === void 0 && (this.scaleByViewPort = !this.sizeAttenuation);
              }
              clone(f = new d()) {
                return super.clone.call(this, f), f.color.copy(this.color), f.map = this.map, f.useScreenCoordinates = this.useScreenCoordinates, f.screenOffset = this.screenOffset, f.sizeAttenuation = this.sizeAttenuation, f.scaleByViewport = this.scaleByViewPort, f.alignment.copy(this.alignment), f.uvOffset.copy(this.uvOffset), f;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/StickImposterMaterial.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/materials/StickImposterMaterial.ts ***!
            \******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              StickImposterMaterial: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class a extends r.ImposterMaterial {
              constructor(h) {
                super(h), this.shaderID = "stickimposter", this.setValues(h);
              }
              clone(h = new a()) {
                return super.clone.call(this, h), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/StickImposterOutlineMaterial.ts": (
          /*!*************************************************************!*\
            !*** ./src/WebGL/materials/StickImposterOutlineMaterial.ts ***!
            \*************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), a = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class s extends a.ImposterMaterial {
              constructor(o = {}) {
                super(o), this.shaderID = "stickimposteroutline", this.outlineColor = new r.Color(0, 0, 0), this.outlineWidth = 0.1, this.outlinePushback = 1, this.outlineMaxPixels = 0, o.color && (this.outlineColor = r.CC.color(o.color)), o.width && (this.outlineWidth = o.width), o.pushback && (this.outlinePushback = o.pushback), o.maxpixels && (this.outlineMaxPixels = o.maxpixels), this.setValues(o);
              }
              clone(o = new s()) {
                return super.clone.call(this, o), o.outlineColor = this.outlineColor, o.outlineWidth = this.outlineWidth, o.outlinePushback = this.outlinePushback, o.outlineMaxPixels = this.outlineMaxPixels, o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/VolumetricMaterial.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/materials/VolumetricMaterial.ts ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              VolumetricMaterial: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), a = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), s = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class h extends s.Material {
              constructor(d) {
                super(), this.transparent = !1, this.volumetric = !0, this.color = new a.Color(16777215), this.transferfn = null, this.map = void 0, this.extent = [], this.maxdepth = 100, this.unit = 0, this.texmatrix = null, this.transfermin = -1, this.transfermax = 1, this.subsamples = 5, this.shaderID = "volumetric", this.side = r.FrontSide, this.setValues(d);
              }
              clone(d = new h()) {
                return super.clone.call(this, d), d.transparent = this.transparent, d.volumetric = this.volumetric, d.color = this.color, d.transferfn = this.transferfn, d.map = this.map, d.extent = this.extent, d.maxdepth = this.maxdepth, d.unit = this.unit, d.texmatrix = this.texmatrix, d.transfermin = this.transfermin, d.transfermax = this.transfermax, d.subsamples = this.subsamples, d.shaderID = this.shaderID, d.side = this.side, d;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/index.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/materials/index.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ImposterMaterial: () => (
                /* reexport safe */
                r.ImposterMaterial
              ),
              /* harmony export */
              InstancedMaterial: () => (
                /* reexport safe */
                a.InstancedMaterial
              ),
              /* harmony export */
              LineBasicMaterial: () => (
                /* reexport safe */
                s.LineBasicMaterial
              ),
              /* harmony export */
              Material: () => (
                /* reexport safe */
                h.Material
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* reexport safe */
                h.MaterialIdCount
              ),
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* reexport safe */
                o.MeshDoubleLambertMaterial
              ),
              /* harmony export */
              MeshLambertMaterial: () => (
                /* reexport safe */
                d.MeshLambertMaterial
              ),
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* reexport safe */
                v.MeshOutlineMaterial
              ),
              /* harmony export */
              SphereImposterMaterial: () => (
                /* reexport safe */
                f.SphereImposterMaterial
              ),
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* reexport safe */
                y.SphereImposterOutlineMaterial
              ),
              /* harmony export */
              SpriteMaterial: () => (
                /* reexport safe */
                A.SpriteMaterial
              ),
              /* harmony export */
              StickImposterMaterial: () => (
                /* reexport safe */
                x.StickImposterMaterial
              ),
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* reexport safe */
                M.StickImposterOutlineMaterial
              ),
              /* harmony export */
              VolumetricMaterial: () => (
                /* reexport safe */
                m.VolumetricMaterial
              )
              /* harmony export */
            });
            var r = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            ), a = t(
              /*! ./InstancedMaterial */
              "./src/WebGL/materials/InstancedMaterial.ts"
            ), s = t(
              /*! ./LineBasicMaterial */
              "./src/WebGL/materials/LineBasicMaterial.ts"
            ), h = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            ), o = t(
              /*! ./MeshDoubleLambertMaterial */
              "./src/WebGL/materials/MeshDoubleLambertMaterial.ts"
            ), d = t(
              /*! ./MeshLambertMaterial */
              "./src/WebGL/materials/MeshLambertMaterial.ts"
            ), v = t(
              /*! ./MeshOutlineMaterial */
              "./src/WebGL/materials/MeshOutlineMaterial.ts"
            ), f = t(
              /*! ./SphereImposterMaterial */
              "./src/WebGL/materials/SphereImposterMaterial.ts"
            ), y = t(
              /*! ./SphereImposterOutlineMaterial */
              "./src/WebGL/materials/SphereImposterOutlineMaterial.ts"
            ), A = t(
              /*! ./SpriteMaterial */
              "./src/WebGL/materials/SpriteMaterial.ts"
            ), x = t(
              /*! ./StickImposterMaterial */
              "./src/WebGL/materials/StickImposterMaterial.ts"
            ), M = t(
              /*! ./StickImposterOutlineMaterial */
              "./src/WebGL/materials/StickImposterOutlineMaterial.ts"
            ), m = t(
              /*! ./VolumetricMaterial */
              "./src/WebGL/materials/VolumetricMaterial.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/math/Quaternion.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/math/Quaternion.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Quaternion: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            class r {
              constructor(s, h, o, d) {
                this.x = s || 0, this.y = h || 0, this.z = o || 0, this.w = d !== void 0 ? d : 1;
              }
              set(s, h, o, d) {
                return this.x = s, this.y = h, this.z = o, this.w = d, this;
              }
              copy(s) {
                return this.x = s.x, this.y = s.y, this.z = s.z, this.w = s.w, this;
              }
              conjugate() {
                return this.x *= -1, this.y *= -1, this.z *= -1, this;
              }
              inverse() {
                return this.conjugate().normalize();
              }
              length() {
                return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
              }
              lengthxyz() {
                return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
              }
              normalize() {
                let s = this.length();
                return s === 0 ? (this.x = 0, this.y = 0, this.z = 0, this.w = 1) : (s = 1 / s, this.x *= s, this.y *= s, this.z *= s, this.w *= s), this;
              }
              multiply(s) {
                return this.multiplyQuaternions(this, s);
              }
              multiplyScalar(s) {
                return this.x *= s, this.y *= s, this.z *= s, this.w *= s, this;
              }
              multiplyQuaternions(s, h) {
                const o = s.x, d = s.y, v = s.z, f = s.w, y = h.x, A = h.y, x = h.z, M = h.w;
                return this.x = o * M + f * y + d * x - v * A, this.y = d * M + f * A + v * y - o * x, this.z = v * M + f * x + o * A - d * y, this.w = f * M - o * y - d * A - v * x, this;
              }
              sub(s) {
                return this.x -= s.x, this.y -= s.y, this.z -= s.z, this.w -= s.w, this;
              }
              clone() {
                return new r(this.x, this.y, this.z, this.w);
              }
              setFromEuler(s) {
                const h = Math.cos(s.x / 2), o = Math.cos(s.y / 2), d = Math.cos(s.z / 2), v = Math.sin(s.x / 2), f = Math.sin(s.y / 2), y = Math.sin(s.z / 2);
                return this.x = v * o * d + h * f * y, this.y = h * f * d - v * o * y, this.z = h * o * y + v * f * d, this.w = h * o * d - v * f * y, this;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/Vector2.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/math/Vector2.ts ***!
            \***********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Vector2: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            class r {
              constructor(s, h) {
                this.x = s || 0, this.y = h || 0;
              }
              set(s, h) {
                return this.x = s, this.y = h, this;
              }
              subVectors(s, h) {
                return this.x = s.x - h.x, this.y = s.y - h.y, this;
              }
              copy(s) {
                return this.x = s.x, this.y = s.y, this;
              }
              clone() {
                return new r(this.x, this.y);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/index.ts": (
          /*!*********************************!*\
            !*** ./src/WebGL/math/index.ts ***!
            \*********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                d.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                d.Matrix4
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                r.Quaternion
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                d.Ray
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                a.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                d.Vector3
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                s.clamp
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                h.conversionMatrix3
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                o.degToRad
              )
              /* harmony export */
            });
            var r = t(
              /*! ./Quaternion */
              "./src/WebGL/math/Quaternion.ts"
            ), a = t(
              /*! ./Vector2 */
              "./src/WebGL/math/Vector2.ts"
            ), s = t(
              /*! ./utils/clamp */
              "./src/WebGL/math/utils/clamp.ts"
            ), h = t(
              /*! ./utils/conversionMatrix3 */
              "./src/WebGL/math/utils/conversionMatrix3.ts"
            ), o = t(
              /*! ./utils/degToRad */
              "./src/WebGL/math/utils/degToRad.ts"
            ), d = t(
              /*! ./math */
              "./src/WebGL/math/math.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/math/math.ts": (
          /*!********************************!*\
            !*** ./src/WebGL/math/math.ts ***!
            \********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Matrix3: () => (
                /* binding */
                A
              ),
              /* harmony export */
              Matrix4: () => (
                /* binding */
                f
              ),
              /* harmony export */
              Ray: () => (
                /* binding */
                x
              ),
              /* harmony export */
              Vector3: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utils/degToRad */
              "./src/WebGL/math/utils/degToRad.ts"
            ), a = t(
              /*! ./utils/clamp */
              "./src/WebGL/math/utils/clamp.ts"
            ), s, h, o, d, v;
            class f {
              constructor(m = 1, l = 0, u = 0, p = 0, g = 0, b = 1, c = 0, _ = 0, E = 0, w = 0, k = 1, $ = 0, L = 0, z = 0, F = 0, R = 1) {
                typeof m < "u" && typeof m != "number" ? this.elements = new Float32Array(m) : (this.elements = new Float32Array(16), this.elements[0] = m, this.elements[4] = l, this.elements[8] = u, this.elements[12] = p, this.elements[1] = g, this.elements[5] = b, this.elements[9] = c, this.elements[13] = _, this.elements[2] = E, this.elements[6] = w, this.elements[10] = k, this.elements[14] = $, this.elements[3] = L, this.elements[7] = z, this.elements[11] = F, this.elements[15] = R);
              }
              // eslint-disable-next-line no-unused-vars, class-methods-use-this
              makeScale(m, l, u) {
                throw new Error("Method not implemented.");
              }
              set(m, l, u, p, g, b, c, _, E, w, k, $, L, z, F, R) {
                const P = this.elements;
                return P[0] = m, P[4] = l, P[8] = u, P[12] = p, P[1] = g, P[5] = b, P[9] = c, P[13] = _, P[2] = E, P[6] = w, P[10] = k, P[14] = $, P[3] = L, P[7] = z, P[11] = F, P[15] = R, this;
              }
              identity() {
                return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
              }
              copy(m) {
                const l = m.elements;
                return this.set(l[0], l[4], l[8], l[12], l[1], l[5], l[9], l[13], l[2], l[6], l[10], l[14], l[3], l[7], l[11], l[15]), this;
              }
              matrix3FromTopLeft() {
                const m = this.elements;
                return new A(m[0], m[4], m[8], m[1], m[5], m[9], m[2], m[6], m[10]);
              }
              setRotationFromEuler(m, l) {
                const u = this.elements, { x: p, y: g, z: b } = m, c = Math.cos(p), _ = Math.sin(p), E = Math.cos(g), w = Math.sin(g), k = Math.cos(b), $ = Math.sin(b);
                if (l === void 0 || l === "XYZ") {
                  const L = c * k, z = c * $, F = _ * k, R = _ * $;
                  u[0] = E * k, u[4] = -E * $, u[8] = w, u[1] = z + F * w, u[5] = L - R * w, u[9] = -_ * E, u[2] = R - L * w, u[6] = F + z * w, u[10] = c * E;
                } else
                  console.error(`Error with matrix4 setRotationFromEuler. Order: ${l}`);
                return this;
              }
              setRotationFromQuaternion(m) {
                const l = this.elements, { x: u, y: p, z: g, w: b } = m, c = u + u, _ = p + p, E = g + g, w = u * c, k = u * _, $ = u * E, L = p * _, z = p * E, F = g * E, R = b * c, P = b * _, U = b * E;
                return l[0] = 1 - (L + F), l[4] = k - U, l[8] = $ + P, l[1] = k + U, l[5] = 1 - (w + F), l[9] = z - R, l[2] = $ - P, l[6] = z + R, l[10] = 1 - (w + L), this;
              }
              multiplyMatrices(m, l) {
                const u = m.elements, p = l.elements, g = this.elements, b = u[0], c = u[4], _ = u[8], E = u[12], w = u[1], k = u[5], $ = u[9], L = u[13], z = u[2], F = u[6], R = u[10], P = u[14], U = u[3], N = u[7], B = u[11], W = u[15], V = p[0], G = p[4], H = p[8], Q = p[12], te = p[1], ee = p[5], ce = p[9], fe = p[13], oe = p[2], he = p[6], Ae = p[10], Se = p[14], Ie = p[3], pe = p[7], le = p[11], ne = p[15];
                return g[0] = b * V + c * te + _ * oe + E * Ie, g[4] = b * G + c * ee + _ * he + E * pe, g[8] = b * H + c * ce + _ * Ae + E * le, g[12] = b * Q + c * fe + _ * Se + E * ne, g[1] = w * V + k * te + $ * oe + L * Ie, g[5] = w * G + k * ee + $ * he + L * pe, g[9] = w * H + k * ce + $ * Ae + L * le, g[13] = w * Q + k * fe + $ * Se + L * ne, g[2] = z * V + F * te + R * oe + P * Ie, g[6] = z * G + F * ee + R * he + P * pe, g[10] = z * H + F * ce + R * Ae + P * le, g[14] = z * Q + F * fe + R * Se + P * ne, g[3] = U * V + N * te + B * oe + W * Ie, g[7] = U * G + N * ee + B * he + W * pe, g[11] = U * H + N * ce + B * Ae + W * le, g[15] = U * Q + N * fe + B * Se + W * ne, this;
              }
              multiplyScalar(m) {
                const l = this.elements;
                return l[0] *= m, l[4] *= m, l[8] *= m, l[12] *= m, l[1] *= m, l[5] *= m, l[9] *= m, l[13] *= m, l[2] *= m, l[6] *= m, l[10] *= m, l[14] *= m, l[3] *= m, l[7] *= m, l[11] *= m, l[15] *= m, this;
              }
              makeTranslation(m, l, u) {
                return this.set(1, 0, 0, m, 0, 1, 0, l, 0, 0, 1, u, 0, 0, 0, 1), this;
              }
              // snap values close to integers to their integer value
              // useful and identifying identity matrices
              snap(m) {
                const l = Math.pow(10, 4), u = this.elements;
                for (let p = 0; p < 16; p++) {
                  const g = Math.round(u[p]);
                  g === Math.round(u[p] * l) / l && (u[p] = g);
                }
                return this;
              }
              transpose() {
                const m = this.elements;
                let l;
                return l = m[1], m[1] = m[4], m[4] = l, l = m[2], m[2] = m[8], m[8] = l, l = m[6], m[6] = m[9], m[9] = l, l = m[3], m[3] = m[12], m[12] = l, l = m[7], m[7] = m[13], m[13] = l, l = m[11], m[11] = m[14], m[14] = l, this;
              }
              setPosition(m) {
                const l = this.elements;
                return l[12] = m.x, l[13] = m.y, l[14] = m.z, this;
              }
              translate(m) {
                const l = this.elements;
                return l[12] += m.x, l[13] += m.y, l[14] += m.z, this;
              }
              getInverse(m, l) {
                const u = this.elements, p = m.elements, g = p[0], b = p[4], c = p[8], _ = p[12], E = p[1], w = p[5], k = p[9], $ = p[13], L = p[2], z = p[6], F = p[10], R = p[14], P = p[3], U = p[7], N = p[11], B = p[15];
                u[0] = k * R * U - $ * F * U + $ * z * N - w * R * N - k * z * B + w * F * B, u[4] = _ * F * U - c * R * U - _ * z * N + b * R * N + c * z * B - b * F * B, u[8] = c * $ * U - _ * k * U + _ * w * N - b * $ * N - c * w * B + b * k * B, u[12] = _ * k * z - c * $ * z - _ * w * F + b * $ * F + c * w * R - b * k * R, u[1] = $ * F * P - k * R * P - $ * L * N + E * R * N + k * L * B - E * F * B, u[5] = c * R * P - _ * F * P + _ * L * N - g * R * N - c * L * B + g * F * B, u[9] = _ * k * P - c * $ * P - _ * E * N + g * $ * N + c * E * B - g * k * B, u[13] = c * $ * L - _ * k * L + _ * E * F - g * $ * F - c * E * R + g * k * R, u[2] = w * R * P - $ * z * P + $ * L * U - E * R * U - w * L * B + E * z * B, u[6] = _ * z * P - b * R * P - _ * L * U + g * R * U + b * L * B - g * z * B, u[10] = b * $ * P - _ * w * P + _ * E * U - g * $ * U - b * E * B + g * w * B, u[14] = _ * w * L - b * $ * L - _ * E * z + g * $ * z + b * E * R - g * w * R, u[3] = k * z * P - w * F * P - k * L * U + E * F * U + w * L * N - E * z * N, u[7] = b * F * P - c * z * P + c * L * U - g * F * U - b * L * N + g * z * N, u[11] = c * w * P - b * k * P - c * E * U + g * k * U + b * E * N - g * w * N, u[15] = b * k * L - c * w * L + c * E * z - g * k * z - b * E * F + g * w * F;
                const W = g * u[0] + E * u[4] + L * u[8] + P * u[12];
                if (W === 0) {
                  const V = "Matrix4.getInverse(): can't invert matrix, determinant is 0";
                  if (l)
                    throw new Error(V);
                  return console.warn(V), this.identity(), this;
                }
                return this.multiplyScalar(1 / W), this;
              }
              isReflected() {
                const m = this.elements, l = m[0], u = m[4], p = m[8], g = m[1], b = m[5], c = m[9], _ = m[2], E = m[6], w = m[10];
                return l * b * w + // +aei
                g * E * p + // +bfg
                _ * u * c - // +cdh
                _ * b * p - // -ceg
                g * u * w - // -bdi
                l * E * c < 0;
              }
              scale(m) {
                const l = this.elements, { x: u } = m, { y: p } = m, { z: g } = m;
                return l[0] *= u, l[4] *= p, l[8] *= g, l[1] *= u, l[5] *= p, l[9] *= g, l[2] *= u, l[6] *= p, l[10] *= g, l[3] *= u, l[7] *= p, l[11] *= g, this;
              }
              getMaxScaleOnAxis() {
                const m = this.elements, l = m[0] * m[0] + m[1] * m[1] + m[2] * m[2], u = m[4] * m[4] + m[5] * m[5] + m[6] * m[6], p = m[8] * m[8] + m[9] * m[9] + m[10] * m[10];
                return Math.sqrt(Math.max(l, Math.max(u, p)));
              }
              makeFrustum(m, l, u, p, g, b) {
                const c = this.elements, _ = 2 * g / (l - m), E = 2 * g / (p - u), w = (l + m) / (l - m), k = (p + u) / (p - u), $ = -(b + g) / (b - g), L = -2 * b * g / (b - g);
                return c[0] = _, c[4] = 0, c[8] = w, c[12] = 0, c[1] = 0, c[5] = E, c[9] = k, c[13] = 0, c[2] = 0, c[6] = 0, c[10] = $, c[14] = L, c[3] = 0, c[7] = 0, c[11] = -1, c[15] = 0, this;
              }
              makePerspective(m, l, u, p) {
                const g = u * Math.tan((0, r.degToRad)(m * 0.5)), b = -g, c = b * l, _ = g * l;
                return this.makeFrustum(c, _, b, g, u, p);
              }
              makeOrthographic(m, l, u, p, g, b) {
                const c = this.elements, _ = 1 / (l - m), E = 1 / (u - p), w = 1 / (b - g), k = (l + m) * _, $ = (u + p) * E, L = (b + g) * w;
                return c[0] = 2 * _, c[4] = 0, c[8] = 0, c[12] = -k, c[1] = 0, c[5] = 2 * E, c[9] = 0, c[13] = -$, c[2] = 0, c[6] = 0, c[10] = -2 * w, c[14] = -L, c[3] = 0, c[7] = 0, c[11] = 0, c[15] = 1, this;
              }
              isEqual(m) {
                const l = m.elements, u = this.elements;
                return u[0] === l[0] && u[4] === l[4] && u[8] === l[8] && u[12] === l[12] && u[1] === l[1] && u[5] === l[5] && u[9] === l[9] && u[13] === l[13] && u[2] === l[2] && u[6] === l[6] && u[10] === l[10] && u[14] === l[14] && u[3] === l[3] && u[7] === l[7] && u[11] === l[11] && u[15] === l[15];
              }
              clone() {
                const m = this.elements;
                return new f(m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]);
              }
              isIdentity() {
                const m = this.elements;
                return m[0] === 1 && m[4] === 0 && m[8] === 0 && m[12] === 0 && m[1] === 0 && m[5] === 1 && m[9] === 0 && m[13] === 0 && m[2] === 0 && m[6] === 0 && m[10] === 1 && m[14] === 0 && m[3] === 0 && m[7] === 0 && m[11] === 0 && m[15] === 1;
              }
              // return true if elements are with digits of identity
              isNearlyIdentity(m) {
                return this.clone().snap(m).isIdentity();
              }
              getScale(m) {
                const l = this.elements;
                return m = m || new y(), o.set(l[0], l[1], l[2]), d.set(l[4], l[5], l[6]), v.set(l[8], l[9], l[10]), m.x = o.length(), m.y = d.length(), m.z = v.length(), m;
              }
              lookAt(m, l, u) {
                const p = this.elements;
                return v.subVectors(m, l).normalize(), v.length() === 0 && (v.z = 1), o.crossVectors(u, v).normalize(), o.length() === 0 && (v.x += 1e-4, o.crossVectors(u, v).normalize()), d.crossVectors(v, o), p[0] = o.x, p[4] = d.x, p[8] = v.x, p[1] = o.y, p[5] = d.y, p[9] = v.y, p[2] = o.z, p[6] = d.z, p[10] = v.z, this;
              }
              compose(m, l, u) {
                const p = this.elements;
                return s.identity(), s.setRotationFromQuaternion(l), h.makeScale(u.x, u.y, u.z), this.multiplyMatrices(s, h), p[12] = m.x, p[13] = m.y, p[14] = m.z, this;
              }
            }
            s = new f(), h = new f();
            class y {
              constructor(m, l, u) {
                this.x = m || 0, this.y = l || 0, this.z = u || 0, this.atomid = void 0;
              }
              set(m, l, u) {
                return this.x = m, this.y = l, this.z = u, this;
              }
              copy(m) {
                return this.x = m.x, this.y = m.y, this.z = m.z, this;
              }
              add(m) {
                return this.x += m.x, this.y += m.y, this.z += m.z, this;
              }
              addVectors(m, l) {
                return this.x = m.x + l.x, this.y = m.y + l.y, this.z = m.z + l.z, this;
              }
              multiplyVectors(m, l) {
                return this.x = m.x * l.x, this.y = m.y * l.y, this.z = m.z * l.z, this;
              }
              sub(m) {
                return this.x -= m.x, this.y -= m.y, this.z -= m.z, this;
              }
              subVectors(m, l) {
                return this.x = m.x - l.x, this.y = m.y - l.y, this.z = m.z - l.z, this;
              }
              multiplyScalar(m) {
                return this.x *= m, this.y *= m, this.z *= m, this;
              }
              divideScalar(m) {
                return m !== 0 ? (this.x /= m, this.y /= m, this.z /= m) : (this.x = 0, this.y = 0, this.z = 0), this;
              }
              // accumulate maximum
              max(m) {
                return this.x = Math.max(this.x, m.x), this.y = Math.max(this.y, m.y), this.z = Math.max(this.z, m.z), this;
              }
              // accumulate min
              min(m) {
                return this.x = Math.min(this.x, m.x), this.y = Math.min(this.y, m.y), this.z = Math.min(this.z, m.z), this;
              }
              distanceTo(m) {
                return Math.sqrt(this.distanceToSquared(m));
              }
              distanceToSquared(m) {
                const l = this.x - m.x, u = this.y - m.y, p = this.z - m.z;
                return l * l + u * u + p * p;
              }
              applyMatrix3(m) {
                const { x: l } = this, { y: u } = this, { z: p } = this, g = m.elements;
                return this.x = g[0] * l + g[3] * u + g[6] * p, this.y = g[1] * l + g[4] * u + g[7] * p, this.z = g[2] * l + g[5] * u + g[8] * p, this;
              }
              applyMatrix4(m) {
                const { x: l } = this, { y: u } = this, { z: p } = this, g = m.elements;
                return this.x = g[0] * l + g[4] * u + g[8] * p + g[12], this.y = g[1] * l + g[5] * u + g[9] * p + g[13], this.z = g[2] * l + g[6] * u + g[10] * p + g[14], this;
              }
              applyProjection(m) {
                const { x: l } = this, { y: u } = this, { z: p } = this, g = m.elements, b = g[3] * l + g[7] * u + g[11] * p + g[15];
                return this.x = (g[0] * l + g[4] * u + g[8] * p + g[12]) / b, this.y = (g[1] * l + g[5] * u + g[9] * p + g[13]) / b, this.z = (g[2] * l + g[6] * u + g[10] * p + g[14]) / b, this;
              }
              applyQuaternion(m) {
                const { x: l } = this, { y: u } = this, { z: p } = this, g = m.x, b = m.y, c = m.z, _ = m.w, E = {};
                E.x = 2 * (u * c - p * b), E.y = 2 * (p * g - l * c), E.z = 2 * (l * b - u * g);
                const w = {};
                return w.x = E.y * c - E.z * b, w.y = E.z * g - E.x * c, w.z = E.x * b - E.y * g, this.x = l + _ * E.x + w.x, this.y = u + _ * E.y + w.y, this.z = p + _ * E.z + w.z, this;
              }
              negate() {
                return this.multiplyScalar(-1);
              }
              dot(m) {
                return this.x * m.x + this.y * m.y + this.z * m.z;
              }
              length() {
                return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
              }
              lengthSq() {
                return this.x * this.x + this.y * this.y + this.z * this.z;
              }
              normalize() {
                return this.divideScalar(this.length());
              }
              cross(m) {
                const { x: l } = this, { y: u } = this, { z: p } = this;
                return this.x = u * m.z - p * m.y, this.y = p * m.x - l * m.z, this.z = l * m.y - u * m.x, this;
              }
              crossVectors(m, l) {
                return this.x = m.y * l.z - m.z * l.y, this.y = m.z * l.x - m.x * l.z, this.z = m.x * l.y - m.y * l.x, this;
              }
              equals(m) {
                return this.x == m.x && this.y == m.y && this.z == m.z;
              }
              getPositionFromMatrix(m) {
                return this.x = m.elements[12], this.y = m.elements[13], this.z = m.elements[14], this;
              }
              setEulerFromRotationMatrix(m, l) {
                const u = m.elements, p = u[0], g = u[4], b = u[8], c = u[5], _ = u[9], E = u[6], w = u[10];
                return l === void 0 || l === "XYZ" ? (this.y = Math.asin((0, a.clamp)(b, -1, 1)), Math.abs(b) < 0.99999 ? (this.x = Math.atan2(-_, w), this.z = Math.atan2(-g, p)) : (this.x = Math.atan2(E, c), this.z = 0)) : console.error(`Error with vector's setEulerFromRotationMatrix: Unknown order: ${l}`), this;
              }
              rotateAboutVector(m, l) {
                m.normalize();
                const u = Math.cos(l), p = Math.sin(l), g = this.clone().multiplyScalar(u), b = m.clone().cross(this).multiplyScalar(p), c = m.clone().multiplyScalar(m.clone().dot(this)).multiplyScalar(1 - u), _ = g.add(b).add(c);
                return this.x = _.x, this.y = _.y, this.z = _.z, this;
              }
              setFromMatrixPosition(m) {
                const l = m.elements;
                return this.x = l[12], this.y = l[13], this.z = l[14], this;
              }
              // unproject is defined after Matrix4
              transformDirection(m) {
                const { x: l } = this, { y: u } = this, { z: p } = this, g = m.elements;
                return this.x = g[0] * l + g[4] * u + g[8] * p, this.y = g[1] * l + g[5] * u + g[9] * p, this.z = g[2] * l + g[6] * u + g[10] * p, this.normalize();
              }
              clone() {
                return new y(this.x, this.y, this.z);
              }
              unproject(m) {
                const l = s;
                return l.multiplyMatrices(m.matrixWorld, l.getInverse(m.projectionMatrix)), this.applyMatrix4(l);
              }
            }
            o = new y(), d = new y(), v = new y();
            class A {
              constructor(m = 1, l = 0, u = 0, p = 0, g = 1, b = 0, c = 0, _ = 0, E = 1) {
                this.elements = new Float32Array(9), this.set(m, l, u, p, g, b, c, _, E);
              }
              set(m, l, u, p, g, b, c, _, E) {
                const w = this.elements;
                return w[0] = m, w[3] = l, w[6] = u, w[1] = p, w[4] = g, w[7] = b, w[2] = c, w[5] = _, w[8] = E, this;
              }
              identity() {
                return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
              }
              copy(m) {
                const l = m.elements;
                this.set(l[0], l[3], l[6], l[1], l[4], l[7], l[2], l[5], l[8]);
              }
              multiplyScalar(m) {
                const l = this.elements;
                return l[0] *= m, l[3] *= m, l[6] *= m, l[1] *= m, l[4] *= m, l[7] *= m, l[2] *= m, l[5] *= m, l[8] *= m, this;
              }
              getInverse3(m) {
                const l = m.elements, u = this.elements;
                u[0] = l[4] * l[8] - l[5] * l[7], u[3] = l[6] * l[5] - l[3] * l[8], u[6] = l[3] * l[7] - l[6] * l[4], u[1] = l[7] * l[2] - l[1] * l[8], u[4] = l[0] * l[8] - l[6] * l[2], u[7] = l[1] * l[6] - l[0] * l[7], u[2] = l[1] * l[5] - l[2] * l[4], u[5] = l[2] * l[3] - l[0] * l[5], u[8] = l[0] * l[4] - l[1] * l[3];
                const p = l[0] * u[0] + l[3] * u[1] + l[6] * u[2];
                return this.multiplyScalar(1 / p), this;
              }
              getInverse(m, l) {
                const u = m.elements, p = this.elements;
                p[0] = u[10] * u[5] - u[6] * u[9], p[1] = -u[10] * u[1] + u[2] * u[9], p[2] = u[6] * u[1] - u[2] * u[5], p[3] = -u[10] * u[4] + u[6] * u[8], p[4] = u[10] * u[0] - u[2] * u[8], p[5] = -u[6] * u[0] + u[2] * u[4], p[6] = u[9] * u[4] - u[5] * u[8], p[7] = -u[9] * u[0] + u[1] * u[8], p[8] = u[5] * u[0] - u[1] * u[4];
                const g = u[0] * p[0] + u[1] * p[3] + u[2] * p[6];
                if (g === 0) {
                  const b = "Matrix3.getInverse(): can't invert matrix, determinant is 0";
                  if (l)
                    throw new Error(b);
                  return console.warn(b), this.identity(), this;
                }
                return this.multiplyScalar(1 / g), this;
              }
              // https://en.wikipedia.org/wiki/Determinant
              getDeterminant() {
                const m = this.elements;
                return m[0] * m[4] * m[8] + // +aei
                m[1] * m[5] * m[6] + // +bfg
                m[2] * m[3] * m[7] - // +cdh
                m[2] * m[4] * m[6] - // -ceg
                m[1] * m[3] * m[8] - // -bdi
                m[0] * m[5] * m[7];
              }
              transpose() {
                let m;
                const l = this.elements;
                return m = l[1], l[1] = l[3], l[3] = m, m = l[2], l[2] = l[6], l[6] = m, m = l[5], l[5] = l[7], l[7] = m, this;
              }
              clone() {
                const m = this.elements;
                return new A(m[0], m[3], m[6], m[1], m[4], m[7], m[2], m[5], m[8]);
              }
              getMatrix4() {
                const m = this.elements;
                return new f(m[0], m[3], m[6], 0, m[1], m[4], m[7], 0, m[2], m[5], m[8], 0);
              }
            }
            class x {
              constructor(m, l) {
                this.origin = m !== void 0 ? m : new y(), this.direction = l !== void 0 ? l : new y();
              }
              set(m, l) {
                return this.origin.copy(m), this.direction.copy(l), this;
              }
              copy(m) {
                return this.origin.copy(m.origin), this.direction.copy(m.direction), this;
              }
              at(m, l) {
                return (l || new y()).copy(this.direction).multiplyScalar(m).add(this.origin);
              }
              recast(m) {
                const l = o;
                return this.origin.copy(this.at(m, l)), this;
              }
              closestPointToPoint(m, l) {
                const u = l || new y();
                u.subVectors(m, this.origin);
                const p = u.dot(this.direction);
                return u.copy(this.direction).multiplyScalar(p).add(this.origin);
              }
              distanceToPoint(m) {
                const l = o, u = l.subVectors(m, this.origin).dot(this.direction);
                return l.copy(this.direction).multiplyScalar(u).add(this.origin), l.distanceTo(m);
              }
              // eslint-disable-next-line class-methods-use-this
              isIntersectionCylinder() {
              }
              isIntersectionSphere(m) {
                return this.distanceToPoint(m.center) <= m.radius;
              }
              isIntersectionPlane(m) {
                return m.normal.dot(this.direction) !== 0 || m.distanceToPoint(this.origin) === 0;
              }
              distanceToPlane(m) {
                const l = m.normal.dot(this.direction);
                return l === 0 ? m.distanceToPoint(this.origin) === 0 ? 0 : void 0 : -(this.origin.dot(m.normal) + m.constant) / l;
              }
              intersectPlane(m, l) {
                const u = this.distanceToPlane(m);
                if (u !== void 0)
                  return this.at(u, l);
              }
              applyMatrix4(m) {
                return this.direction.add(this.origin).applyMatrix4(m), this.origin.applyMatrix4(m), this.direction.sub(this.origin), this;
              }
              clone() {
                return new x().copy(this);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/clamp.ts": (
          /*!***************************************!*\
            !*** ./src/WebGL/math/utils/clamp.ts ***!
            \***************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              clamp: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r(a, s, h) {
              return Math.min(Math.max(a, s), h);
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/conversionMatrix3.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/math/utils/conversionMatrix3.ts ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              conversionMatrix3: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/math.ts"
            );
            function a(s, h, o, d, v, f) {
              d = d * Math.PI / 180, v = v * Math.PI / 180, f = f * Math.PI / 180;
              const y = (u) => u * u, A = Math.cos(d), x = Math.cos(v), M = Math.cos(f), m = Math.sin(f);
              return new r.Matrix3(s, h * M, o * x, 0, h * m, o * (A - x * M) / m, 0, 0, o * Math.sqrt(1 - y(A) - y(x) - y(M) + 2 * A * x * M) / m);
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/degToRad.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/math/utils/degToRad.ts ***!
            \******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              degToRad: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            const r = Math.PI / 180;
            function a(s) {
              return s * r;
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Line.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/objects/Line.ts ***!
            \***********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Line: () => (
                /* binding */
                h
              ),
              /* harmony export */
              LineStyle: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../materials */
              "./src/WebGL/materials/index.ts"
            ), a = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            ), s;
            (function(o) {
              o[o.LineStrip = 0] = "LineStrip", o[o.LinePieces = 1] = "LinePieces";
            })(s || (s = {}));
            class h extends a.Object3D {
              constructor(d, v = new r.LineBasicMaterial({
                color: Math.random() * 16777215
              }), f = s.LineStrip) {
                super(), this.geometry = d, this.material = v, this.type = f;
              }
              clone(d = new h(this.geometry, this.material, this.type)) {
                return super.clone.call(this, d), d;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Mesh.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/objects/Mesh.ts ***!
            \***********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Mesh: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            );
            class a extends r.Object3D {
              constructor(h, o) {
                super(), this.geometry = h, this.material = o;
              }
              clone(h) {
                return h === void 0 && (h = new a(this.geometry, this.material)), super.clone.call(this, h), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Sprite.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/objects/Sprite.ts ***!
            \*************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Sprite: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../materials */
              "./src/WebGL/materials/index.ts"
            ), a = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            );
            class s extends a.Object3D {
              constructor(o = new r.SpriteMaterial()) {
                super(), this.material = o, this.rotation3d = this.rotation, this.rotation = 0;
              }
              updateMatrix() {
                this.matrix.setPosition(this.position), this.rotation3d.set(0, 0, this.rotation), this.matrix.setRotationFromEuler(this.rotation3d), (this.scale.x !== 1 || this.scale.y !== 1) && this.matrix.scale(this.scale), this.matrixWorldNeedsUpdate = !0;
              }
              clone(o = new s(this.material)) {
                return a.Object3D.prototype.clone.call(this, o), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/index.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/objects/index.ts ***!
            \************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Line: () => (
                /* reexport safe */
                r.Line
              ),
              /* harmony export */
              LineStyle: () => (
                /* reexport safe */
                r.LineStyle
              ),
              /* harmony export */
              Mesh: () => (
                /* reexport safe */
                a.Mesh
              ),
              /* harmony export */
              Sprite: () => (
                /* reexport safe */
                s.Sprite
              )
              /* harmony export */
            });
            var r = t(
              /*! ./Line */
              "./src/WebGL/objects/Line.ts"
            ), a = t(
              /*! ./Mesh */
              "./src/WebGL/objects/Mesh.ts"
            ), s = t(
              /*! ./Sprite */
              "./src/WebGL/objects/Sprite.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/shaders/ShaderType.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/shaders/ShaderType.ts ***!
            \*****************************************/
          /***/
          (n, e, t) => {
            t.r(e);
          }
        ),
        /***/
        "./src/WebGL/shaders/index.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/shaders/index.ts ***!
            \************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ShaderLib: () => (
                /* reexport safe */
                r.ShaderLib
              ),
              /* harmony export */
              ShaderUtils: () => (
                /* reexport safe */
                a.ShaderUtils
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                r.basic
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                a.clone
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                r.instanced
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                r.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                r.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                r.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                r.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                r.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                r.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                r.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                r.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                r.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                r.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                r.volumetric
              )
              /* harmony export */
            });
            var r = t(
              /*! ./lib */
              "./src/WebGL/shaders/lib/index.ts"
            ), a = t(
              /*! ./utils */
              "./src/WebGL/shaders/utils/index.ts"
            );
            t(
              /*! ./ShaderType */
              "./src/WebGL/shaders/ShaderType.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/index.ts": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/index.ts ***!
            \**********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              basic: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/basic/uniforms.ts"
            ), a = t(
              /*! ./basic.frag */
              "./src/WebGL/shaders/lib/basic/basic.frag"
            ), s = t(
              /*! ./basic.vert */
              "./src/WebGL/shaders/lib/basic/basic.vert"
            );
            const h = {
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/uniforms.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/uniforms.ts ***!
            \*************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/blur/index.ts": (
          /*!*********************************************!*\
            !*** ./src/WebGL/shaders/lib/blur/index.ts ***!
            \*********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              blur: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/blur/uniforms.ts"
            ), a = t(
              /*! ./blur.frag */
              "./src/WebGL/shaders/lib/blur/blur.frag"
            ), s = t(
              /*! ./blur.vert */
              "./src/WebGL/shaders/lib/blur/blur.vert"
            );
            const h = {
              fragmentShader: a.default,
              vertexShader: s.default,
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/blur/uniforms.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/blur/uniforms.ts ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/index.ts": (
          /*!****************************************!*\
            !*** ./src/WebGL/shaders/lib/index.ts ***!
            \****************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ShaderLib: () => (
                /* binding */
                p
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                r.basic
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                a.instanced
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                s.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                h.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                o.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                d.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                v.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                f.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                y.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                A.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                x.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                M.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                m.volumetric
              )
              /* harmony export */
            });
            var r = t(
              /*! ./basic */
              "./src/WebGL/shaders/lib/basic/index.ts"
            ), a = t(
              /*! ./instanced */
              "./src/WebGL/shaders/lib/instanced/index.ts"
            ), s = t(
              /*! ./lambert */
              "./src/WebGL/shaders/lib/lambert/index.ts"
            ), h = t(
              /*! ./lambertdouble */
              "./src/WebGL/shaders/lib/lambertdouble/index.ts"
            ), o = t(
              /*! ./outline */
              "./src/WebGL/shaders/lib/outline/index.ts"
            ), d = t(
              /*! ./screen */
              "./src/WebGL/shaders/lib/screen/index.ts"
            ), v = t(
              /*! ./screenaa */
              "./src/WebGL/shaders/lib/screenaa/index.ts"
            ), f = t(
              /*! ./sphereimposter */
              "./src/WebGL/shaders/lib/sphereimposter/index.ts"
            ), y = t(
              /*! ./sphereimposteroutline */
              "./src/WebGL/shaders/lib/sphereimposteroutline/index.ts"
            ), A = t(
              /*! ./sprite */
              "./src/WebGL/shaders/lib/sprite/index.ts"
            ), x = t(
              /*! ./stickimposter */
              "./src/WebGL/shaders/lib/stickimposter/index.ts"
            ), M = t(
              /*! ./stickimposteroutline */
              "./src/WebGL/shaders/lib/stickimposteroutline/index.ts"
            ), m = t(
              /*! ./volumetric */
              "./src/WebGL/shaders/lib/volumetric/index.ts"
            ), l = t(
              /*! ./ssao */
              "./src/WebGL/shaders/lib/ssao/index.ts"
            ), u = t(
              /*! ./blur */
              "./src/WebGL/shaders/lib/blur/index.ts"
            );
            const p = {
              basic: r.basic,
              blur: u.blur,
              instanced: a.instanced,
              lambert: s.lambert,
              lambertdouble: h.lambertdouble,
              outline: o.outline,
              screen: d.screen,
              screenaa: v.screenaa,
              ssao: l.ssao,
              sphereimposter: f.sphereimposter,
              sphereimposteroutline: y.sphereimposteroutline,
              sprite: A.sprite,
              stickimposter: x.stickimposter,
              stickimposteroutline: M.stickimposteroutline,
              volumetric: m.volumetric
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/index.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/index.ts ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              instanced: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/instanced/uniforms.ts"
            ), a = t(
              /*! ./instanced.frag */
              "./src/WebGL/shaders/lib/instanced/instanced.frag"
            ), s = t(
              /*! ./instanced.vert */
              "./src/WebGL/shaders/lib/instanced/instanced.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/uniforms.ts": (
          /*!*****************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/uniforms.ts ***!
            \*****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              directionalLightColor: { type: "fv", value: [] },
              directionalLightDirection: { type: "fv", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambert/index.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambert/index.ts ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              lambert: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/lambert/uniforms.ts"
            ), a = t(
              /*! ./lambert.frag */
              "./src/WebGL/shaders/lib/lambert/lambert.frag"
            ), s = t(
              /*! ./lambert.vert */
              "./src/WebGL/shaders/lib/lambert/lambert.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambert/uniforms.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambert/uniforms.ts ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              directionalLightColor: { type: "fv", value: [] },
              directionalLightDirection: { type: "fv", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambertdouble/index.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/index.ts ***!
            \******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              lambertdouble: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts"
            ), a = t(
              /*! ./lambertdouble.frag */
              "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag"
            ), s = t(
              /*! ./lambertdouble.vert */
              "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts": (
          /*!*********************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/uniforms.ts ***!
            \*********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              directionalLightColor: { type: "fv", value: [] },
              directionalLightDirection: { type: "fv", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/outline/index.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/outline/index.ts ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              outline: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/outline/uniforms.ts"
            ), a = t(
              /*! ./outline.frag */
              "./src/WebGL/shaders/lib/outline/outline.frag"
            ), s = t(
              /*! ./outline.vert */
              "./src/WebGL/shaders/lib/outline/outline.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/outline/uniforms.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/outline/uniforms.ts ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              outlineColor: { type: "c", value: new r.Color(0, 0, 0) },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              outlineWidth: { type: "f", value: 0.1 },
              outlinePushback: { type: "f", value: 1 },
              outlineMaxPixels: { type: "f", value: 0 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/index.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/index.ts ***!
            \***********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              screen: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/screen/uniforms.ts"
            ), a = t(
              /*! ./screen.frag */
              "./src/WebGL/shaders/lib/screen/screen.frag"
            ), s = t(
              /*! ./screen.vert */
              "./src/WebGL/shaders/lib/screen/screen.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/uniforms.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/uniforms.ts ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/index.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/index.ts ***!
            \*************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              screenaa: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/screenaa/uniforms.ts"
            ), a = t(
              /*! ./screenaa.frag */
              "./src/WebGL/shaders/lib/screenaa/screenaa.frag"
            ), s = t(
              /*! ./screenaa.vert */
              "./src/WebGL/shaders/lib/screenaa/screenaa.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/uniforms.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/uniforms.ts ***!
            \****************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/index.ts": (
          /*!*******************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/index.ts ***!
            \*******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              sphereimposter: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts"
            ), a = t(
              /*! ./sphereimposter.frag */
              "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag"
            ), s = t(
              /*! ./sphereimposter.vert */
              "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert"
            );
            const h = {
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/uniforms.ts ***!
            \**********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              directionalLightColor: { type: "fv", value: [] },
              directionalLightDirection: { type: "fv", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposteroutline/index.ts": (
          /*!**************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposteroutline/index.ts ***!
            \**************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              sphereimposteroutline: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts"
            ), a = t(
              /*! ./sphereimposteroutline.frag */
              "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag"
            ), s = t(
              /*! ./sphereimposteroutline.vert */
              "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts": (
          /*!*****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts ***!
            \*****************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              outlineColor: { type: "c", value: new r.Color(0, 0, 0) },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              outlineWidth: { type: "f", value: 0.1 },
              outlinePushback: { type: "f", value: 1 },
              outlineMaxPixels: { type: "f", value: 0 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/index.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/index.ts ***!
            \***********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              sprite: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sprite/uniforms.ts"
            ), a = t(
              /*! ./sprite.frag */
              "./src/WebGL/shaders/lib/sprite/sprite.frag"
            ), s = t(
              /*! ./sprite.vert */
              "./src/WebGL/shaders/lib/sprite/sprite.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/uniforms.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/uniforms.ts ***!
            \**************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/ssao/index.ts": (
          /*!*********************************************!*\
            !*** ./src/WebGL/shaders/lib/ssao/index.ts ***!
            \*********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ssao: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/ssao/uniforms.ts"
            ), a = t(
              /*! ./ssao.frag */
              "./src/WebGL/shaders/lib/ssao/ssao.frag"
            ), s = t(
              /*! ./ssao.vert */
              "./src/WebGL/shaders/lib/ssao/ssao.vert"
            );
            const h = {
              fragmentShader: a.default,
              vertexShader: s.default,
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/ssao/uniforms.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/ssao/uniforms.ts ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {
              total_strength: { type: "f", value: 1 },
              radius: { type: "f", value: 5 },
              projinv: { type: "mat4", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/index.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/index.ts ***!
            \******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              stickimposter: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/stickimposter/uniforms.ts"
            ), a = t(
              /*! ./stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/lib/stickimposter/stickimposterFragmentShader.partial.frag"
            ), s = t(
              /*! ./stickimposter.partial.frag */
              "./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag"
            ), h = t(
              /*! ./stickimposter.vert */
              "./src/WebGL/shaders/lib/stickimposter/stickimposter.vert"
            );
            const d = {
              fragmentShader: [a.default, s.default].join(`
`),
              vertexShader: h.default,
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/uniforms.ts": (
          /*!*********************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/uniforms.ts ***!
            \*********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              directionalLightColor: { type: "fv", value: [] },
              directionalLightDirection: { type: "fv", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposteroutline/index.ts": (
          /*!*************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposteroutline/index.ts ***!
            \*************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              stickimposteroutline: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts"
            ), a = t(
              /*! ../stickimposter/stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/lib/stickimposter/stickimposterFragmentShader.partial.frag"
            ), s = t(
              /*! ./stickimposteroutline.vert */
              "./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert"
            );
            const o = {
              fragmentShader: a.default + "gl_FragColor = vec4(color,1.0);}",
              vertexShader: s.default,
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts ***!
            \****************************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              outlineColor: { type: "c", value: new r.Color(0, 0, 0) },
              outlineWidth: { type: "f", value: 0.1 },
              outlinePushback: { type: "f", value: 1 },
              outlineMaxPixels: { type: "f", value: 0 },
              projinv: { type: "mat4", value: [] }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/index.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/index.ts ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              volumetric: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/volumetric/uniforms.ts"
            ), a = t(
              /*! ./volumetric.frag */
              "./src/WebGL/shaders/lib/volumetric/volumetric.frag"
            ), s = t(
              /*! ./volumetric.vert */
              "./src/WebGL/shaders/lib/volumetric/volumetric.vert"
            );
            const h = {
              fragmentShader: a.default.replace("#define GLSLIFY 1", ""),
              vertexShader: s.default.replace("#define GLSLIFY 1", ""),
              uniforms: r.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/uniforms.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/uniforms.ts ***!
            \******************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const a = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new r.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              data: { type: "i", value: 3 },
              colormap: { type: "i", value: 4 },
              depthmap: { type: "i", value: 5 },
              step: { type: "f", value: 1 },
              maxdepth: { type: "f", value: 100 },
              subsamples: { type: "f", value: 5 },
              textmat: { type: "mat4", value: [] },
              projinv: { type: "mat4", value: [] },
              transfermin: { type: "f", value: -0.2 },
              transfermax: { type: "f", value: 0.2 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/utils/clone.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/shaders/utils/clone.ts ***!
            \******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              clone: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../../colors */
              "./src/colors.ts"
            );
            function a(s) {
              let h = {};
              for (const d in s) {
                h[d] = {}, h[d].type = s[d].type;
                var o = s[d].value;
                o instanceof r.Color ? h[d].value = o.clone() : typeof o == "number" ? h[d].value = o : o instanceof Array ? h[d].value = [] : console.error("Error copying shader uniforms from ShaderLib: unknown type for uniform");
              }
              return h;
            }
          }
        ),
        /***/
        "./src/WebGL/shaders/utils/index.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/shaders/utils/index.ts ***!
            \******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ShaderUtils: () => (
                /* binding */
                a
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                r.clone
              )
              /* harmony export */
            });
            var r = t(
              /*! ./clone */
              "./src/WebGL/shaders/utils/clone.ts"
            );
            const a = {
              clone: r.clone
            };
          }
        ),
        /***/
        "./src/WebGL/shapes/Cylinder.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/shapes/Cylinder.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Cylinder: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            let a = new r.Vector3();
            class s {
              constructor(o = new r.Vector3(), d = new r.Vector3(), v = 0) {
                this.c1 = o, this.c2 = d, this.radius = v, this.direction = new r.Vector3().subVectors(this.c2, this.c1).normalize();
              }
              copy(o) {
                return this.c1.copy(o.c1), this.c2.copy(o.c2), this.direction.copy(o.direction), this.radius = o.radius, this;
              }
              lengthSq() {
                return a.subVectors(this.c2, this.c1).lengthSq();
              }
              applyMatrix4(o) {
                return this.direction.add(this.c1).applyMatrix4(o), this.c1.applyMatrix4(o), this.c2.applyMatrix4(o), this.direction.sub(this.c1).normalize(), this.radius = this.radius * o.getMaxScaleOnAxis(), this;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/Sphere.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/shapes/Sphere.ts ***!
            \************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Sphere: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            class a {
              constructor(h = { x: 0, y: 0, z: 0 }, o = 0) {
                this.center = new r.Vector3(h.x, h.y, h.z), this.radius = o;
              }
              set(h, o) {
                return this.center.copy(h), this.radius = o, this;
              }
              copy(h) {
                return this.center.copy(h.center), this.radius = h.radius, this;
              }
              applyMatrix4(h) {
                return this.center.applyMatrix4(h), this.radius = this.radius * h.getMaxScaleOnAxis(), this;
              }
              translate(h) {
                return this.center.add(h), this;
              }
              equals(h) {
                return h.center.equals(this.center) && h.radius === this.radius;
              }
              clone() {
                return new a().copy(this);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/Triangle.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/shapes/Triangle.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Triangle: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const a = new r.Vector3();
            class s {
              constructor(o = new r.Vector3(), d = new r.Vector3(), v = new r.Vector3()) {
                this.a = o, this.b = d, this.c = v;
              }
              copy(o) {
                return this.a.copy(o.a), this.b.copy(o.b), this.c.copy(o.c), this;
              }
              applyMatrix4(o) {
                return this.a.applyMatrix4(o), this.b.applyMatrix4(o), this.c.applyMatrix4(o), this;
              }
              getNormal() {
                var o = this.a.clone();
                return o.sub(this.b), a.subVectors(this.c, this.b), o.cross(a), o.normalize(), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/index.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/shapes/index.ts ***!
            \***********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                a.Cylinder
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                r.Sphere
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                s.Triangle
              )
              /* harmony export */
            });
            var r = t(
              /*! ./Sphere */
              "./src/WebGL/shapes/Sphere.ts"
            ), a = t(
              /*! ./Cylinder */
              "./src/WebGL/shapes/Cylinder.ts"
            ), s = t(
              /*! ./Triangle */
              "./src/WebGL/shapes/Triangle.ts"
            );
          }
        ),
        /***/
        "./src/autoload.ts": (
          /*!*************************!*\
            !*** ./src/autoload.ts ***!
            \*************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              autoinit: () => (
                /* binding */
                o
              ),
              /* harmony export */
              autoload: () => (
                /* binding */
                f
              ),
              /* harmony export */
              processing_autoinit: () => (
                /* binding */
                d
              ),
              /* harmony export */
              viewers: () => (
                /* binding */
                v
              )
              /* harmony export */
            });
            var r = t(
              /*! ./GLViewer */
              "./src/GLViewer.ts"
            ), a = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), s = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), h = t(
              /*! ./colors */
              "./src/colors.ts"
            ), o = !1, d = !1, v = {};
            function f(y, A) {
              var x, M, m;
              if (document.querySelector(".viewer_3Dmoljs") != null && (o = !0), o) {
                d = !0, y = y ?? null;
                var l = 0;
                document.querySelectorAll(".viewer_3Dmoljs").forEach((u) => {
                  var p = [], g = [], b = "";
                  u.style.position == "static" && (u.style.position = "relative");
                  var c = null;
                  if (m = null, u.dataset.pdb)
                    p.push("https://files.rcsb.org/view/" + u.dataset.pdb + ".pdb"), g.push("pdb");
                  else if (u.dataset.cid)
                    g.push("sdf"), p.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + u.dataset.cid + "/SDF?record_type=3d");
                  else if (u.dataset.href || u.dataset.url) {
                    if (u.dataset.href ? b = u.dataset.href : b = u.dataset.url, p.push(b), m = b.substring(b.lastIndexOf(".") + 1), m == "gz") {
                      let pe = b.substring(0, b.lastIndexOf(".")).lastIndexOf(".");
                      m = b.substring(pe + 1);
                    }
                    g.push(m);
                    var _ = b.substring(b.lastIndexOf("/") + 1, b.lastIndexOf("."));
                    _ == "/" && (_ = b.substring(b.lastIndexOf("/") + 1)), u.dataset[g[g.length - 1]] = _;
                  }
                  let E = u.dataset;
                  for (x in E)
                    x.substring(0, 3) === "pdb" && x !== "pdb" ? (p.push("https://files.rcsb.org/view/" + E[x] + ".pdb"), g.push("pdb")) : x.substring(0, 4) === "href" && x !== "href" ? (b = E[x], p.push(b), g.push(b.substring(b.lastIndexOf(".") + 1))) : x.substring(0, 3) === "cid" && x !== "cid" && (p.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + E[x] + "/SDF?record_type=3d"), g.push("sdf"));
                  var w = {};
                  u.dataset.options && (w = (0, s.specStringToObject)(u.dataset.options));
                  var k = h.CC.color(u.dataset.backgroundcolor), $ = u.dataset.backgroundalpha;
                  $ = $ == null ? 1 : parseFloat($);
                  var L = { line: {} };
                  u.dataset.style && (L = (0, s.specStringToObject)(u.dataset.style));
                  var z = {};
                  u.dataset.select && (z = (0, s.specStringToObject)(u.dataset.select));
                  var F = [], R = [], P = [], U = {}, N = null, B = u.dataset, W = /style(.+)/, V = /surface(.*)/, G = /labelres(.*)/, H = [];
                  for (M in B)
                    Object.prototype.hasOwnProperty.call(B, M) && H.push(M);
                  for (H.sort(), x = 0; x < H.length; x++) {
                    M = H[x];
                    var Q = W.exec(M), te, ee, ce;
                    Q && (te = "select" + Q[1], ee = (0, s.specStringToObject)(B[te]), ce = (0, s.specStringToObject)(B[M]), F.push([ee, ce])), Q = V.exec(M), Q && (te = "select" + Q[1], ee = (0, s.specStringToObject)(B[te]), ce = (0, s.specStringToObject)(B[M]), R.push([ee, ce])), Q = G.exec(M), Q && (te = "select" + Q[1], ee = (0, s.specStringToObject)(B[te]), ce = (0, s.specStringToObject)(B[M]), P.push([ee, ce])), M == "zoomto" && (U = (0, s.specStringToObject)(B[M])), M == "spin" && (N = (0, s.specStringToObject)(B[M]));
                  }
                  var fe = function(pe) {
                    for (pe.setStyle(z, L), c && c.createSelectionAndStyle(z, L), x = 0; x < F.length; x++) {
                      let le = F[x][0] || {}, ne = F[x][1] || { line: {} };
                      pe.setStyle(le, ne), c && c.createSelectionAndStyle(z, L);
                    }
                    for (x = 0; x < R.length; x++) {
                      let le = R[x][0] || {}, ne = R[x][1] || {};
                      c ? pe.addSurface(a.SurfaceType.VDW, ne, le, le).then((Oe) => {
                        c.loadSurface("VDW", le, ne, Oe);
                      }) : pe.addSurface(a.SurfaceType.VDW, ne, le, le);
                    }
                    for (x = 0; x < P.length; x++) {
                      let le = P[x][0] || {}, ne = P[x][1] || {};
                      pe.addResLabels(le, ne);
                    }
                    pe.render(), pe.zoomTo(U), N && pe.spin(N.axis, N.speed);
                  };
                  let oe = y;
                  try {
                    var he = (0, s.specStringToObject)(u.dataset.config) || {};
                    he.backgroundColor === void 0 && (he.backgroundColor = k), he.backgroundAlpha === void 0 && (he.backgroundAlpha = $), oe == null ? oe = v[u.id || l++] = (0, r.createViewer)(u, he) : (oe.setBackgroundColor(k, $), oe.setConfig(he), c && c.initiateUI()), u.dataset.ui && $3Dmol.StateManager && (c = new $3Dmol.StateManager(oe));
                  } catch (pe) {
                    console.log(pe), u.textContent = "WebGL appears to be disabled.";
                  }
                  if (p.length != 0) {
                    let pe = 0, le = /* @__PURE__ */ ((ne, Te) => function(Oe) {
                      b = p[pe];
                      var Be = ne.dataset.type || ne.dataset.datatype || g[pe];
                      if (Te.addModel(Oe, Be, w), c) {
                        var Ue = ne.dataset[g[pe]];
                        c.setModelTitle(Ue);
                      }
                      pe += 1, pe < p.length ? (0, s.get)(p[pe]).then(le) : (fe(Te), ne.dataset.callback && (0, s.makeFunction)(ne.dataset.callback)(Te), d = !1, A && A(Te));
                    })(u, oe);
                    m && m.endsWith("gz") ? (0, s.getbin)(p[0]).then(le) : (0, s.get)(p[0]).then(le);
                  } else {
                    if (u.dataset.element) {
                      var Ae = "#" + u.dataset.element, Se = document.querySelector(Ae), Ie = Se ? Se.textContent : "";
                      m = u.dataset.type || u.dataset.datatype, oe.addModel(Ie, m, w);
                    }
                    fe(oe), u.dataset.callback && (0, s.makeFunction)(u.dataset.callback)(oe), d = !1, A && A(oe);
                  }
                });
              }
            }
            document.onreadystatechange = () => {
              document.readyState === "complete" && f();
            };
          }
        ),
        /***/
        "./src/colors.ts": (
          /*!***********************!*\
            !*** ./src/colors.ts ***!
            \***********************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CC: () => (
                /* binding */
                a
              ),
              /* harmony export */
              Color: () => (
                /* binding */
                r
              ),
              /* harmony export */
              builtinColorSchemes: () => (
                /* binding */
                y
              ),
              /* harmony export */
              chains: () => (
                /* binding */
                f
              ),
              /* harmony export */
              elementColors: () => (
                /* binding */
                d
              ),
              /* harmony export */
              htmlColors: () => (
                /* binding */
                s
              ),
              /* harmony export */
              residues: () => (
                /* binding */
                v
              ),
              /* harmony export */
              ssColors: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            class r {
              constructor(x, M, m) {
                return this.r = 0, this.g = 0, this.b = 0, arguments.length > 1 && typeof x == "number" ? (this.r = x || 0, this.g = M || 0, this.b = m || 0, this) : this.set(x || 0);
              }
              set(x) {
                return x instanceof r ? x.clone() : (typeof x == "number" ? this.setHex(x) : typeof x == "object" && (this.r = x?.r || 0, this.g = x?.g || 0, this.b = x?.b || 0), this);
              }
              setHex(x) {
                return x = Math.floor(x), this.r = (x >> 16 & 255) / 255, this.g = (x >> 8 & 255) / 255, this.b = (x & 255) / 255, this;
              }
              getHex() {
                var x = Math.round(this.r * 255), M = Math.round(this.g * 255), m = Math.round(this.b * 255);
                return x << 16 | M << 8 | m;
              }
              clone() {
                return new r(this.r, this.g, this.b);
              }
              copy(x) {
                return this.r = x.r, this.g = x.g, this.b = x.b, this;
              }
              //return object that represents color components from 0 to 255
              scaled() {
                var x = {};
                return x.r = Math.round(this.r * 255), x.g = Math.round(this.g * 255), x.b = Math.round(this.b * 255), x.a = 1, x;
              }
            }
            class a {
              static color(x) {
                if (!x)
                  return a.cache[0];
                if (x instanceof r)
                  return x;
                if (typeof x == "number" && typeof a.cache[x] < "u")
                  return a.cache[x];
                if (x && Array.isArray(x))
                  return x.map(a.color);
                let M = a.getHex(x), m = new r(M);
                return a.cache[M] = m, m;
              }
              static getHex(x) {
                var M;
                if (Array.isArray(x))
                  return x.map(a.getHex);
                if (typeof x == "string") {
                  let m = x;
                  if (!isNaN(parseInt(m)))
                    return parseInt(m);
                  if (m = m.trim(), m.length == 4 && m[0] == "#" && (m = "#" + m[1] + m[1] + m[2] + m[2] + m[3] + m[3]), m.length == 7 && m[0] == "#")
                    return parseInt(m.substring(1), 16);
                  let l = a.rgbRegEx.exec(m);
                  if (l) {
                    l[1] != "" && console.log("WARNING: Opacity value in rgba ignored.  Specify separately as opacity attribute.");
                    let u = 0;
                    for (let p = 2; p < 5; p++) {
                      u *= 256;
                      let g = l[p].endsWith("%") ? 255 * parseFloat(l[p]) / 100 : parseFloat(l[p]);
                      u += Math.round(g);
                    }
                    return u;
                  }
                  return ((M = window?.$3Dmol) === null || M === void 0 ? void 0 : M.htmlColors[x.toLowerCase()]) || 0;
                }
                return x;
              }
            }
            a.rgbRegEx = /rgb(a?)\(\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)/i, a.cache = { 0: new r(0) };
            const s = {
              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,
              darkgrey: 11119017,
              darkgreen: 25600,
              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,
              grey: 8421504,
              green: 32768,
              greenyellow: 11403055,
              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,
              lightgrey: 13882323,
              lightgreen: 9498256,
              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
            }, h = {
              //names are in helix-sheet-coil order
              pyMol: { h: 16711680, s: 16776960, c: 65280 },
              Jmol: { h: 16711808, s: 16762880, c: 16777215 }
            }, o = {
              H: 16777215,
              He: 16761035,
              HE: 16761035,
              Li: 11674146,
              LI: 11674146,
              B: 65280,
              C: 13158600,
              N: 9408511,
              O: 15728640,
              F: 14329120,
              Na: 255,
              NA: 255,
              Mg: 2263842,
              MG: 2263842,
              Al: 8421520,
              AL: 8421520,
              Si: 14329120,
              SI: 14329120,
              P: 16753920,
              S: 16762930,
              Cl: 65280,
              CL: 65280,
              Ca: 8421520,
              CA: 8421520,
              Ti: 8421520,
              TI: 8421520,
              Cr: 8421520,
              CR: 8421520,
              Mn: 8421520,
              MN: 8421520,
              Fe: 16753920,
              FE: 16753920,
              Ni: 10824234,
              NI: 10824234,
              Cu: 10824234,
              CU: 10824234,
              Zn: 10824234,
              ZN: 10824234,
              Br: 10824234,
              BR: 10824234,
              Ag: 8421520,
              AG: 8421520,
              I: 10494192,
              Ba: 16753920,
              BA: 16753920,
              Au: 14329120,
              AU: 14329120
            }, d = {
              defaultColor: 16716947,
              /** Jmol-like element colors*/
              Jmol: {
                H: 16777215,
                He: 14286847,
                HE: 14286847,
                Li: 13402367,
                LI: 13402367,
                Be: 12779264,
                BE: 12779264,
                B: 16758197,
                C: 9474192,
                N: 3166456,
                O: 16715021,
                F: 9494608,
                Ne: 11789301,
                NE: 11789301,
                Na: 11230450,
                NA: 11230450,
                Mg: 9109248,
                MG: 9109248,
                Al: 12560038,
                AL: 12560038,
                Si: 1578e4,
                SI: 1578e4,
                P: 16744448,
                S: 16777008,
                Cl: 2093087,
                CL: 2093087,
                Ar: 8442339,
                AR: 8442339,
                K: 9388244,
                Ca: 4062976,
                CA: 4062976,
                Sc: 15132390,
                SC: 15132390,
                Ti: 12567239,
                TI: 12567239,
                V: 10921643,
                Cr: 9083335,
                CR: 9083335,
                Mn: 10255047,
                MN: 10255047,
                Fe: 14706227,
                FE: 14706227,
                Co: 15765664,
                CO: 15765664,
                Ni: 5296208,
                NI: 5296208,
                Cu: 13140019,
                CU: 13140019,
                Zn: 8224944,
                ZN: 8224944,
                Ga: 12750735,
                GA: 12750735,
                Ge: 6721423,
                GE: 6721423,
                As: 12419299,
                AS: 12419299,
                Se: 16752896,
                SE: 16752896,
                Br: 10889513,
                BR: 10889513,
                Kr: 6076625,
                KR: 6076625,
                Rb: 7351984,
                RB: 7351984,
                Sr: 65280,
                SR: 65280,
                Y: 9764863,
                Zr: 9756896,
                ZR: 9756896,
                Nb: 7586505,
                NB: 7586505,
                Mo: 5551541,
                MO: 5551541,
                Tc: 3907230,
                TC: 3907230,
                Ru: 2396047,
                RU: 2396047,
                Rh: 687500,
                RH: 687500,
                Pd: 27013,
                PD: 27013,
                Ag: 12632256,
                AG: 12632256,
                Cd: 16767375,
                CD: 16767375,
                In: 10909043,
                IN: 10909043,
                Sn: 6717568,
                SN: 6717568,
                Sb: 10380213,
                SB: 10380213,
                Te: 13924864,
                TE: 13924864,
                I: 9699476,
                Xe: 4366e3,
                XE: 4366e3,
                Cs: 5707663,
                CS: 5707663,
                Ba: 51456,
                BA: 51456,
                La: 7394559,
                LA: 7394559,
                Ce: 16777159,
                CE: 16777159,
                Pr: 14286791,
                PR: 14286791,
                Nd: 13107143,
                ND: 13107143,
                Pm: 10747847,
                PM: 10747847,
                Sm: 9437127,
                SM: 9437127,
                Eu: 6422471,
                EU: 6422471,
                Gd: 4587463,
                GD: 4587463,
                Tb: 3211207,
                TB: 3211207,
                Dy: 2097095,
                DY: 2097095,
                Ho: 65436,
                HO: 65436,
                Er: 58997,
                ER: 58997,
                Tm: 54354,
                TM: 54354,
                Yb: 48952,
                YB: 48952,
                Lu: 43812,
                LU: 43812,
                Hf: 5096191,
                HF: 5096191,
                Ta: 5089023,
                TA: 5089023,
                W: 2200790,
                Re: 2522539,
                RE: 2522539,
                Os: 2516630,
                OS: 2516630,
                Ir: 1528967,
                IR: 1528967,
                Pt: 13684960,
                PT: 13684960,
                Au: 16765219,
                AU: 16765219,
                Hg: 12105936,
                HG: 12105936,
                Tl: 10900557,
                TL: 10900557,
                Pb: 5724513,
                PB: 5724513,
                Bi: 10375093,
                BI: 10375093,
                Po: 11230208,
                PO: 11230208,
                At: 7688005,
                AT: 7688005,
                Rn: 4358806,
                RN: 4358806,
                Fr: 4325478,
                FR: 4325478,
                Ra: 32e3,
                RA: 32e3,
                Ac: 7384058,
                AC: 7384058,
                Th: 47871,
                TH: 47871,
                Pa: 41471,
                PA: 41471,
                U: 36863,
                Np: 33023,
                NP: 33023,
                Pu: 27647,
                PU: 27647,
                Am: 5528818,
                AM: 5528818,
                Cm: 7888099,
                CM: 7888099,
                Bk: 9064419,
                BK: 9064419,
                Cf: 10565332,
                CF: 10565332,
                Es: 11739092,
                ES: 11739092,
                Fm: 11739066,
                FM: 11739066,
                Md: 11734438,
                MD: 11734438,
                No: 12389767,
                NO: 12389767,
                Lr: 13041766,
                LR: 13041766,
                Rf: 13369433,
                RF: 13369433,
                Db: 13697103,
                DB: 13697103,
                Sg: 14221381,
                SG: 14221381,
                Bh: 14680120,
                BH: 14680120,
                Hs: 15073326,
                HS: 15073326,
                Mt: 15400998,
                MT: 15400998
              },
              /** rasmol-like element colors */
              rasmol: o,
              defaultColors: Object.assign({}, o),
              greenCarbon: Object.assign(Object.assign({}, o), { C: 65280 }),
              cyanCarbon: Object.assign(Object.assign({}, o), { C: 65535 }),
              magentaCarbon: Object.assign(Object.assign({}, o), { C: 16711935 }),
              yellowCarbon: Object.assign(Object.assign({}, o), { C: 16776960 }),
              whiteCarbon: Object.assign(Object.assign({}, o), { C: 16777215 }),
              orangeCarbon: Object.assign(Object.assign({}, o), { C: 16753920 }),
              purpleCarbon: Object.assign(Object.assign({}, o), { C: 8388736 }),
              blueCarbon: Object.assign(Object.assign({}, o), { C: 255 })
            }, v = {
              /** @property standard amino acid color scheme*/
              amino: {
                ALA: 13158600,
                ARG: 1334015,
                ASN: 56540,
                ASP: 15075850,
                CYS: 15132160,
                GLN: 56540,
                GLU: 15075850,
                GLY: 15461355,
                HIS: 8553170,
                ILE: 1016335,
                LEU: 1016335,
                LYS: 1334015,
                MET: 15132160,
                PHE: 3289770,
                PRO: 14456450,
                SER: 16422400,
                THR: 16422400,
                TRP: 11819700,
                TYR: 3289770,
                VAL: 1016335,
                ASX: 16738740,
                GLX: 16738740
              },
              /** @property shapely amino acid color scheme*/
              shapely: {
                ALA: 9240460,
                ARG: 124,
                ASN: 16743536,
                ASP: 10485826,
                CYS: 16777072,
                GLN: 16731212,
                GLU: 6684672,
                GLY: 16777215,
                HIS: 7368959,
                ILE: 19456,
                LEU: 4546117,
                LYS: 4671416,
                MET: 12099650,
                PHE: 5459026,
                PRO: 5395026,
                SER: 16740418,
                THR: 12078080,
                TRP: 5195264,
                TYR: 9203788,
                VAL: 16747775,
                ASX: 16711935,
                GLX: 16711935
              },
              /** @property nucleic acid color scheme*/
              nucleic: {
                A: 10526975,
                G: 16740464,
                I: 8454143,
                C: 16747595,
                T: 10551200,
                U: 16744576
              }
            }, f = {
              /** @property chain based standard color scheme */
              atom: {
                A: 12636415,
                B: 11599792,
                C: 16761032,
                D: 16777088,
                E: 16761087,
                F: 11596016,
                G: 16765040,
                H: 15761536,
                I: 16113331,
                J: 49151,
                K: 13458524,
                L: 6737322,
                M: 10145074,
                N: 15631086,
                O: 52945,
                P: 65407,
                Q: 3978097,
                R: 139,
                S: 12433259,
                T: 25600,
                U: 8388608,
                V: 8421376,
                W: 8388736,
                X: 32896,
                Y: 12092939,
                Z: 11674146
              },
              /** @property hetatm color scheme */
              hetatm: {
                A: 9478351,
                B: 8441752,
                C: 13602992,
                D: 13619056,
                E: 13603023,
                F: 8437952,
                G: 13607008,
                H: 12603504,
                I: 12955267,
                J: 42959,
                K: 11881548,
                L: 5682578,
                M: 9090346,
                N: 12481214,
                O: 46753,
                P: 53103,
                Q: 3447649,
                R: 187,
                S: 10854235,
                T: 37888,
                U: 11534336,
                V: 11579392,
                W: 11534512,
                X: 45232,
                Y: 15250963,
                Z: 12726834
              }
            }, y = {
              /** secondary structure pymol */
              ssPyMol: { prop: "ss", map: h.pyMol },
              ssJmol: { prop: "ss", map: h.Jmol },
              Jmol: { prop: "elem", map: d.Jmol },
              amino: { prop: "resn", map: v.amino },
              shapely: { prop: "resn", map: v.shapely },
              nucleic: { prop: "resn", map: v.nucleic },
              chain: { prop: "chain", map: f.atom },
              rasmol: { prop: "elem", map: d.rasmol },
              default: { prop: "elem", map: d.defaultColors },
              greenCarbon: { prop: "elem", map: d.greenCarbon },
              chainHetatm: { prop: "chain", map: f.hetatm },
              cyanCarbon: { prop: "elem", map: d.cyanCarbon },
              magentaCarbon: { prop: "elem", map: d.magentaCarbon },
              purpleCarbon: { prop: "elem", map: d.purpleCarbon },
              whiteCarbon: { prop: "elem", map: d.whiteCarbon },
              orangeCarbon: { prop: "elem", map: d.orangeCarbon },
              yellowCarbon: { prop: "elem", map: d.yellowCarbon },
              blueCarbon: { prop: "elem", map: d.blueCarbon }
            };
          }
        ),
        /***/
        "./src/glcartoon.ts": (
          /*!**************************!*\
            !*** ./src/glcartoon.ts ***!
            \**************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              drawCartoon: () => (
                /* binding */
                z
              ),
              /* harmony export */
              subdivide_spline: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var r = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), a = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), s = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), h = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), o = t(
              /*! ./colors */
              "./src/colors.ts"
            ), d = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), v = t(
              /*! ./utilities */
              "./src/utilities.ts"
            );
            function f(F, R) {
              var P = [], U = F;
              U = [], U.push(F[0]);
              var N, B, W, V, G, H, Q, te, ee;
              for (N = 1, B = F.length - 1; N < B; N++)
                if (G = F[N], H = F[N + 1], G.smoothen) {
                  var ce = new r.Vector3((G.x + H.x) / 2, (G.y + H.y) / 2, (G.z + H.z) / 2);
                  ce.atom = G.atom, U.push(ce);
                } else
                  U.push(G);
              for (U.push(F[F.length - 1]), N = -1, W = U.length; N <= W - 3; N++)
                if (V = U[N === -1 ? 0 : N], G = U[N + 1], H = U[N + 2], Q = U[N === W - 3 ? W - 1 : N + 3], te = new r.Vector3().subVectors(H, V).multiplyScalar(0.5), ee = new r.Vector3().subVectors(Q, G).multiplyScalar(0.5), !H.skip)
                  for (var fe = 0; fe < R; fe++) {
                    var oe = 1 / R * fe, he = G.x + oe * te.x + oe * oe * (-3 * G.x + 3 * H.x - 2 * te.x - ee.x) + oe * oe * oe * (2 * G.x - 2 * H.x + te.x + ee.x), Ae = G.y + oe * te.y + oe * oe * (-3 * G.y + 3 * H.y - 2 * te.y - ee.y) + oe * oe * oe * (2 * G.y - 2 * H.y + te.y + ee.y), Se = G.z + oe * te.z + oe * oe * (-3 * G.z + 3 * H.z - 2 * te.z - ee.z) + oe * oe * oe * (2 * G.z - 2 * H.z + te.z + ee.z), Ie = new r.Vector3(he, Ae, Se);
                    fe < R / 2 ? Ie.atom = G.atom : Ie.atom = H.atom, P.push(Ie);
                  }
              return P.push(U[U.length - 1]), P;
            }
            const y = 0.5, A = 1.3, x = 0.8, M = 0.4, m = 0.4;
            function l(F, R, P, U) {
              for (var N, B, W, V, G = 0, H = R.length; G < H; G++) {
                V = Math.round(G * (U.length - 1) / H), W = o.CC.color(U[V]);
                var Q = F.updateGeoGroup(2), te = Q.vertexArray, ee = Q.colorArray, ce = Q.faceArray;
                N = Q.vertices, B = N * 3, te[B] = R[G].x, te[B + 1] = R[G].y, te[B + 2] = R[G].z, te[B + 3] = P[G].x, te[B + 4] = P[G].y, te[B + 5] = P[G].z;
                for (var fe = 0; fe < 6; ++fe)
                  ee[B + 3 * fe] = W.r, ee[B + 1 + 3 * fe] = W.g, ee[B + 2 + 3 * fe] = W.b;
                if (G > 0) {
                  var oe = [N, N + 1, N - 1, N - 2], he = Q.faceidx;
                  ce[he] = oe[0], ce[he + 1] = oe[1], ce[he + 2] = oe[3], ce[he + 3] = oe[1], ce[he + 4] = oe[2], ce[he + 5] = oe[3], Q.faceidx += 6;
                }
                Q.vertices += 2;
              }
            }
            function u(F, R, P, U, N, B, W) {
              var V, G, H, Q;
              if (H = R.length, H < 2 || R[0].length < 2)
                return;
              for (V = 0; V < H; V++)
                R[V] = f(R[V], U);
              if (Q = R[0].length, !N)
                return l(F, R[0], R[H - 1], P);
              var te, ee, ce, fe, oe, he, Ae = [], Se = [], Ie = [];
              for (G = 0; G < H; G++)
                Ae.push(0.25 + 1.5 * Math.sqrt((H - 1) * G - Math.pow(G, 2)) / (H - 1)), Se.push(0.5), Ie.push(2 * (Math.pow(G / H, 2) - G / H) + 0.6);
              var pe = [];
              for (G = 0; G < H * 2 - 1; G++)
                pe[G] = [G, G + 1, G + 1 - 2 * H, G - 2 * H];
              pe[H * 2 - 1] = [
                G,
                G + 1 - 2 * H,
                G + 1 - 4 * H,
                G - 2 * H
              ];
              var le, ne, Te, Oe, Be, Ue, Pe, Ge, Ne, Re;
              let De = F.updateGeoGroup();
              for (V = 0; V < Q; V++) {
                let q = F.groups, re = !1;
                De = F.updateGeoGroup(2 * H), q != F.groups && V > 0 && (V = V - 1, re = !0), Ue = Math.round(V * (P.length - 1) / Q), Be = o.CC.color(P[Ue]), oe = ce, he = fe, ce = [], fe = [], te = [], R[0][V].atom !== void 0 && (Oe = R[0][V].atom, W === "oval" ? ee = Ae : W === "rectangle" ? ee = Se : W === "parabola" && (ee = Ie)), ee || (ee = Se);
                var je, Xe;
                for (G = 0; G < H; G++)
                  V < Q - 1 ? je = R[G][V + 1].clone().sub(R[G][V]) : je = R[G][V - 1].clone().sub(R[G][V]).negate(), G < H - 1 ? Xe = R[G + 1][V].clone().sub(R[G][V]) : Xe = R[G - 1][V].clone().sub(R[G][V]).negate(), te[G] = Xe.cross(je).normalize().multiplyScalar(N * ee[G]);
                for (G = 0; G < H; G++)
                  ce[G] = R[G][V].clone().add(te[G].clone().negate());
                for (G = 0; G < H; G++)
                  fe[G] = R[G][V].clone().add(te[G]);
                for (Pe = De.vertexArray, Ge = De.colorArray, Ne = De.faceArray, le = De.vertices, ne = le * 3, G = 0; G < H; G++)
                  Pe[ne + 3 * G + 0] = ce[G].x, Pe[ne + 3 * G + 1] = ce[G].y, Pe[ne + 3 * G + 2] = ce[G].z;
                for (G = 0; G < H; G++)
                  Pe[ne + 3 * G + 0 + 3 * H] = fe[H - 1 - G].x, Pe[ne + 3 * G + 1 + 3 * H] = fe[H - 1 - G].y, Pe[ne + 3 * G + 2 + 3 * H] = fe[H - 1 - G].z;
                for (G = 0; G < 2 * H; ++G)
                  Ge[ne + 3 * G + 0] = Be.r, Ge[ne + 3 * G + 1] = Be.g, Ge[ne + 3 * G + 2] = Be.b;
                if (V > 0 && !re) {
                  for (G = 0; G < H * 2; G++)
                    Re = [
                      le + pe[G][0],
                      le + pe[G][1],
                      le + pe[G][2],
                      le + pe[G][3]
                    ], Te = De.faceidx, Ne[Te] = Re[0], Ne[Te + 1] = Re[1], Ne[Te + 2] = Re[3], Ne[Te + 3] = Re[1], Ne[Te + 4] = Re[2], Ne[Te + 5] = Re[3], De.faceidx += 6;
                  if (Oe.clickable || Oe.hoverable) {
                    var X = [];
                    X.push(new a.Triangle(oe[0], ce[0], ce[H - 1])), X.push(new a.Triangle(oe[0], ce[H - 1], oe[H - 1])), X.push(new a.Triangle(oe[H - 1], ce[H - 1], fe[H - 1])), X.push(new a.Triangle(oe[H - 1], fe[H - 1], he[H - 1])), X.push(new a.Triangle(fe[0], he[0], he[H - 1])), X.push(new a.Triangle(fe[H - 1], fe[0], he[H - 1])), X.push(new a.Triangle(ce[0], oe[0], he[0])), X.push(new a.Triangle(fe[0], ce[0], he[0]));
                    for (G in X)
                      Oe.intersectionShape.triangle.push(X[G]);
                  }
                }
                De.vertices += 2 * H;
              }
              for (Pe = De.vertexArray, Ge = De.colorArray, Ne = De.faceArray, le = De.vertices, ne = le * 3, Te = De.faceidx, V = 0; V < H - 1; V++)
                Re = [V, V + 1, 2 * H - 2 - V, 2 * H - 1 - V], Te = De.faceidx, Ne[Te] = Re[0], Ne[Te + 1] = Re[1], Ne[Te + 2] = Re[3], Ne[Te + 3] = Re[1], Ne[Te + 4] = Re[2], Ne[Te + 5] = Re[3], De.faceidx += 6;
              for (V = 0; V < H - 1; V++)
                Re = [
                  le - 1 - V,
                  le - 2 - V,
                  le - 2 * H + V + 1,
                  le - 2 * H + V
                ], Te = De.faceidx, Ne[Te] = Re[0], Ne[Te + 1] = Re[1], Ne[Te + 2] = Re[3], Ne[Te + 3] = Re[1], Ne[Te + 4] = Re[2], Ne[Te + 5] = Re[3], De.faceidx += 6;
            }
            function p(F, R, P, U, N, B) {
              if (!(R.length < 2)) {
                var W, V;
                if (W = R[0], V = R[R.length - 1], W = f(W, U), V = f(V, U), !N)
                  return l(F, W, V, P);
                var G = [], H, Q, te, ee, ce, fe = [
                  [0, 2, -6, -8],
                  [-4, -2, 6, 4],
                  [7, -1, -5, 3],
                  [-3, 5, 1, -7]
                ], oe, he, Ae, Se, Ie, pe, le, ne, Te, Oe, Be, Ue, Pe, Ge, Ne, Re, De;
                for (ne = 0, Te = W.length; ne < Te; ne++) {
                  if (Ie = Math.round(ne * (P.length - 1) / Te), Se = o.CC.color(P[Ie]), G.push(Q = W[ne]), G.push(Q), G.push(te = V[ne]), G.push(te), ne < Te - 1) {
                    var je = W[ne + 1].clone().sub(W[ne]), Xe = V[ne].clone().sub(W[ne]);
                    H = Xe.cross(je).normalize().multiplyScalar(N);
                  }
                  for (G.push(ee = W[ne].clone().add(H)), G.push(ee), G.push(ce = V[ne].clone().add(H)), G.push(ce), Q.atom !== void 0 && (pe = Q.atom), Ge = F.updateGeoGroup(8), Ne = Ge.vertexArray, Re = Ge.colorArray, De = Ge.faceArray, oe = Ge.vertices, he = oe * 3, Ne[he] = Q.x, Ne[he + 1] = Q.y, Ne[he + 2] = Q.z, Ne[he + 3] = Q.x, Ne[he + 4] = Q.y, Ne[he + 5] = Q.z, Ne[he + 6] = te.x, Ne[he + 7] = te.y, Ne[he + 8] = te.z, Ne[he + 9] = te.x, Ne[he + 10] = te.y, Ne[he + 11] = te.z, Ne[he + 12] = ee.x, Ne[he + 13] = ee.y, Ne[he + 14] = ee.z, Ne[he + 15] = ee.x, Ne[he + 16] = ee.y, Ne[he + 17] = ee.z, Ne[he + 18] = ce.x, Ne[he + 19] = ce.y, Ne[he + 20] = ce.z, Ne[he + 21] = ce.x, Ne[he + 22] = ce.y, Ne[he + 23] = ce.z, Oe = 0; Oe < 8; ++Oe)
                    Re[he + 3 * Oe] = Se.r, Re[he + 1 + 3 * Oe] = Se.g, Re[he + 2 + 3 * Oe] = Se.b;
                  if (ne > 0) {
                    var X = le !== void 0 && pe !== void 0 && le.serial !== pe.serial;
                    for (Oe = 0; Oe < 4; Oe++) {
                      var q = [
                        oe + fe[Oe][0],
                        oe + fe[Oe][1],
                        oe + fe[Oe][2],
                        oe + fe[Oe][3]
                      ];
                      if (Ae = Ge.faceidx, De[Ae] = q[0], De[Ae + 1] = q[1], De[Ae + 2] = q[3], De[Ae + 3] = q[1], De[Ae + 4] = q[2], De[Ae + 5] = q[3], Ge.faceidx += 6, pe.clickable || le.clickable || pe.hoverable || le.hoverable) {
                        var re = G[q[3]].clone(), ye = G[q[0]].clone(), me = G[q[2]].clone(), ze = G[q[1]].clone();
                        if (re.atom = G[q[3]].atom || null, me.atom = G[q[2]].atom || null, ye.atom = G[q[0]].atom || null, ze.atom = G[q[1]].atom || null, X) {
                          var ke = re.clone().add(ye).multiplyScalar(0.5), K = me.clone().add(ze).multiplyScalar(0.5), ae = re.clone().add(ze).multiplyScalar(0.5);
                          Oe % 2 === 0 ? ((le.clickable || le.hoverable) && (Be = new a.Triangle(ke, ae, re), Ue = new a.Triangle(K, me, ae), Pe = new a.Triangle(ae, me, re), le.intersectionShape.triangle.push(Be), le.intersectionShape.triangle.push(Ue), le.intersectionShape.triangle.push(Pe)), (pe.clickable || pe.hoverable) && (Be = new a.Triangle(ye, ze, ae), Ue = new a.Triangle(ze, K, ae), Pe = new a.Triangle(ye, ae, ke), pe.intersectionShape.triangle.push(Be), pe.intersectionShape.triangle.push(Ue), pe.intersectionShape.triangle.push(Pe))) : ((pe.clickable || pe.hoverable) && (Be = new a.Triangle(ke, ae, re), Ue = new a.Triangle(K, me, ae), Pe = new a.Triangle(ae, me, re), pe.intersectionShape.triangle.push(Be), pe.intersectionShape.triangle.push(Ue), pe.intersectionShape.triangle.push(Pe)), (le.clickable || le.hoverable) && (Be = new a.Triangle(ye, ze, ae), Ue = new a.Triangle(ze, K, ae), Pe = new a.Triangle(ye, ae, ke), le.intersectionShape.triangle.push(Be), le.intersectionShape.triangle.push(Ue), le.intersectionShape.triangle.push(Pe)));
                        } else (pe.clickable || pe.hoverable) && (Be = new a.Triangle(ye, ze, re), Ue = new a.Triangle(ze, me, re), pe.intersectionShape.triangle.push(Be), pe.intersectionShape.triangle.push(Ue));
                      }
                    }
                  }
                  Ge.vertices += 8, le = pe;
                }
                var ge = G.length - 8;
                for (Ge = F.updateGeoGroup(8), Ne = Ge.vertexArray, Re = Ge.colorArray, De = Ge.faceArray, oe = Ge.vertices, he = oe * 3, Ae = Ge.faceidx, ne = 0; ne < 4; ne++) {
                  G.push(G[ne * 2]), G.push(G[ge + ne * 2]);
                  var xe = G[ne * 2], ue = G[ge + ne * 2];
                  Ne[he + 6 * ne] = xe.x, Ne[he + 1 + 6 * ne] = xe.y, Ne[he + 2 + 6 * ne] = xe.z, Ne[he + 3 + 6 * ne] = ue.x, Ne[he + 4 + 6 * ne] = ue.y, Ne[he + 5 + 6 * ne] = ue.z, Re[he + 6 * ne] = Se.r, Re[he + 1 + 6 * ne] = Se.g, Re[he + 2 + 6 * ne] = Se.b, Re[he + 3 + 6 * ne] = Se.r, Re[he + 4 + 6 * ne] = Se.g, Re[he + 5 + 6 * ne] = Se.b;
                }
                ge += 8, Be = [oe, oe + 2, oe + 6, oe + 4], Ue = [oe + 1, oe + 5, oe + 7, oe + 3], De[Ae] = Be[0], De[Ae + 1] = Be[1], De[Ae + 2] = Be[3], De[Ae + 3] = Be[1], De[Ae + 4] = Be[2], De[Ae + 5] = Be[3], De[Ae + 6] = Ue[0], De[Ae + 7] = Ue[1], De[Ae + 8] = Ue[3], De[Ae + 9] = Ue[1], De[Ae + 10] = Ue[2], De[Ae + 11] = Ue[3], Ge.faceidx += 12, Ge.vertices += 8;
              }
            }
            function g(F, R, P, U, N, B, W) {
              (!W || W === "default") && (W = "rectangle"), W === "edged" ? p(F, R, P, U, N) : (W === "rectangle" || W === "oval" || W === "parabola") && u(F, R, P, U, N, B, W);
            }
            function b(F) {
              return F && F.elem === "C" && F.atom === "CA";
            }
            function c(F, R) {
              if (F && R && F.chain === R.chain) {
                if (!F.hetflag && !R.hetflag && F.reschain === R.reschain && (F.resi === R.resi || F.resi === R.resi - 1))
                  return !0;
                if (F.resi < R.resi) {
                  var P = F.x - R.x, U = F.y - R.y, N = F.z - R.z, B = P * P + U * U + N * N;
                  if (F.atom == "CA" && R.atom == "CA" && B < 16)
                    return !0;
                  if ((F.atom == "P" || R.atom == "P") && B < 64)
                    return !0;
                }
              }
              return !1;
            }
            function _(F, R, P, U, N) {
              if (!(R == null || R.vertices == 0)) {
                N && (R.initTypedArrays(), R.setUpNormals());
                var B = new s.MeshDoubleLambertMaterial();
                B.vertexColors = s.Coloring.FaceColors, typeof P == "number" && P >= 0 && P < 1 && (B.transparent = !0, B.opacity = P), B.outline = U;
                var W = new s.Mesh(R, B);
                F.add(W);
              }
            }
            function E(F, R, P, U, N, B, W, V, G) {
              var H, Q, te, ee, ce, fe;
              if (!(!U || !N || !W)) {
                var oe = N.sub(U);
                oe.normalize();
                var he = V[G];
                for (Q = G + 1; Q < V.length && (he = V[Q], he.atom != W.atom); Q++)
                  ;
                if (he = he ? new r.Vector3(he.x, he.y, he.z) : new r.Vector3(0, 0, 0), he.sub(U), W.ss === "arrow start") {
                  var Ae = he.clone().multiplyScalar(0.3).cross(N);
                  U.add(Ae);
                  var Se = he.clone().cross(oe).normalize();
                  oe.rotateAboutVector(Se, 0.43);
                }
                for (W.style.cartoon.ribbon ? H = W.style.cartoon.thickness || M : W.style.cartoon.width ? H = W.style.cartoon.width : W.ss === "c" ? W.atom === "P" ? H = x : H = y : W.ss === "arrow start" ? (H = A, ce = !0) : W.ss === "arrow end" || W.ss === "h" && W.style.cartoon.tubes || W.ss === "tube start" ? H = y : H = A, B != null && oe.dot(B) < 0 && oe.negate(), oe.multiplyScalar(H), Q = 0; Q < R; Q++)
                  te = -1 + Q * 2 / (R - 1), ee = new r.Vector3(U.x + te * oe.x, U.y + te * oe.y, U.z + te * oe.z), ee.atom = W, W.ss === "s" && (ee.smoothen = !0), F[Q].push(ee);
                if (ce)
                  for (oe.multiplyScalar(2), Q = 0; Q < R; Q++)
                    te = -1 + Q * 2 / (R - 1), ee = new r.Vector3(U.x + te * oe.x, U.y + te * oe.y, U.z + te * oe.z), ee.atom = W, ee.smoothen = !1, ee.skip = !0, F[Q].push(ee);
                return fe = W.style.cartoon.style || "default", F.style ? F.style != fe && (console.log("Warning: a cartoon chain's strand-style is ambiguous"), F.style = "default") : F.style = fe, (W.ss === "arrow start" || W.ss === "arrow end") && (W.ss = "s"), ce;
              }
            }
            const w = {
              C: !0,
              CA: !0,
              O: !0,
              P: !0,
              OP2: !0,
              O2P: !0,
              "O5'": !0,
              "O3'": !0,
              "C5'": !0,
              "C2'": !0,
              "O5*": !0,
              "O3*": !0,
              "C5*": !0,
              "C2*": !0,
              N1: !0,
              N3: !0
            }, k = { DA: !0, DG: !0, A: !0, G: !0 }, $ = { DT: !0, DC: !0, U: !0, C: !0, T: !0 }, L = { DA: !0, DG: !0, A: !0, G: !0, DT: !0, DC: !0, U: !0, C: !0, T: !0 };
            function z(F, R, P, U = 10) {
              let N = U, B = U;
              var W, V, G, H, Q, te, ee, ce, fe, oe, he, Ae, Se, Ie, pe, le, ne, Te, Oe = new s.Geometry(!0), Be = new s.Geometry(!0), Ue = [], Pe = [], Ge = 1, Ne = !1, Re = {};
              for (var De in h.Gradient.builtinGradients)
                h.Gradient.builtinGradients.hasOwnProperty(De) && (Re[De] = new h.Gradient.builtinGradients[De](P[1], P[0]));
              var je = function(Z, Fe) {
                return P && Fe.color === "spectrum" ? Fe.colorscheme in Re ? Re[Fe.colorscheme].valueToHex(Z.resi) : Re.sinebow.valueToHex(Z.resi) : (0, v.getColorFromStyle)(Z, Fe).getHex();
              };
              for (ce = 0; ce < N; ce++)
                Pe[ce] = [];
              var Xe = !1, X = !1, q = [];
              for (ce in R) {
                if (H = R[ce], H.elem === "C" && H.atom === "CA") {
                  var re = c(G, H);
                  re && H.ss === "s" ? Xe = !0 : Xe && (G && V && G.style.cartoon.arrows && V.style.cartoon.arrows && (G.ss = "arrow end", V.ss = "arrow start"), Xe = !1), re && (G.ss === "h" || G.ss == "tube start") && G.style.cartoon.tubes ? !X && G.ss != "tube start" && H.style.cartoon.tubes && (H.ss = "tube start", X = !0) : X && (G.ss === "tube start" ? G.ss = "tube end" : V && V.style.cartoon.tubes && (V.ss = "tube end"), X = !1), V = G, G = H;
                }
                H && H.atom in w && q.push(H);
              }
              X && G.style.cartoon.tubes && (G.ss = "tube end", X = !1);
              var ye = function(Z) {
                Pe[0].length > 0 && g(Be, Pe, Ue, B, ee, Ge, Pe.style);
                var Fe = [], We = null;
                if (Z) {
                  for (ce = 0; ce < N; ce++)
                    Fe[ce] = Pe[ce][Pe[ce].length - 1];
                  We = Ue[Ue.length - 1];
                }
                for (Pe = [], ce = 0; ce < N; ce++)
                  Pe[ce] = [];
                if (Ue = [], Z) {
                  for (ce = 0; ce < N; ce++)
                    Pe[ce].push(Fe[ce]);
                  Ue.push(We);
                }
                _(F, Be, Ge, Ne, !0), _(F, Oe, Ge, Ne, !1), Be = new s.Geometry(!0), Oe = new s.Geometry(!0);
              };
              G = void 0;
              for (var me = 0; me < q.length; me++) {
                H = q[me];
                var ze = H.resn.trim(), ke = ze in L;
                if (Ge = 1, W = H.style.cartoon, G && G.style.cartoon && (Ge = G.style.cartoon.opacity), G && G.style.cartoon && G.style.cartoon.outline && (Ne = G.style.cartoon.outline), G && G.style.cartoon && (!H.style.cartoon || G.style.cartoon.opacity != H.style.cartoon.opacity) && ye(G.chain == H.chain), W.style === "trace") {
                  if (!H.hetflag) {
                    if (H.elem === "C" && H.atom === "CA" || ke && H.atom === "P" || H.atom === "BB") {
                      if (te = je(H, W), (0, v.isNumeric)(W.thickness) ? ee = W.thickness : ee = M, c(G, H))
                        if (te == Q) {
                          var K = o.CC.color(te);
                          d.GLDraw.drawCylinder(Oe, G, H, ee, K, 2, 2);
                        } else {
                          var ae = new r.Vector3().addVectors(G, H).multiplyScalar(0.5), ge = o.CC.color(Q), xe = o.CC.color(te);
                          d.GLDraw.drawCylinder(Oe, G, ae, ee, ge, 2, 0), d.GLDraw.drawCylinder(Oe, ae, H, ee, xe, 0, 2);
                        }
                      if ((H.clickable === !0 || H.hoverable) && H.intersectionShape !== void 0) {
                        var ue = new r.Vector3(H.x, H.y, H.z);
                        H.intersectionShape.sphere.push(new a.Sphere(ue, ee));
                      }
                      G = H, Q = te;
                    }
                  }
                } else {
                  if (b(H) || ke && (H.atom === "P" || H.atom.indexOf("O5") == 0)) {
                    if (Te)
                      if (H.ss === "tube end")
                        Te = !1, ne = new r.Vector3(H.x, H.y, H.z), d.GLDraw.drawCylinder(Oe, le, ne, 2, o.CC.color(Q), 1, 1), H.ss = "h";
                      else if (G.chain != H.chain || G.ss === "tube end")
                        Te = !1, G.ss = "h", ne = new r.Vector3(G.x, G.y, G.z), d.GLDraw.drawCylinder(Oe, le, ne, 2, o.CC.color(Q), 1, 1);
                      else
                        continue;
                    if (G && (!c(G, H) || G.ss === "tube start")) {
                      for (G.ss === "tube start" && (Te = !0, le = new r.Vector3(G.x, G.y, G.z), G.ss = "h"), pe && (Ae ? Ie = new r.Vector3().addVectors(G, Ae).multiplyScalar(0.5) : Ie = new r.Vector3(G.x, G.y, G.z), d.GLDraw.drawCylinder(Oe, Ie, pe, m, o.CC.color(pe.color), 0, 2), E(Pe, N, !0, Ae, Se, he, G, q, me), Ue.push(te), Ie = null, pe = null), Pe[0].length > 0 && g(Be, Pe, Ue, B, ee, Ge, Pe.style), Pe = [], ce = 0; ce < N; ce++)
                        Pe[ce] = [];
                      Ue = [];
                    }
                    if (G === void 0 || G.rescode != H.rescode || G.resi != H.resi) {
                      if (pe && G != null) {
                        Ie = new r.Vector3().addVectors(G, H).multiplyScalar(0.5);
                        var Ce = Ie.clone().sub(pe).multiplyScalar(0.02);
                        Ie.add(Ce), d.GLDraw.drawCylinder(Oe, Ie, pe, m, o.CC.color(pe.color), 0, 2), Ie = null, pe = null;
                      }
                      te = je(H, W), Ue.push(te), (0, v.isNumeric)(W.thickness) ? ee = W.thickness : ee = M, G = H, fe = new r.Vector3(G.x, G.y, G.z), fe.resi = G.resi, Q = te;
                    }
                    (H.clickable === !0 || H.hoverable === !0) && (H.intersectionShape === void 0 || H.intersectionShape.triangle === void 0) && (H.intersectionShape = {
                      sphere: null,
                      cylinder: [],
                      line: [],
                      triangle: []
                    });
                  } else G != null && (b(G) && H.atom === "O" || ke && G.atom === "P" && (H.atom === "OP2" || H.atom === "O2P") || ke && G.atom.indexOf("O5") == 0 && H.atom.indexOf("C5") == 0) ? (oe = new r.Vector3(H.x, H.y, H.z), oe.resi = H.resi, (H.atom === "OP2" || H.atom === "O2P") && (Se = new r.Vector3(H.x, H.y, H.z))) : ke && H.atom.indexOf("O3") == 0 ? Ae = new r.Vector3(H.x, H.y, H.z) : (H.atom === "N1" && ze in k || H.atom === "N3" && ze in $) && (pe = new r.Vector3(H.x, H.y, H.z), pe.color = (0, v.getColorFromStyle)(H, W).getHex());
                  oe && fe && oe.resi === fe.resi && (E(Pe, N, !0, fe, oe, he, G, q, me), he = oe, fe = null, oe = null, Ue.push(te));
                }
              }
              pe && (Ae ? Ie = new r.Vector3().addVectors(G, Ae).multiplyScalar(0.5) : Ie = new r.Vector3(G.x, G.y, G.z), d.GLDraw.drawCylinder(Oe, Ie, pe, m, o.CC.color(pe.color), 0, 2), E(Pe, N, !0, Ae, Se, he, G, q, me), Ue.push(te)), ye(!1);
            }
          }
        ),
        /***/
        "./src/index.ts": (
          /*!**********************!*\
            !*** ./src/index.ts ***!
            \**********************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CAP: () => (
                /* reexport safe */
                m.CAP
              ),
              /* harmony export */
              CC: () => (
                /* reexport safe */
                a.CC
              ),
              /* harmony export */
              CONTEXTS_PER_VIEWPORT: () => (
                /* reexport safe */
                p.CONTEXTS_PER_VIEWPORT
              ),
              /* harmony export */
              Color: () => (
                /* reexport safe */
                a.Color
              ),
              /* harmony export */
              CustomLinear: () => (
                /* reexport safe */
                r.CustomLinear
              ),
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                v.Cylinder
              ),
              /* harmony export */
              GLDraw: () => (
                /* reexport safe */
                m.GLDraw
              ),
              /* harmony export */
              GLModel: () => (
                /* reexport safe */
                u.GLModel
              ),
              /* harmony export */
              GLShape: () => (
                /* reexport safe */
                M.GLShape
              ),
              /* harmony export */
              GLViewer: () => (
                /* reexport safe */
                p.GLViewer
              ),
              /* harmony export */
              GLVolumetricRender: () => (
                /* reexport safe */
                x.GLVolumetricRender
              ),
              /* harmony export */
              Gradient: () => (
                /* reexport safe */
                r.Gradient
              ),
              /* harmony export */
              GradientType: () => (
                /* reexport safe */
                r.GradientType
              ),
              /* harmony export */
              Label: () => (
                /* reexport safe */
                s.Label
              ),
              /* harmony export */
              LabelCount: () => (
                /* reexport safe */
                s.LabelCount
              ),
              /* harmony export */
              MarchingCube: () => (
                /* reexport safe */
                y.MarchingCube
              ),
              /* harmony export */
              MarchingCubeInitializer: () => (
                /* reexport safe */
                y.MarchingCubeInitializer
              ),
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                d.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                d.Matrix4
              ),
              /* harmony export */
              Parsers: () => (
                /* reexport safe */
                o.Parsers
              ),
              /* harmony export */
              PausableTimer: () => (
                /* reexport safe */
                f.PausableTimer
              ),
              /* harmony export */
              PointGrid: () => (
                /* reexport safe */
                y.PointGrid
              ),
              /* harmony export */
              ProteinSurface: () => (
                /* reexport safe */
                y.ProteinSurface
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                d.Quaternion
              ),
              /* harmony export */
              ROYGB: () => (
                /* reexport safe */
                r.ROYGB
              ),
              /* harmony export */
              RWB: () => (
                /* reexport safe */
                r.RWB
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                d.Ray
              ),
              /* harmony export */
              Sinebow: () => (
                /* reexport safe */
                r.Sinebow
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                v.Sphere
              ),
              /* harmony export */
              SurfaceType: () => (
                /* reexport safe */
                y.SurfaceType
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                v.Triangle
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                d.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                d.Vector3
              ),
              /* harmony export */
              VolumeData: () => (
                /* reexport safe */
                A.VolumeData
              ),
              /* harmony export */
              adjustVolumeStyle: () => (
                /* reexport safe */
                f.adjustVolumeStyle
              ),
              /* harmony export */
              applyPartialCharges: () => (
                /* reexport safe */
                h.applyPartialCharges
              ),
              /* harmony export */
              autoinit: () => (
                /* reexport safe */
                g.autoinit
              ),
              /* harmony export */
              autoload: () => (
                /* reexport safe */
                g.autoload
              ),
              /* harmony export */
              base64ToArray: () => (
                /* reexport safe */
                f.base64ToArray
              ),
              /* harmony export */
              bondLength: () => (
                /* reexport safe */
                o.bondLength
              ),
              /* harmony export */
              builtinColorSchemes: () => (
                /* reexport safe */
                a.builtinColorSchemes
              ),
              /* harmony export */
              builtinGradients: () => (
                /* reexport safe */
                r.builtinGradients
              ),
              /* harmony export */
              chains: () => (
                /* reexport safe */
                a.chains
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                d.clamp
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                d.conversionMatrix3
              ),
              /* harmony export */
              createStereoViewer: () => (
                /* reexport safe */
                p.createStereoViewer
              ),
              /* harmony export */
              createViewer: () => (
                /* reexport safe */
                p.createViewer
              ),
              /* harmony export */
              createViewerGrid: () => (
                /* reexport safe */
                p.createViewerGrid
              ),
              /* harmony export */
              deepCopy: () => (
                /* reexport safe */
                f.deepCopy
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                d.degToRad
              ),
              /* harmony export */
              download: () => (
                /* reexport safe */
                f.download
              ),
              /* harmony export */
              drawCartoon: () => (
                /* reexport safe */
                l.drawCartoon
              ),
              /* harmony export */
              elementColors: () => (
                /* reexport safe */
                a.elementColors
              ),
              /* harmony export */
              extend: () => (
                /* reexport safe */
                f.extend
              ),
              /* harmony export */
              get: () => (
                /* reexport safe */
                f.get
              ),
              /* harmony export */
              getAtomProperty: () => (
                /* reexport safe */
                f.getAtomProperty
              ),
              /* harmony export */
              getColorFromStyle: () => (
                /* reexport safe */
                f.getColorFromStyle
              ),
              /* harmony export */
              getElement: () => (
                /* reexport safe */
                f.getElement
              ),
              /* harmony export */
              getExtent: () => (
                /* reexport safe */
                f.getExtent
              ),
              /* harmony export */
              getGradient: () => (
                /* reexport safe */
                r.getGradient
              ),
              /* harmony export */
              getPropertyRange: () => (
                /* reexport safe */
                f.getPropertyRange
              ),
              /* harmony export */
              getbin: () => (
                /* reexport safe */
                f.getbin
              ),
              /* harmony export */
              htmlColors: () => (
                /* reexport safe */
                a.htmlColors
              ),
              /* harmony export */
              inflateString: () => (
                /* reexport safe */
                f.inflateString
              ),
              /* harmony export */
              isEmptyObject: () => (
                /* reexport safe */
                f.isEmptyObject
              ),
              /* harmony export */
              isNumeric: () => (
                /* reexport safe */
                f.isNumeric
              ),
              /* harmony export */
              makeFunction: () => (
                /* reexport safe */
                f.makeFunction
              ),
              /* harmony export */
              mergeGeos: () => (
                /* reexport safe */
                f.mergeGeos
              ),
              /* harmony export */
              normalizeValue: () => (
                /* reexport safe */
                r.normalizeValue
              ),
              /* harmony export */
              partialCharges: () => (
                /* reexport safe */
                h.partialCharges
              ),
              /* harmony export */
              processing_autoinit: () => (
                /* reexport safe */
                g.processing_autoinit
              ),
              /* harmony export */
              residues: () => (
                /* reexport safe */
                a.residues
              ),
              /* harmony export */
              setBondLength: () => (
                /* reexport safe */
                o.setBondLength
              ),
              /* harmony export */
              setSyncSurface: () => (
                /* reexport safe */
                y.setSyncSurface
              ),
              /* harmony export */
              specStringToObject: () => (
                /* reexport safe */
                f.specStringToObject
              ),
              /* harmony export */
              splitMesh: () => (
                /* reexport safe */
                M.splitMesh
              ),
              /* harmony export */
              ssColors: () => (
                /* reexport safe */
                a.ssColors
              ),
              /* harmony export */
              subdivide_spline: () => (
                /* reexport safe */
                l.subdivide_spline
              ),
              /* harmony export */
              syncSurface: () => (
                /* reexport safe */
                y.syncSurface
              ),
              /* harmony export */
              viewers: () => (
                /* reexport safe */
                g.viewers
              )
              /* harmony export */
            });
            var r = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), a = t(
              /*! ./colors */
              "./src/colors.ts"
            ), s = t(
              /*! ./Label */
              "./src/Label.ts"
            ), h = t(
              /*! ./partialCharges */
              "./src/partialCharges.ts"
            ), o = t(
              /*! ./parsers */
              "./src/parsers/index.ts"
            ), d = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), v = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), f = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), y = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), A = t(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), x = t(
              /*! ./VolumetricRender */
              "./src/VolumetricRender.ts"
            ), M = t(
              /*! ./GLShape */
              "./src/GLShape.ts"
            ), m = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), l = t(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), u = t(
              /*! ./GLModel */
              "./src/GLModel.ts"
            ), p = t(
              /*! ./GLViewer */
              "./src/GLViewer.ts"
            ), g = t(
              /*! ./autoload */
              "./src/autoload.ts"
            );
            t(
              /*! ./specs */
              "./src/specs.ts"
            ), window && (window.$3Dmol = e);
          }
        ),
        /***/
        "./src/parsers/BCIF.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/BCIF.ts ***!
            \*****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BCIF: () => (
                /* binding */
                M
              )
              /* harmony export */
            });
            var r = t(
              /*! ../utilities */
              "./src/utilities.ts"
            ), a = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), s = t(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), h = t(
              /*! ./cifutils/category */
              "./src/parsers/cifutils/category.ts"
            ), o = t(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), d = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), v = t(
              /*! ./utils/isEmpty */
              "./src/parsers/utils/isEmpty.ts"
            ), f = t(
              /*! ./src/vendor/mmtf.js */
              "./src/vendor/mmtf.js"
            );
            class y {
              constructor(l) {
                if (this.C = {}, l) {
                  let u = l.getField("comp_id"), p = l.getField("atom_id_1"), g = l.getField("atom_id_2"), b = l.getField("value_order");
                  for (let c = 0; c < u.length; c++) {
                    let _ = u[c], E = p[c], w = g[c], k = b[c], $ = 1;
                    k == "doub" ? $ = 2 : k == "trip" && ($ = 3), this.C[_] == null && (this.C[_] = {}), this.C[_][E] == null && (this.C[_][E] = {}), this.C[_][w] == null && (this.C[_][w] = {}), this.C[_][E][w] = $, this.C[_][w][E] = $;
                  }
                }
              }
              //returns bond order, zero if not connected
              order(l, u, p) {
                return this.C[l] !== void 0 && this.C[l][u] !== void 0 && this.C[l][u][p] !== void 0 ? this.C[l][u][p] : 0;
              }
            }
            class A {
              constructor(l) {
                if (this.C = [], l) {
                  let u = l.getField("conn_type_id"), p = l.getField("ptnr1_label_asym_id"), g = l.getField("ptnr1_label_seq_id"), b = l.getField("ptnr1_label_comp_id"), c = l.getField("ptnr1_label_atom_id"), _ = l.getField("ptnr2_label_asym_id"), E = l.getField("ptnr2_label_seq_id"), w = l.getField("ptnr2_label_comp_id"), k = l.getField("ptnr2_label_atom_id"), $ = l.getField("pdbx_value_order");
                  for (let L = 0; L < u.length; L++)
                    if (u[L] == "disulf" || u[L] == "covale") {
                      let z = $ ? $[L] == "" ? 1 : parseInt($[L]) : 1;
                      this.C.push([[p[L], g[L], b[L], c[L]], [_[L], E[L], w[L], k[L]], z]);
                    }
                }
              }
            }
            class x {
              constructor() {
                this.R = {};
              }
              add(l) {
                this.R[l.lchain] == null && (this.R[l.lchain] = {}), this.R[l.lchain][l.lresi] == null && (this.R[l.lchain][l.lresi] = {}), this.R[l.lchain][l.lresi][l.lresn] == null && (this.R[l.lchain][l.lresi][l.lresn] = []), this.R[l.lchain][l.lresi][l.lresn].push(l), this.R[l.lchain][l.lresi][l.lresn][l.atom] = l;
              }
              geta([l, u, p, g]) {
                if (this.R[l] !== void 0 && this.R[l][u] !== void 0 && this.R[l][u][p] !== void 0)
                  return this.R[l][u][p][g];
              }
              setBonds(l, u) {
                for (let p in this.R)
                  for (let g in this.R[p])
                    for (let b in this.R[p][g]) {
                      let c = this.R[p][g][b];
                      for (let _ = 0; _ < c.length; _++)
                        for (let E = _ + 1; E < c.length; E++) {
                          let w = c[_], k = c[E], $ = l.order(b, w.atom, k.atom);
                          $ > 0 && (w.bonds.push(k.index), k.bonds.push(w.index), w.bondOrder.push($), k.bondOrder.push($));
                        }
                    }
                for (let p of u.C) {
                  let g = p[0], b = p[1], c = p[2], _ = this.geta(g), E = this.geta(b);
                  _ != null && E != null && (_.bonds.push(E.index), E.bonds.push(_.index), _.bondOrder.push(c), E.bondOrder.push(c));
                }
              }
            }
            function M(m, l) {
              var u = !l.keepH, p = l.altLoc ? l.altLoc : "A", g = !l.noComputeSecondaryStructure;
              const b = !l.doAssembly, c = l.assignBonds === void 0 ? !0 : l.assignBonds;
              if (typeof m == "string")
                try {
                  m = (0, r.base64ToArray)(m);
                } catch {
                  m = new TextEncoder().encode(m);
                }
              else
                m = new Uint8Array(m);
              var _ = f.decodeMsgpack(m);
              _ == 31 && (m = (0, r.inflateString)(m, !1), _ = f.decodeMsgpack(m));
              var E = [], w = E.modelData = [], k = _.dataBlocks.length;
              if (k == 0)
                return E;
              l.multimodel || (k = 1);
              for (let $ = 0; $ < k; $++) {
                let L = E.length;
                const z = [];
                w.push({ symmetries: [] }), E.push([]);
                const F = _.dataBlocks[$], R = /* @__PURE__ */ Object.create(null);
                for (const Re of F.categories)
                  R[Re.name.substr(1)] = (0, h.Category)(Re);
                let P = {}, U = R.struct_conf;
                if (U) {
                  let Re = U.getField("conf_type_id"), De = U.getField("beg_label_asym_id"), je = U.getField("beg_label_seq_id"), Xe = U.getField("end_label_seq_id");
                  for (let X = 0; X < Re.length; X++)
                    if (Re[X].startsWith("H")) {
                      let q = De[X], re = je[X], ye = Xe[X];
                      q in P || (P[q] = {}), P[q][re] = "h1";
                      for (let me = re + 1; me < ye; me++)
                        P[q][me] = "h";
                      P[q][ye] = "h2";
                    }
                }
                let N = R.struct_sheet_range;
                if (N) {
                  let Re = N.getField("id"), De = N.getField("beg_label_asym_id"), je = N.getField("beg_label_seq_id"), Xe = N.getField("end_label_seq_id");
                  for (let X = 0; X < Re.length; X++) {
                    let q = De[X], re = je[X], ye = Xe[X];
                    q in P || (P[q] = {}), P[q][re] = "s1";
                    for (let me = re + 1; me < ye; me++)
                      P[q][me] = "s";
                    P[q][ye] = "s2";
                  }
                }
                let B = R.pdbx_struct_oper_list, W = B.getField("id");
                if (W && !b) {
                  let Re = B.getField("matrix[1][1]"), De = B.getField("matrix[1][2]"), je = B.getField("matrix[1][3]"), Xe = B.getField("matrix[2][1]"), X = B.getField("matrix[2][2]"), q = B.getField("matrix[2][3]"), re = B.getField("matrix[3][1]"), ye = B.getField("matrix[3][2]"), me = B.getField("matrix[3][3]"), ze = B.getField("vector[1]"), ke = B.getField("vector[2]"), K = B.getField("vector[3]");
                  for (let ae = 0; ae < W.length; ae++) {
                    const ge = new d.Matrix4(Re[ae], De[ae], je[ae], ze[ae], Xe[ae], X[ae], q[ae], ke[ae], re[ae], ye[ae], me[ae], K[ae]);
                    w[w.length - 1].symmetries.push(ge);
                  }
                }
                let V = new y(R.chem_comp_bond), G = new x(), H = new A(R.struct_conn), Q = R.atom_site, te = Q.rowCount, ee = Q.getField("group_PDB"), ce = Q.getField("Cartn_x"), fe = Q.getField("Cartn_y"), oe = Q.getField("Cartn_z"), he = Q.getField("auth_asym_id"), Ae = Q.getField("label_asym_id"), Se = Q.getField("auth_seq_id"), Ie = Q.getField("label_seq_id"), pe = Q.getField("auth_comp_id"), le = Q.getField("label_comp_id"), ne = Q.getField("auth_atom_id"), Te = Q.getField("label_atom_id"), Oe = Q.getField("type_symbol"), Be = Q.getField("B_iso_or_equiv"), Ue = Q.getField("id"), Pe = Q.getField("label_alt_id"), Ge = Q.getField("pdbx_PDB_model_num"), Ne = Ge ? Ge[0] : 0;
                for (let Re = 0; Re < te; Re++) {
                  if (ee !== void 0 && ee[Re] === "TER")
                    continue;
                  if (Ge && Ge[Re] != Ne)
                    if (Ne = Ge[Re], l.multimodel)
                      l.onemol || (E.push([]), w.push(w[w.length - 1]), Ne = Ge[Re], G.setBonds(V, H), G = new x());
                    else
                      break;
                  const De = {};
                  De.x = ce[Re], De.y = fe[Re], De.z = oe[Re], De.chain = he ? he[Re] : Ae ? Ae[Re] : void 0, De.lchain = Ae ? Ae[Re] : void 0, De.resi = Se ? Se[Re] : Ie ? Ie[Re] : void 0, De.lresi = Ie ? Ie[Re] : void 0, De.resn = pe ? pe[Re].trim() : le ? le[Re].trim() : void 0, De.lresn = le ? le[Re].trim() : void 0, De.atom = ne ? ne[Re].replace(/"/gm, "") : Te ? Te[Re].replace(/"/gm, "") : void 0, De.icode = Pe ? Pe[Re] : void 0, De.altLoc = De.icode, De.hetflag = !ee || ee[Re] === "HETA" || ee[Re] === "HETATM";
                  let je = "X";
                  Oe && (je = Oe[Re].replace(/\(?\+?\d+.*/, "")), De.elem = je[0].toUpperCase() + je.substring(1, 2).toLowerCase(), Be && (De.b = Be[Re]), !(u && De.elem == "H") && (De.altLoc != "" && De.altLoc != p && p != "*" || (De.bonds = [], De.ss = "c", De.serial = Ue[Re], De.model = Ne, De.bondOrder = [], De.properties = {}, De.index = E[E.length - 1].length, z[De.serial] = [E.length, De.index], E[E.length - 1].push(De), G.add(De)));
                }
                if (G.setBonds(V, H), !(0, v.isEmpty)(P))
                  for (let Re = L; Re < E.length; Re++) {
                    let De = E[Re];
                    for (let je = 0; je < De.length; je++) {
                      const Xe = De[je];
                      if (Xe !== void 0 && Xe.lchain in P && Xe.lresi in P[Xe.lchain]) {
                        const X = P[Xe.lchain][Xe.lresi];
                        Xe.ss = X[0], X.length > 1 && (X[1] == "1" ? Xe.ssbegin = !0 : X[1] == "2" && (Xe.ssend = !0));
                      }
                    }
                  }
                l.multimodel && $ < k - 1 && (l.onemol || (E.push([]), w.push({ symmetries: [] })));
              }
              for (let $ = 0; $ < E.length; $++)
                c && !(l.duplicateAssemblyAtoms && !l.dontConnectDuplicatedAtoms) && (0, o.assignPDBBonds)(E[$], l), g && (0, a.computeSecondaryStructure)(E[$], l.hbondCutoff), (0, s.processSymmetries)(w[$].symmetries, E[$], l, w[$].cryst), l.duplicateAssemblyAtoms && !l.dontConnectDuplicatedAtoms && c && (0, o.assignPDBBonds)(E[$], l);
              return E;
            }
          }
        ),
        /***/
        "./src/parsers/CDJSON.ts": (
          /*!*******************************!*\
            !*** ./src/parsers/CDJSON.ts ***!
            \*******************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CDJSON: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r(a, s) {
              var h = [[]];
              typeof a == "string" && (a = JSON.parse(a));
              for (var o = a.m, d = o[0].a, v = o[0].b, f = o[0].s, y = s !== void 0 && s.parseStyle !== void 0 ? s.parseStyle : f !== void 0, A = h[h.length - 1].length, x = 0; x < d.length; x++) {
                var M = d[x], m = {};
                m.id = M.i, m.x = M.x, m.y = M.y, m.z = M.z || 0, m.bonds = [], m.bondOrder = [];
                var l = M.l || "C";
                m.elem = l[0].toUpperCase() + l.substring(1).toLowerCase(), m.serial = h[h.length - 1].length, y && (m.style = f[M.s || 0]), h[h.length - 1].push(m);
              }
              for (let u = 0; u < v.length; u++) {
                let p = v[u], g = p.b + A, b = p.e + A, c = p.o || 1, _ = h[h.length - 1][g], E = h[h.length - 1][b];
                _.bonds.push(b), _.bondOrder.push(c), E.bonds.push(g), E.bondOrder.push(c);
              }
              return h;
            }
          }
        ),
        /***/
        "./src/parsers/CIF.ts": (
          /*!****************************!*\
            !*** ./src/parsers/CIF.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CIF: () => (
                /* binding */
                d
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), a = t(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), s = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), h = t(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            );
            const o = function(v, f, y, A) {
              return new s.Vector3(f, y, A).applyMatrix3(v);
            };
            function d(v, f = {}) {
              const y = [], A = !f.doAssembly, x = y.modelData = [], M = f.assignBonds === void 0 ? !0 : f.assignBonds;
              function m(c, _) {
                const E = [];
                let w = 0, k = 0;
                for (; k < c.length; ) {
                  for (; c.substring(k, k + _.length) !== _ && k < c.length; )
                    if (c[k] === "'") {
                      for (k++; k < c.length && c[k] !== "'"; )
                        k++;
                      for (; c.substring(k, k + _.length) !== _ && k < c.length; )
                        k++;
                    } else if (c[k] === '"') {
                      for (k++; k < c.length && c[k] !== '"'; )
                        k++;
                      k++;
                    } else
                      k++;
                  E.push(c.substring(w, k)), w = k = k + _.length;
                }
                return E;
              }
              const l = v.split(/\r?\n|\r/), u = [];
              let p = !1;
              for (let c = 0; c < l.length; c++) {
                var g = l[c].split("#")[0];
                if (p ? g[0] === ";" && (p = !1) : g[0] === ";" && (p = !0), p || g !== "") {
                  if (!p && (g = g.trim(), g[0] === "_")) {
                    const _ = g.split(/\s/)[0].indexOf(".");
                    if (_ > -1) {
                      let E = g.split("");
                      E[_] = "_", g = E.join(""), g = g.substring(0, _) + "_" + g.substring(_ + 1);
                    }
                  }
                  u.push(g);
                }
              }
              let b = 0;
              for (; b < u.length; ) {
                for (; !u[b].startsWith("data_") || u[b] === "data_global"; )
                  b++;
                b++;
                const c = {};
                for (; b < u.length && !u[b].startsWith("data_"); )
                  if (u[b][0] === void 0)
                    b++;
                  else if (u[b][0] === "_") {
                    const k = u[b].split(/\s/)[0].toLowerCase(), $ = c[k] = c[k] || [], L = u[b].substring(u[b].indexOf(k) + k.length);
                    if (L === "")
                      if (b++, u[b][0] === ";") {
                        let z = u[b].substring(1);
                        for (b++; u[b] !== ";"; )
                          z = z + `
` + u[b], b++;
                        $.push(z);
                      } else
                        $.push(u[b]);
                    else
                      $.push(L.trim());
                    b++;
                  } else if (u[b].substring(0, 5) === "loop_") {
                    b++;
                    const k = [];
                    for (; u[b] === "" || u[b][0] === "_"; ) {
                      if (u[b] !== "") {
                        let L = u[b].split(/\s/)[0].toLowerCase(), z = c[L] = c[L] || [];
                        k.push(z);
                      }
                      b++;
                    }
                    let $ = 0;
                    for (; b < u.length && u[b][0] !== "_" && !u[b].startsWith("loop_") && !u[b].startsWith("data_"); ) {
                      let L = m(u[b], " ");
                      for (let z = 0; z < L.length; z++)
                        L[z] !== "" && (k[$].push(L[z]), $ = ($ + 1) % k.length);
                      b++;
                    }
                  } else
                    b++;
                x.push({ symmetries: [] }), y.push([]);
                const _ = c._atom_site_id !== void 0 ? c._atom_site_id.length : c._atom_site_label.length;
                let E;
                if (c._cell_length_a !== void 0) {
                  const k = parseFloat(c._cell_length_a), $ = parseFloat(c._cell_length_b), L = parseFloat(c._cell_length_c), z = parseFloat(c._cell_angle_alpha) || 90, F = parseFloat(c._cell_angle_beta) || 90, R = parseFloat(c._cell_angle_gamma) || 90;
                  E = (0, s.conversionMatrix3)(k, $, L, z, F, R), x[x.length - 1].cryst = {
                    a: k,
                    b: $,
                    c: L,
                    alpha: z,
                    beta: F,
                    gamma: R
                  };
                }
                for (let k = 0; k < _; k++) {
                  if (c._atom_site_group_pdb !== void 0 && c._atom_site_group_pdb[k] === "TER")
                    continue;
                  const $ = {};
                  if (c._atom_site_cartn_x !== void 0)
                    $.x = parseFloat(c._atom_site_cartn_x[k]), $.y = parseFloat(c._atom_site_cartn_y[k]), $.z = parseFloat(c._atom_site_cartn_z[k]);
                  else {
                    const z = o(E, parseFloat(c._atom_site_fract_x[k]), parseFloat(c._atom_site_fract_y[k]), parseFloat(c._atom_site_fract_z[k]));
                    $.x = z.x, $.y = z.y, $.z = z.z;
                  }
                  $.chain = c._atom_site_auth_asym_id ? c._atom_site_auth_asym_id[k] : c._atom_site_label_asym_id ? c._atom_site_label_asym_id[k] : void 0, $.resi = c._atom_site_auth_seq_id ? parseInt(c._atom_site_auth_seq_id[k]) : c._atom_site_label_seq_id ? c._atom_site_label_seq_id[k] : void 0, $.resn = c._atom_site_auth_comp_id ? c._atom_site_auth_comp_id[k].trim() : c._atom_site_label_comp_id ? c._atom_site_label_comp_id[k].trim() : void 0, $.atom = c._atom_site_auth_atom_id ? c._atom_site_auth_atom_id[k].replace(/"/gm, "") : c._atom_site_label_atom_id ? c._atom_site_label_atom_id[k].replace(/"/gm, "") : void 0, $.hetflag = !c._atom_site_group_pdb || c._atom_site_group_pdb[k] === "HETA" || c._atom_site_group_pdb[k] === "HETATM", c._atom_site_b_iso_or_equiv && ($.b = parseFloat(c._atom_site_b_iso_or_equiv[k]));
                  let L = "X";
                  c._atom_site_type_symbol ? L = c._atom_site_type_symbol[k].replace(/\(?\+?\d+.*/, "") : c._atom_site_label && (L = c._atom_site_label[k].split("_")[0].replace(/\(?\d+.*/, "")), $.elem = L[0].toUpperCase() + L.substring(1, 2).toLowerCase(), $.bonds = [], $.ss = "c", $.serial = k, $.bondOrder = [], $.properties = {}, y[y.length - 1].push($);
                }
                if (c._pdbx_struct_oper_list_id !== void 0 && !A)
                  for (let k = 0; k < c._pdbx_struct_oper_list_id.length; k++) {
                    const $ = parseFloat(c["_pdbx_struct_oper_list_matrix[1][1]"][k]), L = parseFloat(c["_pdbx_struct_oper_list_matrix[1][2]"][k]), z = parseFloat(c["_pdbx_struct_oper_list_matrix[1][3]"][k]), F = parseFloat(c["_pdbx_struct_oper_list_vector[1]"][k]), R = parseFloat(c["_pdbx_struct_oper_list_matrix[2][1]"][k]), P = parseFloat(c["_pdbx_struct_oper_list_matrix[2][2]"][k]), U = parseFloat(c["_pdbx_struct_oper_list_matrix[2][3]"][k]), N = parseFloat(c["_pdbx_struct_oper_list_vector[2]"][k]), B = parseFloat(c["_pdbx_struct_oper_list_matrix[3][1]"][k]), W = parseFloat(c["_pdbx_struct_oper_list_matrix[3][2]"][k]), V = parseFloat(c["_pdbx_struct_oper_list_matrix[3][3]"][k]), G = parseFloat(c["_pdbx_struct_oper_list_vector[3]"][k]), H = new s.Matrix4($, L, z, F, R, P, U, N, B, W, V, G);
                    x[x.length - 1].symmetries.push(H);
                  }
                const w = function(k) {
                  const $ = k.match("-");
                  k = k.replace(/[-xyz]/g, "");
                  const L = k.split("/");
                  let z, F;
                  return L[1] === void 0 ? F = 1 : F = parseInt(L[1]), L[0] === "" ? z = 1 : z = parseInt(L[0]), z / F * ($ ? -1 : 1);
                };
                if (c._symmetry_equiv_pos_as_xyz !== void 0 && !A)
                  for (let k = 0; k < c._symmetry_equiv_pos_as_xyz.length; k++) {
                    const L = c._symmetry_equiv_pos_as_xyz[k].replace(/["' ]/g, "").split(",").map(function(P) {
                      return P.replace(/-/g, "+-");
                    });
                    let z = new s.Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
                    for (let P = 0; P < 3; P++) {
                      const U = L[P].split("+");
                      for (let N = 0; N < U.length; N++) {
                        const B = U[N];
                        if (B === "")
                          continue;
                        const W = w(B);
                        B.match("x") ? z.elements[P + 0] = W : B.match("y") ? z.elements[P + 4] = W : B.match("z") ? z.elements[P + 8] = W : z.elements[P + 12] = W;
                      }
                    }
                    const F = E.getMatrix4(), R = new s.Matrix4().getInverse(F, !0);
                    z = new s.Matrix4().multiplyMatrices(z, R), z = new s.Matrix4().multiplyMatrices(F, z), x[x.length - 1].symmetries.push(z);
                  }
              }
              for (let c = 0; c < y.length; c++)
                M && !(f.duplicateAssemblyAtoms && !f.dontConnectDuplicatedAtoms) && (0, h.assignPDBBonds)(y[c], f), (0, r.computeSecondaryStructure)(y[c], f.hbondCutoff), (0, a.processSymmetries)(x[c].symmetries, y[c], f, x[c].cryst), f.duplicateAssemblyAtoms && !f.dontConnectDuplicatedAtoms && M && (0, h.assignPDBBonds)(y[c], f);
              return y;
            }
          }
        ),
        /***/
        "./src/parsers/CUBE.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/CUBE.ts ***!
            \*****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CUBE: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), s = t(
              /*! ./utils/anumToSymbol */
              "./src/parsers/utils/anumToSymbol.ts"
            );
            function h(o, d) {
              d = d || {};
              const v = [[]];
              let f = o.split(/\r?\n/);
              const y = d.assignBonds === void 0 ? !0 : d.assignBonds;
              if (f.length < 6)
                return v;
              let A = f[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              const x = Math.abs(parseFloat(A[0]));
              let M = {
                origin: void 0,
                size: void 0,
                unit: void 0,
                matrix4: void 0,
                matrix: void 0
              };
              const m = M.origin = new r.Vector3(parseFloat(A[1]), parseFloat(A[2]), parseFloat(A[3]));
              A = f[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), A = f[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              const l = A[0] > 0 ? 0.529177 : 1;
              m.multiplyScalar(l);
              const u = Math.abs(A[0]), p = new r.Vector3(parseFloat(A[1]), parseFloat(A[2]), parseFloat(A[3])).multiplyScalar(l);
              A = f[4].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              const g = Math.abs(A[0]), b = new r.Vector3(parseFloat(A[1]), parseFloat(A[2]), parseFloat(A[3])).multiplyScalar(l);
              A = f[5].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              const c = Math.abs(A[0]), _ = new r.Vector3(parseFloat(A[1]), parseFloat(A[2]), parseFloat(A[3])).multiplyScalar(l);
              if (M.size = { x: u, y: g, z: c }, M.unit = new r.Vector3(p.x, b.y, _.z), p.y != 0 || p.z != 0 || b.x != 0 || b.z != 0 || _.x != 0 || _.y != 0) {
                M.matrix4 = new r.Matrix4(p.x, b.x, _.x, 0, p.y, b.y, _.y, 0, p.z, b.z, _.z, 0, 0, 0, 0, 1);
                let F = new r.Matrix4().makeTranslation(m.x, m.y, m.z);
                M.matrix4 = M.matrix4.multiplyMatrices(F, M.matrix4), M.matrix = M.matrix4.matrix3FromTopLeft(), M.origin = new r.Vector3(0, 0, 0), M.unit = new r.Vector3(1, 1, 1);
              }
              v.modelData = [{ cryst: M }], f = f.splice(6, x);
              for (var E = v[v.length - 1].length, w = E + f.length, k = E; k < w; ++k) {
                var $ = {};
                $.serial = k;
                var L = f[k - E], z = L.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                $.elem = s.anumToSymbol[z[0]], $.x = parseFloat(z[2]) * l, $.y = parseFloat(z[3]) * l, $.z = parseFloat(z[4]) * l, $.hetflag = !0, $.bonds = [], $.bondOrder = [], $.properties = {}, v[v.length - 1].push($);
              }
              if (y)
                for (let F = 0; F < v.length; F++)
                  (0, a.assignBonds)(v[F], d);
              return v;
            }
          }
        ),
        /***/
        "./src/parsers/GRO.ts": (
          /*!****************************!*\
            !*** ./src/parsers/GRO.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GRO: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), a = t(
              /*! ./utils/atomNameToElem */
              "./src/parsers/utils/atomNameToElem.ts"
            );
            function s(h, o) {
              const d = [], v = h.split(/\r?\n|\r/);
              for (; v.length > 0; ) {
                const f = parseInt(v[1]);
                if (v.length < 3 || isNaN(f) || f <= 0 || v.length < f + 3)
                  break;
                const A = [];
                d.push(A);
                let x = 2;
                const M = A.length, m = M + f;
                for (let l = M; l < m; l++) {
                  const u = v[x++], p = {};
                  p.serial = l, p.atom = u.slice(10, 15).trim(), p.elem = (0, a.atomNameToElem)(p.atom, !0), p.x = 10 * parseFloat(u.slice(20, 28)), p.y = 10 * parseFloat(u.slice(28, 36)), p.z = 10 * parseFloat(u.slice(36, 44)), p.resi = parseInt(u.slice(0, 5)), p.resn = u.slice(5, 10).trim(), p.bonds = [], p.bondOrder = [], p.properties = {}, u.length > 44 && (p.dx = 10 * parseFloat(u.slice(44, 52)), p.dy = 10 * parseFloat(u.slice(52, 60)), p.dz = 10 * parseFloat(u.slice(60, 68))), A[l] = p;
                }
                if (v.length <= x + 3) {
                  const u = v[x++].trim().split(/\s+/);
                  if (u.length === 3) {
                    for (let p = 0; p < 3; p++)
                      u[p] = (parseFloat(u[p]) * 10).toString();
                    d.box = u;
                  }
                }
                v.splice(0, ++x);
              }
              for (let f = 0; f < d.length; f++)
                (0, r.assignPDBBonds)(d[f], o);
              return d;
            }
          }
        ),
        /***/
        "./src/parsers/LAMMPSTRJ.ts": (
          /*!**********************************!*\
            !*** ./src/parsers/LAMMPSTRJ.ts ***!
            \**********************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              LAMMPSTRJ: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            const a = {
              id: "serial",
              type: "atom",
              element: "elem",
              q: "charge",
              radius: "radius",
              x: "x",
              xu: "x",
              xs: "x",
              xsu: "x",
              y: "y",
              yu: "y",
              ys: "y",
              ysu: "y",
              z: "z",
              zu: "z",
              zs: "z",
              zsu: "z"
            };
            function s(h, o) {
              const d = [], v = h.split(/\r?\n|\r/);
              let f = 0, y = 0, A = 0;
              for (; A < v.length - 9; ) {
                for (var x = A; x < v.length; x++)
                  if (v[x].match(/ITEM: NUMBER OF ATOMS/) && (y = parseInt(v[x + 1])), v[x].match(/ITEM: ATOMS/)) {
                    f = x + 1;
                    break;
                  }
                const M = v[f - 1].replace("ITEM: ATOMS ", "").split(" ");
                d.push([]);
                for (let m = f; m < f + y; m++) {
                  const l = {}, u = {}, p = v[m].split(" ");
                  for (let g = 0; g < p.length; g++) {
                    const b = a[M[g]];
                    b !== void 0 && (b === "serial" ? l[b] = parseInt(p[g]) : b === "x" || b === "y" || b === "z" ? l[b] = parseFloat(p[g]) : b === "charge" || b === "radius" ? u[b] = parseFloat(p[g]) : l[b] = p[g]), l.properties = u, l.bonds = [], l.bondOrder = [];
                  }
                  d[d.length - 1][m - f] = l;
                }
                A = f + y - 1;
              }
              if (o.assignBonds)
                for (let M = 0; M < d.length; M++)
                  (0, r.assignBonds)(d[M], o);
              return d;
            }
          }
        ),
        /***/
        "./src/parsers/MMTF.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/MMTF.ts ***!
            \*****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MMTFparser: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var r = t(
              /*! ../utilities */
              "./src/utilities.ts"
            ), a = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), s = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), h = t(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), o = t(
              /*! ./src/vendor/mmtf.js */
              "./src/vendor/mmtf.js"
            ), d = function(A) {
              return String.fromCharCode.apply(null, A).replace(/\0/g, "");
            }, v = function(A) {
              return A == 0 || A == 2 || A == 4 ? "h" : A == 3 ? "s" : "c";
            };
            let f = /* @__PURE__ */ new Set([
              "D-SACCHARIDE",
              "D-SACCHARIDE 1,4 AND 1,4 LINKING",
              "D-SACCHARIDE 1,4 AND 1,6 LINKING",
              "L-SACCHARIDE",
              "L-SACCHARIDE 1,4 AND 1,4 LINKING",
              "L-SACCHARIDE 1,4 AND 1,6 LINKING",
              "NON-POLYMER",
              "OTHER",
              "PEPTIDE-LIKE",
              "SACCHARIDE"
            ]);
            function y(A, x) {
              var M = !x.keepH, m = x.altLoc ? x.altLoc : "A", l = !!x.noSecondaryStructure, u = !x.noComputeSecondaryStructure, p = !x.doAssembly, g = x.assemblyIndex ? x.assemblyIndex : 0;
              typeof A == "string" ? A = (0, r.base64ToArray)(A) : A = new Uint8Array(A);
              var b = o.decode(A), c = [[]], _ = c.modelData = [], E = 0, w = 0, k = 0, $ = b.secStructList, L = b.bFactorList, z = b.altLocList, F = b.occupancyList, R = b.bondAtomList, P = b.bondOrderList, U = b.numModels;
              if (U == 0)
                return c;
              x.multimodel || (U = 1);
              var N, B, W, V, G, H, Q = [];
              if (!p && b.bioAssemblyList && b.bioAssemblyList.length > 0) {
                var te = b.bioAssemblyList[g].transformList;
                for (N = 0, H = te.length; N < H; N++) {
                  var ee = new a.Matrix4(te[N].matrix);
                  ee.transpose(), Q.push(ee);
                }
              }
              var ce = null;
              if (b.unitCell) {
                var fe = b.unitCell;
                ce = { a: fe[0], b: fe[1], c: fe[2], alpha: fe[3], beta: fe[4], gamma: fe[5] };
              }
              let oe = [];
              b.entityList.forEach((ve) => {
                ve.chainIndexList.forEach((Y) => {
                  oe[Y] = ve.type == "polymer";
                });
              });
              var he = 0;
              for (G = 0; G < U; G++) {
                var Ae = b.chainsPerModel[G], Se = c[c.length - 1], Ie = [];
                for (_.push({ symmetries: Q, cryst: ce }), N = 0; N < Ae; ++N) {
                  var pe = b.groupsPerChain[E], le = d(b.chainIdList.subarray(E * 4, E * 4 + 4));
                  b.chainNameList && (le = d(b.chainNameList.subarray(E * 4, E * 4 + 4)));
                  var ne = w, Te = "";
                  for (B = 0; B < pe; ++B) {
                    var Oe = b.groupList[b.groupTypeList[w]], Be = Oe.atomNameList.length, Ue = 0, Pe = !1, Ge = !1;
                    if ($) {
                      Ue = $[w];
                      var Ne = v(Ue);
                      (w == 0 || Ne != Te) && (Pe = !0), Te = Ne;
                      var Re = w + 1;
                      (Re >= $.length || v($[Re] != Ne)) && (Ge = !0);
                    }
                    var De = b.groupIdList[w], je = Oe.groupName;
                    let ve = Oe.chemCompType;
                    var Xe = k;
                    let Y = f.has(ve) || !oe[E];
                    for (W = 0; W < Be; ++W) {
                      var X = Oe.elementList[W];
                      if (M && X == "H") {
                        k += 1;
                        continue;
                      }
                      var q = "";
                      L && (q = L[k]);
                      var re = "";
                      z && z[k] && (re = String.fromCharCode(z[k]));
                      var ye = "";
                      if (F && (ye = F[k]), re != "" && re != m && m != "*") {
                        k += 1;
                        continue;
                      }
                      var me = b.atomIdList[k], ze = Oe.atomNameList[W], ke = 0;
                      Oe.atomChargeList && (ke = Oe.atomChargeList[W]);
                      var K = b.xCoordList[k], ae = b.yCoordList[k], ge = b.zCoordList[k];
                      Ie[k] = Se.length, Se.push({
                        resn: je,
                        x: K,
                        y: ae,
                        z: ge,
                        elem: X,
                        hetflag: Y,
                        chain: le,
                        resi: De,
                        icode: re,
                        rescode: De + (re != " " ? "^" + re : ""),
                        // resi
                        // and
                        // icode
                        serial: me,
                        altLoc: re,
                        index: k,
                        atom: ze,
                        bonds: [],
                        ss: v(Ue),
                        ssbegin: Pe,
                        ssend: Ge,
                        bondOrder: [],
                        properties: { charge: ke, occupancy: ye },
                        b: q
                      }), k += 1;
                    }
                    var xe = Oe.bondAtomList;
                    for (W = 0, V = Oe.bondOrderList.length; W < V; ++W) {
                      var ue = Xe + xe[W * 2], Ce = Xe + xe[W * 2 + 1], Z = Oe.bondOrderList[W], Fe = Ie[ue], We = Ie[Ce], I = Se[Fe], we = Se[We];
                      I && we && (I.bonds.push(We), I.bondOrder.push(Z), we.bonds.push(Fe), we.bondOrder.push(Z));
                    }
                    w += 1;
                  }
                  for (w = ne, B = 0; B < pe; ++B)
                    w += 1;
                  E += 1;
                }
                if (R)
                  for (let ve = he, Y = R.length; ve < Y; ve += 2) {
                    let de = R[ve], Me = R[ve + 1], Ye = P ? P[ve / 2] : 1;
                    if (de >= k) {
                      he = ve;
                      break;
                    }
                    let Ze = Ie[de], Ke = Ie[Me], rt = Se[Ze], wt = Se[Ke];
                    rt && wt && (rt.bonds.push(Ke), rt.bondOrder.push(Ye), wt.bonds.push(Ze), wt.bondOrder.push(Ye));
                  }
                x.multimodel && (x.onemol || c.push([]));
              }
              if (!p)
                for (let ve = 0; ve < c.length; ve++)
                  (0, h.processSymmetries)(_[ve].symmetries, c[ve], x, _[ve].cryst);
              return u && !l && (0, s.computeSecondaryStructure)(c, x.hbondCutoff), c;
            }
          }
        ),
        /***/
        "./src/parsers/MOL2.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/MOL2.ts ***!
            \*****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MOL2: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            let r = {
              "C.1": "C",
              C1: "C",
              "C.2": "C",
              C2: "C",
              "C.3": "C",
              C3: "C",
              "C.ar": "C",
              Car: "C",
              "C.cat": "C",
              Ccat: "C",
              "H.spc": "H",
              Hspc: "H",
              "H.t3p": "H",
              Ht3p: "H",
              "N.1": "N",
              N1: "N",
              "N.2": "N",
              N2: "N",
              "N.3": "N",
              N3: "N",
              "N.4": "N",
              N4: "N",
              "N.am": "N",
              Nam: "N",
              "N.ar": "N",
              Nar: "N",
              "N.p13": "N",
              Np13: "N",
              "O.2": "O",
              O2: "O",
              "O.3": "O",
              O3: "O",
              "O.co2": "O",
              Oco2: "O",
              "O.spc": "O",
              Ospc: "O",
              "O.t3p": "O",
              Ot3p: "O",
              "P.3": "P",
              P3: "P",
              "S.2": "S",
              S2: "S",
              "S.3": "S",
              S3: "S",
              "S.o": "S",
              So: "S",
              "S.o2": "S",
              So2: "S"
            };
            function a(s, h) {
              var o = [[]], d = !1;
              typeof h.keepH < "u" && (d = !h.keepH);
              var v = s.search(/@<TRIPOS>MOLECULE/), f = s.search(/@<TRIPOS>ATOM/);
              if (v == -1 || f == -1)
                return o;
              for (var y = s.substring(v).split(/\r?\n|\r/); y.length > 0; ) {
                var A = [], x = y[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), M = parseInt(x[0]), m = 0;
                x.length > 1 && (m = parseInt(x[1]));
                var l = 4, u;
                for (u = 3; u < y.length; u++)
                  if (y[u] == "@<TRIPOS>ATOM") {
                    l = u + 1;
                    break;
                  }
                var p = o[o.length - 1].length, g = p + M, b;
                for (u = p; u < g; u++) {
                  b = y[l++], x = b.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                  var c = {}, _ = x[5];
                  if (r[_] !== void 0 ? _ = r[_] : (_ = _.split(".")[0], _ = _[0].toUpperCase() + _.substring(1).toLowerCase()), c.atom = x[1], c.elem = _, !(c.elem == "H" && d)) {
                    var E = o[o.length - 1].length, w = parseInt(x[0]);
                    c.serial = w, c.x = parseFloat(x[2]), c.y = parseFloat(x[3]), c.z = parseFloat(x[4]), c.atom = x[5];
                    var k = parseFloat(x[8]);
                    c.index = E, c.bonds = [], c.bondOrder = [], c.properties = {
                      charge: k,
                      partialCharge: k
                    }, A[w] = E, o[o.length - 1].push(c);
                  }
                }
                for (var $ = !1; l < y.length; )
                  if (y[l++] == "@<TRIPOS>BOND") {
                    $ = !0;
                    break;
                  }
                if ($ && m)
                  for (u = 0; u < m; u++) {
                    b = y[l++], x = b.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                    var L = parseInt(x[1]), z = o[o.length - 1][A[L]], F = parseInt(x[2]), R = o[o.length - 1][A[F]], P = parseInt(x[3]);
                    isNaN(P) && (P = 1), z !== void 0 && R !== void 0 && (z.bonds.push(A[F]), z.bondOrder.push(P), R.bonds.push(A[L]), R.bondOrder.push(P));
                  }
                if (h.multimodel) {
                  h.onemol || o.push([]), y.splice(0, l), s = y.join(`
`);
                  continue;
                } else
                  break;
              }
              return o;
            }
          }
        ),
        /***/
        "./src/parsers/PDB.ts": (
          /*!****************************!*\
            !*** ./src/parsers/PDB.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              PDB: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utils/getSinglePDB */
              "./src/parsers/utils/getSinglePDB.ts"
            );
            function a(s, h) {
              h = h || {};
              var o = [], d = {};
              o.modelData = [];
              for (var v = s.split(/\r?\n|\r/); v.length > 0; ) {
                var f = (0, r.getSinglePDB)(v, h, d), y = f[0], A = f[1];
                if (v = f[2], y.length != 0) {
                  if (h.multimodel && h.onemol && o.length > 0)
                    for (var x = o[0].length, M = 0; M < y.length; M++) {
                      var m = y[M];
                      m.index = M;
                      for (var l = 0; l < m.bonds.length; l++)
                        m.bonds[l] += x;
                      o[0].push(m);
                    }
                  else
                    o.modelData.push(A), o.push(y);
                  if (!h.multimodel)
                    break;
                }
              }
              return o;
            }
          }
        ),
        /***/
        "./src/parsers/PQR.ts": (
          /*!****************************!*\
            !*** ./src/parsers/PQR.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              PQR: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), a = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            );
            function s(h, o) {
              var d = [[]], v = !o.noSecondaryStructure;
              d.modelData = [{ symmetries: [] }];
              var f = [], y = h.split(/\r?\n|\r/), A;
              for (let $ = 0; $ < y.length; $++) {
                A = y[$].replace(/^\s*/, "");
                var x = A.substring(0, 6);
                if (x.indexOf("END") == 0)
                  if (o.multimodel) {
                    o.onemol || d.push([]);
                    continue;
                  } else
                    break;
                else if (x == "ATOM  " || x == "HETATM") {
                  var M;
                  let L = parseInt(A.substring(6, 11)), z = A.substring(12, 16).replace(/ /g, ""), F = A.substring(17, 20).trim(), R = A.substring(21, 22), P = parseInt(A.substring(22, 26));
                  var m = A.substring(30).trim().split(/\s+/), l = parseFloat(m[0]), u = parseFloat(m[1]), p = parseFloat(m[2]), g = parseFloat(m[3]), b = parseFloat(m[4]), c = z[0];
                  z.length > 1 && z[1].toUpperCase() != z[1] && (c = z.substring(0, 2)), A[0] == "H" ? M = !0 : M = !1, f[L] = d[d.length - 1].length, d[d.length - 1].push({
                    resn: F,
                    x: l,
                    y: u,
                    z: p,
                    elem: c,
                    hetflag: M,
                    chain: R,
                    resi: P,
                    serial: L,
                    atom: z,
                    bonds: [],
                    ss: "c",
                    bondOrder: [],
                    properties: {
                      charge: g,
                      partialCharge: g,
                      radius: b
                    },
                    pdbline: A
                  });
                } else if (x == "CONECT") {
                  var _ = parseInt(A.substring(6, 11)), E = d[d.length - 1][f[_]];
                  for (let L = 0; L < 4; L++) {
                    var w = parseInt(A.substring([11, 16, 21, 26][L], [11, 16, 21, 26][L] + 5)), k = d[d.length - 1][f[w]];
                    E !== void 0 && k !== void 0 && (E.bonds.push(f[w]), E.bondOrder.push(1));
                  }
                }
              }
              for (let $ = 0; $ < d.length; $++)
                (0, r.assignPDBBonds)(d[$], o), v && (0, a.computeSecondaryStructure)(d[$], o.hbondCutoff);
              return d;
            }
          }
        ),
        /***/
        "./src/parsers/PRMTOP.ts": (
          /*!*******************************!*\
            !*** ./src/parsers/PRMTOP.ts ***!
            \*******************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              PRMTOP: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r(a) {
              var s = [], h, o = 0, d = a.split(/\r?\n|\r/);
              if (d.length > 0 && d[0].includes("VERSION")) {
                var v = d.filter(function(l) {
                  return l.includes("POINTERS") || l.includes("ATOM_NAME") || l.includes("CHARGE") || l.includes("RADII") || l.includes("BONDS_INC_HYDROGEN") || l.includes("BONDS_WITHOUT_HYDROGEN");
                }), f = M("POINTERS");
                if (f == -1)
                  return [];
                var y = m(f), A = parseInt(d[f + 1].slice(0, y[1]));
                if (isNaN(A) || A <= 0)
                  return [];
                if (f = M("ATOM_NAME"), f == -1)
                  return [];
                y = m(f);
                var x = y[0];
                for (let l = 0; l < A / y[0]; l++) {
                  l == parseInt(A / y[0]) && (x = A % y[0]);
                  for (let u = 0; u < x; u++) {
                    let p = {}, g = { charge: "", radii: "" };
                    p.serial = o, p.x = 0, p.y = 0, p.z = 0, p.atom = d[f + 1].slice(y[1] * u, y[1] * (u + 1)).trim(), p.elem = d[f + 1].slice(y[1] * u, y[1] * u + 1).trim(), p.properties = g, p.bonds = [], p.bondOrder = [], s.push(p), o++;
                  }
                  f++;
                }
                if (f = M("CHARGE"), f != -1) {
                  y = m(f), o = 0, x = y[0];
                  for (let l = 0; l < A / y[0]; l++) {
                    l == parseInt(A / y[0]) && (x = A % y[0]);
                    for (let u = 0; u < x; u++)
                      s[o].properties.charge = parseFloat(d[f + 1].slice(y[1] * u, y[1] * (u + 1))), o++;
                    f++;
                  }
                }
                if (f = M("RADII"), f != -1) {
                  y = m(f), o = 0, x = y[0];
                  for (let l = 0; l < A / y[0]; l++) {
                    l == parseInt(A / y[0]) && (x = A % y[0]);
                    for (let u = 0; u < x; u++)
                      s[o].properties.radii = parseFloat(d[f + 1].slice(y[1] * u, y[1] * (u + 1))), o++;
                    f++;
                  }
                }
                if (f = M("BONDS_WITHOUT_HYDROGEN"), f != -1)
                  for (y = m(f), o = 0, x = y[0], f = f + 1; !d[f].match(/^%FLAG/); ) {
                    d[f + 1].match(/^%FLAG/) && (x = A % y[0]);
                    for (let l = 0; l < x; l++)
                      o % 3 == 0 ? h = parseInt(d[f].slice(y[1] * l, y[1] * (l + 1)) / 3) : o % 3 == 1 && s[h].bonds.push(parseInt(d[f].slice(y[1] * l, y[1] * (l + 1)) / 3)), o++;
                    f++;
                  }
                if (f = M("BONDS_INC_HYDROGEN"), f != -1)
                  for (y = m(f), o = 0, x = y[0], f = f + 1; !d[f].match(/^%FLAG/); ) {
                    d[f + 1].match(/^%FLAG/) && (x = A % y[0]);
                    for (let l = 0; l < x; l++)
                      o % 3 == 0 ? h = parseInt(d[f].slice(y[1] * l, y[1] * (l + 1)) / 3) : o % 3 == 1 && s[h].bonds.push(parseInt(d[f].slice(y[1] * l, y[1] * (l + 1)) / 3)), o++;
                    f++;
                  }
              } else
                return [];
              function M(l) {
                var u = d.indexOf(v.filter(function(p) {
                  return p.includes(l);
                })[0]);
                if (Number.isInteger(u) && u > 0) {
                  for (; !d[u].includes("FORMAT"); )
                    u++;
                  return u;
                } else
                  return -1;
              }
              function m(l) {
                var u = d[l].match(/\((\d*)\S*/), p = d[l].match(/[a-zA-Z](\d*)\)\s*/);
                return p == null && (p = d[l].match(/[a-zA-Z](\d*)\.\d*\)\s*/)), [u[1], p[1]];
              }
              return [s];
            }
          }
        ),
        /***/
        "./src/parsers/SDF.ts": (
          /*!****************************!*\
            !*** ./src/parsers/SDF.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SDF: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = function(h, o) {
              var d = [[]], v = !1;
              for (typeof o.keepH < "u" && (v = !o.keepH); h.length > 0 && !(h.length < 4); ) {
                var f = parseInt(h[3].substring(0, 3));
                if (isNaN(f) || f <= 0)
                  break;
                var y = parseInt(h[3].substring(3, 6)), A = 4;
                if (h.length < 4 + f + y)
                  break;
                var x = [], M = d[d.length - 1].length, m = M + f, l, u;
                for (l = M; l < m; l++, A++) {
                  u = h[A];
                  var p = {}, g = u.substring(31, 34).replace(/ /g, "");
                  p.atom = p.elem = g[0].toUpperCase() + g.substring(1).toLowerCase(), (p.elem !== "H" || !v) && (p.serial = l, x[l] = d[d.length - 1].length, p.x = parseFloat(u.substring(0, 10)), p.y = parseFloat(u.substring(10, 20)), p.z = parseFloat(u.substring(20, 30)), p.hetflag = !0, p.bonds = [], p.bondOrder = [], p.properties = {}, p.index = d[d.length - 1].length, d[d.length - 1].push(p));
                }
                for (l = 0; l < y; l++, A++) {
                  u = h[A];
                  var b = x[parseInt(u.substring(0, 3)) - 1 + M], c = x[parseInt(u.substring(3, 6)) - 1 + M], _ = parseFloat(u.substring(6));
                  typeof b < "u" && typeof c < "u" && (d[d.length - 1][b].bonds.push(c), d[d.length - 1][b].bondOrder.push(_), d[d.length - 1][c].bonds.push(b), d[d.length - 1][c].bondOrder.push(_));
                }
                if (o.multimodel) {
                  for (o.onemol || d.push([]); h[A] !== "$$$$" && A < h.length; )
                    A++;
                  h.splice(0, ++A);
                } else
                  break;
              }
              return d;
            }, a = function(h, o) {
              var d = [[]], v = !1;
              for (typeof o.keepH < "u" && (v = !o.keepH); h.length > 0 && !(h.length < 8 || !h[4].startsWith("M  V30 BEGIN CTAB") || !h[5].startsWith("M  V30 COUNTS") || h[5].length < 14); ) {
                var f = h[5].substring(13).match(/\S+/g);
                if (f.length < 2)
                  break;
                var y = parseInt(f[0]);
                if (isNaN(y) || y <= 0)
                  break;
                var A = parseInt(f[1]), x = 7;
                if (h.length < 8 + y + A)
                  break;
                var M = [], m = d[d.length - 1].length, l = m + y, u, p;
                for (u = m; u < l; u++, x++) {
                  p = h[x];
                  var g = p.substring(6).match(/\S+/g);
                  if (g.length > 4) {
                    var b = {}, c = g[1].replace(/ /g, "");
                    b.atom = b.elem = c[0].toUpperCase() + c.substring(1).toLowerCase(), (b.elem !== "H" || !v) && (b.serial = u, M[u] = d[d.length - 1].length, b.x = parseFloat(g[2]), b.y = parseFloat(g[3]), b.z = parseFloat(g[4]), b.hetflag = !0, b.bonds = [], b.bondOrder = [], b.properties = {}, b.index = d[d.length - 1].length, d[d.length - 1].push(b));
                  }
                }
                if (h[x] === "M  V30 END ATOM")
                  x++;
                else
                  break;
                if (A !== 0 && h[x] === "M  V30 BEGIN BOND")
                  x++;
                else
                  break;
                for (u = 0; u < A; u++, x++) {
                  p = h[x];
                  var _ = p.substring(6).match(/\S+/g);
                  if (_.length > 3) {
                    var E = M[parseInt(_[2]) - 1 + m], w = M[parseInt(_[3]) - 1 + m], k = parseFloat(_[1]);
                    typeof E < "u" && typeof w < "u" && (d[d.length - 1][E].bonds.push(w), d[d.length - 1][E].bondOrder.push(k), d[d.length - 1][w].bonds.push(E), d[d.length - 1][w].bondOrder.push(k));
                  }
                }
                if (o.multimodel) {
                  for (o.onemol || d.push([]); h[x] !== "$$$$" && x < h.length; )
                    x++;
                  h.splice(0, ++x);
                } else
                  break;
              }
              return d;
            };
            function s(h, o) {
              var d = "V2000", v = h.split(/\r?\n|\r/);
              return v.length > 3 && v[3].length > 38 && (d = v[3].substring(34, 39)), d === "V2000" ? r(v, o) : d === "V3000" ? a(v, o) : [[""]];
            }
          }
        ),
        /***/
        "./src/parsers/VASP.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/VASP.ts ***!
            \*****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              VASP: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function s(h, o = {}) {
              var d = [[]], v = {};
              const f = o.assignBonds === void 0 ? !0 : o.assignBonds;
              var y = h.replace(/^\s+/, "").split(/\r?\n/);
              if (y.length < 3)
                return d;
              if (y[1].match(/\d+/))
                v.length = parseFloat(y[1]);
              else
                return console.log("Warning: second line of the vasp structure file must be a number"), d;
              if (v.length < 0)
                return console.log("Warning: Vasp implementation for negative lattice lengths is not yet available"), d;
              v.xVec = new Float32Array(y[2].replace(/^\s+/, "").split(/\s+/)), v.yVec = new Float32Array(y[3].replace(/^\s+/, "").split(/\s+/)), v.zVec = new Float32Array(y[4].replace(/^\s+/, "").split(/\s+/));
              var A = new r.Matrix3(v.xVec[0], v.xVec[1], v.xVec[2], v.yVec[0], v.yVec[1], v.yVec[2], v.zVec[0], v.zVec[1], v.zVec[2]);
              A.multiplyScalar(v.length), d.modelData = [{ symmetries: [], cryst: { matrix: A } }];
              var x = y[5].trim().split(/\s+/), M = new Int16Array(y[6].trim().split(/\s+/)), m = y[7].trim(), l = !1;
              if (m.match(/S/) && (l = !0, m = y[8].trim()), m.toLowerCase()[0] == "c")
                m = "cartesian";
              else if (m.toLowerCase()[0] == "d")
                m = "direct";
              else
                return console.log("Warning: Unknown vasp mode in POSCAR file: mode must be either C(artesian) or D(irect)"), d;
              if (x.length != M.length)
                return console.log("Warning: declaration of atomary species wrong:"), console.log(x), console.log(M), d;
              l ? y.splice(0, 9) : y.splice(0, 8);
              for (var u = 0, p = 0, g = x.length; p < g; p++) {
                for (var b = x[p], c = 0, _ = M[p]; c < _; c++) {
                  var E = new Float32Array(y[u + c].trim().split(/\s+/)), w = {};
                  w.elem = b, m == "cartesian" ? (w.x = v.length * E[0], w.y = v.length * E[1], w.z = v.length * E[2]) : (w.x = v.length * (E[0] * v.xVec[0] + E[1] * v.yVec[0] + E[2] * v.zVec[0]), w.y = v.length * (E[0] * v.xVec[1] + E[1] * v.yVec[1] + E[2] * v.zVec[1]), w.z = v.length * (E[0] * v.xVec[2] + E[1] * v.yVec[2] + E[2] * v.zVec[2])), w.bonds = [], w.bondOrder = [], d[0].push(w);
                }
                u += M[p];
              }
              if (f)
                for (let k = 0; k < d.length; k++)
                  (0, a.assignBonds)(d[k], o);
              return d;
            }
          }
        ),
        /***/
        "./src/parsers/XYZ.ts": (
          /*!****************************!*\
            !*** ./src/parsers/XYZ.ts ***!
            \****************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              XYZ: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function s(h, o) {
              o = o || {};
              for (var d = [[]], v = o.assignBonds === void 0 ? !0 : o.assignBonds, f = h.split(/\r?\n|\r/); f.length > 0 && !(f.length < 3); ) {
                var y = parseInt(f[0]);
                if (isNaN(y) || y <= 0 || f.length < y + 2)
                  break;
                var A = /Lattice\s*=\s*["\{\}]([^"\{\}]+)["\{\}]\s*/gi, x = A.exec(f[1]);
                if (x != null && x.length > 1) {
                  var M = new Float32Array(x[1].split(/\s+/)), m = new r.Matrix3(M[0], M[3], M[6], M[1], M[4], M[7], M[2], M[5], M[8]);
                  d.modelData = [{ cryst: { matrix: m } }];
                }
                for (var l = 2, u = d[d.length - 1].length, p = u + y, g = u; g < p; g++) {
                  var b = f[l++], c = b.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), _ = {};
                  _.serial = g;
                  var E = c[0];
                  _.atom = _.elem = E[0].toUpperCase() + E.substring(1, 2).toLowerCase(), _.x = parseFloat(c[1]), _.y = parseFloat(c[2]), _.z = parseFloat(c[3]), _.hetflag = !0, _.bonds = [], _.bondOrder = [], _.properties = {}, d[d.length - 1][g] = _, c.length >= 7 && (_.dx = parseFloat(c[4]), _.dy = parseFloat(c[5]), _.dz = parseFloat(c[6]));
                }
                if (o.multimodel)
                  d.push([]), f.splice(0, l);
                else
                  break;
              }
              if (v)
                for (let k = 0; k < d.length; k++)
                  (0, a.assignBonds)(d[k], o);
              if (o.onemol) {
                var w = d;
                d = [], d.push(w[0]);
                for (let k = 1; k < w.length; k++) {
                  let $ = d[0].length;
                  for (let L = 0; L < w[k].length; L++) {
                    let z = w[k][L];
                    for (let F = 0; F < z.bonds.length; F++)
                      z.bonds[F] = z.bonds[F] + $;
                    z.index = d[0].length, z.serial = d[0].length, d[0].push(z);
                  }
                }
              }
              return d;
            }
          }
        ),
        /***/
        "./src/parsers/cifutils/category.ts": (
          /*!******************************************!*\
            !*** ./src/parsers/cifutils/category.ts ***!
            \******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Category: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./decoder */
              "./src/parsers/cifutils/decoder.ts"
            );
            function a(s) {
              const h = /* @__PURE__ */ Object.create(null), o = /* @__PURE__ */ Object.create(null);
              for (const d of s.columns)
                h[d.name] = d;
              return {
                rowCount: s.rowCount,
                name: s.name.substring(1),
                fieldNames: s.columns.map((d) => d.name),
                getField(d) {
                  const v = h[d];
                  if (v)
                    return o[d] || (o[d] = (0, r.decode)(v.data)), o[d];
                }
              };
            }
          }
        ),
        /***/
        "./src/parsers/cifutils/decoder.ts": (
          /*!*****************************************!*\
            !*** ./src/parsers/cifutils/decoder.ts ***!
            \*****************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              decode: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./encoding */
              "./src/parsers/cifutils/encoding.ts"
            );
            const a = new Uint16Array(new Uint8Array([18, 52]).buffer)[0] === 13330;
            function s($, L) {
              const z = new ArrayBuffer($.length), F = new Uint8Array(z);
              for (let R = 0, P = $.length; R < P; R += L)
                for (let U = 0; U < L; U++)
                  F[R + L - U - 1] = $[R + U];
              return z;
            }
            function h($) {
              let L = $.data;
              for (let z = $.encoding.length - 1; z >= 0; z--)
                L = o(L, $.encoding[z]);
              return L;
            }
            function o($, L) {
              switch (L.kind) {
                case "ByteArray":
                  switch (L.type) {
                    case r.Encoding.IntDataType.Uint8:
                      return $;
                    case r.Encoding.IntDataType.Int8:
                      return f($);
                    case r.Encoding.IntDataType.Int16:
                      return A($);
                    case r.Encoding.IntDataType.Uint16:
                      return x($);
                    case r.Encoding.IntDataType.Int32:
                      return M($);
                    case r.Encoding.IntDataType.Uint32:
                      return m($);
                    case r.Encoding.FloatDataType.Float32:
                      return l($);
                    case r.Encoding.FloatDataType.Float64:
                      return u($);
                    default:
                      throw new Error("unreachable");
                  }
                case "FixedPoint":
                  return p($, L);
                case "IntervalQuantization":
                  return g($, L);
                case "RunLength":
                  return b($, L);
                case "Delta":
                  return c($, L);
                case "IntegerPacking":
                  return w($, L);
                case "StringArray":
                  return k($, L);
              }
            }
            function d($, L) {
              switch ($) {
                case r.Encoding.IntDataType.Int8:
                  return new Int8Array(L);
                case r.Encoding.IntDataType.Int16:
                  return new Int16Array(L);
                case r.Encoding.IntDataType.Int32:
                  return new Int32Array(L);
                case r.Encoding.IntDataType.Uint8:
                  return new Uint8Array(L);
                case r.Encoding.IntDataType.Uint16:
                  return new Uint16Array(L);
                case r.Encoding.IntDataType.Uint32:
                  return new Uint32Array(L);
                default:
                  return new Int32Array(L);
              }
            }
            function v($, L) {
              switch ($) {
                case r.Encoding.FloatDataType.Float32:
                  return new Float32Array(L);
                case r.Encoding.FloatDataType.Float64:
                  return new Float64Array(L);
                default:
                  return new Float64Array(L);
              }
            }
            function f($) {
              return new Int8Array($.buffer, $.byteOffset);
            }
            function y($, L, z) {
              return ($.byteOffset != 0 || $.byteLength != $.buffer.byteLength) && ($ = new Uint8Array($)), a ? new z($.buffer) : new z(s($, L));
            }
            function A($) {
              return y($, 2, Int16Array);
            }
            function x($) {
              return y($, 2, Uint16Array);
            }
            function M($) {
              return y($, 4, Int32Array);
            }
            function m($) {
              return y($, 4, Uint32Array);
            }
            function l($) {
              return y($, 4, Float32Array);
            }
            function u($) {
              return y($, 8, Float64Array);
            }
            function p($, L) {
              const z = $.length, F = v(L.srcType, z), R = 1 / L.factor;
              for (let P = 0; P < z; P++)
                F[P] = R * $[P];
              return F;
            }
            function g($, L) {
              const z = $.length, F = v(L.srcType, z), R = (L.max - L.min) / (L.numSteps - 1), P = L.min;
              for (let U = 0; U < z; U++)
                F[U] = P + R * $[U];
              return F;
            }
            function b($, L) {
              const z = d(L.srcType, L.srcSize);
              let F = 0;
              for (let R = 0, P = $.length; R < P; R += 2) {
                const U = $[R], N = $[R + 1];
                for (let B = 0; B < N; ++B)
                  z[F++] = U;
              }
              return z;
            }
            function c($, L) {
              const z = $.length, F = d(L.srcType, z);
              if (!z)
                return $;
              F[0] = $[0] + (L.origin | 0);
              for (let R = 1; R < z; ++R)
                F[R] = $[R] + F[R - 1];
              return F;
            }
            function _($, L) {
              const z = L.byteCount === 1 ? 127 : 32767, F = -z - 1, R = $.length, P = new Int32Array(L.srcSize);
              let U = 0, N = 0;
              for (; U < R; ) {
                let B = 0, W = $[U];
                for (; W === z || W === F; )
                  B += W, U++, W = $[U];
                B += W, P[N] = B, U++, N++;
              }
              return P;
            }
            function E($, L) {
              const z = L.byteCount === 1 ? 255 : 65535, F = $.length, R = new Int32Array(L.srcSize);
              let P = 0, U = 0;
              for (; P < F; ) {
                let N = 0, B = $[P];
                for (; B === z; )
                  N += B, P++, B = $[P];
                N += B, R[U] = N, P++, U++;
              }
              return R;
            }
            function w($, L) {
              return $.length === L.srcSize ? $ : L.isUnsigned ? E($, L) : _($, L);
            }
            function k($, L) {
              const z = h({ encoding: L.offsetEncoding, data: L.offsets }), F = h({ encoding: L.dataEncoding, data: $ }), R = L.stringData, P = new Array(z.length);
              P[0] = "";
              for (let B = 1, W = z.length; B < W; B++)
                P[B] = R.substring(z[B - 1], z[B]);
              let U = 0;
              const N = new Array(F.length);
              for (let B = 0, W = F.length; B < W; B++)
                N[U++] = P[F[B] + 1];
              return N;
            }
          }
        ),
        /***/
        "./src/parsers/cifutils/encoding.ts": (
          /*!******************************************!*\
            !*** ./src/parsers/cifutils/encoding.ts ***!
            \******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Encoding: () => (
                /* binding */
                a
              ),
              /* harmony export */
              VERSION: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = "0.3.0";
            var a;
            (function(s) {
              (function(d) {
                d[d.Int8 = 1] = "Int8", d[d.Int16 = 2] = "Int16", d[d.Int32 = 3] = "Int32", d[d.Uint8 = 4] = "Uint8", d[d.Uint16 = 5] = "Uint16", d[d.Uint32 = 6] = "Uint32";
              })(s.IntDataType || (s.IntDataType = {})), function(d) {
                d[d.Float32 = 32] = "Float32", d[d.Float64 = 33] = "Float64";
              }(s.FloatDataType || (s.FloatDataType = {}));
              function h(d) {
                let v;
                return d instanceof Int8Array ? v = s.IntDataType.Int8 : d instanceof Int16Array ? v = s.IntDataType.Int16 : d instanceof Int32Array ? v = s.IntDataType.Int32 : d instanceof Uint8Array ? v = s.IntDataType.Uint8 : d instanceof Uint16Array ? v = s.IntDataType.Uint16 : d instanceof Uint32Array ? v = s.IntDataType.Uint32 : d instanceof Float32Array ? v = s.FloatDataType.Float32 : d instanceof Float64Array ? v = s.FloatDataType.Float64 : v = s.IntDataType.Int32, v;
              }
              s.getDataType = h;
              function o(d) {
                if (d instanceof Int8Array || d instanceof Int16Array || d instanceof Int32Array)
                  return !0;
                for (let v = 0, f = d.length; v < f; v++)
                  if (v < 0)
                    return !1;
                return !0;
              }
              s.isSignedIntegerDataType = o;
            })(a || (a = {}));
          }
        ),
        /***/
        "./src/parsers/index.ts": (
          /*!******************************!*\
            !*** ./src/parsers/index.ts ***!
            \******************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Parsers: () => (
                /* binding */
                p
              ),
              /* harmony export */
              bondLength: () => (
                /* reexport safe */
                u.bondLength
              ),
              /* harmony export */
              setBondLength: () => (
                /* reexport safe */
                u.setBondLength
              )
              /* harmony export */
            });
            var r = t(
              /*! ./VASP */
              "./src/parsers/VASP.ts"
            ), a = t(
              /*! ./CUBE */
              "./src/parsers/CUBE.ts"
            ), s = t(
              /*! ./XYZ */
              "./src/parsers/XYZ.ts"
            ), h = t(
              /*! ./SDF */
              "./src/parsers/SDF.ts"
            ), o = t(
              /*! ./CDJSON */
              "./src/parsers/CDJSON.ts"
            ), d = t(
              /*! ./CIF */
              "./src/parsers/CIF.ts"
            ), v = t(
              /*! ./MOL2 */
              "./src/parsers/MOL2.ts"
            ), f = t(
              /*! ./PDB */
              "./src/parsers/PDB.ts"
            ), y = t(
              /*! ./PQR */
              "./src/parsers/PQR.ts"
            ), A = t(
              /*! ./MMTF */
              "./src/parsers/MMTF.ts"
            ), x = t(
              /*! ./PRMTOP */
              "./src/parsers/PRMTOP.ts"
            ), M = t(
              /*! ./GRO */
              "./src/parsers/GRO.ts"
            ), m = t(
              /*! ./LAMMPSTRJ */
              "./src/parsers/LAMMPSTRJ.ts"
            ), l = t(
              /*! ./BCIF */
              "./src/parsers/BCIF.ts"
            ), u = t(
              /*! ./utils/bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            const p = {
              vasp: r.VASP,
              VASP: r.VASP,
              cube: a.CUBE,
              CUBE: a.CUBE,
              xyz: s.XYZ,
              XYZ: s.XYZ,
              sdf: h.SDF,
              SDF: h.SDF,
              json: o.CDJSON,
              cdjson: o.CDJSON,
              CDJSON: o.CDJSON,
              mcif: d.CIF,
              cif: d.CIF,
              CIF: d.CIF,
              mol2: v.MOL2,
              MOL2: v.MOL2,
              pdb: f.PDB,
              PDB: f.PDB,
              pdbqt: f.PDB,
              PDBQT: f.PDB,
              pqr: y.PQR,
              PQR: y.PQR,
              mmtf: A.MMTFparser,
              MMTF: A.MMTFparser,
              prmtop: x.PRMTOP,
              PRMTOP: x.PRMTOP,
              gro: M.GRO,
              GRO: M.GRO,
              lammpstrj: m.LAMMPSTRJ,
              LAMMPSTRJ: m.LAMMPSTRJ,
              bcif: l.BCIF,
              BCIF: l.BCIF
            };
          }
        ),
        /***/
        "./src/parsers/utils/anumToSymbol.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/anumToSymbol.ts ***!
            \*******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              anumToSymbol: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {
              1: "H",
              2: "He",
              3: "Li",
              4: "Be",
              5: "B",
              6: "C",
              7: "N",
              8: "O",
              9: "F",
              10: "Ne",
              11: "Na",
              12: "Mg",
              13: "Al",
              14: "Si",
              15: "P",
              16: "S",
              17: "Cl",
              18: "Ar",
              19: "K",
              20: "Ca",
              21: "Sc",
              22: "Ti",
              23: "V",
              24: "Cr",
              25: "Mn",
              26: "Fe",
              27: "Co",
              28: "Ni",
              29: "Cu",
              30: "Zn",
              31: "Ga",
              32: "Ge",
              33: "As",
              34: "Se",
              35: "Br",
              36: "Kr",
              37: "Rb",
              38: "Sr",
              39: "Y",
              40: "Zr",
              41: "Nb",
              42: "Mo",
              43: "Tc",
              44: "Ru",
              45: "Rh",
              46: "Pd",
              47: "Ag",
              48: "Cd",
              49: "In",
              50: "Sn",
              51: "Sb",
              52: "Te",
              53: "I",
              54: "Xe",
              55: "Cs",
              56: "Ba",
              71: "Lu",
              72: "Hf",
              73: "Ta",
              74: "W",
              75: "Re",
              76: "Os",
              77: "Ir",
              78: "Pt",
              79: "Au",
              80: "Hg",
              81: "Tl",
              82: "Pb",
              83: "Bi",
              84: "Po",
              85: "At",
              86: "Rn",
              87: "Fr",
              88: "Ra",
              104: "Rf",
              105: "Db",
              106: "Sg",
              107: "Bh",
              108: "Hs",
              109: "Mt",
              110: "Ds",
              111: "Rg",
              112: "Cn",
              113: "Nh",
              114: "Fl",
              115: "Mc",
              116: "Lv",
              117: "Ts",
              118: "Og",
              57: "La",
              58: "Ce",
              59: "Pr",
              60: "Nd",
              61: "Pm",
              62: "Sm",
              63: "Eu",
              64: "Gd",
              65: "Tb",
              66: "Dy",
              67: "Ho",
              68: "Er",
              69: "Tm",
              70: "Yb",
              89: "Ac",
              90: "Th",
              91: "Pa",
              92: "U",
              93: "Np",
              94: "Pu",
              95: "Am",
              96: "Cm",
              97: "Bk",
              98: "Cf",
              99: "Es",
              100: "Fm",
              101: "Md",
              102: "No"
            };
          }
        ),
        /***/
        "./src/parsers/utils/areConnected.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/areConnected.ts ***!
            \*******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              areConnected: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            var r = t(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            const a = /* @__PURE__ */ new Set(["Na", "K", "Ca", "Mg", "Mn", "Sr"]);
            function s(h, o, d) {
              if (d && d.unboundCations && (a.has(h.elem) || a.has(o.elem)))
                return !1;
              let v = (0, r.bondLength)(h.elem) + (0, r.bondLength)(o.elem);
              v += 0.25, v *= v;
              let f = h.x - o.x;
              if (f *= f, f > v)
                return !1;
              let y = h.y - o.y;
              if (y *= y, y > v)
                return !1;
              let A = h.z - o.z;
              if (A *= A, A > v)
                return !1;
              const x = f + y + A;
              return !(isNaN(x) || x < 0.5 || x > v || h.altLoc !== o.altLoc && h.altLoc.trim() !== "" && o.altLoc.trim() !== "");
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignBackboneHBonds.ts": (
          /*!***************************************************!*\
            !*** ./src/parsers/utils/assignBackboneHBonds.ts ***!
            \***************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              assignBackboneHBonds: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r(a, s) {
              const h = s || 3.2, o = h * h, d = [];
              for (let v = 0, f = a.length; v < f; v++) {
                a[v].index = v;
                const y = a[v];
                !y.hetflag && (y.atom === "N" || y.atom === "O") && (d.push(y), y.hbondOther = null, y.hbondDistanceSq = Number.POSITIVE_INFINITY);
              }
              d.sort(function(v, f) {
                return v.z - f.z;
              });
              for (let v = 0, f = d.length; v < f; v++) {
                const y = d[v];
                for (let A = v + 1; A < f; A++) {
                  const x = d[A], M = x.z - y.z;
                  if (M > h)
                    break;
                  if (x.atom == y.atom)
                    continue;
                  const m = Math.abs(x.y - y.y);
                  if (m > h)
                    continue;
                  const l = Math.abs(x.x - y.x);
                  if (l > h)
                    continue;
                  const u = l * l + m * m + M * M;
                  u > o || x.chain == y.chain && Math.abs(x.resi - y.resi) < 4 || (u < y.hbondDistanceSq && (y.hbondOther = x, y.hbondDistanceSq = u), u < x.hbondDistanceSq && (x.hbondOther = y, x.hbondDistanceSq = u));
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignBonds.ts": (
          /*!******************************************!*\
            !*** ./src/parsers/utils/assignBonds.ts ***!
            \******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              assignBonds: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./areConnected */
              "./src/parsers/utils/areConnected.ts"
            );
            const a = [
              { x: 0, y: 0, z: 1 },
              { x: 0, y: 1, z: -1 },
              { x: 0, y: 1, z: 0 },
              { x: 0, y: 1, z: 1 },
              { x: 1, y: -1, z: -1 },
              { x: 1, y: -1, z: 0 },
              { x: 1, y: -1, z: 1 },
              { x: 1, y: 0, z: -1 },
              { x: 1, y: 0, z: 0 },
              { x: 1, y: 0, z: 1 },
              { x: 1, y: 1, z: -1 },
              { x: 1, y: 1, z: 0 },
              { x: 1, y: 1, z: 1 }
            ], s = 4.95;
            function h(o, d) {
              for (let y = 0, A = o.length; y < A; y++)
                o[y].index || (o[y].index = y);
              const v = {
                x: {
                  y: {
                    z: []
                  }
                }
              };
              for (let y = 0; y < o.length; y++) {
                const A = o[y], x = Math.floor(A.x / s), M = Math.floor(A.y / s), m = Math.floor(A.z / s);
                v[x] || (v[x] = {}), v[x][M] || (v[x][M] = {}), v[x][M][m] || (v[x][M][m] = []), v[x][M][m].push(A);
              }
              function f(y, A) {
                for (let x = 0; x < y.length; x++) {
                  const M = y[x];
                  for (let m = 0; m < A.length; m++) {
                    const l = A[m];
                    if ((0, r.areConnected)(M, l, d)) {
                      const u = M.bonds.indexOf(l.index), p = l.bonds.indexOf(M.index);
                      u === -1 && p === -1 ? (M.bonds.push(l.index), M.bondOrder.push(1), l.bonds.push(M.index), l.bondOrder.push(1)) : u === -1 ? (M.bonds.push(l.index), M.bondOrder.push(l.bondOrder[p])) : p === -1 && (l.bonds.push(M.index), l.bondOrder.push(M.bondOrder[u]));
                    }
                  }
                }
              }
              for (let y in v) {
                const A = parseInt(y);
                for (let x in v[A]) {
                  const M = parseInt(x);
                  for (let m in v[A][M]) {
                    const l = parseInt(m), u = v[A][M][l];
                    for (let p = 0; p < u.length; p++) {
                      const g = u[p];
                      for (let b = p + 1; b < u.length; b++) {
                        const c = u[b];
                        (0, r.areConnected)(g, c, d) && g.bonds.indexOf(c.index) == -1 && (g.bonds.push(c.index), g.bondOrder.push(1), c.bonds.push(g.index), c.bondOrder.push(1));
                      }
                    }
                    for (let p = 0; p < a.length; p++) {
                      const g = a[p];
                      if (!v[A + g.x] || !v[A + g.x][M + g.y] || !v[A + g.x][M + g.y][l + g.z])
                        continue;
                      const b = v[A + g.x][M + g.y][l + g.z];
                      f(u, b);
                    }
                  }
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignPDBBonds.ts": (
          /*!*********************************************!*\
            !*** ./src/parsers/utils/assignPDBBonds.ts ***!
            \*********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              assignPDBBonds: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var r = t(
              /*! ./areConnected */
              "./src/parsers/utils/areConnected.ts"
            ), a = t(
              /*! ./assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), s = t(
              /*! ./standardResidues */
              "./src/parsers/utils/standardResidues.ts"
            );
            function h(o, d) {
              const v = [], f = [];
              for (let M = 0, m = o.length; M < m; M++) {
                const l = o[M];
                l.index = M, l.hetflag || !s.standardResidues.has(l.resn) ? f.push(l) : v.push(l);
              }
              (0, a.assignBonds)(f, d), v.sort(function(M, m) {
                return M.chain !== m.chain ? M.chain < m.chain ? -1 : 1 : M.resi - m.resi;
              });
              let y = -1, A = -1, x;
              for (let M = 0, m = v.length; M < m; M++) {
                const l = v[M];
                l.resi !== y && (y = l.resi, x || A++, x = !1), l.reschain = A;
                for (let u = M + 1; u < v.length; u++) {
                  const p = v[u];
                  if (p.chain !== l.chain || p.resi - l.resi > 1)
                    break;
                  (0, r.areConnected)(l, p, d) && (l.bonds.indexOf(p.index) === -1 && (l.bonds.push(p.index), l.bondOrder.push(1), p.bonds.push(l.index), p.bondOrder.push(1)), l.resi !== p.resi && (x = !0));
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/atomNameToElem.ts": (
          /*!*********************************************!*\
            !*** ./src/parsers/utils/atomNameToElem.ts ***!
            \*********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              atomNameToElem: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            function a(s, h) {
              let o = s.replace(/ /g, "");
              return o.length > 0 && o[0] === "H" && o !== "Hg" && o !== "He" && o !== "Hf" && o !== "Hs" && o !== "Ho" && (o = "H"), o.length > 1 && (o = o[0].toUpperCase() + o.substring(1).toLowerCase(), r.bondTable[o] === void 0 ? o = o[0] : h && (o === "Ca" || o === "Cd") && (o = "C")), o;
            }
          }
        ),
        /***/
        "./src/parsers/utils/bondLength.ts": (
          /*!*****************************************!*\
            !*** ./src/parsers/utils/bondLength.ts ***!
            \*****************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              bondLength: () => (
                /* binding */
                a
              ),
              /* harmony export */
              bondTable: () => (
                /* binding */
                r
              ),
              /* harmony export */
              setBondLength: () => (
                /* binding */
                s
              )
              /* harmony export */
            });
            let r = {
              H: 0.37,
              He: 0.32,
              Li: 1.34,
              Be: 0.9,
              B: 0.82,
              C: 0.77,
              N: 0.75,
              O: 0.73,
              F: 0.71,
              Ne: 0.69,
              Na: 1.54,
              Mg: 1.3,
              Al: 1.18,
              Si: 1.11,
              P: 1.06,
              S: 1.02,
              Cl: 0.99,
              Ar: 0.97,
              K: 1.96,
              Ca: 1.74,
              Sc: 1.44,
              Ti: 1.56,
              V: 1.25,
              /* Cr */
              Mn: 1.39,
              Fe: 1.25,
              Co: 1.26,
              Ni: 1.21,
              Cu: 1.38,
              Zn: 1.31,
              Ga: 1.26,
              Ge: 1.22,
              /* As */
              Se: 1.16,
              Br: 1.14,
              Kr: 1.1,
              Rb: 2.11,
              Sr: 1.92,
              Y: 1.62,
              Zr: 1.48,
              Nb: 1.37,
              Mo: 1.45,
              Tc: 1.56,
              Ru: 1.26,
              Rh: 1.35,
              Pd: 1.31,
              Ag: 1.53,
              Cd: 1.48,
              In: 1.44,
              Sn: 1.41,
              Sb: 1.38,
              Te: 1.35,
              I: 1.33,
              Xe: 1.3,
              Cs: 2.25,
              Ba: 1.98,
              Lu: 1.6,
              Hf: 1.5,
              Ta: 1.38,
              W: 1.46,
              Re: 1.59,
              Os: 1.44,
              Ir: 1.37,
              Pt: 1.28,
              Au: 1.44,
              Hg: 1.49,
              Tl: 1.48,
              Pb: 1.47,
              Bi: 1.46,
              /* Po */
              /* At */
              Rn: 1.45
              // None of the bottom row or any of the Lanthanides have bond lengths
            };
            function a(h) {
              return r[h] || 1.6;
            }
            function s(h, o) {
              o < 0 && (o = 0), r[h] = o;
            }
          }
        ),
        /***/
        "./src/parsers/utils/computeSecondaryStructure.ts": (
          /*!********************************************************!*\
            !*** ./src/parsers/utils/computeSecondaryStructure.ts ***!
            \********************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              computeSecondaryStructure: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ./assignBackboneHBonds */
              "./src/parsers/utils/assignBackboneHBonds.ts"
            );
            function a(s, h) {
              (0, r.assignBackboneHBonds)(s, h);
              const o = {};
              let d, v, f, y, A, x;
              for (d = 0, v = s.length; d < v; d++)
                if (A = s[d], o[A.chain] === void 0 && (o[A.chain] = []), isFinite(A.hbondDistanceSq)) {
                  const M = A.hbondOther;
                  o[M.chain] === void 0 && (o[M.chain] = []), Math.abs(M.resi - A.resi) === 4 && (o[A.chain][A.resi] = "h");
                }
              for (f in o)
                for (y = 1; y < o[f].length - 1; y++) {
                  const M = o[f][y - 1], m = o[f][y + 1];
                  x = o[f][y], M == "h" && M == m && x != M && (o[f][y] = M);
                }
              for (d = 0, v = s.length; d < v; d++)
                A = s[d], isFinite(A.hbondDistanceSq) && o[A.chain][A.resi] != "h" && A.ss !== "h" && (o[A.chain][A.resi] = "maybesheet");
              for (let M = 0, m = s.length; M < m; M++)
                if (A = s[M], isFinite(A.hbondDistanceSq) && o[A.chain][A.resi] == "maybesheet") {
                  let l = A.hbondOther, u = o[l.chain][l.resi];
                  (u == "maybesheet" || u == "s") && (o[A.chain][A.resi] = "s", o[l.chain][l.resi] = "s");
                }
              for (let M in o) {
                for (let m = 1; m < o[M].length - 1; m++) {
                  const l = o[M][m - 1], u = o[M][m + 1];
                  x = o[M][m], l == "s" && l == u && x != l && (o[M][m] = l);
                }
                for (let m = 0; m < o[M].length; m++) {
                  const l = o[M][m];
                  (l == "h" || l == "s") && o[M][m - 1] != l && o[M][m + 1] != l && delete o[M][m];
                }
              }
              for (d = 0, v = s.length; d < v; d++)
                A = s[d], x = o[A.chain][A.resi], delete A.hbondOther, delete A.hbondDistanceSq, !(x === void 0 || x === "maybesheet") && (A.ss = x, o[A.chain][A.resi - 1] != x && (A.ssbegin = !0), o[A.chain][A.resi + 1] != x && (A.ssend = !0));
            }
          }
        ),
        /***/
        "./src/parsers/utils/getSinglePDB.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/getSinglePDB.ts ***!
            \*******************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              getSinglePDB: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../WebGL */
              "./src/WebGL/index.ts"
            ), a = t(
              /*! ./atomNameToElem */
              "./src/parsers/utils/atomNameToElem.ts"
            ), s = t(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            ), h = t(
              /*! ./computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), o = t(
              /*! ./isEmpty */
              "./src/parsers/utils/isEmpty.ts"
            ), d = t(
              /*! ./processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), v = t(
              /*! ./assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), f = t(
              /*! ./validateBonds */
              "./src/parsers/utils/validateBonds.ts"
            );
            function y(A, x, M) {
              const m = [], l = x.assignBonds === void 0 ? !0 : x.assignBonds, u = !x.keepH, p = !!x.noSecondaryStructure, g = !x.noComputeSecondaryStructure, b = !x.doAssembly, c = x.altLoc ? x.altLoc : "A", _ = { symmetries: [], cryst: void 0 };
              let E, w = [];
              const k = [];
              let $;
              const L = {};
              for (let z = 0; z < A.length; z++) {
                $ = A[z].replace(/^\s*/, "");
                const F = $.substring(0, 6);
                let R, P, U;
                if (F.indexOf("END") === 0) {
                  if (w = A.slice(z + 1), F === "END")
                    for (const N in M)
                      M.hasOwnProperty(N) && delete M[N];
                  break;
                } else if (F === "ATOM  " || F === "HETATM") {
                  let N, B, W, V, G, H, Q, te, ee, ce, fe, oe;
                  if (fe = $.substring(16, 17), fe !== " " && fe !== c && c !== "*" || (ce = parseInt($.substring(6, 11)), E = $.substring(12, 16).replace(/ /g, ""), N = $.substring(17, 20).replace(/ /g, ""), B = $.substring(21, 22), W = parseInt($.substring(22, 26)), V = $.substring(26, 27), G = parseFloat($.substring(30, 38)), H = parseFloat($.substring(38, 46)), Q = parseFloat($.substring(46, 54)), oe = parseFloat($.substring(60, 68)), ee = $.substring(76, 78).replace(/ /g, ""), ee === "" || s.bondTable[ee] === void 0 ? ee = (0, a.atomNameToElem)($.substring(12, 14), $[0] == "A") : ee = ee[0].toUpperCase() + ee.substring(1).toLowerCase(), ee === "H" && u))
                    continue;
                  F[0] == "H" ? te = !0 : te = !1, k[ce] = m.length, m.push({
                    resn: N,
                    x: G,
                    y: H,
                    z: Q,
                    elem: ee,
                    hetflag: te,
                    altLoc: fe,
                    chain: B,
                    resi: W,
                    icode: V,
                    rescode: W + (V !== " " ? "^" + V : ""),
                    // resi
                    // and
                    // icode
                    serial: ce,
                    atom: E,
                    bonds: [],
                    ss: "c",
                    bondOrder: [],
                    properties: {},
                    b: oe,
                    pdbline: $
                  });
                } else if (F === "SHEET ") {
                  R = $.substring(21, 22), P = parseInt($.substring(22, 26)), U = parseInt($.substring(33, 37)), R in M || (M[R] = {}), M[R][P] = "s1";
                  for (let N = P + 1; N < U; N++)
                    M[R][N] = "s";
                  M[R][U] = "s2";
                } else if (F === "CONECT") {
                  const N = parseInt($.substring(6, 11)), B = k[N], W = m[B], V = [11, 16, 21, 26];
                  for (let G = 0; G < 4; G++) {
                    const H = parseInt($.substring(V[G], V[G] + 5)), Q = k[H];
                    let te = B + ":" + Q;
                    const ee = m[Q];
                    if (W !== void 0 && ee !== void 0)
                      if (!L[te])
                        L[te] = 1, (W.bonds.length == 0 || W.bonds[W.bonds.length - 1] !== Q) && (W.bonds.push(Q), W.bondOrder.push(1));
                      else {
                        L[te] += 1;
                        for (let ce = 0; ce < W.bonds.length; ce++)
                          if (W.bonds[ce] == Q) {
                            const fe = L[te];
                            fe >= 4 ? W.bondOrder[ce] = 1 : W.bondOrder[ce] = fe;
                          }
                      }
                  }
                } else if (F === "HELIX ") {
                  R = $.substring(19, 20), P = parseInt($.substring(21, 25)), U = parseInt($.substring(33, 37)), R in M || (M[R] = {}), M[R][P] = "h1";
                  for (let N = P + 1; N < U; N++)
                    M[R][N] = "h";
                  M[R][U] = "h2";
                } else if (!b && F === "REMARK" && $.substring(13, 18) === "BIOMT") {
                  let N, B = new r.Matrix4();
                  for (N = 1; N <= 3; N++)
                    if ($ = A[z].replace(/^\s*/, ""), parseInt($.substring(18, 19)) == N)
                      B.elements[N - 1] = parseFloat($.substring(23, 33)), B.elements[N - 1 + 4] = parseFloat($.substring(33, 43)), B.elements[N - 1 + 8] = parseFloat($.substring(43, 53)), B.elements[N - 1 + 12] = parseFloat($.substring(53)), z++;
                    else
                      for (; $.substring(13, 18) === "BIOMT"; )
                        z++, $ = A[z].replace(/^\s*/, "");
                  B.elements[3] = 0, B.elements[7] = 0, B.elements[11] = 0, B.elements[15] = 1, _.symmetries.push(B), z--;
                } else if (F === "CRYST1") {
                  let N, B, W, V, G, H;
                  N = parseFloat($.substring(7, 15)), B = parseFloat($.substring(16, 24)), W = parseFloat($.substring(25, 33)), V = parseFloat($.substring(34, 40)), G = parseFloat($.substring(41, 47)), H = parseFloat($.substring(48, 54)), _.cryst = {
                    a: N,
                    b: B,
                    c: W,
                    alpha: V,
                    beta: G,
                    gamma: H
                  };
                } else if (F === "ANISOU") {
                  const N = parseInt($.substring(6, 11)), B = k[N], W = m[B];
                  if (W) {
                    const V = $.substring(30).trim().split(/\s+/), G = {
                      u11: parseInt(V[0]),
                      u22: parseInt(V[1]),
                      u33: parseInt(V[2]),
                      u12: parseInt(V[3]),
                      u13: parseInt(V[4]),
                      u23: parseInt(V[5])
                    };
                    W.uMat = G;
                  }
                }
              }
              if ((0, f.validateBonds)(m, k), l && (0, v.assignPDBBonds)(m, x), b || (0, d.processSymmetries)(_.symmetries, m, x, _.cryst), g && !p && (0, h.computeSecondaryStructure)(m, x.hbondCutoff), !(0, o.isEmpty)(M))
                for (let z = 0; z < m.length; z++) {
                  const F = m[z];
                  if (F !== void 0 && F.chain in M && F.resi in M[F.chain]) {
                    const R = M[F.chain][F.resi];
                    F.ss = R[0], R.length > 1 && (R[1] == "1" ? F.ssbegin = !0 : R[1] == "2" && (F.ssend = !0));
                  }
                }
              return [m, _, w];
            }
          }
        ),
        /***/
        "./src/parsers/utils/isEmpty.ts": (
          /*!**************************************!*\
            !*** ./src/parsers/utils/isEmpty.ts ***!
            \**************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              isEmpty: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r(a) {
              for (const s in a)
                return !1;
              return !0;
            }
          }
        ),
        /***/
        "./src/parsers/utils/processSymmetries.ts": (
          /*!************************************************!*\
            !*** ./src/parsers/utils/processSymmetries.ts ***!
            \************************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              processSymmetries: () => (
                /* binding */
                a
              )
              /* harmony export */
            });
            var r = t(
              /*! ../../WebGL */
              "./src/WebGL/index.ts"
            );
            function a(s, h, o, d) {
              const v = !o.duplicateAssemblyAtoms, f = h.length;
              let y = f, A = -1, x = null, M = null;
              (o.normalizeAssembly || o.wrapAtoms) && d && (x = (0, r.conversionMatrix3)(d.a, d.b, d.c, d.alpha, d.beta, d.gamma), M = new r.Matrix3(), M.getInverse3(x));
              let m = function(p) {
                let g = p.clone().applyMatrix3(M);
                const b = [g.x, g.y, g.z], c = [0, 0, 0];
                for (let E = 0; E < 3; E++) {
                  for (; b[E] < -1e-3; )
                    b[E] += 1, c[E] += 1;
                  for (; b[E] > 1.001; )
                    b[E] -= 1, c[E] -= 1;
                }
                const _ = new r.Vector3(c[0], c[1], c[2]);
                return _.applyMatrix3(x), _;
              };
              if (o.normalizeAssembly && d)
                for (let p = 0; p < s.length; p++) {
                  const g = new r.Vector3(0, 0, 0);
                  for (let c = 0; c < f; c++) {
                    const _ = new r.Vector3(h[c].x, h[c].y, h[c].z);
                    _.applyMatrix4(s[p]), g.add(_);
                  }
                  g.divideScalar(f);
                  const b = m(g);
                  s[p].isNearlyIdentity() && b.lengthSq() > 1e-3 && (A = p), s[p].translate(b);
                }
              if (v) {
                if (s.length > 1)
                  for (let p = 0; p < h.length; p++) {
                    var l = [];
                    for (let g = 0; g < s.length; g++)
                      if (!s[g].isNearlyIdentity()) {
                        var u = new r.Vector3();
                        u.set(h[p].x, h[p].y, h[p].z), u.applyMatrix4(s[g]), l.push(u);
                      }
                    h[p].symmetries = l;
                  }
              } else {
                for (let p = 0; p < f; p++)
                  h[p].sym = -1;
                for (let p = 0; p < s.length; p++)
                  if (!s[p].isNearlyIdentity() && A != p) {
                    let g = new r.Vector3();
                    for (let b = 0; b < f; b++) {
                      const c = [];
                      for (let E = 0; E < h[b].bonds.length; E++)
                        c.push(h[b].bonds[E] + y);
                      if (g.set(h[b].x, h[b].y, h[b].z), g.applyMatrix4(s[p]), o.wrapAtoms && d) {
                        let E = m(g);
                        g.add(E);
                      }
                      const _ = {};
                      for (const E in h[b])
                        _[E] = h[b][E];
                      _.x = g.x, _.y = g.y, _.z = g.z, _.bonds = c, _.sym = p, _.index = h.length, h.push(_);
                    }
                    y = h.length;
                  } else
                    for (let g = 0; g < f; g++)
                      h[g].sym = p;
                if (o.wrapAtoms && d) {
                  let p = new r.Vector3();
                  for (let g = 0; g < f; g++) {
                    p.set(h[g].x, h[g].y, h[g].z);
                    let b = m(p);
                    p.add(b), h[g].x = p.x, h[g].y = p.y, h[g].z = p.z;
                  }
                }
                if (A >= 0) {
                  const p = new r.Vector3();
                  for (let g = 0; g < f; g++)
                    p.set(h[g].x, h[g].y, h[g].z), p.applyMatrix4(s[A]), h[g].x = p.x, h[g].y = p.y, h[g].z = p.z;
                }
                s.length = 0;
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/standardResidues.ts": (
          /*!***********************************************!*\
            !*** ./src/parsers/utils/standardResidues.ts ***!
            \***********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              standardResidues: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = /* @__PURE__ */ new Set([
              "ABU",
              "ACD",
              "ALA",
              "ALB",
              "ALI",
              "ARG",
              "AR0",
              "ASN",
              "ASP",
              "ASX",
              "BAS",
              "CYS",
              "CYH",
              "CYX",
              "CSS",
              "CSH",
              "GLN",
              "GLU",
              "GLX",
              "GLY",
              "HIS",
              "HIE",
              "HID",
              "HIP",
              "HYP",
              "ILE",
              "ILU",
              "LEU",
              "LYS",
              "MET",
              "PCA",
              "PGA",
              "PHE",
              "PR0",
              "PRO",
              "PRZ",
              "SER",
              "THR",
              "TRP",
              "TYR",
              "VAL",
              "A",
              "1MA",
              "C",
              "5MC",
              "OMC",
              "G",
              "1MG",
              "2MG",
              "M2G",
              "7MG",
              "OMG",
              "YG",
              "I",
              "T",
              "U",
              "+U",
              "H2U",
              "5MU",
              "PSU",
              "ACE",
              "F0R",
              "H2O",
              "HOH",
              "WAT"
            ]);
          }
        ),
        /***/
        "./src/parsers/utils/validateBonds.ts": (
          /*!********************************************!*\
            !*** ./src/parsers/utils/validateBonds.ts ***!
            \********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              validateBonds: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            function r(a, s) {
              for (let h = 0, o = a.length; h < o; h++) {
                const d = a[h];
                for (let v = 0; v < d.bonds.length; v++) {
                  const f = d.bonds[v], y = a[f], A = s[d.serial];
                  y && A && y.bonds.indexOf(A) < 0 && (y.bonds.push(A), y.bondOrder.push(d.bondOrder[v]));
                }
              }
            }
          }
        ),
        /***/
        "./src/partialCharges.ts": (
          /*!*******************************!*\
            !*** ./src/partialCharges.ts ***!
            \*******************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              applyPartialCharges: () => (
                /* binding */
                a
              ),
              /* harmony export */
              partialCharges: () => (
                /* binding */
                r
              )
              /* harmony export */
            });
            const r = {
              "ALA:N": -0.15,
              "ALA:CA": 0.1,
              "ALA:CB": 0,
              "ALA:C": 0.6,
              "ALA:O": -0.55,
              "ARG:N": -0.15,
              "ARG:CA": 0.1,
              "ARG:CB": 0,
              "ARG:CG": 0,
              "ARG:CD": 0.1,
              "ARG:NE": -0.1,
              "ARG:CZ": 0.5,
              "ARG:NH1": 0.25,
              "ARG:NH2": 0.25,
              "ARG:C": 0.6,
              "ARG:O": -0.55,
              "ASN:N": -0.15,
              "ASN:CA": 0.1,
              "ASN:CB": 0,
              "ASN:CG": 0.55,
              "ASN:OD1": -0.55,
              "ASN:ND2": 0,
              "ASN:C": 0.6,
              "ASN:O": -0.55,
              "ASP:N": -0.15,
              "ASP:CA": 0.1,
              "ASP:CB": 0,
              "ASP:CG": 0.14,
              "ASP:OD1": -0.57,
              "ASP:OD2": -0.57,
              "ASP:C": 0.6,
              "ASP:O": -0.55,
              "CYS:N": -0.15,
              "CYS:CA": 0.1,
              "CYS:CB": 0.19,
              "CYS:SG": -0.19,
              "CYS:C": 0.6,
              "CYS:O": -0.55,
              "GLN:N": -0.15,
              "GLN:CA": 0.1,
              "GLN:CB": 0,
              "GLN:CG": 0,
              "GLN:CD": 0.55,
              "GLN:OE1": -0.55,
              "GLN:NE2": 0,
              "GLN:C": 0.6,
              "GLN:O": -0.55,
              "GLU:N": -0.15,
              "GLU:CA": 0.1,
              "GLU:CB": 0,
              "GLU:CG": 0,
              "GLU:CD": 0.14,
              "GLU:OE1": -0.57,
              "GLU:OE2": -0.57,
              "GLU:C": 0.6,
              "GLU:O": -0.55,
              "GLY:N": -0.15,
              "GLY:CA": 0.1,
              "GLY:C": 0.6,
              "GLY:O": -0.55,
              "HIS:N": -0.15,
              "HIS:CA": 0.1,
              "HIS:CB": 0,
              "HIS:CG": 0.1,
              "HIS:ND1": -0.1,
              "HIS:CD2": 0.1,
              "HIS:NE2": -0.4,
              "HIS:CE1": 0.3,
              "HIS:C": 0.6,
              "HIS:O": -0.55,
              "ILE:N": -0.15,
              "ILE:CA": 0.1,
              "ILE:CB": 0,
              "ILE:CG2": 0,
              "ILE:CG1": 0,
              "ILE:CD": 0,
              "ILE:C": 0.6,
              "ILE:O": -0.55,
              "LEU:N": -0.15,
              "LEU:CA": 0.1,
              "LEU:CB": 0,
              "LEU:CG": 0,
              "LEU:CD1": 0,
              "LEU:CD2": 0,
              "LEU:C": 0.6,
              "LEU:O": -0.55,
              "LYS:N": -0.15,
              "LYS:CA": 0.1,
              "LYS:CB": 0,
              "LYS:CG": 0,
              "LYS:CD": 0,
              "LYS:CE": 0.25,
              "LYS:NZ": 0.75,
              "LYS:C": 0.6,
              "LYS:O": -0.55,
              "MET:N": -0.15,
              "MET:CA": 0.1,
              "MET:CB": 0,
              "MET:CG": 0.06,
              "MET:SD": -0.12,
              "MET:CE": 0.06,
              "MET:C": 0.6,
              "MET:O": -0.55,
              "PHE:N": -0.15,
              "PHE:CA": 0.1,
              "PHE:CB": 0,
              "PHE:CG": 0,
              "PHE:CD1": 0,
              "PHE:CD2": 0,
              "PHE:CE1": 0,
              "PHE:CE2": 0,
              "PHE:CZ": 0,
              "PHE:C": 0.6,
              "PHE:O": -0.55,
              "PRO:N": -0.25,
              "PRO:CD": 0.1,
              "PRO:CA": 0.1,
              "PRO:CB": 0,
              "PRO:CG": 0,
              "PRO:C": 0.6,
              "PRO:O": -0.55,
              "SER:N": -0.15,
              "SER:CA": 0.1,
              "SER:CB": 0.25,
              "SER:OG": -0.25,
              "SER:C": 0.6,
              "SER:O": -0.55,
              "THR:N": -0.15,
              "THR:CA": 0.1,
              "THR:CB": 0.25,
              "THR:OG1": -0.25,
              "THR:CG2": 0,
              "THR:C": 0.6,
              "THR:O": -0.55,
              "TRP:N": -0.15,
              "TRP:CA": 0.1,
              "TRP:CB": 0,
              "TRP:CG": -0.03,
              "TRP:CD2": 0.1,
              "TRP:CE2": -0.04,
              "TRP:CE3": -0.03,
              "TRP:CD1": 0.06,
              "TRP:NE1": -0.06,
              "TRP:CZ2": 0,
              "TRP:CZ3": 0,
              "TRP:CH2": 0,
              "TRP:C": 0.6,
              "TRP:O": -0.55,
              "TYR:N": -0.15,
              "TYR:CA": 0.1,
              "TYR:CB": 0,
              "TYR:CG": 0,
              "TYR:CD1": 0,
              "TYR:CE1": 0,
              "TYR:CD2": 0,
              "TYR:CE2": 0,
              "TYR:CZ": 0.25,
              "TYR:OH": -0.25,
              "TYR:C": 0.6,
              "TYR:O": -0.55,
              "VAL:N": -0.15,
              "VAL:CA": 0.1,
              "VAL:CB": 0,
              "VAL:CG1": 0,
              "VAL:CG2": 0,
              "VAL:C": 0.6,
              "VAL:O": -0.55
            };
            function a(s, h) {
              if ((!h || typeof s.partialCharge > "u") && s.resn && s.atom) {
                var o = s.resn + ":" + s.atom;
                s.properties.partialCharge = r[o];
              }
            }
          }
        ),
        /***/
        "./src/specs.ts": (
          /*!**********************!*\
            !*** ./src/specs.ts ***!
            \**********************/
          /***/
          (n, e, t) => {
            t.r(e);
          }
        ),
        /***/
        "./src/utilities.ts": (
          /*!**************************!*\
            !*** ./src/utilities.ts ***!
            \**************************/
          /***/
          (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
            __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
              /* harmony export */
              PausableTimer: () => (
                /* binding */
                PausableTimer
              ),
              /* harmony export */
              adjustVolumeStyle: () => (
                /* binding */
                adjustVolumeStyle
              ),
              /* harmony export */
              base64ToArray: () => (
                /* binding */
                base64ToArray
              ),
              /* harmony export */
              deepCopy: () => (
                /* binding */
                deepCopy
              ),
              /* harmony export */
              download: () => (
                /* binding */
                download
              ),
              /* harmony export */
              extend: () => (
                /* binding */
                extend
              ),
              /* harmony export */
              get: () => (
                /* binding */
                get
              ),
              /* harmony export */
              getAtomProperty: () => (
                /* binding */
                getAtomProperty
              ),
              /* harmony export */
              getColorFromStyle: () => (
                /* binding */
                getColorFromStyle
              ),
              /* harmony export */
              getElement: () => (
                /* binding */
                getElement
              ),
              /* harmony export */
              getExtent: () => (
                /* binding */
                getExtent
              ),
              /* harmony export */
              getPropertyRange: () => (
                /* binding */
                getPropertyRange
              ),
              /* harmony export */
              getbin: () => (
                /* binding */
                getbin
              ),
              /* harmony export */
              inflateString: () => (
                /* binding */
                inflateString
              ),
              /* harmony export */
              isEmptyObject: () => (
                /* binding */
                isEmptyObject
              ),
              /* harmony export */
              isNumeric: () => (
                /* binding */
                isNumeric
              ),
              /* harmony export */
              makeFunction: () => (
                /* binding */
                makeFunction
              ),
              /* harmony export */
              mergeGeos: () => (
                /* binding */
                mergeGeos
              ),
              /* harmony export */
              specStringToObject: () => (
                /* binding */
                specStringToObject
              )
              /* harmony export */
            });
            var _Gradient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), _VolumeData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), _colors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
              /*! ./colors */
              "./src/colors.ts"
            ), pako__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
              /*! pako */
              "./node_modules/pako/dist/pako.esm.mjs"
            );
            function extend(n, e) {
              for (var t in e)
                e.hasOwnProperty(t) && e[t] !== void 0 && (n[t] = e[t]);
              return n;
            }
            function deepCopy(n) {
              let e, t, r;
              if (n == null)
                return {};
              if (typeof n != "object" || n === null)
                return n;
              e = Array.isArray(n) ? [] : {};
              for (r in n)
                t = n[r], e[r] = deepCopy(t);
              return e;
            }
            function isNumeric(n) {
              var e = typeof n;
              return (e === "number" || e === "string") && !isNaN(n - parseFloat(n));
            }
            function isEmptyObject(n) {
              var e;
              for (e in n)
                return !1;
              return !0;
            }
            function makeFunction(callback) {
              return callback && typeof callback == "string" && (callback = eval("(" + callback + ")")), callback && typeof callback != "function" ? (console.warn("Invalid callback provided."), () => {
              }) : callback;
            }
            function adjustVolumeStyle(n) {
              n && (n.volformat && !(n.voldata instanceof _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData) && (n.voldata = new _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData(n.voldata, n.volformat)), n.volscheme && (n.volscheme = _Gradient__WEBPACK_IMPORTED_MODULE_0__.Gradient.getGradient(n.volscheme)));
            }
            function getExtent(n, e) {
              var t, r, a, s, h, o, d, v, f, y, A = !e;
              if (t = r = a = 9999, s = h = o = -9999, d = v = f = y = 0, n.length === 0)
                return [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
              for (var x = 0; x < n.length; x++) {
                var M = n[x];
                if (!(typeof M > "u" || !isFinite(M.x) || !isFinite(M.y) || !isFinite(M.z)) && (y++, d += M.x, v += M.y, f += M.z, t = t < M.x ? t : M.x, r = r < M.y ? r : M.y, a = a < M.z ? a : M.z, s = s > M.x ? s : M.x, h = h > M.y ? h : M.y, o = o > M.z ? o : M.z, M.symmetries && A))
                  for (var m = 0; m < M.symmetries.length; m++)
                    y++, d += M.symmetries[m].x, v += M.symmetries[m].y, f += M.symmetries[m].z, t = t < M.symmetries[m].x ? t : M.symmetries[m].x, r = r < M.symmetries[m].y ? r : M.symmetries[m].y, a = a < M.symmetries[m].z ? a : M.symmetries[m].z, s = s > M.symmetries[m].x ? s : M.symmetries[m].x, h = h > M.symmetries[m].y ? h : M.symmetries[m].y, o = o > M.symmetries[m].z ? o : M.symmetries[m].z;
              }
              return [
                [t, r, a],
                [s, h, o],
                [d / y, v / y, f / y]
              ];
            }
            function getPropertyRange(n, e) {
              for (var t = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY, a = 0, s = n.length; a < s; a++) {
                var h = n[a], o = getAtomProperty(h, e);
                o != null && (o < t && (t = o), o > r && (r = o));
              }
              return !isFinite(t) && !isFinite(r) ? t = r = 0 : isFinite(t) ? isFinite(r) || (r = t) : t = r, [t, r];
            }
            class PausableTimer {
              constructor(e, t, r) {
                this.total_time_run = 0, this.fn = e, this.arg = r, this.countdown = t, this.start_time = (/* @__PURE__ */ new Date()).getTime(), this.ident = setTimeout(e, t, r);
              }
              cancel() {
                clearTimeout(this.ident);
              }
              pause() {
                clearTimeout(this.ident), this.total_time_run = (/* @__PURE__ */ new Date()).getTime() - this.start_time;
              }
              resume() {
                this.ident = setTimeout(this.fn, Math.max(0, this.countdown - this.total_time_run), this.arg);
              }
            }
            function base64ToArray(n) {
              for (var e = window.atob(n), t = e.length, r = new Uint8Array(t), a = 0; a < t; a++)
                r[a] = e.charCodeAt(a);
              return r;
            }
            function getAtomProperty(n, e) {
              var t = null;
              return n.properties && typeof n.properties[e] < "u" ? t = n.properties[e] : typeof n[e] < "u" && (t = n[e]), t;
            }
            function mergeGeos(n, e) {
              var t = e.geometry;
              t !== void 0 && n.geometryGroups.push(t.geometryGroups[0]);
            }
            function specStringToObject(n) {
              if (typeof n == "object")
                return n;
              if (typeof n > "u" || n == null)
                return n;
              try {
                return JSON.parse(n);
              } catch {
              }
              n = n.replace(/%7E/g, "~");
              var e = function(A) {
                return isNumeric(A) ? Math.floor(parseFloat(A)) == parseInt(A) || A.indexOf(".") >= 0 ? parseFloat(A) : parseInt(A) : A === "true" ? !0 : A === "false" ? !1 : A;
              }, t = {};
              if (n === "all")
                return t;
              for (var r = n.split(";"), a = 0; a < r.length; a++) {
                var s = r[a].split(":"), h = s[0], o = {}, d = s[1];
                if (d)
                  if (d = d.replace(/~/g, "="), d.indexOf("=") !== -1)
                    for (var v = d.split(","), f = 0; f < v.length; f++) {
                      var y = v[f].split("=", 2);
                      o[y[0]] = e(y[1]);
                    }
                  else d.indexOf(",") !== -1 ? o = d.split(",") : o = e(d);
                t[h] = o;
              }
              return t;
            }
            function checkStatus(n) {
              if (!n.ok)
                throw new Error(`HTTP ${n.status} - ${n.statusText}`);
              return n;
            }
            function get(n, e) {
              var t = fetch(n).then(checkStatus).then((r) => r.text());
              return e ? t.then(e) : t;
            }
            function getbin(n, e, t, r) {
              var a;
              return t == "POST" ? a = fetch(n, { method: "POST", body: r }).then((s) => checkStatus(s)).then((s) => s.arrayBuffer()) : a = fetch(n).then((s) => checkStatus(s)).then((s) => s.arrayBuffer()), e ? a.then(e) : a;
            }
            function download(n, e, t, r) {
              var a = "", s = "", h = "", o = null, d = e.addModel();
              if (n.indexOf(":") < 0 && (n.length == 4 ? n = "pdb:" + n : isNaN(n) ? n = "url:" + n : n = "cid:" + n), n.substring(0, 5) == "mmtf:" && (console.warn("WARNING: MMTF now deprecated.  Reverting to bcif."), n = "bcif:" + n.slice(5)), n.substring(0, 5) === "bcif:")
                n = n.substring(5).toUpperCase(), h = "https://models.rcsb.org/" + n + ".bcif.gz", t && typeof t.noComputeSecondaryStructure > "u" && (t.noComputeSecondaryStructure = !0), o = new Promise(function(f) {
                  getbin(h).then(function(y) {
                    d.addMolData(y, "bcif.gz", t), e.zoomTo(), e.render(), f(d);
                  }, function() {
                    console.error("fetch of " + h + " failed.");
                  });
                });
              else {
                if (n.substring(0, 4) === "pdb:") {
                  if (a = "bcif", t && t.format && (a = t.format), t && typeof t.noComputeSecondaryStructure > "u" && (t.noComputeSecondaryStructure = !0), n = n.substring(4).toUpperCase(), !n.match(/^[1-9][A-Za-z0-9]{3}$/)) {
                    alert("Wrong PDB ID");
                    return;
                  }
                  a == "bcif" ? h = "https://models.rcsb.org/" + n.toUpperCase() + ".bcif.gz" : (s = t && t.pdbUri ? t.pdbUri : "https://files.rcsb.org/view/", h = s + n + "." + a);
                } else if (n.substring(0, 4) == "cid:") {
                  if (a = "sdf", n = n.substring(4), !n.match(/^[0-9]+$/)) {
                    alert("Wrong Compound ID");
                    return;
                  }
                  h = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + n + "/SDF?record_type=3d";
                } else n.substring(0, 4) == "url:" && (h = n.substring(4), a = h);
                var v = function(f) {
                  d.addMolData(f, a, t), e.zoomTo(), e.render();
                };
                o = new Promise(function(f) {
                  a == "bcif" ? getbin(h).then(function(y) {
                    v(y), f(d);
                  }).catch(function() {
                    s = t && t.pdbUri ? t.pdbUri : "https://files.rcsb.org/view/", h = s + n + ".pdb", a = "pdb", console.warn("falling back to pdb format"), get(h).then(function(y) {
                      v(y), f(d);
                    }).catch(function(y) {
                      v(""), f(d), console.error("fetch of " + h + " failed: " + y.statusText);
                    });
                  }) : get(h).then(function(y) {
                    v(y), f(d);
                  }).catch(function(y) {
                    v(""), f(d), console.error("fetch of " + h + " failed: " + y.statusText);
                  });
                });
              }
              return r ? (o.then(function(f) {
                r(f);
              }), d) : o;
            }
            function getColorFromStyle(n, e) {
              let t = e.colorscheme;
              if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t] < "u")
                t = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t];
              else if (typeof t == "string" && t.endsWith("Carbon")) {
                let h = t.substring(0, t.lastIndexOf("Carbon")).toLowerCase();
                if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[h] < "u") {
                  let o = Object.assign({}, _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors.defaultColors);
                  o.C = _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[h], _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t] = { prop: "elem", map: o }, t = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t];
                }
              }
              let r = n.color;
              if (typeof e.color < "u" && e.color != "spectrum" && (r = e.color), typeof t < "u") {
                let h, o;
                if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[t] < "u")
                  t = _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[t], typeof t[n[t.prop]] < "u" && (r = t.map[n[t.prop]]);
                else if (typeof t[n[t.prop]] < "u")
                  r = t.map[n[t.prop]];
                else if (typeof t.prop < "u" && typeof t.gradient < "u") {
                  h = t.prop;
                  var a = t.gradient;
                  a instanceof _Gradient__WEBPACK_IMPORTED_MODULE_0__.GradientType || (a = (0, _Gradient__WEBPACK_IMPORTED_MODULE_0__.getGradient)(t));
                  let d = a.range() || [-1, 1];
                  o = getAtomProperty(n, h), o != null && (r = a.valueToHex(o, d));
                } else typeof t.prop < "u" && typeof t.map < "u" ? (h = t.prop, o = getAtomProperty(n, h), typeof t.map[o] < "u" && (r = t.map[o])) : typeof e.colorscheme[n.elem] < "u" ? r = e.colorscheme[n.elem] : console.warn("Could not interpret colorscheme " + t);
              } else typeof e.colorfunc < "u" && (r = e.colorfunc(n));
              return _colors__WEBPACK_IMPORTED_MODULE_2__.CC.color(r);
            }
            function getElement(n) {
              let e = n;
              return typeof n == "string" ? e = document.querySelector("#" + n) : typeof n == "object" && n.get && (e = n.get(0)), e;
            }
            function inflateString(n, e = !0) {
              let t;
              return typeof n == "string" ? t = new TextEncoder().encode(n) : t = new Uint8Array(n), (0, pako__WEBPACK_IMPORTED_MODULE_3__.inflate)(t, {
                to: e ? "string" : null
              });
            }
          }
        ),
        /***/
        "./node_modules/upng-js/UPNG.js": (
          /*!**************************************!*\
            !*** ./node_modules/upng-js/UPNG.js ***!
            \**************************************/
          /***/
          (n, e, t) => {
            (function() {
              var r = {}, a;
              n.exports = r, a = t(
                /*! pako */
                "./node_modules/upng-js/node_modules/pako/index.js"
              ), function(s, h) {
                s.toRGBA8 = function(o) {
                  var d = o.width, v = o.height;
                  if (o.tabs.acTL == null) return [s.toRGBA8.decodeImage(o.data, d, v, o).buffer];
                  var f = [];
                  o.frames[0].data == null && (o.frames[0].data = o.data);
                  for (var y, A = new Uint8Array(d * v * 4), x = 0; x < o.frames.length; x++) {
                    var M = o.frames[x], m = M.rect.x, l = M.rect.y, u = M.rect.width, p = M.rect.height, g = s.toRGBA8.decodeImage(M.data, u, p, o);
                    if (x == 0 ? y = g : M.blend == 0 ? s._copyTile(g, u, p, y, d, v, m, l, 0) : M.blend == 1 && s._copyTile(g, u, p, y, d, v, m, l, 1), f.push(y.buffer), y = y.slice(0), M.dispose != 0) {
                      if (M.dispose == 1) s._copyTile(A, u, p, y, d, v, m, l, 0);
                      else if (M.dispose == 2) {
                        for (var b = x - 1; o.frames[b].dispose == 2; ) b--;
                        y = new Uint8Array(f[b]).slice(0);
                      }
                    }
                  }
                  return f;
                }, s.toRGBA8.decodeImage = function(o, d, v, f) {
                  var y = d * v, A = s.decode._getBPP(f), x = Math.ceil(d * A / 8), M = new Uint8Array(y * 4), m = new Uint32Array(M.buffer), l = f.ctype, u = f.depth, p = s._bin.readUshort;
                  if (l == 6) {
                    var g = y << 2;
                    if (u == 8) for (var b = 0; b < g; b++)
                      M[b] = o[b];
                    if (u == 16) for (var b = 0; b < g; b++)
                      M[b] = o[b << 1];
                  } else if (l == 2) {
                    var c = f.tabs.tRNS, _ = -1, E = -1, w = -1;
                    if (c && (_ = c[0], E = c[1], w = c[2]), u == 8) for (var b = 0; b < y; b++) {
                      var k = b << 2, $ = b * 3;
                      M[k] = o[$], M[k + 1] = o[$ + 1], M[k + 2] = o[$ + 2], M[k + 3] = 255, _ != -1 && o[$] == _ && o[$ + 1] == E && o[$ + 2] == w && (M[k + 3] = 0);
                    }
                    if (u == 16) for (var b = 0; b < y; b++) {
                      var k = b << 2, $ = b * 6;
                      M[k] = o[$], M[k + 1] = o[$ + 2], M[k + 2] = o[$ + 4], M[k + 3] = 255, _ != -1 && p(o, $) == _ && p(o, $ + 2) == E && p(o, $ + 4) == w && (M[k + 3] = 0);
                    }
                  } else if (l == 3) {
                    var L = f.tabs.PLTE, z = f.tabs.tRNS, F = z ? z.length : 0;
                    if (u == 1) for (var R = 0; R < v; R++)
                      for (var P = R * x, U = R * d, b = 0; b < d; b++) {
                        var k = U + b << 2, N = o[P + (b >> 3)] >> 7 - ((b & 7) << 0) & 1, B = 3 * N;
                        M[k] = L[B], M[k + 1] = L[B + 1], M[k + 2] = L[B + 2], M[k + 3] = N < F ? z[N] : 255;
                      }
                    if (u == 2) for (var R = 0; R < v; R++)
                      for (var P = R * x, U = R * d, b = 0; b < d; b++) {
                        var k = U + b << 2, N = o[P + (b >> 2)] >> 6 - ((b & 3) << 1) & 3, B = 3 * N;
                        M[k] = L[B], M[k + 1] = L[B + 1], M[k + 2] = L[B + 2], M[k + 3] = N < F ? z[N] : 255;
                      }
                    if (u == 4) for (var R = 0; R < v; R++)
                      for (var P = R * x, U = R * d, b = 0; b < d; b++) {
                        var k = U + b << 2, N = o[P + (b >> 1)] >> 4 - ((b & 1) << 2) & 15, B = 3 * N;
                        M[k] = L[B], M[k + 1] = L[B + 1], M[k + 2] = L[B + 2], M[k + 3] = N < F ? z[N] : 255;
                      }
                    if (u == 8) for (var b = 0; b < y; b++) {
                      var k = b << 2, N = o[b], B = 3 * N;
                      M[k] = L[B], M[k + 1] = L[B + 1], M[k + 2] = L[B + 2], M[k + 3] = N < F ? z[N] : 255;
                    }
                  } else if (l == 4) {
                    if (u == 8) for (var b = 0; b < y; b++) {
                      var k = b << 2, W = b << 1, V = o[W];
                      M[k] = V, M[k + 1] = V, M[k + 2] = V, M[k + 3] = o[W + 1];
                    }
                    if (u == 16) for (var b = 0; b < y; b++) {
                      var k = b << 2, W = b << 2, V = o[W];
                      M[k] = V, M[k + 1] = V, M[k + 2] = V, M[k + 3] = o[W + 2];
                    }
                  } else if (l == 0) {
                    var _ = f.tabs.tRNS ? f.tabs.tRNS : -1;
                    if (u == 1) for (var b = 0; b < y; b++) {
                      var V = 255 * (o[b >> 3] >> 7 - (b & 7) & 1), G = V == _ * 255 ? 0 : 255;
                      m[b] = G << 24 | V << 16 | V << 8 | V;
                    }
                    if (u == 2) for (var b = 0; b < y; b++) {
                      var V = 85 * (o[b >> 2] >> 6 - ((b & 3) << 1) & 3), G = V == _ * 85 ? 0 : 255;
                      m[b] = G << 24 | V << 16 | V << 8 | V;
                    }
                    if (u == 4) for (var b = 0; b < y; b++) {
                      var V = 17 * (o[b >> 1] >> 4 - ((b & 1) << 2) & 15), G = V == _ * 17 ? 0 : 255;
                      m[b] = G << 24 | V << 16 | V << 8 | V;
                    }
                    if (u == 8) for (var b = 0; b < y; b++) {
                      var V = o[b], G = V == _ ? 0 : 255;
                      m[b] = G << 24 | V << 16 | V << 8 | V;
                    }
                    if (u == 16) for (var b = 0; b < y; b++) {
                      var V = o[b << 1], G = p(o, b << 1) == _ ? 0 : 255;
                      m[b] = G << 24 | V << 16 | V << 8 | V;
                    }
                  }
                  return M;
                }, s.decode = function(o) {
                  for (var d = new Uint8Array(o), v = 8, f = s._bin, y = f.readUshort, A = f.readUint, x = { tabs: {}, frames: [] }, M = new Uint8Array(d.length), m = 0, l, u = 0, p = [137, 80, 78, 71, 13, 10, 26, 10], g = 0; g < 8; g++) if (d[g] != p[g]) throw "The input is not a PNG file!";
                  for (; v < d.length; ) {
                    var b = f.readUint(d, v);
                    v += 4;
                    var c = f.readASCII(d, v, 4);
                    if (v += 4, c == "IHDR")
                      s.decode._IHDR(d, v, x);
                    else if (c == "IDAT") {
                      for (var g = 0; g < b; g++) M[m + g] = d[v + g];
                      m += b;
                    } else if (c == "acTL")
                      x.tabs[c] = { num_frames: A(d, v), num_plays: A(d, v + 4) }, l = new Uint8Array(d.length);
                    else if (c == "fcTL") {
                      if (u != 0) {
                        var _ = x.frames[x.frames.length - 1];
                        _.data = s.decode._decompress(x, l.slice(0, u), _.rect.width, _.rect.height), u = 0;
                      }
                      var E = { x: A(d, v + 12), y: A(d, v + 16), width: A(d, v + 4), height: A(d, v + 8) }, w = y(d, v + 22);
                      w = y(d, v + 20) / (w == 0 ? 100 : w);
                      var k = { rect: E, delay: Math.round(w * 1e3), dispose: d[v + 24], blend: d[v + 25] };
                      x.frames.push(k);
                    } else if (c == "fdAT") {
                      for (var g = 0; g < b - 4; g++) l[u + g] = d[v + g + 4];
                      u += b - 4;
                    } else if (c == "pHYs")
                      x.tabs[c] = [f.readUint(d, v), f.readUint(d, v + 4), d[v + 8]];
                    else if (c == "cHRM") {
                      x.tabs[c] = [];
                      for (var g = 0; g < 8; g++) x.tabs[c].push(f.readUint(d, v + g * 4));
                    } else if (c == "tEXt") {
                      x.tabs[c] == null && (x.tabs[c] = {});
                      var $ = f.nextZero(d, v), L = f.readASCII(d, v, $ - v), z = f.readASCII(d, $ + 1, v + b - $ - 1);
                      x.tabs[c][L] = z;
                    } else if (c == "iTXt") {
                      x.tabs[c] == null && (x.tabs[c] = {});
                      var $ = 0, F = v;
                      $ = f.nextZero(d, F);
                      var L = f.readASCII(d, F, $ - F);
                      F = $ + 1, d[F], d[F + 1], F += 2, $ = f.nextZero(d, F), f.readASCII(d, F, $ - F), F = $ + 1, $ = f.nextZero(d, F), f.readUTF8(d, F, $ - F), F = $ + 1;
                      var z = f.readUTF8(d, F, b - (F - v));
                      x.tabs[c][L] = z;
                    } else if (c == "PLTE")
                      x.tabs[c] = f.readBytes(d, v, b);
                    else if (c == "hIST") {
                      var R = x.tabs.PLTE.length / 3;
                      x.tabs[c] = [];
                      for (var g = 0; g < R; g++) x.tabs[c].push(y(d, v + g * 2));
                    } else if (c == "tRNS")
                      x.ctype == 3 ? x.tabs[c] = f.readBytes(d, v, b) : x.ctype == 0 ? x.tabs[c] = y(d, v) : x.ctype == 2 && (x.tabs[c] = [y(d, v), y(d, v + 2), y(d, v + 4)]);
                    else if (c == "gAMA") x.tabs[c] = f.readUint(d, v) / 1e5;
                    else if (c == "sRGB") x.tabs[c] = d[v];
                    else if (c == "bKGD")
                      x.ctype == 0 || x.ctype == 4 ? x.tabs[c] = [y(d, v)] : x.ctype == 2 || x.ctype == 6 ? x.tabs[c] = [y(d, v), y(d, v + 2), y(d, v + 4)] : x.ctype == 3 && (x.tabs[c] = d[v]);
                    else if (c == "IEND") {
                      if (u != 0) {
                        var _ = x.frames[x.frames.length - 1];
                        _.data = s.decode._decompress(x, l.slice(0, u), _.rect.width, _.rect.height), u = 0;
                      }
                      x.data = s.decode._decompress(x, M, x.width, x.height);
                      break;
                    }
                    v += b, f.readUint(d, v), v += 4;
                  }
                  return delete x.compress, delete x.interlace, delete x.filter, x;
                }, s.decode._decompress = function(o, d, v, f) {
                  return o.compress == 0 && (d = s.decode._inflate(d)), o.interlace == 0 ? d = s.decode._filterZero(d, o, 0, v, f) : o.interlace == 1 && (d = s.decode._readInterlace(d, o)), d;
                }, s.decode._inflate = function(o) {
                  return h.inflate(o);
                }, s.decode._readInterlace = function(o, d) {
                  for (var v = d.width, f = d.height, y = s.decode._getBPP(d), A = y >> 3, x = Math.ceil(v * y / 8), M = new Uint8Array(f * x), m = 0, l = [0, 0, 4, 0, 2, 0, 1], u = [0, 4, 0, 2, 0, 1, 0], p = [8, 8, 8, 4, 4, 2, 2], g = [8, 8, 4, 4, 2, 2, 1], b = 0; b < 7; ) {
                    for (var c = p[b], _ = g[b], E = 0, w = 0, k = l[b]; k < f; )
                      k += c, w++;
                    for (var $ = u[b]; $ < v; )
                      $ += _, E++;
                    var L = Math.ceil(E * y / 8);
                    s.decode._filterZero(o, d, m, E, w);
                    for (var z = 0, F = l[b]; F < f; ) {
                      for (var R = u[b], P = m + z * L << 3; R < v; ) {
                        if (y == 1) {
                          var U = o[P >> 3];
                          U = U >> 7 - (P & 7) & 1, M[F * x + (R >> 3)] |= U << 7 - ((R & 3) << 0);
                        }
                        if (y == 2) {
                          var U = o[P >> 3];
                          U = U >> 6 - (P & 7) & 3, M[F * x + (R >> 2)] |= U << 6 - ((R & 3) << 1);
                        }
                        if (y == 4) {
                          var U = o[P >> 3];
                          U = U >> 4 - (P & 7) & 15, M[F * x + (R >> 1)] |= U << 4 - ((R & 1) << 2);
                        }
                        if (y >= 8)
                          for (var N = F * x + R * A, B = 0; B < A; B++) M[N + B] = o[(P >> 3) + B];
                        P += y, R += _;
                      }
                      z++, F += c;
                    }
                    E * w != 0 && (m += w * (1 + L)), b = b + 1;
                  }
                  return M;
                }, s.decode._getBPP = function(o) {
                  var d = [1, null, 3, 1, 2, null, 4][o.ctype];
                  return d * o.depth;
                }, s.decode._filterZero = function(o, d, v, f, y) {
                  var A = s.decode._getBPP(d), x = Math.ceil(f * A / 8), M = s.decode._paeth;
                  A = Math.ceil(A / 8);
                  for (var m = 0; m < y; m++) {
                    var l = v + m * x, u = l + m + 1, p = o[u - 1];
                    if (p == 0) for (var g = 0; g < x; g++) o[l + g] = o[u + g];
                    else if (p == 1) {
                      for (var g = 0; g < A; g++) o[l + g] = o[u + g];
                      for (var g = A; g < x; g++) o[l + g] = o[u + g] + o[l + g - A] & 255;
                    } else if (m == 0) {
                      for (var g = 0; g < A; g++) o[l + g] = o[u + g];
                      if (p == 2) for (var g = A; g < x; g++) o[l + g] = o[u + g] & 255;
                      if (p == 3) for (var g = A; g < x; g++) o[l + g] = o[u + g] + (o[l + g - A] >> 1) & 255;
                      if (p == 4) for (var g = A; g < x; g++) o[l + g] = o[u + g] + M(o[l + g - A], 0, 0) & 255;
                    } else {
                      if (p == 2)
                        for (var g = 0; g < x; g++) o[l + g] = o[u + g] + o[l + g - x] & 255;
                      if (p == 3) {
                        for (var g = 0; g < A; g++) o[l + g] = o[u + g] + (o[l + g - x] >> 1) & 255;
                        for (var g = A; g < x; g++) o[l + g] = o[u + g] + (o[l + g - x] + o[l + g - A] >> 1) & 255;
                      }
                      if (p == 4) {
                        for (var g = 0; g < A; g++) o[l + g] = o[u + g] + M(0, o[l + g - x], 0) & 255;
                        for (var g = A; g < x; g++) o[l + g] = o[u + g] + M(o[l + g - A], o[l + g - x], o[l + g - A - x]) & 255;
                      }
                    }
                  }
                  return o;
                }, s.decode._paeth = function(o, d, v) {
                  var f = o + d - v, y = Math.abs(f - o), A = Math.abs(f - d), x = Math.abs(f - v);
                  return y <= A && y <= x ? o : A <= x ? d : v;
                }, s.decode._IHDR = function(o, d, v) {
                  var f = s._bin;
                  v.width = f.readUint(o, d), d += 4, v.height = f.readUint(o, d), d += 4, v.depth = o[d], d++, v.ctype = o[d], d++, v.compress = o[d], d++, v.filter = o[d], d++, v.interlace = o[d], d++;
                }, s._bin = {
                  nextZero: function(o, d) {
                    for (; o[d] != 0; ) d++;
                    return d;
                  },
                  readUshort: function(o, d) {
                    return o[d] << 8 | o[d + 1];
                  },
                  writeUshort: function(o, d, v) {
                    o[d] = v >> 8 & 255, o[d + 1] = v & 255;
                  },
                  readUint: function(o, d) {
                    return o[d] * 16777216 + (o[d + 1] << 16 | o[d + 2] << 8 | o[d + 3]);
                  },
                  writeUint: function(o, d, v) {
                    o[d] = v >> 24 & 255, o[d + 1] = v >> 16 & 255, o[d + 2] = v >> 8 & 255, o[d + 3] = v & 255;
                  },
                  readASCII: function(o, d, v) {
                    for (var f = "", y = 0; y < v; y++) f += String.fromCharCode(o[d + y]);
                    return f;
                  },
                  writeASCII: function(o, d, v) {
                    for (var f = 0; f < v.length; f++) o[d + f] = v.charCodeAt(f);
                  },
                  readBytes: function(o, d, v) {
                    for (var f = [], y = 0; y < v; y++) f.push(o[d + y]);
                    return f;
                  },
                  pad: function(o) {
                    return o.length < 2 ? "0" + o : o;
                  },
                  readUTF8: function(o, d, v) {
                    for (var f = "", y, A = 0; A < v; A++) f += "%" + s._bin.pad(o[d + A].toString(16));
                    try {
                      y = decodeURIComponent(f);
                    } catch {
                      return s._bin.readASCII(o, d, v);
                    }
                    return y;
                  }
                }, s._copyTile = function(o, d, v, f, y, A, x, M, m) {
                  for (var l = Math.min(d, y), u = Math.min(v, A), p = 0, g = 0, b = 0; b < u; b++)
                    for (var c = 0; c < l; c++)
                      if (x >= 0 && M >= 0 ? (p = b * d + c << 2, g = (M + b) * y + x + c << 2) : (p = (-M + b) * d - x + c << 2, g = b * y + c << 2), m == 0)
                        f[g] = o[p], f[g + 1] = o[p + 1], f[g + 2] = o[p + 2], f[g + 3] = o[p + 3];
                      else if (m == 1) {
                        var _ = o[p + 3] * 0.00392156862745098, E = o[p] * _, w = o[p + 1] * _, k = o[p + 2] * _, $ = f[g + 3] * (1 / 255), L = f[g] * $, z = f[g + 1] * $, F = f[g + 2] * $, R = 1 - _, P = _ + $ * R, U = P == 0 ? 0 : 1 / P;
                        f[g + 3] = 255 * P, f[g + 0] = (E + L * R) * U, f[g + 1] = (w + z * R) * U, f[g + 2] = (k + F * R) * U;
                      } else if (m == 2) {
                        var _ = o[p + 3], E = o[p], w = o[p + 1], k = o[p + 2], $ = f[g + 3], L = f[g], z = f[g + 1], F = f[g + 2];
                        _ == $ && E == L && w == z && k == F ? (f[g] = 0, f[g + 1] = 0, f[g + 2] = 0, f[g + 3] = 0) : (f[g] = E, f[g + 1] = w, f[g + 2] = k, f[g + 3] = _);
                      } else if (m == 3) {
                        var _ = o[p + 3], E = o[p], w = o[p + 1], k = o[p + 2], $ = f[g + 3], L = f[g], z = f[g + 1], F = f[g + 2];
                        if (_ == $ && E == L && w == z && k == F) continue;
                        if (_ < 220 && $ > 20) return !1;
                      }
                  return !0;
                }, s.encode = function(o, d, v, f, y, A) {
                  f == null && (f = 0), A == null && (A = !1);
                  for (var x = new Uint8Array(o[0].byteLength * o.length + 100), M = [137, 80, 78, 71, 13, 10, 26, 10], m = 0; m < 8; m++) x[m] = M[m];
                  var l = 8, u = s._bin, p = s.crc.crc, g = u.writeUint, b = u.writeUshort, c = u.writeASCII, _ = s.encode.compressPNG(o, d, v, f, A);
                  g(x, l, 13), l += 4, c(x, l, "IHDR"), l += 4, g(x, l, d), l += 4, g(x, l, v), l += 4, x[l] = _.depth, l++, x[l] = _.ctype, l++, x[l] = 0, l++, x[l] = 0, l++, x[l] = 0, l++, g(x, l, p(x, l - 17, 17)), l += 4, g(x, l, 1), l += 4, c(x, l, "sRGB"), l += 4, x[l] = 1, l++, g(x, l, p(x, l - 5, 5)), l += 4;
                  var E = o.length > 1;
                  if (E && (g(x, l, 8), l += 4, c(x, l, "acTL"), l += 4, g(x, l, o.length), l += 4, g(x, l, 0), l += 4, g(x, l, p(x, l - 12, 12)), l += 4), _.ctype == 3) {
                    var w = _.plte.length;
                    g(x, l, w * 3), l += 4, c(x, l, "PLTE"), l += 4;
                    for (var m = 0; m < w; m++) {
                      var k = m * 3, $ = _.plte[m], L = $ & 255, z = $ >> 8 & 255, F = $ >> 16 & 255;
                      x[l + k + 0] = L, x[l + k + 1] = z, x[l + k + 2] = F;
                    }
                    if (l += w * 3, g(x, l, p(x, l - w * 3 - 4, w * 3 + 4)), l += 4, _.gotAlpha) {
                      g(x, l, w), l += 4, c(x, l, "tRNS"), l += 4;
                      for (var m = 0; m < w; m++) x[l + m] = _.plte[m] >> 24 & 255;
                      l += w, g(x, l, p(x, l - w - 4, w + 4)), l += 4;
                    }
                  }
                  for (var R = 0, P = 0; P < _.frames.length; P++) {
                    var U = _.frames[P];
                    E && (g(x, l, 26), l += 4, c(x, l, "fcTL"), l += 4, g(x, l, R++), l += 4, g(x, l, U.rect.width), l += 4, g(x, l, U.rect.height), l += 4, g(x, l, U.rect.x), l += 4, g(x, l, U.rect.y), l += 4, b(x, l, y[P]), l += 2, b(x, l, 1e3), l += 2, x[l] = U.dispose, l++, x[l] = U.blend, l++, g(x, l, p(x, l - 30, 30)), l += 4);
                    var N = U.cimg, w = N.length;
                    g(x, l, w + (P == 0 ? 0 : 4)), l += 4;
                    var B = l;
                    c(x, l, P == 0 ? "IDAT" : "fdAT"), l += 4, P != 0 && (g(x, l, R++), l += 4);
                    for (var m = 0; m < w; m++) x[l + m] = N[m];
                    l += w, g(x, l, p(x, B, l - B)), l += 4;
                  }
                  return g(x, l, 0), l += 4, c(x, l, "IEND"), l += 4, g(x, l, p(x, l - 4, 4)), l += 4, x.buffer.slice(0, l);
                }, s.encode.compressPNG = function(o, d, v, f, y) {
                  for (var A = s.encode.compress(o, d, v, f, !1, y), x = 0; x < o.length; x++) {
                    var M = A.frames[x];
                    M.rect.width;
                    var m = M.rect.height, l = M.bpl, u = M.bpp, p = new Uint8Array(m * l + m);
                    M.cimg = s.encode._filterZero(M.img, m, u, l, p);
                  }
                  return A;
                }, s.encode.compress = function(o, d, v, f, y, A) {
                  A == null && (A = !1);
                  for (var x = 6, M = 8, m = 4, l = 255, u = 0; u < o.length; u++)
                    for (var p = new Uint8Array(o[u]), g = p.length, b = 0; b < g; b += 4) l &= p[b + 3];
                  var c = l != 255, _ = {}, E = [];
                  if (o.length != 0 && (_[0] = 0, E.push(0), f != 0 && f--), f != 0) {
                    var w = s.quantize(o, f, y);
                    o = w.bufs;
                    for (var b = 0; b < w.plte.length; b++) {
                      var k = w.plte[b].est.rgba;
                      _[k] == null && (_[k] = E.length, E.push(k));
                    }
                  } else
                    for (var u = 0; u < o.length; u++)
                      for (var $ = new Uint32Array(o[u]), g = $.length, b = 0; b < g; b++) {
                        var k = $[b];
                        if ((b < d || k != $[b - 1] && k != $[b - d]) && _[k] == null && (_[k] = E.length, E.push(k), E.length >= 300))
                          break;
                      }
                  var L = c ? y : !1, z = E.length;
                  z <= 256 && A == !1 && (z <= 2 ? M = 1 : z <= 4 ? M = 2 : z <= 16 ? M = 4 : M = 8, y && (M = 8), c = !0);
                  for (var F = [], u = 0; u < o.length; u++) {
                    var R = new Uint8Array(o[u]), P = new Uint32Array(R.buffer), U = 0, N = 0, B = d, W = v, V = 0;
                    if (u != 0 && !L) {
                      for (var G = y || u == 1 || F[F.length - 2].dispose == 2 ? 1 : 2, H = 0, Q = 1e9, te = 0; te < G; te++) {
                        for (var pe = new Uint8Array(o[u - 1 - te]), ee = new Uint32Array(o[u - 1 - te]), ce = d, fe = v, oe = -1, he = -1, Ae = 0; Ae < v; Ae++) for (var Se = 0; Se < d; Se++) {
                          var b = Ae * d + Se;
                          P[b] != ee[b] && (Se < ce && (ce = Se), Se > oe && (oe = Se), Ae < fe && (fe = Ae), Ae > he && (he = Ae));
                        }
                        var Ie = oe == -1 ? 1 : (oe - ce + 1) * (he - fe + 1);
                        Ie < Q && (Q = Ie, H = te, oe == -1 ? (U = N = 0, B = W = 1) : (U = ce, N = fe, B = oe - ce + 1, W = he - fe + 1));
                      }
                      var pe = new Uint8Array(o[u - 1 - H]);
                      H == 1 && (F[F.length - 1].dispose = 2);
                      var le = new Uint8Array(B * W * 4);
                      new Uint32Array(le.buffer), s._copyTile(pe, d, v, le, B, W, -U, -N, 0), s._copyTile(R, d, v, le, B, W, -U, -N, 3) ? (s._copyTile(R, d, v, le, B, W, -U, -N, 2), V = 1) : (s._copyTile(R, d, v, le, B, W, -U, -N, 0), V = 0), R = le, P = new Uint32Array(R.buffer);
                    }
                    var ne = 4 * B;
                    if (z <= 256 && A == !1) {
                      ne = Math.ceil(M * B / 8);
                      for (var le = new Uint8Array(ne * W), Ae = 0; Ae < W; Ae++) {
                        var b = Ae * ne, Te = Ae * B;
                        if (M == 8) for (var Se = 0; Se < B; Se++) le[b + Se] = _[P[Te + Se]];
                        else if (M == 4) for (var Se = 0; Se < B; Se++) le[b + (Se >> 1)] |= _[P[Te + Se]] << 4 - (Se & 1) * 4;
                        else if (M == 2) for (var Se = 0; Se < B; Se++) le[b + (Se >> 2)] |= _[P[Te + Se]] << 6 - (Se & 3) * 2;
                        else if (M == 1) for (var Se = 0; Se < B; Se++) le[b + (Se >> 3)] |= _[P[Te + Se]] << 7 - (Se & 7) * 1;
                      }
                      R = le, x = 3, m = 1;
                    } else if (c == !1 && o.length == 1) {
                      for (var le = new Uint8Array(B * W * 3), Oe = B * W, b = 0; b < Oe; b++) {
                        var Be = b * 3, Ue = b * 4;
                        le[Be] = R[Ue], le[Be + 1] = R[Ue + 1], le[Be + 2] = R[Ue + 2];
                      }
                      R = le, x = 2, m = 3, ne = 3 * B;
                    }
                    F.push({ rect: { x: U, y: N, width: B, height: W }, img: R, bpl: ne, bpp: m, blend: V, dispose: L ? 1 : 0 });
                  }
                  return { ctype: x, depth: M, plte: E, gotAlpha: c, frames: F };
                }, s.encode._filterZero = function(o, d, v, f, y) {
                  for (var A = [], x = 0; x < 5; x++)
                    if (!(d * f > 5e5 && (x == 2 || x == 3 || x == 4))) {
                      for (var M = 0; M < d; M++) s.encode._filterLine(y, o, M, f, v, x);
                      if (A.push(h.deflate(y)), v == 1) break;
                    }
                  for (var m, l = 1e9, u = 0; u < A.length; u++) A[u].length < l && (m = u, l = A[u].length);
                  return A[m];
                }, s.encode._filterLine = function(o, d, v, f, y, A) {
                  var x = v * f, M = x + v, m = s.decode._paeth;
                  if (o[M] = A, M++, A == 0) for (var l = 0; l < f; l++) o[M + l] = d[x + l];
                  else if (A == 1) {
                    for (var l = 0; l < y; l++) o[M + l] = d[x + l];
                    for (var l = y; l < f; l++) o[M + l] = d[x + l] - d[x + l - y] + 256 & 255;
                  } else if (v == 0) {
                    for (var l = 0; l < y; l++) o[M + l] = d[x + l];
                    if (A == 2) for (var l = y; l < f; l++) o[M + l] = d[x + l];
                    if (A == 3) for (var l = y; l < f; l++) o[M + l] = d[x + l] - (d[x + l - y] >> 1) + 256 & 255;
                    if (A == 4) for (var l = y; l < f; l++) o[M + l] = d[x + l] - m(d[x + l - y], 0, 0) + 256 & 255;
                  } else {
                    if (A == 2)
                      for (var l = 0; l < f; l++) o[M + l] = d[x + l] + 256 - d[x + l - f] & 255;
                    if (A == 3) {
                      for (var l = 0; l < y; l++) o[M + l] = d[x + l] + 256 - (d[x + l - f] >> 1) & 255;
                      for (var l = y; l < f; l++) o[M + l] = d[x + l] + 256 - (d[x + l - f] + d[x + l - y] >> 1) & 255;
                    }
                    if (A == 4) {
                      for (var l = 0; l < y; l++) o[M + l] = d[x + l] + 256 - m(0, d[x + l - f], 0) & 255;
                      for (var l = y; l < f; l++) o[M + l] = d[x + l] + 256 - m(d[x + l - y], d[x + l - f], d[x + l - y - f]) & 255;
                    }
                  }
                }, s.crc = {
                  table: function() {
                    for (var o = new Uint32Array(256), d = 0; d < 256; d++) {
                      for (var v = d, f = 0; f < 8; f++)
                        v & 1 ? v = 3988292384 ^ v >>> 1 : v = v >>> 1;
                      o[d] = v;
                    }
                    return o;
                  }(),
                  update: function(o, d, v, f) {
                    for (var y = 0; y < f; y++) o = s.crc.table[(o ^ d[v + y]) & 255] ^ o >>> 8;
                    return o;
                  },
                  crc: function(o, d, v) {
                    return s.crc.update(4294967295, o, d, v) ^ 4294967295;
                  }
                }, s.quantize = function(o, d, v) {
                  for (var f = [], y = 0, A = 0; A < o.length; A++)
                    f.push(s.encode.alphaMul(new Uint8Array(o[A]), v)), y += o[A].byteLength;
                  for (var x = new Uint8Array(y), M = new Uint32Array(x.buffer), m = 0, A = 0; A < f.length; A++) {
                    for (var l = f[A], u = l.length, p = 0; p < u; p++) x[m + p] = l[p];
                    m += u;
                  }
                  var g = { i0: 0, i1: x.length, bst: null, est: null, tdst: 0, left: null, right: null };
                  g.bst = s.quantize.stats(x, g.i0, g.i1), g.est = s.quantize.estats(g.bst);
                  for (var b = [g]; b.length < d; ) {
                    for (var c = 0, _ = 0, A = 0; A < b.length; A++) b[A].est.L > c && (c = b[A].est.L, _ = A);
                    if (c < 1e-3) break;
                    var E = b[_], w = s.quantize.splitPixels(x, M, E.i0, E.i1, E.est.e, E.est.eMq255), k = { i0: E.i0, i1: w, bst: null, est: null, tdst: 0, left: null, right: null };
                    k.bst = s.quantize.stats(x, k.i0, k.i1), k.est = s.quantize.estats(k.bst);
                    var $ = { i0: w, i1: E.i1, bst: null, est: null, tdst: 0, left: null, right: null };
                    $.bst = { R: [], m: [], N: E.bst.N - k.bst.N };
                    for (var A = 0; A < 16; A++) $.bst.R[A] = E.bst.R[A] - k.bst.R[A];
                    for (var A = 0; A < 4; A++) $.bst.m[A] = E.bst.m[A] - k.bst.m[A];
                    $.est = s.quantize.estats($.bst), E.left = k, E.right = $, b[_] = k, b.push($);
                  }
                  b.sort(function(G, H) {
                    return H.bst.N - G.bst.N;
                  });
                  for (var L = 0; L < f.length; L++) {
                    for (var z = s.quantize.planeDst, F = new Uint8Array(f[L].buffer), R = new Uint32Array(f[L].buffer), P = F.length, A = 0; A < P; A += 4) {
                      for (var U = F[A] * 0.00392156862745098, N = F[A + 1] * (1 / 255), B = F[A + 2] * (1 / 255), W = F[A + 3] * (1 / 255), V = g; V.left; ) V = z(V.est, U, N, B, W) <= 0 ? V.left : V.right;
                      R[A >> 2] = V.est.rgba;
                    }
                    f[L] = R.buffer;
                  }
                  return { bufs: f, plte: b };
                }, s.quantize.getNearest = function(o, d, v, f, y) {
                  if (o.left == null)
                    return o.tdst = s.quantize.dist(o.est.q, d, v, f, y), o;
                  var A = s.quantize.planeDst(o.est, d, v, f, y), x = o.left, M = o.right;
                  A > 0 && (x = o.right, M = o.left);
                  var m = s.quantize.getNearest(x, d, v, f, y);
                  if (m.tdst <= A * A) return m;
                  var l = s.quantize.getNearest(M, d, v, f, y);
                  return l.tdst < m.tdst ? l : m;
                }, s.quantize.planeDst = function(o, d, v, f, y) {
                  var A = o.e;
                  return A[0] * d + A[1] * v + A[2] * f + A[3] * y - o.eMq;
                }, s.quantize.dist = function(o, d, v, f, y) {
                  var A = d - o[0], x = v - o[1], M = f - o[2], m = y - o[3];
                  return A * A + x * x + M * M + m * m;
                }, s.quantize.splitPixels = function(o, d, v, f, y, A) {
                  var x = s.quantize.vecDot;
                  for (f -= 4; v < f; ) {
                    for (; x(o, v, y) <= A; ) v += 4;
                    for (; x(o, f, y) > A; ) f -= 4;
                    if (v >= f) break;
                    var M = d[v >> 2];
                    d[v >> 2] = d[f >> 2], d[f >> 2] = M, v += 4, f -= 4;
                  }
                  for (; x(o, v, y) > A; ) v -= 4;
                  return v + 4;
                }, s.quantize.vecDot = function(o, d, v) {
                  return o[d] * v[0] + o[d + 1] * v[1] + o[d + 2] * v[2] + o[d + 3] * v[3];
                }, s.quantize.stats = function(o, d, v) {
                  for (var f = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], y = [0, 0, 0, 0], A = v - d >> 2, x = d; x < v; x += 4) {
                    var M = o[x] * 0.00392156862745098, m = o[x + 1] * (1 / 255), l = o[x + 2] * (1 / 255), u = o[x + 3] * (1 / 255);
                    y[0] += M, y[1] += m, y[2] += l, y[3] += u, f[0] += M * M, f[1] += M * m, f[2] += M * l, f[3] += M * u, f[5] += m * m, f[6] += m * l, f[7] += m * u, f[10] += l * l, f[11] += l * u, f[15] += u * u;
                  }
                  return f[4] = f[1], f[8] = f[2], f[12] = f[3], f[9] = f[6], f[13] = f[7], f[14] = f[11], { R: f, m: y, N: A };
                }, s.quantize.estats = function(o) {
                  var d = o.R, v = o.m, f = o.N, y = v[0], A = v[1], x = v[2], M = v[3], m = f == 0 ? 0 : 1 / f, l = [
                    d[0] - y * y * m,
                    d[1] - y * A * m,
                    d[2] - y * x * m,
                    d[3] - y * M * m,
                    d[4] - A * y * m,
                    d[5] - A * A * m,
                    d[6] - A * x * m,
                    d[7] - A * M * m,
                    d[8] - x * y * m,
                    d[9] - x * A * m,
                    d[10] - x * x * m,
                    d[11] - x * M * m,
                    d[12] - M * y * m,
                    d[13] - M * A * m,
                    d[14] - M * x * m,
                    d[15] - M * M * m
                  ], u = l, p = s.M4, g = [0.5, 0.5, 0.5, 0.5], b = 0, c = 0;
                  if (f != 0)
                    for (var _ = 0; _ < 10 && (g = p.multVec(u, g), c = Math.sqrt(p.dot(g, g)), g = p.sml(1 / c, g), !(Math.abs(c - b) < 1e-9)); _++)
                      b = c;
                  var E = [y * m, A * m, x * m, M * m], w = p.dot(p.sml(255, E), g), k = E[3] < 1e-3 ? 0 : 1 / E[3];
                  return {
                    Cov: l,
                    q: E,
                    e: g,
                    L: b,
                    eMq255: w,
                    eMq: p.dot(g, E),
                    rgba: (Math.round(255 * E[3]) << 24 | Math.round(255 * E[2] * k) << 16 | Math.round(255 * E[1] * k) << 8 | Math.round(255 * E[0] * k) << 0) >>> 0
                  };
                }, s.M4 = {
                  multVec: function(o, d) {
                    return [
                      o[0] * d[0] + o[1] * d[1] + o[2] * d[2] + o[3] * d[3],
                      o[4] * d[0] + o[5] * d[1] + o[6] * d[2] + o[7] * d[3],
                      o[8] * d[0] + o[9] * d[1] + o[10] * d[2] + o[11] * d[3],
                      o[12] * d[0] + o[13] * d[1] + o[14] * d[2] + o[15] * d[3]
                    ];
                  },
                  dot: function(o, d) {
                    return o[0] * d[0] + o[1] * d[1] + o[2] * d[2] + o[3] * d[3];
                  },
                  sml: function(o, d) {
                    return [o * d[0], o * d[1], o * d[2], o * d[3]];
                  }
                }, s.encode.alphaMul = function(o, d) {
                  for (var v = new Uint8Array(o.length), f = o.length >> 2, y = 0; y < f; y++) {
                    var A = y << 2, x = o[A + 3];
                    d && (x = x < 128 ? 0 : 255);
                    var M = x * (1 / 255);
                    v[A + 0] = o[A + 0] * M, v[A + 1] = o[A + 1] * M, v[A + 2] = o[A + 2] * M, v[A + 3] = x;
                  }
                  return v;
                };
              }(r, a);
            })();
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/index.js": (
          /*!*********************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/index.js ***!
            \*********************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ./lib/utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ).assign, a = t(
              /*! ./lib/deflate */
              "./node_modules/upng-js/node_modules/pako/lib/deflate.js"
            ), s = t(
              /*! ./lib/inflate */
              "./node_modules/upng-js/node_modules/pako/lib/inflate.js"
            ), h = t(
              /*! ./lib/zlib/constants */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js"
            ), o = {};
            r(o, a, s, h), n.exports = o;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/deflate.js": (
          /*!***************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/deflate.js ***!
            \***************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ./zlib/deflate */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js"
            ), a = t(
              /*! ./utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), s = t(
              /*! ./utils/strings */
              "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js"
            ), h = t(
              /*! ./zlib/messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), o = t(
              /*! ./zlib/zstream */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js"
            ), d = Object.prototype.toString, v = 0, f = 4, y = 0, A = 1, x = 2, M = -1, m = 0, l = 8;
            function u(c) {
              if (!(this instanceof u)) return new u(c);
              this.options = a.assign({
                level: M,
                method: l,
                chunkSize: 16384,
                windowBits: 15,
                memLevel: 8,
                strategy: m,
                to: ""
              }, c || {});
              var _ = this.options;
              _.raw && _.windowBits > 0 ? _.windowBits = -_.windowBits : _.gzip && _.windowBits > 0 && _.windowBits < 16 && (_.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new o(), this.strm.avail_out = 0;
              var E = r.deflateInit2(
                this.strm,
                _.level,
                _.method,
                _.windowBits,
                _.memLevel,
                _.strategy
              );
              if (E !== y)
                throw new Error(h[E]);
              if (_.header && r.deflateSetHeader(this.strm, _.header), _.dictionary) {
                var w;
                if (typeof _.dictionary == "string" ? w = s.string2buf(_.dictionary) : d.call(_.dictionary) === "[object ArrayBuffer]" ? w = new Uint8Array(_.dictionary) : w = _.dictionary, E = r.deflateSetDictionary(this.strm, w), E !== y)
                  throw new Error(h[E]);
                this._dict_set = !0;
              }
            }
            u.prototype.push = function(c, _) {
              var E = this.strm, w = this.options.chunkSize, k, $;
              if (this.ended)
                return !1;
              $ = _ === ~~_ ? _ : _ === !0 ? f : v, typeof c == "string" ? E.input = s.string2buf(c) : d.call(c) === "[object ArrayBuffer]" ? E.input = new Uint8Array(c) : E.input = c, E.next_in = 0, E.avail_in = E.input.length;
              do {
                if (E.avail_out === 0 && (E.output = new a.Buf8(w), E.next_out = 0, E.avail_out = w), k = r.deflate(E, $), k !== A && k !== y)
                  return this.onEnd(k), this.ended = !0, !1;
                (E.avail_out === 0 || E.avail_in === 0 && ($ === f || $ === x)) && (this.options.to === "string" ? this.onData(s.buf2binstring(a.shrinkBuf(E.output, E.next_out))) : this.onData(a.shrinkBuf(E.output, E.next_out)));
              } while ((E.avail_in > 0 || E.avail_out === 0) && k !== A);
              return $ === f ? (k = r.deflateEnd(this.strm), this.onEnd(k), this.ended = !0, k === y) : ($ === x && (this.onEnd(y), E.avail_out = 0), !0);
            }, u.prototype.onData = function(c) {
              this.chunks.push(c);
            }, u.prototype.onEnd = function(c) {
              c === y && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = a.flattenChunks(this.chunks)), this.chunks = [], this.err = c, this.msg = this.strm.msg;
            };
            function p(c, _) {
              var E = new u(_);
              if (E.push(c, !0), E.err)
                throw E.msg || h[E.err];
              return E.result;
            }
            function g(c, _) {
              return _ = _ || {}, _.raw = !0, p(c, _);
            }
            function b(c, _) {
              return _ = _ || {}, _.gzip = !0, p(c, _);
            }
            e.Deflate = u, e.deflate = p, e.deflateRaw = g, e.gzip = b;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/inflate.js": (
          /*!***************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/inflate.js ***!
            \***************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ./zlib/inflate */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js"
            ), a = t(
              /*! ./utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), s = t(
              /*! ./utils/strings */
              "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js"
            ), h = t(
              /*! ./zlib/constants */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js"
            ), o = t(
              /*! ./zlib/messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), d = t(
              /*! ./zlib/zstream */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js"
            ), v = t(
              /*! ./zlib/gzheader */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js"
            ), f = Object.prototype.toString;
            function y(M) {
              if (!(this instanceof y)) return new y(M);
              this.options = a.assign({
                chunkSize: 16384,
                windowBits: 0,
                to: ""
              }, M || {});
              var m = this.options;
              m.raw && m.windowBits >= 0 && m.windowBits < 16 && (m.windowBits = -m.windowBits, m.windowBits === 0 && (m.windowBits = -15)), m.windowBits >= 0 && m.windowBits < 16 && !(M && M.windowBits) && (m.windowBits += 32), m.windowBits > 15 && m.windowBits < 48 && (m.windowBits & 15 || (m.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new d(), this.strm.avail_out = 0;
              var l = r.inflateInit2(
                this.strm,
                m.windowBits
              );
              if (l !== h.Z_OK)
                throw new Error(o[l]);
              if (this.header = new v(), r.inflateGetHeader(this.strm, this.header), m.dictionary && (typeof m.dictionary == "string" ? m.dictionary = s.string2buf(m.dictionary) : f.call(m.dictionary) === "[object ArrayBuffer]" && (m.dictionary = new Uint8Array(m.dictionary)), m.raw && (l = r.inflateSetDictionary(this.strm, m.dictionary), l !== h.Z_OK)))
                throw new Error(o[l]);
            }
            y.prototype.push = function(M, m) {
              var l = this.strm, u = this.options.chunkSize, p = this.options.dictionary, g, b, c, _, E, w = !1;
              if (this.ended)
                return !1;
              b = m === ~~m ? m : m === !0 ? h.Z_FINISH : h.Z_NO_FLUSH, typeof M == "string" ? l.input = s.binstring2buf(M) : f.call(M) === "[object ArrayBuffer]" ? l.input = new Uint8Array(M) : l.input = M, l.next_in = 0, l.avail_in = l.input.length;
              do {
                if (l.avail_out === 0 && (l.output = new a.Buf8(u), l.next_out = 0, l.avail_out = u), g = r.inflate(l, h.Z_NO_FLUSH), g === h.Z_NEED_DICT && p && (g = r.inflateSetDictionary(this.strm, p)), g === h.Z_BUF_ERROR && w === !0 && (g = h.Z_OK, w = !1), g !== h.Z_STREAM_END && g !== h.Z_OK)
                  return this.onEnd(g), this.ended = !0, !1;
                l.next_out && (l.avail_out === 0 || g === h.Z_STREAM_END || l.avail_in === 0 && (b === h.Z_FINISH || b === h.Z_SYNC_FLUSH)) && (this.options.to === "string" ? (c = s.utf8border(l.output, l.next_out), _ = l.next_out - c, E = s.buf2string(l.output, c), l.next_out = _, l.avail_out = u - _, _ && a.arraySet(l.output, l.output, c, _, 0), this.onData(E)) : this.onData(a.shrinkBuf(l.output, l.next_out))), l.avail_in === 0 && l.avail_out === 0 && (w = !0);
              } while ((l.avail_in > 0 || l.avail_out === 0) && g !== h.Z_STREAM_END);
              return g === h.Z_STREAM_END && (b = h.Z_FINISH), b === h.Z_FINISH ? (g = r.inflateEnd(this.strm), this.onEnd(g), this.ended = !0, g === h.Z_OK) : (b === h.Z_SYNC_FLUSH && (this.onEnd(h.Z_OK), l.avail_out = 0), !0);
            }, y.prototype.onData = function(M) {
              this.chunks.push(M);
            }, y.prototype.onEnd = function(M) {
              M === h.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = a.flattenChunks(this.chunks)), this.chunks = [], this.err = M, this.msg = this.strm.msg;
            };
            function A(M, m) {
              var l = new y(m);
              if (l.push(M, !0), l.err)
                throw l.msg || o[l.err];
              return l.result;
            }
            function x(M, m) {
              return m = m || {}, m.raw = !0, A(M, m);
            }
            e.Inflate = y, e.inflate = A, e.inflateRaw = x, e.ungzip = A;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/utils/common.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/utils/common.js ***!
            \********************************************************************/
          /***/
          (n, e) => {
            var t = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
            function r(h, o) {
              return Object.prototype.hasOwnProperty.call(h, o);
            }
            e.assign = function(h) {
              for (var o = Array.prototype.slice.call(arguments, 1); o.length; ) {
                var d = o.shift();
                if (d) {
                  if (typeof d != "object")
                    throw new TypeError(d + "must be non-object");
                  for (var v in d)
                    r(d, v) && (h[v] = d[v]);
                }
              }
              return h;
            }, e.shrinkBuf = function(h, o) {
              return h.length === o ? h : h.subarray ? h.subarray(0, o) : (h.length = o, h);
            };
            var a = {
              arraySet: function(h, o, d, v, f) {
                if (o.subarray && h.subarray) {
                  h.set(o.subarray(d, d + v), f);
                  return;
                }
                for (var y = 0; y < v; y++)
                  h[f + y] = o[d + y];
              },
              // Join array of chunks to single array.
              flattenChunks: function(h) {
                var o, d, v, f, y, A;
                for (v = 0, o = 0, d = h.length; o < d; o++)
                  v += h[o].length;
                for (A = new Uint8Array(v), f = 0, o = 0, d = h.length; o < d; o++)
                  y = h[o], A.set(y, f), f += y.length;
                return A;
              }
            }, s = {
              arraySet: function(h, o, d, v, f) {
                for (var y = 0; y < v; y++)
                  h[f + y] = o[d + y];
              },
              // Join array of chunks to single array.
              flattenChunks: function(h) {
                return [].concat.apply([], h);
              }
            };
            e.setTyped = function(h) {
              h ? (e.Buf8 = Uint8Array, e.Buf16 = Uint16Array, e.Buf32 = Int32Array, e.assign(e, a)) : (e.Buf8 = Array, e.Buf16 = Array, e.Buf32 = Array, e.assign(e, s));
            }, e.setTyped(t);
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/utils/strings.js ***!
            \*********************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ./common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), a = !0, s = !0;
            try {
              String.fromCharCode.apply(null, [0]);
            } catch {
              a = !1;
            }
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch {
              s = !1;
            }
            for (var h = new r.Buf8(256), o = 0; o < 256; o++)
              h[o] = o >= 252 ? 6 : o >= 248 ? 5 : o >= 240 ? 4 : o >= 224 ? 3 : o >= 192 ? 2 : 1;
            h[254] = h[254] = 1, e.string2buf = function(v) {
              var f, y, A, x, M, m = v.length, l = 0;
              for (x = 0; x < m; x++)
                y = v.charCodeAt(x), (y & 64512) === 55296 && x + 1 < m && (A = v.charCodeAt(x + 1), (A & 64512) === 56320 && (y = 65536 + (y - 55296 << 10) + (A - 56320), x++)), l += y < 128 ? 1 : y < 2048 ? 2 : y < 65536 ? 3 : 4;
              for (f = new r.Buf8(l), M = 0, x = 0; M < l; x++)
                y = v.charCodeAt(x), (y & 64512) === 55296 && x + 1 < m && (A = v.charCodeAt(x + 1), (A & 64512) === 56320 && (y = 65536 + (y - 55296 << 10) + (A - 56320), x++)), y < 128 ? f[M++] = y : y < 2048 ? (f[M++] = 192 | y >>> 6, f[M++] = 128 | y & 63) : y < 65536 ? (f[M++] = 224 | y >>> 12, f[M++] = 128 | y >>> 6 & 63, f[M++] = 128 | y & 63) : (f[M++] = 240 | y >>> 18, f[M++] = 128 | y >>> 12 & 63, f[M++] = 128 | y >>> 6 & 63, f[M++] = 128 | y & 63);
              return f;
            };
            function d(v, f) {
              if (f < 65534 && (v.subarray && s || !v.subarray && a))
                return String.fromCharCode.apply(null, r.shrinkBuf(v, f));
              for (var y = "", A = 0; A < f; A++)
                y += String.fromCharCode(v[A]);
              return y;
            }
            e.buf2binstring = function(v) {
              return d(v, v.length);
            }, e.binstring2buf = function(v) {
              for (var f = new r.Buf8(v.length), y = 0, A = f.length; y < A; y++)
                f[y] = v.charCodeAt(y);
              return f;
            }, e.buf2string = function(v, f) {
              var y, A, x, M, m = f || v.length, l = new Array(m * 2);
              for (A = 0, y = 0; y < m; ) {
                if (x = v[y++], x < 128) {
                  l[A++] = x;
                  continue;
                }
                if (M = h[x], M > 4) {
                  l[A++] = 65533, y += M - 1;
                  continue;
                }
                for (x &= M === 2 ? 31 : M === 3 ? 15 : 7; M > 1 && y < m; )
                  x = x << 6 | v[y++] & 63, M--;
                if (M > 1) {
                  l[A++] = 65533;
                  continue;
                }
                x < 65536 ? l[A++] = x : (x -= 65536, l[A++] = 55296 | x >> 10 & 1023, l[A++] = 56320 | x & 1023);
              }
              return d(l, A);
            }, e.utf8border = function(v, f) {
              var y;
              for (f = f || v.length, f > v.length && (f = v.length), y = f - 1; y >= 0 && (v[y] & 192) === 128; )
                y--;
              return y < 0 || y === 0 ? f : y + h[v[y]] > f ? y : f;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js ***!
            \********************************************************************/
          /***/
          (n) => {
            function e(t, r, a, s) {
              for (var h = t & 65535 | 0, o = t >>> 16 & 65535 | 0, d = 0; a !== 0; ) {
                d = a > 2e3 ? 2e3 : a, a -= d;
                do
                  h = h + r[s++] | 0, o = o + h | 0;
                while (--d);
                h %= 65521, o %= 65521;
              }
              return h | o << 16 | 0;
            }
            n.exports = e;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js": (
          /*!**********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js ***!
            \**********************************************************************/
          /***/
          (n) => {
            n.exports = {
              /* Allowed flush values; see deflate() and inflate() below for details */
              Z_NO_FLUSH: 0,
              Z_PARTIAL_FLUSH: 1,
              Z_SYNC_FLUSH: 2,
              Z_FULL_FLUSH: 3,
              Z_FINISH: 4,
              Z_BLOCK: 5,
              Z_TREES: 6,
              /* Return codes for the compression/decompression functions. Negative values
              * are errors, positive values are used for special but normal events.
              */
              Z_OK: 0,
              Z_STREAM_END: 1,
              Z_NEED_DICT: 2,
              Z_ERRNO: -1,
              Z_STREAM_ERROR: -2,
              Z_DATA_ERROR: -3,
              //Z_MEM_ERROR:     -4,
              Z_BUF_ERROR: -5,
              //Z_VERSION_ERROR: -6,
              /* compression levels */
              Z_NO_COMPRESSION: 0,
              Z_BEST_SPEED: 1,
              Z_BEST_COMPRESSION: 9,
              Z_DEFAULT_COMPRESSION: -1,
              Z_FILTERED: 1,
              Z_HUFFMAN_ONLY: 2,
              Z_RLE: 3,
              Z_FIXED: 4,
              Z_DEFAULT_STRATEGY: 0,
              /* Possible values of the data_type field (though see inflate()) */
              Z_BINARY: 0,
              Z_TEXT: 1,
              //Z_ASCII:                1, // = Z_TEXT (deprecated)
              Z_UNKNOWN: 2,
              /* The deflate compression method */
              Z_DEFLATED: 8
              //Z_NULL:                 null // Use -1 or null inline, depending on var type
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js": (
          /*!******************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js ***!
            \******************************************************************/
          /***/
          (n) => {
            function e() {
              for (var a, s = [], h = 0; h < 256; h++) {
                a = h;
                for (var o = 0; o < 8; o++)
                  a = a & 1 ? 3988292384 ^ a >>> 1 : a >>> 1;
                s[h] = a;
              }
              return s;
            }
            var t = e();
            function r(a, s, h, o) {
              var d = t, v = o + h;
              a ^= -1;
              for (var f = o; f < v; f++)
                a = a >>> 8 ^ d[(a ^ s[f]) & 255];
              return a ^ -1;
            }
            n.exports = r;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js ***!
            \********************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), a = t(
              /*! ./trees */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js"
            ), s = t(
              /*! ./adler32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js"
            ), h = t(
              /*! ./crc32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js"
            ), o = t(
              /*! ./messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), d = 0, v = 1, f = 3, y = 4, A = 5, x = 0, M = 1, m = -2, l = -3, u = -5, p = -1, g = 1, b = 2, c = 3, _ = 4, E = 0, w = 2, k = 8, $ = 9, L = 15, z = 8, F = 29, R = 256, P = R + 1 + F, U = 30, N = 19, B = 2 * P + 1, W = 15, V = 3, G = 258, H = G + V + 1, Q = 32, te = 42, ee = 69, ce = 73, fe = 91, oe = 103, he = 113, Ae = 666, Se = 1, Ie = 2, pe = 3, le = 4, ne = 3;
            function Te(I, we) {
              return I.msg = o[we], we;
            }
            function Oe(I) {
              return (I << 1) - (I > 4 ? 9 : 0);
            }
            function Be(I) {
              for (var we = I.length; --we >= 0; )
                I[we] = 0;
            }
            function Ue(I) {
              var we = I.state, ve = we.pending;
              ve > I.avail_out && (ve = I.avail_out), ve !== 0 && (r.arraySet(I.output, we.pending_buf, we.pending_out, ve, I.next_out), I.next_out += ve, we.pending_out += ve, I.total_out += ve, I.avail_out -= ve, we.pending -= ve, we.pending === 0 && (we.pending_out = 0));
            }
            function Pe(I, we) {
              a._tr_flush_block(I, I.block_start >= 0 ? I.block_start : -1, I.strstart - I.block_start, we), I.block_start = I.strstart, Ue(I.strm);
            }
            function Ge(I, we) {
              I.pending_buf[I.pending++] = we;
            }
            function Ne(I, we) {
              I.pending_buf[I.pending++] = we >>> 8 & 255, I.pending_buf[I.pending++] = we & 255;
            }
            function Re(I, we, ve, Y) {
              var de = I.avail_in;
              return de > Y && (de = Y), de === 0 ? 0 : (I.avail_in -= de, r.arraySet(we, I.input, I.next_in, de, ve), I.state.wrap === 1 ? I.adler = s(I.adler, we, de, ve) : I.state.wrap === 2 && (I.adler = h(I.adler, we, de, ve)), I.next_in += de, I.total_in += de, de);
            }
            function De(I, we) {
              var ve = I.max_chain_length, Y = I.strstart, de, Me, Ye = I.prev_length, Ze = I.nice_match, Ke = I.strstart > I.w_size - H ? I.strstart - (I.w_size - H) : 0, rt = I.window, wt = I.w_mask, st = I.prev, ot = I.strstart + G, at = rt[Y + Ye - 1], Mt = rt[Y + Ye];
              I.prev_length >= I.good_match && (ve >>= 2), Ze > I.lookahead && (Ze = I.lookahead);
              do
                if (de = we, !(rt[de + Ye] !== Mt || rt[de + Ye - 1] !== at || rt[de] !== rt[Y] || rt[++de] !== rt[Y + 1])) {
                  Y += 2, de++;
                  do
                    ;
                  while (rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && rt[++Y] === rt[++de] && Y < ot);
                  if (Me = G - (ot - Y), Y = ot - G, Me > Ye) {
                    if (I.match_start = we, Ye = Me, Me >= Ze)
                      break;
                    at = rt[Y + Ye - 1], Mt = rt[Y + Ye];
                  }
                }
              while ((we = st[we & wt]) > Ke && --ve !== 0);
              return Ye <= I.lookahead ? Ye : I.lookahead;
            }
            function je(I) {
              var we = I.w_size, ve, Y, de, Me, Ye;
              do {
                if (Me = I.window_size - I.lookahead - I.strstart, I.strstart >= we + (we - H)) {
                  r.arraySet(I.window, I.window, we, we, 0), I.match_start -= we, I.strstart -= we, I.block_start -= we, Y = I.hash_size, ve = Y;
                  do
                    de = I.head[--ve], I.head[ve] = de >= we ? de - we : 0;
                  while (--Y);
                  Y = we, ve = Y;
                  do
                    de = I.prev[--ve], I.prev[ve] = de >= we ? de - we : 0;
                  while (--Y);
                  Me += we;
                }
                if (I.strm.avail_in === 0)
                  break;
                if (Y = Re(I.strm, I.window, I.strstart + I.lookahead, Me), I.lookahead += Y, I.lookahead + I.insert >= V)
                  for (Ye = I.strstart - I.insert, I.ins_h = I.window[Ye], I.ins_h = (I.ins_h << I.hash_shift ^ I.window[Ye + 1]) & I.hash_mask; I.insert && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[Ye + V - 1]) & I.hash_mask, I.prev[Ye & I.w_mask] = I.head[I.ins_h], I.head[I.ins_h] = Ye, Ye++, I.insert--, !(I.lookahead + I.insert < V)); )
                    ;
              } while (I.lookahead < H && I.strm.avail_in !== 0);
            }
            function Xe(I, we) {
              var ve = 65535;
              for (ve > I.pending_buf_size - 5 && (ve = I.pending_buf_size - 5); ; ) {
                if (I.lookahead <= 1) {
                  if (je(I), I.lookahead === 0 && we === d)
                    return Se;
                  if (I.lookahead === 0)
                    break;
                }
                I.strstart += I.lookahead, I.lookahead = 0;
                var Y = I.block_start + ve;
                if ((I.strstart === 0 || I.strstart >= Y) && (I.lookahead = I.strstart - Y, I.strstart = Y, Pe(I, !1), I.strm.avail_out === 0) || I.strstart - I.block_start >= I.w_size - H && (Pe(I, !1), I.strm.avail_out === 0))
                  return Se;
              }
              return I.insert = 0, we === y ? (Pe(I, !0), I.strm.avail_out === 0 ? pe : le) : (I.strstart > I.block_start && (Pe(I, !1), I.strm.avail_out === 0), Se);
            }
            function X(I, we) {
              for (var ve, Y; ; ) {
                if (I.lookahead < H) {
                  if (je(I), I.lookahead < H && we === d)
                    return Se;
                  if (I.lookahead === 0)
                    break;
                }
                if (ve = 0, I.lookahead >= V && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + V - 1]) & I.hash_mask, ve = I.prev[I.strstart & I.w_mask] = I.head[I.ins_h], I.head[I.ins_h] = I.strstart), ve !== 0 && I.strstart - ve <= I.w_size - H && (I.match_length = De(I, ve)), I.match_length >= V)
                  if (Y = a._tr_tally(I, I.strstart - I.match_start, I.match_length - V), I.lookahead -= I.match_length, I.match_length <= I.max_lazy_match && I.lookahead >= V) {
                    I.match_length--;
                    do
                      I.strstart++, I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + V - 1]) & I.hash_mask, ve = I.prev[I.strstart & I.w_mask] = I.head[I.ins_h], I.head[I.ins_h] = I.strstart;
                    while (--I.match_length !== 0);
                    I.strstart++;
                  } else
                    I.strstart += I.match_length, I.match_length = 0, I.ins_h = I.window[I.strstart], I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + 1]) & I.hash_mask;
                else
                  Y = a._tr_tally(I, 0, I.window[I.strstart]), I.lookahead--, I.strstart++;
                if (Y && (Pe(I, !1), I.strm.avail_out === 0))
                  return Se;
              }
              return I.insert = I.strstart < V - 1 ? I.strstart : V - 1, we === y ? (Pe(I, !0), I.strm.avail_out === 0 ? pe : le) : I.last_lit && (Pe(I, !1), I.strm.avail_out === 0) ? Se : Ie;
            }
            function q(I, we) {
              for (var ve, Y, de; ; ) {
                if (I.lookahead < H) {
                  if (je(I), I.lookahead < H && we === d)
                    return Se;
                  if (I.lookahead === 0)
                    break;
                }
                if (ve = 0, I.lookahead >= V && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + V - 1]) & I.hash_mask, ve = I.prev[I.strstart & I.w_mask] = I.head[I.ins_h], I.head[I.ins_h] = I.strstart), I.prev_length = I.match_length, I.prev_match = I.match_start, I.match_length = V - 1, ve !== 0 && I.prev_length < I.max_lazy_match && I.strstart - ve <= I.w_size - H && (I.match_length = De(I, ve), I.match_length <= 5 && (I.strategy === g || I.match_length === V && I.strstart - I.match_start > 4096) && (I.match_length = V - 1)), I.prev_length >= V && I.match_length <= I.prev_length) {
                  de = I.strstart + I.lookahead - V, Y = a._tr_tally(I, I.strstart - 1 - I.prev_match, I.prev_length - V), I.lookahead -= I.prev_length - 1, I.prev_length -= 2;
                  do
                    ++I.strstart <= de && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + V - 1]) & I.hash_mask, ve = I.prev[I.strstart & I.w_mask] = I.head[I.ins_h], I.head[I.ins_h] = I.strstart);
                  while (--I.prev_length !== 0);
                  if (I.match_available = 0, I.match_length = V - 1, I.strstart++, Y && (Pe(I, !1), I.strm.avail_out === 0))
                    return Se;
                } else if (I.match_available) {
                  if (Y = a._tr_tally(I, 0, I.window[I.strstart - 1]), Y && Pe(I, !1), I.strstart++, I.lookahead--, I.strm.avail_out === 0)
                    return Se;
                } else
                  I.match_available = 1, I.strstart++, I.lookahead--;
              }
              return I.match_available && (Y = a._tr_tally(I, 0, I.window[I.strstart - 1]), I.match_available = 0), I.insert = I.strstart < V - 1 ? I.strstart : V - 1, we === y ? (Pe(I, !0), I.strm.avail_out === 0 ? pe : le) : I.last_lit && (Pe(I, !1), I.strm.avail_out === 0) ? Se : Ie;
            }
            function re(I, we) {
              for (var ve, Y, de, Me, Ye = I.window; ; ) {
                if (I.lookahead <= G) {
                  if (je(I), I.lookahead <= G && we === d)
                    return Se;
                  if (I.lookahead === 0)
                    break;
                }
                if (I.match_length = 0, I.lookahead >= V && I.strstart > 0 && (de = I.strstart - 1, Y = Ye[de], Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de])) {
                  Me = I.strstart + G;
                  do
                    ;
                  while (Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de] && Y === Ye[++de] && de < Me);
                  I.match_length = G - (Me - de), I.match_length > I.lookahead && (I.match_length = I.lookahead);
                }
                if (I.match_length >= V ? (ve = a._tr_tally(I, 1, I.match_length - V), I.lookahead -= I.match_length, I.strstart += I.match_length, I.match_length = 0) : (ve = a._tr_tally(I, 0, I.window[I.strstart]), I.lookahead--, I.strstart++), ve && (Pe(I, !1), I.strm.avail_out === 0))
                  return Se;
              }
              return I.insert = 0, we === y ? (Pe(I, !0), I.strm.avail_out === 0 ? pe : le) : I.last_lit && (Pe(I, !1), I.strm.avail_out === 0) ? Se : Ie;
            }
            function ye(I, we) {
              for (var ve; ; ) {
                if (I.lookahead === 0 && (je(I), I.lookahead === 0)) {
                  if (we === d)
                    return Se;
                  break;
                }
                if (I.match_length = 0, ve = a._tr_tally(I, 0, I.window[I.strstart]), I.lookahead--, I.strstart++, ve && (Pe(I, !1), I.strm.avail_out === 0))
                  return Se;
              }
              return I.insert = 0, we === y ? (Pe(I, !0), I.strm.avail_out === 0 ? pe : le) : I.last_lit && (Pe(I, !1), I.strm.avail_out === 0) ? Se : Ie;
            }
            function me(I, we, ve, Y, de) {
              this.good_length = I, this.max_lazy = we, this.nice_length = ve, this.max_chain = Y, this.func = de;
            }
            var ze;
            ze = [
              /*      good lazy nice chain */
              new me(0, 0, 0, 0, Xe),
              /* 0 store only */
              new me(4, 4, 8, 4, X),
              /* 1 max speed, no lazy matches */
              new me(4, 5, 16, 8, X),
              /* 2 */
              new me(4, 6, 32, 32, X),
              /* 3 */
              new me(4, 4, 16, 16, q),
              /* 4 lazy matches */
              new me(8, 16, 32, 32, q),
              /* 5 */
              new me(8, 16, 128, 128, q),
              /* 6 */
              new me(8, 32, 128, 256, q),
              /* 7 */
              new me(32, 128, 258, 1024, q),
              /* 8 */
              new me(32, 258, 258, 4096, q)
              /* 9 max compression */
            ];
            function ke(I) {
              I.window_size = 2 * I.w_size, Be(I.head), I.max_lazy_match = ze[I.level].max_lazy, I.good_match = ze[I.level].good_length, I.nice_match = ze[I.level].nice_length, I.max_chain_length = ze[I.level].max_chain, I.strstart = 0, I.block_start = 0, I.lookahead = 0, I.insert = 0, I.match_length = I.prev_length = V - 1, I.match_available = 0, I.ins_h = 0;
            }
            function K() {
              this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = k, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new r.Buf16(B * 2), this.dyn_dtree = new r.Buf16((2 * U + 1) * 2), this.bl_tree = new r.Buf16((2 * N + 1) * 2), Be(this.dyn_ltree), Be(this.dyn_dtree), Be(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new r.Buf16(W + 1), this.heap = new r.Buf16(2 * P + 1), Be(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new r.Buf16(2 * P + 1), Be(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
            }
            function ae(I) {
              var we;
              return !I || !I.state ? Te(I, m) : (I.total_in = I.total_out = 0, I.data_type = w, we = I.state, we.pending = 0, we.pending_out = 0, we.wrap < 0 && (we.wrap = -we.wrap), we.status = we.wrap ? te : he, I.adler = we.wrap === 2 ? 0 : 1, we.last_flush = d, a._tr_init(we), x);
            }
            function ge(I) {
              var we = ae(I);
              return we === x && ke(I.state), we;
            }
            function xe(I, we) {
              return !I || !I.state || I.state.wrap !== 2 ? m : (I.state.gzhead = we, x);
            }
            function ue(I, we, ve, Y, de, Me) {
              if (!I)
                return m;
              var Ye = 1;
              if (we === p && (we = 6), Y < 0 ? (Ye = 0, Y = -Y) : Y > 15 && (Ye = 2, Y -= 16), de < 1 || de > $ || ve !== k || Y < 8 || Y > 15 || we < 0 || we > 9 || Me < 0 || Me > _)
                return Te(I, m);
              Y === 8 && (Y = 9);
              var Ze = new K();
              return I.state = Ze, Ze.strm = I, Ze.wrap = Ye, Ze.gzhead = null, Ze.w_bits = Y, Ze.w_size = 1 << Ze.w_bits, Ze.w_mask = Ze.w_size - 1, Ze.hash_bits = de + 7, Ze.hash_size = 1 << Ze.hash_bits, Ze.hash_mask = Ze.hash_size - 1, Ze.hash_shift = ~~((Ze.hash_bits + V - 1) / V), Ze.window = new r.Buf8(Ze.w_size * 2), Ze.head = new r.Buf16(Ze.hash_size), Ze.prev = new r.Buf16(Ze.w_size), Ze.lit_bufsize = 1 << de + 6, Ze.pending_buf_size = Ze.lit_bufsize * 4, Ze.pending_buf = new r.Buf8(Ze.pending_buf_size), Ze.d_buf = 1 * Ze.lit_bufsize, Ze.l_buf = 3 * Ze.lit_bufsize, Ze.level = we, Ze.strategy = Me, Ze.method = ve, ge(I);
            }
            function Ce(I, we) {
              return ue(I, we, k, L, z, E);
            }
            function Z(I, we) {
              var ve, Y, de, Me;
              if (!I || !I.state || we > A || we < 0)
                return I ? Te(I, m) : m;
              if (Y = I.state, !I.output || !I.input && I.avail_in !== 0 || Y.status === Ae && we !== y)
                return Te(I, I.avail_out === 0 ? u : m);
              if (Y.strm = I, ve = Y.last_flush, Y.last_flush = we, Y.status === te)
                if (Y.wrap === 2)
                  I.adler = 0, Ge(Y, 31), Ge(Y, 139), Ge(Y, 8), Y.gzhead ? (Ge(
                    Y,
                    (Y.gzhead.text ? 1 : 0) + (Y.gzhead.hcrc ? 2 : 0) + (Y.gzhead.extra ? 4 : 0) + (Y.gzhead.name ? 8 : 0) + (Y.gzhead.comment ? 16 : 0)
                  ), Ge(Y, Y.gzhead.time & 255), Ge(Y, Y.gzhead.time >> 8 & 255), Ge(Y, Y.gzhead.time >> 16 & 255), Ge(Y, Y.gzhead.time >> 24 & 255), Ge(Y, Y.level === 9 ? 2 : Y.strategy >= b || Y.level < 2 ? 4 : 0), Ge(Y, Y.gzhead.os & 255), Y.gzhead.extra && Y.gzhead.extra.length && (Ge(Y, Y.gzhead.extra.length & 255), Ge(Y, Y.gzhead.extra.length >> 8 & 255)), Y.gzhead.hcrc && (I.adler = h(I.adler, Y.pending_buf, Y.pending, 0)), Y.gzindex = 0, Y.status = ee) : (Ge(Y, 0), Ge(Y, 0), Ge(Y, 0), Ge(Y, 0), Ge(Y, 0), Ge(Y, Y.level === 9 ? 2 : Y.strategy >= b || Y.level < 2 ? 4 : 0), Ge(Y, ne), Y.status = he);
                else {
                  var Ye = k + (Y.w_bits - 8 << 4) << 8, Ze = -1;
                  Y.strategy >= b || Y.level < 2 ? Ze = 0 : Y.level < 6 ? Ze = 1 : Y.level === 6 ? Ze = 2 : Ze = 3, Ye |= Ze << 6, Y.strstart !== 0 && (Ye |= Q), Ye += 31 - Ye % 31, Y.status = he, Ne(Y, Ye), Y.strstart !== 0 && (Ne(Y, I.adler >>> 16), Ne(Y, I.adler & 65535)), I.adler = 1;
                }
              if (Y.status === ee)
                if (Y.gzhead.extra) {
                  for (de = Y.pending; Y.gzindex < (Y.gzhead.extra.length & 65535) && !(Y.pending === Y.pending_buf_size && (Y.gzhead.hcrc && Y.pending > de && (I.adler = h(I.adler, Y.pending_buf, Y.pending - de, de)), Ue(I), de = Y.pending, Y.pending === Y.pending_buf_size)); )
                    Ge(Y, Y.gzhead.extra[Y.gzindex] & 255), Y.gzindex++;
                  Y.gzhead.hcrc && Y.pending > de && (I.adler = h(I.adler, Y.pending_buf, Y.pending - de, de)), Y.gzindex === Y.gzhead.extra.length && (Y.gzindex = 0, Y.status = ce);
                } else
                  Y.status = ce;
              if (Y.status === ce)
                if (Y.gzhead.name) {
                  de = Y.pending;
                  do {
                    if (Y.pending === Y.pending_buf_size && (Y.gzhead.hcrc && Y.pending > de && (I.adler = h(I.adler, Y.pending_buf, Y.pending - de, de)), Ue(I), de = Y.pending, Y.pending === Y.pending_buf_size)) {
                      Me = 1;
                      break;
                    }
                    Y.gzindex < Y.gzhead.name.length ? Me = Y.gzhead.name.charCodeAt(Y.gzindex++) & 255 : Me = 0, Ge(Y, Me);
                  } while (Me !== 0);
                  Y.gzhead.hcrc && Y.pending > de && (I.adler = h(I.adler, Y.pending_buf, Y.pending - de, de)), Me === 0 && (Y.gzindex = 0, Y.status = fe);
                } else
                  Y.status = fe;
              if (Y.status === fe)
                if (Y.gzhead.comment) {
                  de = Y.pending;
                  do {
                    if (Y.pending === Y.pending_buf_size && (Y.gzhead.hcrc && Y.pending > de && (I.adler = h(I.adler, Y.pending_buf, Y.pending - de, de)), Ue(I), de = Y.pending, Y.pending === Y.pending_buf_size)) {
                      Me = 1;
                      break;
                    }
                    Y.gzindex < Y.gzhead.comment.length ? Me = Y.gzhead.comment.charCodeAt(Y.gzindex++) & 255 : Me = 0, Ge(Y, Me);
                  } while (Me !== 0);
                  Y.gzhead.hcrc && Y.pending > de && (I.adler = h(I.adler, Y.pending_buf, Y.pending - de, de)), Me === 0 && (Y.status = oe);
                } else
                  Y.status = oe;
              if (Y.status === oe && (Y.gzhead.hcrc ? (Y.pending + 2 > Y.pending_buf_size && Ue(I), Y.pending + 2 <= Y.pending_buf_size && (Ge(Y, I.adler & 255), Ge(Y, I.adler >> 8 & 255), I.adler = 0, Y.status = he)) : Y.status = he), Y.pending !== 0) {
                if (Ue(I), I.avail_out === 0)
                  return Y.last_flush = -1, x;
              } else if (I.avail_in === 0 && Oe(we) <= Oe(ve) && we !== y)
                return Te(I, u);
              if (Y.status === Ae && I.avail_in !== 0)
                return Te(I, u);
              if (I.avail_in !== 0 || Y.lookahead !== 0 || we !== d && Y.status !== Ae) {
                var Ke = Y.strategy === b ? ye(Y, we) : Y.strategy === c ? re(Y, we) : ze[Y.level].func(Y, we);
                if ((Ke === pe || Ke === le) && (Y.status = Ae), Ke === Se || Ke === pe)
                  return I.avail_out === 0 && (Y.last_flush = -1), x;
                if (Ke === Ie && (we === v ? a._tr_align(Y) : we !== A && (a._tr_stored_block(Y, 0, 0, !1), we === f && (Be(Y.head), Y.lookahead === 0 && (Y.strstart = 0, Y.block_start = 0, Y.insert = 0))), Ue(I), I.avail_out === 0))
                  return Y.last_flush = -1, x;
              }
              return we !== y ? x : Y.wrap <= 0 ? M : (Y.wrap === 2 ? (Ge(Y, I.adler & 255), Ge(Y, I.adler >> 8 & 255), Ge(Y, I.adler >> 16 & 255), Ge(Y, I.adler >> 24 & 255), Ge(Y, I.total_in & 255), Ge(Y, I.total_in >> 8 & 255), Ge(Y, I.total_in >> 16 & 255), Ge(Y, I.total_in >> 24 & 255)) : (Ne(Y, I.adler >>> 16), Ne(Y, I.adler & 65535)), Ue(I), Y.wrap > 0 && (Y.wrap = -Y.wrap), Y.pending !== 0 ? x : M);
            }
            function Fe(I) {
              var we;
              return !I || !I.state ? m : (we = I.state.status, we !== te && we !== ee && we !== ce && we !== fe && we !== oe && we !== he && we !== Ae ? Te(I, m) : (I.state = null, we === he ? Te(I, l) : x));
            }
            function We(I, we) {
              var ve = we.length, Y, de, Me, Ye, Ze, Ke, rt, wt;
              if (!I || !I.state || (Y = I.state, Ye = Y.wrap, Ye === 2 || Ye === 1 && Y.status !== te || Y.lookahead))
                return m;
              for (Ye === 1 && (I.adler = s(I.adler, we, ve, 0)), Y.wrap = 0, ve >= Y.w_size && (Ye === 0 && (Be(Y.head), Y.strstart = 0, Y.block_start = 0, Y.insert = 0), wt = new r.Buf8(Y.w_size), r.arraySet(wt, we, ve - Y.w_size, Y.w_size, 0), we = wt, ve = Y.w_size), Ze = I.avail_in, Ke = I.next_in, rt = I.input, I.avail_in = ve, I.next_in = 0, I.input = we, je(Y); Y.lookahead >= V; ) {
                de = Y.strstart, Me = Y.lookahead - (V - 1);
                do
                  Y.ins_h = (Y.ins_h << Y.hash_shift ^ Y.window[de + V - 1]) & Y.hash_mask, Y.prev[de & Y.w_mask] = Y.head[Y.ins_h], Y.head[Y.ins_h] = de, de++;
                while (--Me);
                Y.strstart = de, Y.lookahead = V - 1, je(Y);
              }
              return Y.strstart += Y.lookahead, Y.block_start = Y.strstart, Y.insert = Y.lookahead, Y.lookahead = 0, Y.match_length = Y.prev_length = V - 1, Y.match_available = 0, I.next_in = Ke, I.input = rt, I.avail_in = Ze, Y.wrap = Ye, x;
            }
            e.deflateInit = Ce, e.deflateInit2 = ue, e.deflateReset = ge, e.deflateResetKeep = ae, e.deflateSetHeader = xe, e.deflate = Z, e.deflateEnd = Fe, e.deflateSetDictionary = We, e.deflateInfo = "pako deflate (from Nodeca project)";
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js ***!
            \*********************************************************************/
          /***/
          (n) => {
            function e() {
              this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
            }
            n.exports = e;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js ***!
            \********************************************************************/
          /***/
          (n) => {
            var e = 30, t = 12;
            n.exports = function(a, s) {
              var h, o, d, v, f, y, A, x, M, m, l, u, p, g, b, c, _, E, w, k, $, L, z, F, R;
              h = a.state, o = a.next_in, F = a.input, d = o + (a.avail_in - 5), v = a.next_out, R = a.output, f = v - (s - a.avail_out), y = v + (a.avail_out - 257), A = h.dmax, x = h.wsize, M = h.whave, m = h.wnext, l = h.window, u = h.hold, p = h.bits, g = h.lencode, b = h.distcode, c = (1 << h.lenbits) - 1, _ = (1 << h.distbits) - 1;
              e:
                do {
                  p < 15 && (u += F[o++] << p, p += 8, u += F[o++] << p, p += 8), E = g[u & c];
                  t:
                    for (; ; ) {
                      if (w = E >>> 24, u >>>= w, p -= w, w = E >>> 16 & 255, w === 0)
                        R[v++] = E & 65535;
                      else if (w & 16) {
                        k = E & 65535, w &= 15, w && (p < w && (u += F[o++] << p, p += 8), k += u & (1 << w) - 1, u >>>= w, p -= w), p < 15 && (u += F[o++] << p, p += 8, u += F[o++] << p, p += 8), E = b[u & _];
                        r:
                          for (; ; ) {
                            if (w = E >>> 24, u >>>= w, p -= w, w = E >>> 16 & 255, w & 16) {
                              if ($ = E & 65535, w &= 15, p < w && (u += F[o++] << p, p += 8, p < w && (u += F[o++] << p, p += 8)), $ += u & (1 << w) - 1, $ > A) {
                                a.msg = "invalid distance too far back", h.mode = e;
                                break e;
                              }
                              if (u >>>= w, p -= w, w = v - f, $ > w) {
                                if (w = $ - w, w > M && h.sane) {
                                  a.msg = "invalid distance too far back", h.mode = e;
                                  break e;
                                }
                                if (L = 0, z = l, m === 0) {
                                  if (L += x - w, w < k) {
                                    k -= w;
                                    do
                                      R[v++] = l[L++];
                                    while (--w);
                                    L = v - $, z = R;
                                  }
                                } else if (m < w) {
                                  if (L += x + m - w, w -= m, w < k) {
                                    k -= w;
                                    do
                                      R[v++] = l[L++];
                                    while (--w);
                                    if (L = 0, m < k) {
                                      w = m, k -= w;
                                      do
                                        R[v++] = l[L++];
                                      while (--w);
                                      L = v - $, z = R;
                                    }
                                  }
                                } else if (L += m - w, w < k) {
                                  k -= w;
                                  do
                                    R[v++] = l[L++];
                                  while (--w);
                                  L = v - $, z = R;
                                }
                                for (; k > 2; )
                                  R[v++] = z[L++], R[v++] = z[L++], R[v++] = z[L++], k -= 3;
                                k && (R[v++] = z[L++], k > 1 && (R[v++] = z[L++]));
                              } else {
                                L = v - $;
                                do
                                  R[v++] = R[L++], R[v++] = R[L++], R[v++] = R[L++], k -= 3;
                                while (k > 2);
                                k && (R[v++] = R[L++], k > 1 && (R[v++] = R[L++]));
                              }
                            } else if (w & 64) {
                              a.msg = "invalid distance code", h.mode = e;
                              break e;
                            } else {
                              E = b[(E & 65535) + (u & (1 << w) - 1)];
                              continue r;
                            }
                            break;
                          }
                      } else if (w & 64)
                        if (w & 32) {
                          h.mode = t;
                          break e;
                        } else {
                          a.msg = "invalid literal/length code", h.mode = e;
                          break e;
                        }
                      else {
                        E = g[(E & 65535) + (u & (1 << w) - 1)];
                        continue t;
                      }
                      break;
                    }
                } while (o < d && v < y);
              k = p >> 3, o -= k, p -= k << 3, u &= (1 << p) - 1, a.next_in = o, a.next_out = v, a.avail_in = o < d ? 5 + (d - o) : 5 - (o - d), a.avail_out = v < y ? 257 + (y - v) : 257 - (v - y), h.hold = u, h.bits = p;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js ***!
            \********************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), a = t(
              /*! ./adler32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js"
            ), s = t(
              /*! ./crc32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js"
            ), h = t(
              /*! ./inffast */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js"
            ), o = t(
              /*! ./inftrees */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js"
            ), d = 0, v = 1, f = 2, y = 4, A = 5, x = 6, M = 0, m = 1, l = 2, u = -2, p = -3, g = -4, b = -5, c = 8, _ = 1, E = 2, w = 3, k = 4, $ = 5, L = 6, z = 7, F = 8, R = 9, P = 10, U = 11, N = 12, B = 13, W = 14, V = 15, G = 16, H = 17, Q = 18, te = 19, ee = 20, ce = 21, fe = 22, oe = 23, he = 24, Ae = 25, Se = 26, Ie = 27, pe = 28, le = 29, ne = 30, Te = 31, Oe = 32, Be = 852, Ue = 592, Pe = 15, Ge = Pe;
            function Ne(ue) {
              return (ue >>> 24 & 255) + (ue >>> 8 & 65280) + ((ue & 65280) << 8) + ((ue & 255) << 24);
            }
            function Re() {
              this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new r.Buf16(320), this.work = new r.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
            }
            function De(ue) {
              var Ce;
              return !ue || !ue.state ? u : (Ce = ue.state, ue.total_in = ue.total_out = Ce.total = 0, ue.msg = "", Ce.wrap && (ue.adler = Ce.wrap & 1), Ce.mode = _, Ce.last = 0, Ce.havedict = 0, Ce.dmax = 32768, Ce.head = null, Ce.hold = 0, Ce.bits = 0, Ce.lencode = Ce.lendyn = new r.Buf32(Be), Ce.distcode = Ce.distdyn = new r.Buf32(Ue), Ce.sane = 1, Ce.back = -1, M);
            }
            function je(ue) {
              var Ce;
              return !ue || !ue.state ? u : (Ce = ue.state, Ce.wsize = 0, Ce.whave = 0, Ce.wnext = 0, De(ue));
            }
            function Xe(ue, Ce) {
              var Z, Fe;
              return !ue || !ue.state || (Fe = ue.state, Ce < 0 ? (Z = 0, Ce = -Ce) : (Z = (Ce >> 4) + 1, Ce < 48 && (Ce &= 15)), Ce && (Ce < 8 || Ce > 15)) ? u : (Fe.window !== null && Fe.wbits !== Ce && (Fe.window = null), Fe.wrap = Z, Fe.wbits = Ce, je(ue));
            }
            function X(ue, Ce) {
              var Z, Fe;
              return ue ? (Fe = new Re(), ue.state = Fe, Fe.window = null, Z = Xe(ue, Ce), Z !== M && (ue.state = null), Z) : u;
            }
            function q(ue) {
              return X(ue, Ge);
            }
            var re = !0, ye, me;
            function ze(ue) {
              if (re) {
                var Ce;
                for (ye = new r.Buf32(512), me = new r.Buf32(32), Ce = 0; Ce < 144; )
                  ue.lens[Ce++] = 8;
                for (; Ce < 256; )
                  ue.lens[Ce++] = 9;
                for (; Ce < 280; )
                  ue.lens[Ce++] = 7;
                for (; Ce < 288; )
                  ue.lens[Ce++] = 8;
                for (o(v, ue.lens, 0, 288, ye, 0, ue.work, { bits: 9 }), Ce = 0; Ce < 32; )
                  ue.lens[Ce++] = 5;
                o(f, ue.lens, 0, 32, me, 0, ue.work, { bits: 5 }), re = !1;
              }
              ue.lencode = ye, ue.lenbits = 9, ue.distcode = me, ue.distbits = 5;
            }
            function ke(ue, Ce, Z, Fe) {
              var We, I = ue.state;
              return I.window === null && (I.wsize = 1 << I.wbits, I.wnext = 0, I.whave = 0, I.window = new r.Buf8(I.wsize)), Fe >= I.wsize ? (r.arraySet(I.window, Ce, Z - I.wsize, I.wsize, 0), I.wnext = 0, I.whave = I.wsize) : (We = I.wsize - I.wnext, We > Fe && (We = Fe), r.arraySet(I.window, Ce, Z - Fe, We, I.wnext), Fe -= We, Fe ? (r.arraySet(I.window, Ce, Z - Fe, Fe, 0), I.wnext = Fe, I.whave = I.wsize) : (I.wnext += We, I.wnext === I.wsize && (I.wnext = 0), I.whave < I.wsize && (I.whave += We))), 0;
            }
            function K(ue, Ce) {
              var Z, Fe, We, I, we, ve, Y, de, Me, Ye, Ze, Ke, rt, wt, st = 0, ot, at, Mt, gt, $t, Pt, Et, St, yt = new r.Buf8(4), zt, qe, be = (
                /* permutation of code lengths */
                [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]
              );
              if (!ue || !ue.state || !ue.output || !ue.input && ue.avail_in !== 0)
                return u;
              Z = ue.state, Z.mode === N && (Z.mode = B), we = ue.next_out, We = ue.output, Y = ue.avail_out, I = ue.next_in, Fe = ue.input, ve = ue.avail_in, de = Z.hold, Me = Z.bits, Ye = ve, Ze = Y, St = M;
              e:
                for (; ; )
                  switch (Z.mode) {
                    case _:
                      if (Z.wrap === 0) {
                        Z.mode = B;
                        break;
                      }
                      for (; Me < 16; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      if (Z.wrap & 2 && de === 35615) {
                        Z.check = 0, yt[0] = de & 255, yt[1] = de >>> 8 & 255, Z.check = s(Z.check, yt, 2, 0), de = 0, Me = 0, Z.mode = E;
                        break;
                      }
                      if (Z.flags = 0, Z.head && (Z.head.done = !1), !(Z.wrap & 1) || /* check if zlib header allowed */
                      (((de & 255) << 8) + (de >> 8)) % 31) {
                        ue.msg = "incorrect header check", Z.mode = ne;
                        break;
                      }
                      if ((de & 15) !== c) {
                        ue.msg = "unknown compression method", Z.mode = ne;
                        break;
                      }
                      if (de >>>= 4, Me -= 4, Et = (de & 15) + 8, Z.wbits === 0)
                        Z.wbits = Et;
                      else if (Et > Z.wbits) {
                        ue.msg = "invalid window size", Z.mode = ne;
                        break;
                      }
                      Z.dmax = 1 << Et, ue.adler = Z.check = 1, Z.mode = de & 512 ? P : N, de = 0, Me = 0;
                      break;
                    case E:
                      for (; Me < 16; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      if (Z.flags = de, (Z.flags & 255) !== c) {
                        ue.msg = "unknown compression method", Z.mode = ne;
                        break;
                      }
                      if (Z.flags & 57344) {
                        ue.msg = "unknown header flags set", Z.mode = ne;
                        break;
                      }
                      Z.head && (Z.head.text = de >> 8 & 1), Z.flags & 512 && (yt[0] = de & 255, yt[1] = de >>> 8 & 255, Z.check = s(Z.check, yt, 2, 0)), de = 0, Me = 0, Z.mode = w;
                    case w:
                      for (; Me < 32; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      Z.head && (Z.head.time = de), Z.flags & 512 && (yt[0] = de & 255, yt[1] = de >>> 8 & 255, yt[2] = de >>> 16 & 255, yt[3] = de >>> 24 & 255, Z.check = s(Z.check, yt, 4, 0)), de = 0, Me = 0, Z.mode = k;
                    case k:
                      for (; Me < 16; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      Z.head && (Z.head.xflags = de & 255, Z.head.os = de >> 8), Z.flags & 512 && (yt[0] = de & 255, yt[1] = de >>> 8 & 255, Z.check = s(Z.check, yt, 2, 0)), de = 0, Me = 0, Z.mode = $;
                    case $:
                      if (Z.flags & 1024) {
                        for (; Me < 16; ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        Z.length = de, Z.head && (Z.head.extra_len = de), Z.flags & 512 && (yt[0] = de & 255, yt[1] = de >>> 8 & 255, Z.check = s(Z.check, yt, 2, 0)), de = 0, Me = 0;
                      } else Z.head && (Z.head.extra = null);
                      Z.mode = L;
                    case L:
                      if (Z.flags & 1024 && (Ke = Z.length, Ke > ve && (Ke = ve), Ke && (Z.head && (Et = Z.head.extra_len - Z.length, Z.head.extra || (Z.head.extra = new Array(Z.head.extra_len)), r.arraySet(
                        Z.head.extra,
                        Fe,
                        I,
                        // extra field is limited to 65536 bytes
                        // - no need for additional size check
                        Ke,
                        /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                        Et
                      )), Z.flags & 512 && (Z.check = s(Z.check, Fe, Ke, I)), ve -= Ke, I += Ke, Z.length -= Ke), Z.length))
                        break e;
                      Z.length = 0, Z.mode = z;
                    case z:
                      if (Z.flags & 2048) {
                        if (ve === 0)
                          break e;
                        Ke = 0;
                        do
                          Et = Fe[I + Ke++], Z.head && Et && Z.length < 65536 && (Z.head.name += String.fromCharCode(Et));
                        while (Et && Ke < ve);
                        if (Z.flags & 512 && (Z.check = s(Z.check, Fe, Ke, I)), ve -= Ke, I += Ke, Et)
                          break e;
                      } else Z.head && (Z.head.name = null);
                      Z.length = 0, Z.mode = F;
                    case F:
                      if (Z.flags & 4096) {
                        if (ve === 0)
                          break e;
                        Ke = 0;
                        do
                          Et = Fe[I + Ke++], Z.head && Et && Z.length < 65536 && (Z.head.comment += String.fromCharCode(Et));
                        while (Et && Ke < ve);
                        if (Z.flags & 512 && (Z.check = s(Z.check, Fe, Ke, I)), ve -= Ke, I += Ke, Et)
                          break e;
                      } else Z.head && (Z.head.comment = null);
                      Z.mode = R;
                    case R:
                      if (Z.flags & 512) {
                        for (; Me < 16; ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        if (de !== (Z.check & 65535)) {
                          ue.msg = "header crc mismatch", Z.mode = ne;
                          break;
                        }
                        de = 0, Me = 0;
                      }
                      Z.head && (Z.head.hcrc = Z.flags >> 9 & 1, Z.head.done = !0), ue.adler = Z.check = 0, Z.mode = N;
                      break;
                    case P:
                      for (; Me < 32; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      ue.adler = Z.check = Ne(de), de = 0, Me = 0, Z.mode = U;
                    case U:
                      if (Z.havedict === 0)
                        return ue.next_out = we, ue.avail_out = Y, ue.next_in = I, ue.avail_in = ve, Z.hold = de, Z.bits = Me, l;
                      ue.adler = Z.check = 1, Z.mode = N;
                    case N:
                      if (Ce === A || Ce === x)
                        break e;
                    case B:
                      if (Z.last) {
                        de >>>= Me & 7, Me -= Me & 7, Z.mode = Ie;
                        break;
                      }
                      for (; Me < 3; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      switch (Z.last = de & 1, de >>>= 1, Me -= 1, de & 3) {
                        case 0:
                          Z.mode = W;
                          break;
                        case 1:
                          if (ze(Z), Z.mode = ee, Ce === x) {
                            de >>>= 2, Me -= 2;
                            break e;
                          }
                          break;
                        case 2:
                          Z.mode = H;
                          break;
                        case 3:
                          ue.msg = "invalid block type", Z.mode = ne;
                      }
                      de >>>= 2, Me -= 2;
                      break;
                    case W:
                      for (de >>>= Me & 7, Me -= Me & 7; Me < 32; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      if ((de & 65535) !== (de >>> 16 ^ 65535)) {
                        ue.msg = "invalid stored block lengths", Z.mode = ne;
                        break;
                      }
                      if (Z.length = de & 65535, de = 0, Me = 0, Z.mode = V, Ce === x)
                        break e;
                    case V:
                      Z.mode = G;
                    case G:
                      if (Ke = Z.length, Ke) {
                        if (Ke > ve && (Ke = ve), Ke > Y && (Ke = Y), Ke === 0)
                          break e;
                        r.arraySet(We, Fe, I, Ke, we), ve -= Ke, I += Ke, Y -= Ke, we += Ke, Z.length -= Ke;
                        break;
                      }
                      Z.mode = N;
                      break;
                    case H:
                      for (; Me < 14; ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      if (Z.nlen = (de & 31) + 257, de >>>= 5, Me -= 5, Z.ndist = (de & 31) + 1, de >>>= 5, Me -= 5, Z.ncode = (de & 15) + 4, de >>>= 4, Me -= 4, Z.nlen > 286 || Z.ndist > 30) {
                        ue.msg = "too many length or distance symbols", Z.mode = ne;
                        break;
                      }
                      Z.have = 0, Z.mode = Q;
                    case Q:
                      for (; Z.have < Z.ncode; ) {
                        for (; Me < 3; ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        Z.lens[be[Z.have++]] = de & 7, de >>>= 3, Me -= 3;
                      }
                      for (; Z.have < 19; )
                        Z.lens[be[Z.have++]] = 0;
                      if (Z.lencode = Z.lendyn, Z.lenbits = 7, zt = { bits: Z.lenbits }, St = o(d, Z.lens, 0, 19, Z.lencode, 0, Z.work, zt), Z.lenbits = zt.bits, St) {
                        ue.msg = "invalid code lengths set", Z.mode = ne;
                        break;
                      }
                      Z.have = 0, Z.mode = te;
                    case te:
                      for (; Z.have < Z.nlen + Z.ndist; ) {
                        for (; st = Z.lencode[de & (1 << Z.lenbits) - 1], ot = st >>> 24, at = st >>> 16 & 255, Mt = st & 65535, !(ot <= Me); ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        if (Mt < 16)
                          de >>>= ot, Me -= ot, Z.lens[Z.have++] = Mt;
                        else {
                          if (Mt === 16) {
                            for (qe = ot + 2; Me < qe; ) {
                              if (ve === 0)
                                break e;
                              ve--, de += Fe[I++] << Me, Me += 8;
                            }
                            if (de >>>= ot, Me -= ot, Z.have === 0) {
                              ue.msg = "invalid bit length repeat", Z.mode = ne;
                              break;
                            }
                            Et = Z.lens[Z.have - 1], Ke = 3 + (de & 3), de >>>= 2, Me -= 2;
                          } else if (Mt === 17) {
                            for (qe = ot + 3; Me < qe; ) {
                              if (ve === 0)
                                break e;
                              ve--, de += Fe[I++] << Me, Me += 8;
                            }
                            de >>>= ot, Me -= ot, Et = 0, Ke = 3 + (de & 7), de >>>= 3, Me -= 3;
                          } else {
                            for (qe = ot + 7; Me < qe; ) {
                              if (ve === 0)
                                break e;
                              ve--, de += Fe[I++] << Me, Me += 8;
                            }
                            de >>>= ot, Me -= ot, Et = 0, Ke = 11 + (de & 127), de >>>= 7, Me -= 7;
                          }
                          if (Z.have + Ke > Z.nlen + Z.ndist) {
                            ue.msg = "invalid bit length repeat", Z.mode = ne;
                            break;
                          }
                          for (; Ke--; )
                            Z.lens[Z.have++] = Et;
                        }
                      }
                      if (Z.mode === ne)
                        break;
                      if (Z.lens[256] === 0) {
                        ue.msg = "invalid code -- missing end-of-block", Z.mode = ne;
                        break;
                      }
                      if (Z.lenbits = 9, zt = { bits: Z.lenbits }, St = o(v, Z.lens, 0, Z.nlen, Z.lencode, 0, Z.work, zt), Z.lenbits = zt.bits, St) {
                        ue.msg = "invalid literal/lengths set", Z.mode = ne;
                        break;
                      }
                      if (Z.distbits = 6, Z.distcode = Z.distdyn, zt = { bits: Z.distbits }, St = o(f, Z.lens, Z.nlen, Z.ndist, Z.distcode, 0, Z.work, zt), Z.distbits = zt.bits, St) {
                        ue.msg = "invalid distances set", Z.mode = ne;
                        break;
                      }
                      if (Z.mode = ee, Ce === x)
                        break e;
                    case ee:
                      Z.mode = ce;
                    case ce:
                      if (ve >= 6 && Y >= 258) {
                        ue.next_out = we, ue.avail_out = Y, ue.next_in = I, ue.avail_in = ve, Z.hold = de, Z.bits = Me, h(ue, Ze), we = ue.next_out, We = ue.output, Y = ue.avail_out, I = ue.next_in, Fe = ue.input, ve = ue.avail_in, de = Z.hold, Me = Z.bits, Z.mode === N && (Z.back = -1);
                        break;
                      }
                      for (Z.back = 0; st = Z.lencode[de & (1 << Z.lenbits) - 1], ot = st >>> 24, at = st >>> 16 & 255, Mt = st & 65535, !(ot <= Me); ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      if (at && !(at & 240)) {
                        for (gt = ot, $t = at, Pt = Mt; st = Z.lencode[Pt + ((de & (1 << gt + $t) - 1) >> gt)], ot = st >>> 24, at = st >>> 16 & 255, Mt = st & 65535, !(gt + ot <= Me); ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        de >>>= gt, Me -= gt, Z.back += gt;
                      }
                      if (de >>>= ot, Me -= ot, Z.back += ot, Z.length = Mt, at === 0) {
                        Z.mode = Se;
                        break;
                      }
                      if (at & 32) {
                        Z.back = -1, Z.mode = N;
                        break;
                      }
                      if (at & 64) {
                        ue.msg = "invalid literal/length code", Z.mode = ne;
                        break;
                      }
                      Z.extra = at & 15, Z.mode = fe;
                    case fe:
                      if (Z.extra) {
                        for (qe = Z.extra; Me < qe; ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        Z.length += de & (1 << Z.extra) - 1, de >>>= Z.extra, Me -= Z.extra, Z.back += Z.extra;
                      }
                      Z.was = Z.length, Z.mode = oe;
                    case oe:
                      for (; st = Z.distcode[de & (1 << Z.distbits) - 1], ot = st >>> 24, at = st >>> 16 & 255, Mt = st & 65535, !(ot <= Me); ) {
                        if (ve === 0)
                          break e;
                        ve--, de += Fe[I++] << Me, Me += 8;
                      }
                      if (!(at & 240)) {
                        for (gt = ot, $t = at, Pt = Mt; st = Z.distcode[Pt + ((de & (1 << gt + $t) - 1) >> gt)], ot = st >>> 24, at = st >>> 16 & 255, Mt = st & 65535, !(gt + ot <= Me); ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        de >>>= gt, Me -= gt, Z.back += gt;
                      }
                      if (de >>>= ot, Me -= ot, Z.back += ot, at & 64) {
                        ue.msg = "invalid distance code", Z.mode = ne;
                        break;
                      }
                      Z.offset = Mt, Z.extra = at & 15, Z.mode = he;
                    case he:
                      if (Z.extra) {
                        for (qe = Z.extra; Me < qe; ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        Z.offset += de & (1 << Z.extra) - 1, de >>>= Z.extra, Me -= Z.extra, Z.back += Z.extra;
                      }
                      if (Z.offset > Z.dmax) {
                        ue.msg = "invalid distance too far back", Z.mode = ne;
                        break;
                      }
                      Z.mode = Ae;
                    case Ae:
                      if (Y === 0)
                        break e;
                      if (Ke = Ze - Y, Z.offset > Ke) {
                        if (Ke = Z.offset - Ke, Ke > Z.whave && Z.sane) {
                          ue.msg = "invalid distance too far back", Z.mode = ne;
                          break;
                        }
                        Ke > Z.wnext ? (Ke -= Z.wnext, rt = Z.wsize - Ke) : rt = Z.wnext - Ke, Ke > Z.length && (Ke = Z.length), wt = Z.window;
                      } else
                        wt = We, rt = we - Z.offset, Ke = Z.length;
                      Ke > Y && (Ke = Y), Y -= Ke, Z.length -= Ke;
                      do
                        We[we++] = wt[rt++];
                      while (--Ke);
                      Z.length === 0 && (Z.mode = ce);
                      break;
                    case Se:
                      if (Y === 0)
                        break e;
                      We[we++] = Z.length, Y--, Z.mode = ce;
                      break;
                    case Ie:
                      if (Z.wrap) {
                        for (; Me < 32; ) {
                          if (ve === 0)
                            break e;
                          ve--, de |= Fe[I++] << Me, Me += 8;
                        }
                        if (Ze -= Y, ue.total_out += Ze, Z.total += Ze, Ze && (ue.adler = Z.check = /*UPDATE(state.check, put - _out, _out);*/
                        Z.flags ? s(Z.check, We, Ze, we - Ze) : a(Z.check, We, Ze, we - Ze)), Ze = Y, (Z.flags ? de : Ne(de)) !== Z.check) {
                          ue.msg = "incorrect data check", Z.mode = ne;
                          break;
                        }
                        de = 0, Me = 0;
                      }
                      Z.mode = pe;
                    case pe:
                      if (Z.wrap && Z.flags) {
                        for (; Me < 32; ) {
                          if (ve === 0)
                            break e;
                          ve--, de += Fe[I++] << Me, Me += 8;
                        }
                        if (de !== (Z.total & 4294967295)) {
                          ue.msg = "incorrect length check", Z.mode = ne;
                          break;
                        }
                        de = 0, Me = 0;
                      }
                      Z.mode = le;
                    case le:
                      St = m;
                      break e;
                    case ne:
                      St = p;
                      break e;
                    case Te:
                      return g;
                    case Oe:
                    default:
                      return u;
                  }
              return ue.next_out = we, ue.avail_out = Y, ue.next_in = I, ue.avail_in = ve, Z.hold = de, Z.bits = Me, (Z.wsize || Ze !== ue.avail_out && Z.mode < ne && (Z.mode < Ie || Ce !== y)) && ke(ue, ue.output, ue.next_out, Ze - ue.avail_out), Ye -= ue.avail_in, Ze -= ue.avail_out, ue.total_in += Ye, ue.total_out += Ze, Z.total += Ze, Z.wrap && Ze && (ue.adler = Z.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
              Z.flags ? s(Z.check, We, Ze, ue.next_out - Ze) : a(Z.check, We, Ze, ue.next_out - Ze)), ue.data_type = Z.bits + (Z.last ? 64 : 0) + (Z.mode === N ? 128 : 0) + (Z.mode === ee || Z.mode === V ? 256 : 0), (Ye === 0 && Ze === 0 || Ce === y) && St === M && (St = b), St;
            }
            function ae(ue) {
              if (!ue || !ue.state)
                return u;
              var Ce = ue.state;
              return Ce.window && (Ce.window = null), ue.state = null, M;
            }
            function ge(ue, Ce) {
              var Z;
              return !ue || !ue.state || (Z = ue.state, !(Z.wrap & 2)) ? u : (Z.head = Ce, Ce.done = !1, M);
            }
            function xe(ue, Ce) {
              var Z = Ce.length, Fe, We, I;
              return !ue || !ue.state || (Fe = ue.state, Fe.wrap !== 0 && Fe.mode !== U) ? u : Fe.mode === U && (We = 1, We = a(We, Ce, Z, 0), We !== Fe.check) ? p : (I = ke(ue, Ce, Z, Z), I ? (Fe.mode = Te, g) : (Fe.havedict = 1, M));
            }
            e.inflateReset = je, e.inflateReset2 = Xe, e.inflateResetKeep = De, e.inflateInit = q, e.inflateInit2 = X, e.inflate = K, e.inflateEnd = ae, e.inflateGetHeader = ge, e.inflateSetDictionary = xe, e.inflateInfo = "pako inflate (from Nodeca project)";
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js ***!
            \*********************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), a = 15, s = 852, h = 592, o = 0, d = 1, v = 2, f = [
              /* Length codes 257..285 base */
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              13,
              15,
              17,
              19,
              23,
              27,
              31,
              35,
              43,
              51,
              59,
              67,
              83,
              99,
              115,
              131,
              163,
              195,
              227,
              258,
              0,
              0
            ], y = [
              /* Length codes 257..285 extra */
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              17,
              17,
              17,
              17,
              18,
              18,
              18,
              18,
              19,
              19,
              19,
              19,
              20,
              20,
              20,
              20,
              21,
              21,
              21,
              21,
              16,
              72,
              78
            ], A = [
              /* Distance codes 0..29 base */
              1,
              2,
              3,
              4,
              5,
              7,
              9,
              13,
              17,
              25,
              33,
              49,
              65,
              97,
              129,
              193,
              257,
              385,
              513,
              769,
              1025,
              1537,
              2049,
              3073,
              4097,
              6145,
              8193,
              12289,
              16385,
              24577,
              0,
              0
            ], x = [
              /* Distance codes 0..29 extra */
              16,
              16,
              16,
              16,
              17,
              17,
              18,
              18,
              19,
              19,
              20,
              20,
              21,
              21,
              22,
              22,
              23,
              23,
              24,
              24,
              25,
              25,
              26,
              26,
              27,
              27,
              28,
              28,
              29,
              29,
              64,
              64
            ];
            n.exports = function(m, l, u, p, g, b, c, _) {
              var E = _.bits, w = 0, k = 0, $ = 0, L = 0, z = 0, F = 0, R = 0, P = 0, U = 0, N = 0, B, W, V, G, H, Q = null, te = 0, ee, ce = new r.Buf16(a + 1), fe = new r.Buf16(a + 1), oe = null, he = 0, Ae, Se, Ie;
              for (w = 0; w <= a; w++)
                ce[w] = 0;
              for (k = 0; k < p; k++)
                ce[l[u + k]]++;
              for (z = E, L = a; L >= 1 && ce[L] === 0; L--)
                ;
              if (z > L && (z = L), L === 0)
                return g[b++] = 20971520, g[b++] = 20971520, _.bits = 1, 0;
              for ($ = 1; $ < L && ce[$] === 0; $++)
                ;
              for (z < $ && (z = $), P = 1, w = 1; w <= a; w++)
                if (P <<= 1, P -= ce[w], P < 0)
                  return -1;
              if (P > 0 && (m === o || L !== 1))
                return -1;
              for (fe[1] = 0, w = 1; w < a; w++)
                fe[w + 1] = fe[w] + ce[w];
              for (k = 0; k < p; k++)
                l[u + k] !== 0 && (c[fe[l[u + k]]++] = k);
              if (m === o ? (Q = oe = c, ee = 19) : m === d ? (Q = f, te -= 257, oe = y, he -= 257, ee = 256) : (Q = A, oe = x, ee = -1), N = 0, k = 0, w = $, H = b, F = z, R = 0, V = -1, U = 1 << z, G = U - 1, m === d && U > s || m === v && U > h)
                return 1;
              for (; ; ) {
                Ae = w - R, c[k] < ee ? (Se = 0, Ie = c[k]) : c[k] > ee ? (Se = oe[he + c[k]], Ie = Q[te + c[k]]) : (Se = 96, Ie = 0), B = 1 << w - R, W = 1 << F, $ = W;
                do
                  W -= B, g[H + (N >> R) + W] = Ae << 24 | Se << 16 | Ie | 0;
                while (W !== 0);
                for (B = 1 << w - 1; N & B; )
                  B >>= 1;
                if (B !== 0 ? (N &= B - 1, N += B) : N = 0, k++, --ce[w] === 0) {
                  if (w === L)
                    break;
                  w = l[u + c[k]];
                }
                if (w > z && (N & G) !== V) {
                  for (R === 0 && (R = z), H += $, F = w - R, P = 1 << F; F + R < L && (P -= ce[F + R], !(P <= 0)); )
                    F++, P <<= 1;
                  if (U += 1 << F, m === d && U > s || m === v && U > h)
                    return 1;
                  V = N & G, g[V] = z << 24 | F << 16 | H - b | 0;
                }
              }
              return N !== 0 && (g[H + N] = w - R << 24 | 4194304 | 0), _.bits = z, 0;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js ***!
            \*********************************************************************/
          /***/
          (n) => {
            n.exports = {
              2: "need dictionary",
              /* Z_NEED_DICT       2  */
              1: "stream end",
              /* Z_STREAM_END      1  */
              0: "",
              /* Z_OK              0  */
              "-1": "file error",
              /* Z_ERRNO         (-1) */
              "-2": "stream error",
              /* Z_STREAM_ERROR  (-2) */
              "-3": "data error",
              /* Z_DATA_ERROR    (-3) */
              "-4": "insufficient memory",
              /* Z_MEM_ERROR     (-4) */
              "-5": "buffer error",
              /* Z_BUF_ERROR     (-5) */
              "-6": "incompatible version"
              /* Z_VERSION_ERROR (-6) */
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js": (
          /*!******************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js ***!
            \******************************************************************/
          /***/
          (n, e, t) => {
            var r = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), a = 4, s = 0, h = 1, o = 2;
            function d(K) {
              for (var ae = K.length; --ae >= 0; )
                K[ae] = 0;
            }
            var v = 0, f = 1, y = 2, A = 3, x = 258, M = 29, m = 256, l = m + 1 + M, u = 30, p = 19, g = 2 * l + 1, b = 15, c = 16, _ = 7, E = 256, w = 16, k = 17, $ = 18, L = (
              /* extra bits for each length code */
              [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]
            ), z = (
              /* extra bits for each distance code */
              [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]
            ), F = (
              /* extra bits for each bit length code */
              [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]
            ), R = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], P = 512, U = new Array((l + 2) * 2);
            d(U);
            var N = new Array(u * 2);
            d(N);
            var B = new Array(P);
            d(B);
            var W = new Array(x - A + 1);
            d(W);
            var V = new Array(M);
            d(V);
            var G = new Array(u);
            d(G);
            function H(K, ae, ge, xe, ue) {
              this.static_tree = K, this.extra_bits = ae, this.extra_base = ge, this.elems = xe, this.max_length = ue, this.has_stree = K && K.length;
            }
            var Q, te, ee;
            function ce(K, ae) {
              this.dyn_tree = K, this.max_code = 0, this.stat_desc = ae;
            }
            function fe(K) {
              return K < 256 ? B[K] : B[256 + (K >>> 7)];
            }
            function oe(K, ae) {
              K.pending_buf[K.pending++] = ae & 255, K.pending_buf[K.pending++] = ae >>> 8 & 255;
            }
            function he(K, ae, ge) {
              K.bi_valid > c - ge ? (K.bi_buf |= ae << K.bi_valid & 65535, oe(K, K.bi_buf), K.bi_buf = ae >> c - K.bi_valid, K.bi_valid += ge - c) : (K.bi_buf |= ae << K.bi_valid & 65535, K.bi_valid += ge);
            }
            function Ae(K, ae, ge) {
              he(
                K,
                ge[ae * 2],
                ge[ae * 2 + 1]
                /*.Len*/
              );
            }
            function Se(K, ae) {
              var ge = 0;
              do
                ge |= K & 1, K >>>= 1, ge <<= 1;
              while (--ae > 0);
              return ge >>> 1;
            }
            function Ie(K) {
              K.bi_valid === 16 ? (oe(K, K.bi_buf), K.bi_buf = 0, K.bi_valid = 0) : K.bi_valid >= 8 && (K.pending_buf[K.pending++] = K.bi_buf & 255, K.bi_buf >>= 8, K.bi_valid -= 8);
            }
            function pe(K, ae) {
              var ge = ae.dyn_tree, xe = ae.max_code, ue = ae.stat_desc.static_tree, Ce = ae.stat_desc.has_stree, Z = ae.stat_desc.extra_bits, Fe = ae.stat_desc.extra_base, We = ae.stat_desc.max_length, I, we, ve, Y, de, Me, Ye = 0;
              for (Y = 0; Y <= b; Y++)
                K.bl_count[Y] = 0;
              for (ge[K.heap[K.heap_max] * 2 + 1] = 0, I = K.heap_max + 1; I < g; I++)
                we = K.heap[I], Y = ge[ge[we * 2 + 1] * 2 + 1] + 1, Y > We && (Y = We, Ye++), ge[we * 2 + 1] = Y, !(we > xe) && (K.bl_count[Y]++, de = 0, we >= Fe && (de = Z[we - Fe]), Me = ge[we * 2], K.opt_len += Me * (Y + de), Ce && (K.static_len += Me * (ue[we * 2 + 1] + de)));
              if (Ye !== 0) {
                do {
                  for (Y = We - 1; K.bl_count[Y] === 0; )
                    Y--;
                  K.bl_count[Y]--, K.bl_count[Y + 1] += 2, K.bl_count[We]--, Ye -= 2;
                } while (Ye > 0);
                for (Y = We; Y !== 0; Y--)
                  for (we = K.bl_count[Y]; we !== 0; )
                    ve = K.heap[--I], !(ve > xe) && (ge[ve * 2 + 1] !== Y && (K.opt_len += (Y - ge[ve * 2 + 1]) * ge[ve * 2], ge[ve * 2 + 1] = Y), we--);
              }
            }
            function le(K, ae, ge) {
              var xe = new Array(b + 1), ue = 0, Ce, Z;
              for (Ce = 1; Ce <= b; Ce++)
                xe[Ce] = ue = ue + ge[Ce - 1] << 1;
              for (Z = 0; Z <= ae; Z++) {
                var Fe = K[Z * 2 + 1];
                Fe !== 0 && (K[Z * 2] = Se(xe[Fe]++, Fe));
              }
            }
            function ne() {
              var K, ae, ge, xe, ue, Ce = new Array(b + 1);
              for (ge = 0, xe = 0; xe < M - 1; xe++)
                for (V[xe] = ge, K = 0; K < 1 << L[xe]; K++)
                  W[ge++] = xe;
              for (W[ge - 1] = xe, ue = 0, xe = 0; xe < 16; xe++)
                for (G[xe] = ue, K = 0; K < 1 << z[xe]; K++)
                  B[ue++] = xe;
              for (ue >>= 7; xe < u; xe++)
                for (G[xe] = ue << 7, K = 0; K < 1 << z[xe] - 7; K++)
                  B[256 + ue++] = xe;
              for (ae = 0; ae <= b; ae++)
                Ce[ae] = 0;
              for (K = 0; K <= 143; )
                U[K * 2 + 1] = 8, K++, Ce[8]++;
              for (; K <= 255; )
                U[K * 2 + 1] = 9, K++, Ce[9]++;
              for (; K <= 279; )
                U[K * 2 + 1] = 7, K++, Ce[7]++;
              for (; K <= 287; )
                U[K * 2 + 1] = 8, K++, Ce[8]++;
              for (le(U, l + 1, Ce), K = 0; K < u; K++)
                N[K * 2 + 1] = 5, N[K * 2] = Se(K, 5);
              Q = new H(U, L, m + 1, l, b), te = new H(N, z, 0, u, b), ee = new H(new Array(0), F, 0, p, _);
            }
            function Te(K) {
              var ae;
              for (ae = 0; ae < l; ae++)
                K.dyn_ltree[ae * 2] = 0;
              for (ae = 0; ae < u; ae++)
                K.dyn_dtree[ae * 2] = 0;
              for (ae = 0; ae < p; ae++)
                K.bl_tree[ae * 2] = 0;
              K.dyn_ltree[E * 2] = 1, K.opt_len = K.static_len = 0, K.last_lit = K.matches = 0;
            }
            function Oe(K) {
              K.bi_valid > 8 ? oe(K, K.bi_buf) : K.bi_valid > 0 && (K.pending_buf[K.pending++] = K.bi_buf), K.bi_buf = 0, K.bi_valid = 0;
            }
            function Be(K, ae, ge, xe) {
              Oe(K), oe(K, ge), oe(K, ~ge), r.arraySet(K.pending_buf, K.window, ae, ge, K.pending), K.pending += ge;
            }
            function Ue(K, ae, ge, xe) {
              var ue = ae * 2, Ce = ge * 2;
              return K[ue] < K[Ce] || K[ue] === K[Ce] && xe[ae] <= xe[ge];
            }
            function Pe(K, ae, ge) {
              for (var xe = K.heap[ge], ue = ge << 1; ue <= K.heap_len && (ue < K.heap_len && Ue(ae, K.heap[ue + 1], K.heap[ue], K.depth) && ue++, !Ue(ae, xe, K.heap[ue], K.depth)); )
                K.heap[ge] = K.heap[ue], ge = ue, ue <<= 1;
              K.heap[ge] = xe;
            }
            function Ge(K, ae, ge) {
              var xe, ue, Ce = 0, Z, Fe;
              if (K.last_lit !== 0)
                do
                  xe = K.pending_buf[K.d_buf + Ce * 2] << 8 | K.pending_buf[K.d_buf + Ce * 2 + 1], ue = K.pending_buf[K.l_buf + Ce], Ce++, xe === 0 ? Ae(K, ue, ae) : (Z = W[ue], Ae(K, Z + m + 1, ae), Fe = L[Z], Fe !== 0 && (ue -= V[Z], he(K, ue, Fe)), xe--, Z = fe(xe), Ae(K, Z, ge), Fe = z[Z], Fe !== 0 && (xe -= G[Z], he(K, xe, Fe)));
                while (Ce < K.last_lit);
              Ae(K, E, ae);
            }
            function Ne(K, ae) {
              var ge = ae.dyn_tree, xe = ae.stat_desc.static_tree, ue = ae.stat_desc.has_stree, Ce = ae.stat_desc.elems, Z, Fe, We = -1, I;
              for (K.heap_len = 0, K.heap_max = g, Z = 0; Z < Ce; Z++)
                ge[Z * 2] !== 0 ? (K.heap[++K.heap_len] = We = Z, K.depth[Z] = 0) : ge[Z * 2 + 1] = 0;
              for (; K.heap_len < 2; )
                I = K.heap[++K.heap_len] = We < 2 ? ++We : 0, ge[I * 2] = 1, K.depth[I] = 0, K.opt_len--, ue && (K.static_len -= xe[I * 2 + 1]);
              for (ae.max_code = We, Z = K.heap_len >> 1; Z >= 1; Z--)
                Pe(K, ge, Z);
              I = Ce;
              do
                Z = K.heap[
                  1
                  /*SMALLEST*/
                ], K.heap[
                  1
                  /*SMALLEST*/
                ] = K.heap[K.heap_len--], Pe(
                  K,
                  ge,
                  1
                  /*SMALLEST*/
                ), Fe = K.heap[
                  1
                  /*SMALLEST*/
                ], K.heap[--K.heap_max] = Z, K.heap[--K.heap_max] = Fe, ge[I * 2] = ge[Z * 2] + ge[Fe * 2], K.depth[I] = (K.depth[Z] >= K.depth[Fe] ? K.depth[Z] : K.depth[Fe]) + 1, ge[Z * 2 + 1] = ge[Fe * 2 + 1] = I, K.heap[
                  1
                  /*SMALLEST*/
                ] = I++, Pe(
                  K,
                  ge,
                  1
                  /*SMALLEST*/
                );
              while (K.heap_len >= 2);
              K.heap[--K.heap_max] = K.heap[
                1
                /*SMALLEST*/
              ], pe(K, ae), le(ge, We, K.bl_count);
            }
            function Re(K, ae, ge) {
              var xe, ue = -1, Ce, Z = ae[0 * 2 + 1], Fe = 0, We = 7, I = 4;
              for (Z === 0 && (We = 138, I = 3), ae[(ge + 1) * 2 + 1] = 65535, xe = 0; xe <= ge; xe++)
                Ce = Z, Z = ae[(xe + 1) * 2 + 1], !(++Fe < We && Ce === Z) && (Fe < I ? K.bl_tree[Ce * 2] += Fe : Ce !== 0 ? (Ce !== ue && K.bl_tree[Ce * 2]++, K.bl_tree[w * 2]++) : Fe <= 10 ? K.bl_tree[k * 2]++ : K.bl_tree[$ * 2]++, Fe = 0, ue = Ce, Z === 0 ? (We = 138, I = 3) : Ce === Z ? (We = 6, I = 3) : (We = 7, I = 4));
            }
            function De(K, ae, ge) {
              var xe, ue = -1, Ce, Z = ae[0 * 2 + 1], Fe = 0, We = 7, I = 4;
              for (Z === 0 && (We = 138, I = 3), xe = 0; xe <= ge; xe++)
                if (Ce = Z, Z = ae[(xe + 1) * 2 + 1], !(++Fe < We && Ce === Z)) {
                  if (Fe < I)
                    do
                      Ae(K, Ce, K.bl_tree);
                    while (--Fe !== 0);
                  else Ce !== 0 ? (Ce !== ue && (Ae(K, Ce, K.bl_tree), Fe--), Ae(K, w, K.bl_tree), he(K, Fe - 3, 2)) : Fe <= 10 ? (Ae(K, k, K.bl_tree), he(K, Fe - 3, 3)) : (Ae(K, $, K.bl_tree), he(K, Fe - 11, 7));
                  Fe = 0, ue = Ce, Z === 0 ? (We = 138, I = 3) : Ce === Z ? (We = 6, I = 3) : (We = 7, I = 4);
                }
            }
            function je(K) {
              var ae;
              for (Re(K, K.dyn_ltree, K.l_desc.max_code), Re(K, K.dyn_dtree, K.d_desc.max_code), Ne(K, K.bl_desc), ae = p - 1; ae >= 3 && K.bl_tree[R[ae] * 2 + 1] === 0; ae--)
                ;
              return K.opt_len += 3 * (ae + 1) + 5 + 5 + 4, ae;
            }
            function Xe(K, ae, ge, xe) {
              var ue;
              for (he(K, ae - 257, 5), he(K, ge - 1, 5), he(K, xe - 4, 4), ue = 0; ue < xe; ue++)
                he(K, K.bl_tree[R[ue] * 2 + 1], 3);
              De(K, K.dyn_ltree, ae - 1), De(K, K.dyn_dtree, ge - 1);
            }
            function X(K) {
              var ae = 4093624447, ge;
              for (ge = 0; ge <= 31; ge++, ae >>>= 1)
                if (ae & 1 && K.dyn_ltree[ge * 2] !== 0)
                  return s;
              if (K.dyn_ltree[18] !== 0 || K.dyn_ltree[20] !== 0 || K.dyn_ltree[26] !== 0)
                return h;
              for (ge = 32; ge < m; ge++)
                if (K.dyn_ltree[ge * 2] !== 0)
                  return h;
              return s;
            }
            var q = !1;
            function re(K) {
              q || (ne(), q = !0), K.l_desc = new ce(K.dyn_ltree, Q), K.d_desc = new ce(K.dyn_dtree, te), K.bl_desc = new ce(K.bl_tree, ee), K.bi_buf = 0, K.bi_valid = 0, Te(K);
            }
            function ye(K, ae, ge, xe) {
              he(K, (v << 1) + (xe ? 1 : 0), 3), Be(K, ae, ge);
            }
            function me(K) {
              he(K, f << 1, 3), Ae(K, E, U), Ie(K);
            }
            function ze(K, ae, ge, xe) {
              var ue, Ce, Z = 0;
              K.level > 0 ? (K.strm.data_type === o && (K.strm.data_type = X(K)), Ne(K, K.l_desc), Ne(K, K.d_desc), Z = je(K), ue = K.opt_len + 3 + 7 >>> 3, Ce = K.static_len + 3 + 7 >>> 3, Ce <= ue && (ue = Ce)) : ue = Ce = ge + 5, ge + 4 <= ue && ae !== -1 ? ye(K, ae, ge, xe) : K.strategy === a || Ce === ue ? (he(K, (f << 1) + (xe ? 1 : 0), 3), Ge(K, U, N)) : (he(K, (y << 1) + (xe ? 1 : 0), 3), Xe(K, K.l_desc.max_code + 1, K.d_desc.max_code + 1, Z + 1), Ge(K, K.dyn_ltree, K.dyn_dtree)), Te(K), xe && Oe(K);
            }
            function ke(K, ae, ge) {
              return K.pending_buf[K.d_buf + K.last_lit * 2] = ae >>> 8 & 255, K.pending_buf[K.d_buf + K.last_lit * 2 + 1] = ae & 255, K.pending_buf[K.l_buf + K.last_lit] = ge & 255, K.last_lit++, ae === 0 ? K.dyn_ltree[ge * 2]++ : (K.matches++, ae--, K.dyn_ltree[(W[ge] + m + 1) * 2]++, K.dyn_dtree[fe(ae) * 2]++), K.last_lit === K.lit_bufsize - 1;
            }
            e._tr_init = re, e._tr_stored_block = ye, e._tr_flush_block = ze, e._tr_tally = ke, e._tr_align = me;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js ***!
            \********************************************************************/
          /***/
          (n) => {
            function e() {
              this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
            }
            n.exports = e;
          }
        ),
        /***/
        "./src/SurfaceWorker.js": (
          /*!******************************!*\
            !*** ./src/SurfaceWorker.js ***!
            \******************************/
          /***/
          () => {
            $3Dmol.workerString = function() {
              self.onmessage = function(n) {
                var e = n.data, t = e.type;
                if (t < 0)
                  self.atomData = e.atoms, self.volume = e.volume, self.ps = new ProteinSurface();
                else {
                  var r = self.ps;
                  r.initparm(e.expandedExtent, t != 1, self.volume), r.fillvoxels(self.atomData, e.extendedAtoms), r.buildboundary(), (t === 4 || t === 2) && (r.fastdistancemap(), r.boundingatom(!1), r.fillvoxelswaals(self.atomData, e.extendedAtoms)), r.marchingcube(t);
                  var a = r.getFacesAndVertices(e.atomsToShow);
                  self.postMessage(a);
                }
              };
            }.toString().replace(/(^.*?\{|\}$)/g, ""), $3Dmol.workerString += `;
function _classCallCheck() {};`, $3Dmol.workerString += `;
` + $3Dmol.Vector3.toString(), $3Dmol.workerString += `;
` + $3Dmol.MarchingCubeInitializer.toString() + `;

`, $3Dmol.workerString += `;
` + $3Dmol.PointGrid.toString() + `;
`, $3Dmol.workerString += `;
var ProteinSurface = ` + $3Dmol.ProteinSurface.toString() + `;
`, $3Dmol.SurfaceWorker = window.URL ? window.URL.createObjectURL(new Blob([$3Dmol.workerString], { type: "text/javascript" })) : void 0;
          }
        ),
        /***/
        "./src/exporter.js": (
          /*!*************************!*\
            !*** ./src/exporter.js ***!
            \*************************/
          /***/
          (n) => {
            typeof n.exports == "object" && (n.exports = window.$3Dmol);
          }
        ),
        /***/
        "./src/vendor/mmtf.js": (
          /*!****************************!*\
            !*** ./src/vendor/mmtf.js ***!
            \****************************/
          /***/
          function(n, e) {
            (function(t, r) {
              r(e);
            })(this, function(t) {
              function r(X, q, re) {
                for (var ye = (X.byteLength, 0), me = re.length; me > ye; ye++) {
                  var ze = re.charCodeAt(ye);
                  if (128 > ze) X.setUint8(q++, ze >>> 0 & 127 | 0);
                  else if (2048 > ze) X.setUint8(q++, ze >>> 6 & 31 | 192), X.setUint8(q++, ze >>> 0 & 63 | 128);
                  else if (65536 > ze) X.setUint8(q++, ze >>> 12 & 15 | 224), X.setUint8(q++, ze >>> 6 & 63 | 128), X.setUint8(q++, ze >>> 0 & 63 | 128);
                  else {
                    if (!(1114112 > ze)) throw new Error("bad codepoint " + ze);
                    X.setUint8(q++, ze >>> 18 & 7 | 240), X.setUint8(q++, ze >>> 12 & 63 | 128), X.setUint8(q++, ze >>> 6 & 63 | 128), X.setUint8(q++, ze >>> 0 & 63 | 128);
                  }
                }
              }
              function a(X) {
                for (var q = 0, re = 0, ye = X.length; ye > re; re++) {
                  var me = X.charCodeAt(re);
                  if (128 > me) q += 1;
                  else if (2048 > me) q += 2;
                  else if (65536 > me) q += 3;
                  else {
                    if (!(1114112 > me)) throw new Error("bad codepoint " + me);
                    q += 4;
                  }
                }
                return q;
              }
              function s(X, q, re) {
                var ye = typeof X;
                if (ye === "string") {
                  var me = a(X);
                  if (32 > me) return q.setUint8(re, 160 | me), r(q, re + 1, X), 1 + me;
                  if (256 > me) return q.setUint8(re, 217), q.setUint8(re + 1, me), r(q, re + 2, X), 2 + me;
                  if (65536 > me) return q.setUint8(re, 218), q.setUint16(re + 1, me), r(q, re + 3, X), 3 + me;
                  if (4294967296 > me) return q.setUint8(re, 219), q.setUint32(re + 1, me), r(q, re + 5, X), 5 + me;
                }
                if (X instanceof Uint8Array) {
                  var me = X.byteLength, ze = new Uint8Array(q.buffer);
                  if (256 > me) return q.setUint8(re, 196), q.setUint8(re + 1, me), ze.set(X, re + 2), 2 + me;
                  if (65536 > me) return q.setUint8(re, 197), q.setUint16(re + 1, me), ze.set(X, re + 3), 3 + me;
                  if (4294967296 > me) return q.setUint8(re, 198), q.setUint32(re + 1, me), ze.set(X, re + 5), 5 + me;
                }
                if (ye === "number") {
                  if (!isFinite(X)) throw new Error("Number not finite: " + X);
                  if (Math.floor(X) !== X) return q.setUint8(re, 203), q.setFloat64(re + 1, X), 9;
                  if (X >= 0) {
                    if (128 > X) return q.setUint8(re, X), 1;
                    if (256 > X) return q.setUint8(re, 204), q.setUint8(re + 1, X), 2;
                    if (65536 > X) return q.setUint8(re, 205), q.setUint16(re + 1, X), 3;
                    if (4294967296 > X) return q.setUint8(re, 206), q.setUint32(re + 1, X), 5;
                    throw new Error("Number too big 0x" + X.toString(16));
                  }
                  if (X >= -32) return q.setInt8(re, X), 1;
                  if (X >= -128) return q.setUint8(re, 208), q.setInt8(re + 1, X), 2;
                  if (X >= -32768) return q.setUint8(re, 209), q.setInt16(re + 1, X), 3;
                  if (X >= -2147483648) return q.setUint8(re, 210), q.setInt32(re + 1, X), 5;
                  throw new Error("Number too small -0x" + (-X).toString(16).substr(1));
                }
                if (X === null) return q.setUint8(re, 192), 1;
                if (ye === "boolean") return q.setUint8(re, X ? 195 : 194), 1;
                if (ye === "object") {
                  var me, ae = 0, ke = Array.isArray(X);
                  if (ke) me = X.length;
                  else {
                    var K = Object.keys(X);
                    me = K.length;
                  }
                  var ae;
                  if (16 > me ? (q.setUint8(re, me | (ke ? 144 : 128)), ae = 1) : 65536 > me ? (q.setUint8(re, ke ? 220 : 222), q.setUint16(re + 1, me), ae = 3) : 4294967296 > me && (q.setUint8(re, ke ? 221 : 223), q.setUint32(re + 1, me), ae = 5), ke) for (var ge = 0; me > ge; ge++) ae += s(X[ge], q, re + ae);
                  else for (var ge = 0; me > ge; ge++) {
                    var xe = K[ge];
                    ae += s(xe, q, re + ae), ae += s(X[xe], q, re + ae);
                  }
                  return ae;
                }
                throw new Error("Unknown type " + ye);
              }
              function h(X) {
                var q = typeof X;
                if (q === "string") {
                  var re = a(X);
                  if (32 > re) return 1 + re;
                  if (256 > re) return 2 + re;
                  if (65536 > re) return 3 + re;
                  if (4294967296 > re) return 5 + re;
                }
                if (X instanceof Uint8Array) {
                  var re = X.byteLength;
                  if (256 > re) return 2 + re;
                  if (65536 > re) return 3 + re;
                  if (4294967296 > re) return 5 + re;
                }
                if (q === "number") {
                  if (Math.floor(X) !== X) return 9;
                  if (X >= 0) {
                    if (128 > X) return 1;
                    if (256 > X) return 2;
                    if (65536 > X) return 3;
                    if (4294967296 > X) return 5;
                    throw new Error("Number too big 0x" + X.toString(16));
                  }
                  if (X >= -32) return 1;
                  if (X >= -128) return 2;
                  if (X >= -32768) return 3;
                  if (X >= -2147483648) return 5;
                  throw new Error("Number too small -0x" + X.toString(16).substr(1));
                }
                if (q === "boolean" || X === null) return 1;
                if (q === "object") {
                  var re, ye = 0;
                  if (Array.isArray(X)) {
                    re = X.length;
                    for (var me = 0; re > me; me++) ye += h(X[me]);
                  } else {
                    var ze = Object.keys(X);
                    re = ze.length;
                    for (var me = 0; re > me; me++) {
                      var ke = ze[me];
                      ye += h(ke) + h(X[ke]);
                    }
                  }
                  if (16 > re) return 1 + ye;
                  if (65536 > re) return 3 + ye;
                  if (4294967296 > re) return 5 + ye;
                  throw new Error("Array or object too long 0x" + re.toString(16));
                }
                throw new Error("Unknown type " + q);
              }
              function o(X) {
                var q = new ArrayBuffer(h(X)), re = new DataView(q);
                return s(X, re, 0), new Uint8Array(q);
              }
              function d(X, q, re) {
                return q ? new X(q.buffer, q.byteOffset, q.byteLength / (re || 1)) : void 0;
              }
              function v(X) {
                return d(DataView, X);
              }
              function f(X) {
                return d(Uint8Array, X);
              }
              function y(X) {
                return d(Int8Array, X);
              }
              function A(X) {
                return d(Int32Array, X, 4);
              }
              function x(X) {
                return d(Float32Array, X, 4);
              }
              function M(X, q) {
                var re = X.length / 2;
                q || (q = new Int16Array(re));
                for (var ye = 0, me = 0; re > ye; ++ye, me += 2) q[ye] = X[me] << 8 ^ X[me + 1] << 0;
                return q;
              }
              function m(X, q) {
                var re = X.length;
                q || (q = new Uint8Array(2 * re));
                for (var ye = v(q), me = 0; re > me; ++me) ye.setInt16(2 * me, X[me]);
                return f(q);
              }
              function l(X, q) {
                var re = X.length / 4;
                q || (q = new Int32Array(re));
                for (var ye = 0, me = 0; re > ye; ++ye, me += 4) q[ye] = X[me] << 24 ^ X[me + 1] << 16 ^ X[me + 2] << 8 ^ X[me + 3] << 0;
                return q;
              }
              function u(X, q) {
                var re = X.length;
                q || (q = new Uint8Array(4 * re));
                for (var ye = v(q), me = 0; re > me; ++me) ye.setInt32(4 * me, X[me]);
                return f(q);
              }
              function p(X, q) {
                var re = X.length;
                q || (q = new Float32Array(re / 4));
                for (var ye = v(q), me = v(X), ze = 0, ke = 0, K = re / 4; K > ze; ++ze, ke += 4) ye.setFloat32(ke, me.getFloat32(ke), !0);
                return q;
              }
              function g(X, q, re) {
                var ye = X.length, me = 1 / q;
                re || (re = new Float32Array(ye));
                for (var ze = 0; ye > ze; ++ze) re[ze] = X[ze] * me;
                return re;
              }
              function b(X, q, re) {
                var ye = X.length;
                re || (re = new Int32Array(ye));
                for (var me = 0; ye > me; ++me) re[me] = Math.round(X[me] * q);
                return re;
              }
              function c(X, q) {
                var re, ye;
                if (!q) {
                  var me = 0;
                  for (re = 0, ye = X.length; ye > re; re += 2) me += X[re + 1];
                  q = new X.constructor(me);
                }
                var ze = 0;
                for (re = 0, ye = X.length; ye > re; re += 2) for (var ke = X[re], K = X[re + 1], ae = 0; K > ae; ++ae) q[ze] = ke, ++ze;
                return q;
              }
              function _(X) {
                if (X.length === 0) return new Int32Array();
                var q, re, ye = 2;
                for (q = 1, re = X.length; re > q; ++q) X[q - 1] !== X[q] && (ye += 2);
                var me = new Int32Array(ye), ze = 0, ke = 1;
                for (q = 1, re = X.length; re > q; ++q) X[q - 1] !== X[q] ? (me[ze] = X[q - 1], me[ze + 1] = ke, ke = 1, ze += 2) : ++ke;
                return me[ze] = X[X.length - 1], me[ze + 1] = ke, me;
              }
              function E(X, q) {
                var re = X.length;
                q || (q = new X.constructor(re)), re && (q[0] = X[0]);
                for (var ye = 1; re > ye; ++ye) q[ye] = X[ye] + q[ye - 1];
                return q;
              }
              function w(X, q) {
                var re = X.length;
                q || (q = new X.constructor(re)), q[0] = X[0];
                for (var ye = 1; re > ye; ++ye) q[ye] = X[ye] - X[ye - 1];
                return q;
              }
              function k(X, q) {
                var re, ye, me = X instanceof Int8Array ? 127 : 32767, ze = -me - 1, ke = X.length;
                if (!q) {
                  var K = 0;
                  for (re = 0; ke > re; ++re) X[re] < me && X[re] > ze && ++K;
                  q = new Int32Array(K);
                }
                for (re = 0, ye = 0; ke > re; ) {
                  for (var ae = 0; X[re] === me || X[re] === ze; ) ae += X[re], ++re;
                  ae += X[re], ++re, q[ye] = ae, ++ye;
                }
                return q;
              }
              function $(X, q) {
                var re, ye = 32767, me = -ye - 1, ze = X.length, ke = 0;
                for (re = 0; ze > re; ++re) {
                  var K = X[re];
                  K === 0 ? ++ke : K > 0 ? (ke += Math.ceil(K / ye), K % ye === 0 && (ke += 1)) : (ke += Math.ceil(K / me), K % me === 0 && (ke += 1));
                }
                var ae = new Int16Array(ke), ge = 0;
                for (re = 0; ze > re; ++re) {
                  var K = X[re];
                  if (K >= 0) for (; K >= ye; ) ae[ge] = ye, ++ge, K -= ye;
                  else for (; me >= K; ) ae[ge] = me, ++ge, K -= me;
                  ae[ge] = K, ++ge;
                }
                return ae;
              }
              function L(X, q) {
                return E(c(X), q);
              }
              function z(X) {
                return _(w(X));
              }
              function F(X, q, re) {
                return g(c(X, A(re)), q, re);
              }
              function R(X, q) {
                return _(b(X, q));
              }
              function P(X, q, re) {
                return g(E(X, A(re)), q, re);
              }
              function U(X, q, re) {
                return w(b(X, q), re);
              }
              function N(X, q, re) {
                return g(k(X, A(re)), q, re);
              }
              function B(X, q, re) {
                var ye = k(X, A(re));
                return P(ye, q, x(ye));
              }
              function W(X, q, re) {
                return $(U(X, q));
              }
              function V(ze) {
                var q = v(ze), re = q.getInt32(0), ye = q.getInt32(4), me = ze.subarray(8, 12), ze = ze.subarray(12);
                return [re, ze, ye, me];
              }
              function G(X, q, re, ye) {
                var me = new ArrayBuffer(12 + ye.byteLength), ze = new Uint8Array(me), ke = new DataView(me);
                return ke.setInt32(0, X), ke.setInt32(4, q), re && ze.set(re, 8), ze.set(ye, 12), ze;
              }
              function H(X) {
                var q = X.length, re = f(X);
                return G(2, q, void 0, re);
              }
              function Q(X) {
                var q = X.length, re = u(X);
                return G(4, q, void 0, re);
              }
              function te(X, q) {
                var re = X.length / q, ye = u([q]), me = f(X);
                return G(5, re, ye, me);
              }
              function ee(X) {
                var q = X.length, re = u(_(X));
                return G(6, q, void 0, re);
              }
              function ce(X) {
                var q = X.length, re = u(z(X));
                return G(8, q, void 0, re);
              }
              function fe(X, q) {
                var re = X.length, ye = u([q]), me = u(R(X, q));
                return G(9, re, ye, me);
              }
              function oe(X, q) {
                var re = X.length, ye = u([q]), me = m(W(X, q));
                return G(10, re, ye, me);
              }
              function he(X) {
                var q = {};
                return Pe.forEach(function(re) {
                  X[re] !== void 0 && (q[re] = X[re]);
                }), X.bondAtomList && (q.bondAtomList = Q(X.bondAtomList)), X.bondOrderList && (q.bondOrderList = H(X.bondOrderList)), q.xCoordList = oe(X.xCoordList, 1e3), q.yCoordList = oe(X.yCoordList, 1e3), q.zCoordList = oe(X.zCoordList, 1e3), X.bFactorList && (q.bFactorList = oe(X.bFactorList, 100)), X.atomIdList && (q.atomIdList = ce(X.atomIdList)), X.altLocList && (q.altLocList = ee(X.altLocList)), X.occupancyList && (q.occupancyList = fe(X.occupancyList, 100)), q.groupIdList = ce(X.groupIdList), q.groupTypeList = Q(X.groupTypeList), X.secStructList && (q.secStructList = H(X.secStructList)), X.insCodeList && (q.insCodeList = ee(X.insCodeList)), X.sequenceIndexList && (q.sequenceIndexList = ce(X.sequenceIndexList)), q.chainIdList = te(X.chainIdList, 4), X.chainNameList && (q.chainNameList = te(X.chainNameList, 4)), q;
              }
              function Ae(X) {
                function q(ae) {
                  for (var ge = {}, xe = 0; ae > xe; xe++) {
                    var ue = ze();
                    ge[ue] = ze();
                  }
                  return ge;
                }
                function re(ae) {
                  var ge = X.subarray(ke, ke + ae);
                  return ke += ae, ge;
                }
                function ye(ae) {
                  var ge = X.subarray(ke, ke + ae);
                  ke += ae;
                  var xe = 65535;
                  if (ae > xe) {
                    for (var ue = [], Ce = 0; Ce < ge.length; Ce += xe) ue.push(String.fromCharCode.apply(null, ge.subarray(Ce, Ce + xe)));
                    return ue.join("");
                  }
                  return String.fromCharCode.apply(null, ge);
                }
                function me(ae) {
                  for (var ge = new Array(ae), xe = 0; ae > xe; xe++) ge[xe] = ze();
                  return ge;
                }
                function ze() {
                  var ae, ge, xe = X[ke];
                  if (!(128 & xe)) return ke++, xe;
                  if ((240 & xe) === 128) return ge = 15 & xe, ke++, q(ge);
                  if ((240 & xe) === 144) return ge = 15 & xe, ke++, me(ge);
                  if ((224 & xe) === 160) return ge = 31 & xe, ke++, ye(ge);
                  if ((224 & xe) === 224) return ae = K.getInt8(ke), ke++, ae;
                  switch (xe) {
                    case 192:
                      return ke++, null;
                    case 194:
                      return ke++, !1;
                    case 195:
                      return ke++, !0;
                    case 196:
                      return ge = K.getUint8(ke + 1), ke += 2, re(ge);
                    case 197:
                      return ge = K.getUint16(ke + 1), ke += 3, re(ge);
                    case 198:
                      return ge = K.getUint32(ke + 1), ke += 5, re(ge);
                    case 202:
                      return ae = K.getFloat32(ke + 1), ke += 5, ae;
                    case 203:
                      return ae = K.getFloat64(ke + 1), ke += 9, ae;
                    case 204:
                      return ae = X[ke + 1], ke += 2, ae;
                    case 205:
                      return ae = K.getUint16(ke + 1), ke += 3, ae;
                    case 206:
                      return ae = K.getUint32(ke + 1), ke += 5, ae;
                    case 208:
                      return ae = K.getInt8(ke + 1), ke += 2, ae;
                    case 209:
                      return ae = K.getInt16(ke + 1), ke += 3, ae;
                    case 210:
                      return ae = K.getInt32(ke + 1), ke += 5, ae;
                    case 217:
                      return ge = K.getUint8(ke + 1), ke += 2, ye(ge);
                    case 218:
                      return ge = K.getUint16(ke + 1), ke += 3, ye(ge);
                    case 219:
                      return ge = K.getUint32(ke + 1), ke += 5, ye(ge);
                    case 220:
                      return ge = K.getUint16(ke + 1), ke += 3, me(ge);
                    case 221:
                      return ge = K.getUint32(ke + 1), ke += 5, me(ge);
                    case 222:
                      return ge = K.getUint16(ke + 1), ke += 3, q(ge);
                    case 223:
                      return ge = K.getUint32(ke + 1), ke += 5, q(ge);
                  }
                  throw new Error("Unknown type 0x" + xe.toString(16));
                }
                var ke = 0, K = new DataView(X.buffer);
                return ze();
              }
              function Se(X, q, re, ye) {
                switch (X) {
                  case 1:
                    return p(q);
                  case 2:
                    return y(q);
                  case 3:
                    return M(q);
                  case 4:
                    return l(q);
                  case 5:
                    return f(q);
                  case 6:
                    return c(l(q), new Uint8Array(re));
                  case 7:
                    return c(l(q));
                  case 8:
                    return L(l(q));
                  case 9:
                    return F(l(q), l(ye)[0]);
                  case 10:
                    return B(M(q), l(ye)[0]);
                  case 11:
                    return g(M(q), l(ye)[0]);
                  case 12:
                    return N(M(q), l(ye)[0]);
                  case 13:
                    return N(y(q), l(ye)[0]);
                  case 14:
                    return k(M(q));
                  case 15:
                    return k(y(q));
                }
              }
              function Ie(X, q) {
                q = q || {};
                var re = q.ignoreFields, ye = {};
                return Ne.forEach(function(me) {
                  var ze = re ? re.indexOf(me) !== -1 : !1, ke = X[me];
                  ze || ke === void 0 || (ke instanceof Uint8Array ? ye[me] = Se.apply(null, V(ke)) : ye[me] = ke);
                }), ye;
              }
              function pe(X) {
                return String.fromCharCode.apply(null, X).replace(/\0/g, "");
              }
              function le(X, q, re) {
                re = re || {};
                var ye, me, ze, ke, K, ae, ge = re.firstModelOnly, xe = q.onModel, ue = q.onChain, Ce = q.onGroup, Z = q.onAtom, Fe = q.onBond, We = 0, I = 0, we = 0, ve = 0, Y = 0, de = -1, Me = X.chainNameList, Ye = X.secStructList, Ze = X.insCodeList, Ke = X.sequenceIndexList, rt = X.atomIdList, wt = X.bFactorList, st = X.altLocList, ot = X.occupancyList, at = X.bondAtomList, Mt = X.bondOrderList;
                for (ye = 0, me = X.chainsPerModel.length; me > ye && !(ge && We > 0); ++ye) {
                  var gt = X.chainsPerModel[We];
                  for (xe && xe({ chainCount: gt, modelIndex: We }), ze = 0; gt > ze; ++ze) {
                    var $t = X.groupsPerChain[I];
                    if (ue) {
                      var Pt = pe(X.chainIdList.subarray(4 * I, 4 * I + 4)), Et = null;
                      Me && (Et = pe(Me.subarray(4 * I, 4 * I + 4))), ue({ groupCount: $t, chainIndex: I, modelIndex: We, chainId: Pt, chainName: Et });
                    }
                    for (ke = 0; $t > ke; ++ke) {
                      var St = X.groupList[X.groupTypeList[we]], yt = St.atomNameList.length;
                      if (Ce) {
                        var zt = null;
                        Ye && (zt = Ye[we]);
                        var qe = null;
                        X.insCodeList && (qe = String.fromCharCode(Ze[we]));
                        var be = null;
                        Ke && (be = Ke[we]), Ce({ atomCount: yt, groupIndex: we, chainIndex: I, modelIndex: We, groupId: X.groupIdList[we], groupType: X.groupTypeList[we], groupName: St.groupName, singleLetterCode: St.singleLetterCode, chemCompType: St.chemCompType, secStruct: zt, insCode: qe, sequenceIndex: be });
                      }
                      for (K = 0; yt > K; ++K) {
                        if (Z) {
                          var Ve = null;
                          rt && (Ve = rt[ve]);
                          var et = null;
                          wt && (et = wt[ve]);
                          var _t = null;
                          st && (_t = String.fromCharCode(st[ve]));
                          var kt = null;
                          ot && (kt = ot[ve]), Z({ atomIndex: ve, groupIndex: we, chainIndex: I, modelIndex: We, atomId: Ve, element: St.elementList[K], atomName: St.atomNameList[K], formalCharge: St.formalChargeList[K], xCoord: X.xCoordList[ve], yCoord: X.yCoordList[ve], zCoord: X.zCoordList[ve], bFactor: et, altLoc: _t, occupancy: kt });
                        }
                        ve += 1;
                      }
                      if (Fe) {
                        var Tt = St.bondAtomList;
                        for (K = 0, ae = St.bondOrderList.length; ae > K; ++K) Fe({ atomIndex1: ve - yt + Tt[2 * K], atomIndex2: ve - yt + Tt[2 * K + 1], bondOrder: St.bondOrderList[K] });
                      }
                      we += 1;
                    }
                    I += 1;
                  }
                  if (Y = de + 1, de = ve - 1, Fe && at) for (K = 0, ae = at.length; ae > K; K += 2) {
                    var Lt = at[K], It = at[K + 1];
                    (Lt >= Y && de >= Lt || It >= Y && de >= It) && Fe({ atomIndex1: Lt, atomIndex2: It, bondOrder: Mt ? Mt[K / 2] : null });
                  }
                  We += 1;
                }
              }
              function ne(X) {
                return o(he(X));
              }
              function Te(X, q) {
                X instanceof ArrayBuffer && (X = new Uint8Array(X));
                var re;
                return re = X instanceof Uint8Array ? Ae(X) : X, Ie(re, q);
              }
              function Oe(X, q, re, ye) {
                function me() {
                  try {
                    var ke = Te(ze.response);
                    re(ke);
                  } catch (K) {
                    ye(K);
                  }
                }
                var ze = new XMLHttpRequest();
                ze.addEventListener("load", me, !0), ze.addEventListener("error", ye, !0), ze.responseType = "arraybuffer", ze.open("GET", q + X.toUpperCase()), ze.send();
              }
              function Be(X, q, re) {
                Oe(X, je, q, re);
              }
              function Ue(X, q, re) {
                Oe(X, Xe, q, re);
              }
              var Pe = ["mmtfVersion", "mmtfProducer", "unitCell", "spaceGroup", "structureId", "title", "depositionDate", "releaseDate", "experimentalMethods", "resolution", "rFree", "rWork", "bioAssemblyList", "ncsOperatorList", "entityList", "groupList", "numBonds", "numAtoms", "numGroups", "numChains", "numModels", "groupsPerChain", "chainsPerModel"], Ge = ["xCoordList", "yCoordList", "zCoordList", "groupIdList", "groupTypeList", "chainIdList", "bFactorList", "atomIdList", "altLocList", "occupancyList", "secStructList", "insCodeList", "sequenceIndexList", "chainNameList", "bondAtomList", "bondOrderList"], Ne = Pe.concat(Ge), Re = "v1.0.1", De = "//mmtf.rcsb.org/v1.0/", je = De + "full/", Xe = De + "reduced/";
              t.encode = ne, t.decode = Te, t.traverse = le, t.fetch = Be, t.fetchReduced = Ue, t.version = Re, t.fetchUrl = je, t.fetchReducedUrl = Xe, t.encodeMsgpack = o, t.encodeMmtf = he, t.decodeMsgpack = Ae, t.decodeMmtf = Ie;
            });
          }
        ),
        /***/
        "./node_modules/pako/dist/pako.esm.mjs": (
          /*!*********************************************!*\
            !*** ./node_modules/pako/dist/pako.esm.mjs ***!
            \*********************************************/
          /***/
          (n, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Deflate: () => (
                /* binding */
                Xi
              ),
              /* harmony export */
              Inflate: () => (
                /* binding */
                Qi
              ),
              /* harmony export */
              constants: () => (
                /* binding */
                rn
              ),
              /* harmony export */
              default: () => (
                /* binding */
                Za
              ),
              /* harmony export */
              deflate: () => (
                /* binding */
                Zi
              ),
              /* harmony export */
              deflateRaw: () => (
                /* binding */
                Yi
              ),
              /* harmony export */
              gzip: () => (
                /* binding */
                qi
              ),
              /* harmony export */
              inflate: () => (
                /* binding */
                Ji
              ),
              /* harmony export */
              inflateRaw: () => (
                /* binding */
                en
              ),
              /* harmony export */
              ungzip: () => (
                /* binding */
                tn
              )
              /* harmony export */
            });
            /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
            const r = 4, a = 0, s = 1, h = 2;
            function o(C) {
              let j = C.length;
              for (; --j >= 0; )
                C[j] = 0;
            }
            const d = 0, v = 1, f = 2, y = 3, A = 258, x = 29, M = 256, m = M + 1 + x, l = 30, u = 19, p = 2 * m + 1, g = 15, b = 16, c = 7, _ = 256, E = 16, w = 17, k = 18, $ = (
              /* extra bits for each length code */
              new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0])
            ), L = (
              /* extra bits for each distance code */
              new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13])
            ), z = (
              /* extra bits for each bit length code */
              new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
            ), F = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), R = 512, P = new Array((m + 2) * 2);
            o(P);
            const U = new Array(l * 2);
            o(U);
            const N = new Array(R);
            o(N);
            const B = new Array(A - y + 1);
            o(B);
            const W = new Array(x);
            o(W);
            const V = new Array(l);
            o(V);
            function G(C, j, O, J, se) {
              this.static_tree = C, this.extra_bits = j, this.extra_base = O, this.elems = J, this.max_length = se, this.has_stree = C && C.length;
            }
            let H, Q, te;
            function ee(C, j) {
              this.dyn_tree = C, this.max_code = 0, this.stat_desc = j;
            }
            const ce = (C) => C < 256 ? N[C] : N[256 + (C >>> 7)], fe = (C, j) => {
              C.pending_buf[C.pending++] = j & 255, C.pending_buf[C.pending++] = j >>> 8 & 255;
            }, oe = (C, j, O) => {
              C.bi_valid > b - O ? (C.bi_buf |= j << C.bi_valid & 65535, fe(C, C.bi_buf), C.bi_buf = j >> b - C.bi_valid, C.bi_valid += O - b) : (C.bi_buf |= j << C.bi_valid & 65535, C.bi_valid += O);
            }, he = (C, j, O) => {
              oe(
                C,
                O[j * 2],
                O[j * 2 + 1]
                /*.Len*/
              );
            }, Ae = (C, j) => {
              let O = 0;
              do
                O |= C & 1, C >>>= 1, O <<= 1;
              while (--j > 0);
              return O >>> 1;
            }, Se = (C) => {
              C.bi_valid === 16 ? (fe(C, C.bi_buf), C.bi_buf = 0, C.bi_valid = 0) : C.bi_valid >= 8 && (C.pending_buf[C.pending++] = C.bi_buf & 255, C.bi_buf >>= 8, C.bi_valid -= 8);
            }, Ie = (C, j) => {
              const O = j.dyn_tree, J = j.max_code, se = j.stat_desc.static_tree, ie = j.stat_desc.has_stree, $e = j.stat_desc.extra_bits, Ee = j.stat_desc.extra_base, tt = j.stat_desc.max_length;
              let _e, Le, pt, Je, He, it, Ct = 0;
              for (Je = 0; Je <= g; Je++)
                C.bl_count[Je] = 0;
              for (O[C.heap[C.heap_max] * 2 + 1] = 0, _e = C.heap_max + 1; _e < p; _e++)
                Le = C.heap[_e], Je = O[O[Le * 2 + 1] * 2 + 1] + 1, Je > tt && (Je = tt, Ct++), O[Le * 2 + 1] = Je, !(Le > J) && (C.bl_count[Je]++, He = 0, Le >= Ee && (He = $e[Le - Ee]), it = O[Le * 2], C.opt_len += it * (Je + He), ie && (C.static_len += it * (se[Le * 2 + 1] + He)));
              if (Ct !== 0) {
                do {
                  for (Je = tt - 1; C.bl_count[Je] === 0; )
                    Je--;
                  C.bl_count[Je]--, C.bl_count[Je + 1] += 2, C.bl_count[tt]--, Ct -= 2;
                } while (Ct > 0);
                for (Je = tt; Je !== 0; Je--)
                  for (Le = C.bl_count[Je]; Le !== 0; )
                    pt = C.heap[--_e], !(pt > J) && (O[pt * 2 + 1] !== Je && (C.opt_len += (Je - O[pt * 2 + 1]) * O[pt * 2], O[pt * 2 + 1] = Je), Le--);
              }
            }, pe = (C, j, O) => {
              const J = new Array(g + 1);
              let se = 0, ie, $e;
              for (ie = 1; ie <= g; ie++)
                se = se + O[ie - 1] << 1, J[ie] = se;
              for ($e = 0; $e <= j; $e++) {
                let Ee = C[$e * 2 + 1];
                Ee !== 0 && (C[$e * 2] = Ae(J[Ee]++, Ee));
              }
            }, le = () => {
              let C, j, O, J, se;
              const ie = new Array(g + 1);
              for (O = 0, J = 0; J < x - 1; J++)
                for (W[J] = O, C = 0; C < 1 << $[J]; C++)
                  B[O++] = J;
              for (B[O - 1] = J, se = 0, J = 0; J < 16; J++)
                for (V[J] = se, C = 0; C < 1 << L[J]; C++)
                  N[se++] = J;
              for (se >>= 7; J < l; J++)
                for (V[J] = se << 7, C = 0; C < 1 << L[J] - 7; C++)
                  N[256 + se++] = J;
              for (j = 0; j <= g; j++)
                ie[j] = 0;
              for (C = 0; C <= 143; )
                P[C * 2 + 1] = 8, C++, ie[8]++;
              for (; C <= 255; )
                P[C * 2 + 1] = 9, C++, ie[9]++;
              for (; C <= 279; )
                P[C * 2 + 1] = 7, C++, ie[7]++;
              for (; C <= 287; )
                P[C * 2 + 1] = 8, C++, ie[8]++;
              for (pe(P, m + 1, ie), C = 0; C < l; C++)
                U[C * 2 + 1] = 5, U[C * 2] = Ae(C, 5);
              H = new G(P, $, M + 1, m, g), Q = new G(U, L, 0, l, g), te = new G(new Array(0), z, 0, u, c);
            }, ne = (C) => {
              let j;
              for (j = 0; j < m; j++)
                C.dyn_ltree[j * 2] = 0;
              for (j = 0; j < l; j++)
                C.dyn_dtree[j * 2] = 0;
              for (j = 0; j < u; j++)
                C.bl_tree[j * 2] = 0;
              C.dyn_ltree[_ * 2] = 1, C.opt_len = C.static_len = 0, C.sym_next = C.matches = 0;
            }, Te = (C) => {
              C.bi_valid > 8 ? fe(C, C.bi_buf) : C.bi_valid > 0 && (C.pending_buf[C.pending++] = C.bi_buf), C.bi_buf = 0, C.bi_valid = 0;
            }, Oe = (C, j, O, J) => {
              const se = j * 2, ie = O * 2;
              return C[se] < C[ie] || C[se] === C[ie] && J[j] <= J[O];
            }, Be = (C, j, O) => {
              const J = C.heap[O];
              let se = O << 1;
              for (; se <= C.heap_len && (se < C.heap_len && Oe(j, C.heap[se + 1], C.heap[se], C.depth) && se++, !Oe(j, J, C.heap[se], C.depth)); )
                C.heap[O] = C.heap[se], O = se, se <<= 1;
              C.heap[O] = J;
            }, Ue = (C, j, O) => {
              let J, se, ie = 0, $e, Ee;
              if (C.sym_next !== 0)
                do
                  J = C.pending_buf[C.sym_buf + ie++] & 255, J += (C.pending_buf[C.sym_buf + ie++] & 255) << 8, se = C.pending_buf[C.sym_buf + ie++], J === 0 ? he(C, se, j) : ($e = B[se], he(C, $e + M + 1, j), Ee = $[$e], Ee !== 0 && (se -= W[$e], oe(C, se, Ee)), J--, $e = ce(J), he(C, $e, O), Ee = L[$e], Ee !== 0 && (J -= V[$e], oe(C, J, Ee)));
                while (ie < C.sym_next);
              he(C, _, j);
            }, Pe = (C, j) => {
              const O = j.dyn_tree, J = j.stat_desc.static_tree, se = j.stat_desc.has_stree, ie = j.stat_desc.elems;
              let $e, Ee, tt = -1, _e;
              for (C.heap_len = 0, C.heap_max = p, $e = 0; $e < ie; $e++)
                O[$e * 2] !== 0 ? (C.heap[++C.heap_len] = tt = $e, C.depth[$e] = 0) : O[$e * 2 + 1] = 0;
              for (; C.heap_len < 2; )
                _e = C.heap[++C.heap_len] = tt < 2 ? ++tt : 0, O[_e * 2] = 1, C.depth[_e] = 0, C.opt_len--, se && (C.static_len -= J[_e * 2 + 1]);
              for (j.max_code = tt, $e = C.heap_len >> 1; $e >= 1; $e--)
                Be(C, O, $e);
              _e = ie;
              do
                $e = C.heap[
                  1
                  /*SMALLEST*/
                ], C.heap[
                  1
                  /*SMALLEST*/
                ] = C.heap[C.heap_len--], Be(
                  C,
                  O,
                  1
                  /*SMALLEST*/
                ), Ee = C.heap[
                  1
                  /*SMALLEST*/
                ], C.heap[--C.heap_max] = $e, C.heap[--C.heap_max] = Ee, O[_e * 2] = O[$e * 2] + O[Ee * 2], C.depth[_e] = (C.depth[$e] >= C.depth[Ee] ? C.depth[$e] : C.depth[Ee]) + 1, O[$e * 2 + 1] = O[Ee * 2 + 1] = _e, C.heap[
                  1
                  /*SMALLEST*/
                ] = _e++, Be(
                  C,
                  O,
                  1
                  /*SMALLEST*/
                );
              while (C.heap_len >= 2);
              C.heap[--C.heap_max] = C.heap[
                1
                /*SMALLEST*/
              ], Ie(C, j), pe(O, tt, C.bl_count);
            }, Ge = (C, j, O) => {
              let J, se = -1, ie, $e = j[0 * 2 + 1], Ee = 0, tt = 7, _e = 4;
              for ($e === 0 && (tt = 138, _e = 3), j[(O + 1) * 2 + 1] = 65535, J = 0; J <= O; J++)
                ie = $e, $e = j[(J + 1) * 2 + 1], !(++Ee < tt && ie === $e) && (Ee < _e ? C.bl_tree[ie * 2] += Ee : ie !== 0 ? (ie !== se && C.bl_tree[ie * 2]++, C.bl_tree[E * 2]++) : Ee <= 10 ? C.bl_tree[w * 2]++ : C.bl_tree[k * 2]++, Ee = 0, se = ie, $e === 0 ? (tt = 138, _e = 3) : ie === $e ? (tt = 6, _e = 3) : (tt = 7, _e = 4));
            }, Ne = (C, j, O) => {
              let J, se = -1, ie, $e = j[0 * 2 + 1], Ee = 0, tt = 7, _e = 4;
              for ($e === 0 && (tt = 138, _e = 3), J = 0; J <= O; J++)
                if (ie = $e, $e = j[(J + 1) * 2 + 1], !(++Ee < tt && ie === $e)) {
                  if (Ee < _e)
                    do
                      he(C, ie, C.bl_tree);
                    while (--Ee !== 0);
                  else ie !== 0 ? (ie !== se && (he(C, ie, C.bl_tree), Ee--), he(C, E, C.bl_tree), oe(C, Ee - 3, 2)) : Ee <= 10 ? (he(C, w, C.bl_tree), oe(C, Ee - 3, 3)) : (he(C, k, C.bl_tree), oe(C, Ee - 11, 7));
                  Ee = 0, se = ie, $e === 0 ? (tt = 138, _e = 3) : ie === $e ? (tt = 6, _e = 3) : (tt = 7, _e = 4);
                }
            }, Re = (C) => {
              let j;
              for (Ge(C, C.dyn_ltree, C.l_desc.max_code), Ge(C, C.dyn_dtree, C.d_desc.max_code), Pe(C, C.bl_desc), j = u - 1; j >= 3 && C.bl_tree[F[j] * 2 + 1] === 0; j--)
                ;
              return C.opt_len += 3 * (j + 1) + 5 + 5 + 4, j;
            }, De = (C, j, O, J) => {
              let se;
              for (oe(C, j - 257, 5), oe(C, O - 1, 5), oe(C, J - 4, 4), se = 0; se < J; se++)
                oe(C, C.bl_tree[F[se] * 2 + 1], 3);
              Ne(C, C.dyn_ltree, j - 1), Ne(C, C.dyn_dtree, O - 1);
            }, je = (C) => {
              let j = 4093624447, O;
              for (O = 0; O <= 31; O++, j >>>= 1)
                if (j & 1 && C.dyn_ltree[O * 2] !== 0)
                  return a;
              if (C.dyn_ltree[9 * 2] !== 0 || C.dyn_ltree[10 * 2] !== 0 || C.dyn_ltree[13 * 2] !== 0)
                return s;
              for (O = 32; O < M; O++)
                if (C.dyn_ltree[O * 2] !== 0)
                  return s;
              return a;
            };
            let Xe = !1;
            const X = (C) => {
              Xe || (le(), Xe = !0), C.l_desc = new ee(C.dyn_ltree, H), C.d_desc = new ee(C.dyn_dtree, Q), C.bl_desc = new ee(C.bl_tree, te), C.bi_buf = 0, C.bi_valid = 0, ne(C);
            }, q = (C, j, O, J) => {
              oe(C, (d << 1) + (J ? 1 : 0), 3), Te(C), fe(C, O), fe(C, ~O), O && C.pending_buf.set(C.window.subarray(j, j + O), C.pending), C.pending += O;
            }, re = (C) => {
              oe(C, v << 1, 3), he(C, _, P), Se(C);
            }, ye = (C, j, O, J) => {
              let se, ie, $e = 0;
              C.level > 0 ? (C.strm.data_type === h && (C.strm.data_type = je(C)), Pe(C, C.l_desc), Pe(C, C.d_desc), $e = Re(C), se = C.opt_len + 3 + 7 >>> 3, ie = C.static_len + 3 + 7 >>> 3, ie <= se && (se = ie)) : se = ie = O + 5, O + 4 <= se && j !== -1 ? q(C, j, O, J) : C.strategy === r || ie === se ? (oe(C, (v << 1) + (J ? 1 : 0), 3), Ue(C, P, U)) : (oe(C, (f << 1) + (J ? 1 : 0), 3), De(C, C.l_desc.max_code + 1, C.d_desc.max_code + 1, $e + 1), Ue(C, C.dyn_ltree, C.dyn_dtree)), ne(C), J && Te(C);
            }, me = (C, j, O) => (C.pending_buf[C.sym_buf + C.sym_next++] = j, C.pending_buf[C.sym_buf + C.sym_next++] = j >> 8, C.pending_buf[C.sym_buf + C.sym_next++] = O, j === 0 ? C.dyn_ltree[O * 2]++ : (C.matches++, j--, C.dyn_ltree[(B[O] + M + 1) * 2]++, C.dyn_dtree[ce(j) * 2]++), C.sym_next === C.sym_end);
            var ze = X, ke = q, K = ye, ae = me, ge = re, xe = {
              _tr_init: ze,
              _tr_stored_block: ke,
              _tr_flush_block: K,
              _tr_tally: ae,
              _tr_align: ge
            }, Ce = (C, j, O, J) => {
              let se = C & 65535 | 0, ie = C >>> 16 & 65535 | 0, $e = 0;
              for (; O !== 0; ) {
                $e = O > 2e3 ? 2e3 : O, O -= $e;
                do
                  se = se + j[J++] | 0, ie = ie + se | 0;
                while (--$e);
                se %= 65521, ie %= 65521;
              }
              return se | ie << 16 | 0;
            };
            const Z = () => {
              let C, j = [];
              for (var O = 0; O < 256; O++) {
                C = O;
                for (var J = 0; J < 8; J++)
                  C = C & 1 ? 3988292384 ^ C >>> 1 : C >>> 1;
                j[O] = C;
              }
              return j;
            }, Fe = new Uint32Array(Z());
            var I = (C, j, O, J) => {
              const se = Fe, ie = J + O;
              C ^= -1;
              for (let $e = J; $e < ie; $e++)
                C = C >>> 8 ^ se[(C ^ j[$e]) & 255];
              return C ^ -1;
            }, we = {
              2: "need dictionary",
              /* Z_NEED_DICT       2  */
              1: "stream end",
              /* Z_STREAM_END      1  */
              0: "",
              /* Z_OK              0  */
              "-1": "file error",
              /* Z_ERRNO         (-1) */
              "-2": "stream error",
              /* Z_STREAM_ERROR  (-2) */
              "-3": "data error",
              /* Z_DATA_ERROR    (-3) */
              "-4": "insufficient memory",
              /* Z_MEM_ERROR     (-4) */
              "-5": "buffer error",
              /* Z_BUF_ERROR     (-5) */
              "-6": "incompatible version"
              /* Z_VERSION_ERROR (-6) */
            }, ve = {
              /* Allowed flush values; see deflate() and inflate() below for details */
              Z_NO_FLUSH: 0,
              Z_PARTIAL_FLUSH: 1,
              Z_SYNC_FLUSH: 2,
              Z_FULL_FLUSH: 3,
              Z_FINISH: 4,
              Z_BLOCK: 5,
              Z_TREES: 6,
              /* Return codes for the compression/decompression functions. Negative values
              * are errors, positive values are used for special but normal events.
              */
              Z_OK: 0,
              Z_STREAM_END: 1,
              Z_NEED_DICT: 2,
              Z_ERRNO: -1,
              Z_STREAM_ERROR: -2,
              Z_DATA_ERROR: -3,
              Z_MEM_ERROR: -4,
              Z_BUF_ERROR: -5,
              //Z_VERSION_ERROR: -6,
              /* compression levels */
              Z_NO_COMPRESSION: 0,
              Z_BEST_SPEED: 1,
              Z_BEST_COMPRESSION: 9,
              Z_DEFAULT_COMPRESSION: -1,
              Z_FILTERED: 1,
              Z_HUFFMAN_ONLY: 2,
              Z_RLE: 3,
              Z_FIXED: 4,
              Z_DEFAULT_STRATEGY: 0,
              /* Possible values of the data_type field (though see inflate()) */
              Z_BINARY: 0,
              Z_TEXT: 1,
              //Z_ASCII:                1, // = Z_TEXT (deprecated)
              Z_UNKNOWN: 2,
              /* The deflate compression method */
              Z_DEFLATED: 8
              //Z_NULL:                 null // Use -1 or null inline, depending on var type
            };
            const { _tr_init: Y, _tr_stored_block: de, _tr_flush_block: Me, _tr_tally: Ye, _tr_align: Ze } = xe, {
              Z_NO_FLUSH: Ke,
              Z_PARTIAL_FLUSH: rt,
              Z_FULL_FLUSH: wt,
              Z_FINISH: st,
              Z_BLOCK: ot,
              Z_OK: at,
              Z_STREAM_END: Mt,
              Z_STREAM_ERROR: gt,
              Z_DATA_ERROR: $t,
              Z_BUF_ERROR: Pt,
              Z_DEFAULT_COMPRESSION: Et,
              Z_FILTERED: St,
              Z_HUFFMAN_ONLY: yt,
              Z_RLE: zt,
              Z_FIXED: qe,
              Z_DEFAULT_STRATEGY: be,
              Z_UNKNOWN: Ve,
              Z_DEFLATED: et
            } = ve, _t = 9, kt = 15, Tt = 8, Ht = 256 + 1 + 29, Ft = 30, xr = 19, wr = 2 * Ht + 1, an = 15, ut = 3, Kt = 258, Gt = Kt + ut + 1, sn = 32, rr = 42, Or = 57, Fr = 69, zr = 73, Ir = 91, Rr = 103, Yt = 113, or = 666, Rt = 1, ir = 2, qt = 3, nr = 4, ln = 3, Qt = (C, j) => (C.msg = we[j], j), Yr = (C) => C * 2 - (C > 4 ? 9 : 0), Xt = (C) => {
              let j = C.length;
              for (; --j >= 0; )
                C[j] = 0;
            }, on = (C) => {
              let j, O, J, se = C.w_size;
              j = C.hash_size, J = j;
              do
                O = C.head[--J], C.head[J] = O >= se ? O - se : 0;
              while (--j);
              j = se, J = j;
              do
                O = C.prev[--J], C.prev[J] = O >= se ? O - se : 0;
              while (--j);
            };
            let Zt = (C, j, O) => (j << C.hash_shift ^ O) & C.hash_mask;
            const Bt = (C) => {
              const j = C.state;
              let O = j.pending;
              O > C.avail_out && (O = C.avail_out), O !== 0 && (C.output.set(j.pending_buf.subarray(j.pending_out, j.pending_out + O), C.next_out), C.next_out += O, j.pending_out += O, C.total_out += O, C.avail_out -= O, j.pending -= O, j.pending === 0 && (j.pending_out = 0));
            }, Nt = (C, j) => {
              Me(C, C.block_start >= 0 ? C.block_start : -1, C.strstart - C.block_start, j), C.block_start = C.strstart, Bt(C.strm);
            }, vt = (C, j) => {
              C.pending_buf[C.pending++] = j;
            }, cr = (C, j) => {
              C.pending_buf[C.pending++] = j >>> 8 & 255, C.pending_buf[C.pending++] = j & 255;
            }, Pr = (C, j, O, J) => {
              let se = C.avail_in;
              return se > J && (se = J), se === 0 ? 0 : (C.avail_in -= se, j.set(C.input.subarray(C.next_in, C.next_in + se), O), C.state.wrap === 1 ? C.adler = Ce(C.adler, j, se, O) : C.state.wrap === 2 && (C.adler = I(C.adler, j, se, O)), C.next_in += se, C.total_in += se, se);
            }, qr = (C, j) => {
              let O = C.max_chain_length, J = C.strstart, se, ie, $e = C.prev_length, Ee = C.nice_match;
              const tt = C.strstart > C.w_size - Gt ? C.strstart - (C.w_size - Gt) : 0, _e = C.window, Le = C.w_mask, pt = C.prev, Je = C.strstart + Kt;
              let He = _e[J + $e - 1], it = _e[J + $e];
              C.prev_length >= C.good_match && (O >>= 2), Ee > C.lookahead && (Ee = C.lookahead);
              do
                if (se = j, !(_e[se + $e] !== it || _e[se + $e - 1] !== He || _e[se] !== _e[J] || _e[++se] !== _e[J + 1])) {
                  J += 2, se++;
                  do
                    ;
                  while (_e[++J] === _e[++se] && _e[++J] === _e[++se] && _e[++J] === _e[++se] && _e[++J] === _e[++se] && _e[++J] === _e[++se] && _e[++J] === _e[++se] && _e[++J] === _e[++se] && _e[++J] === _e[++se] && J < Je);
                  if (ie = Kt - (Je - J), J = Je - Kt, ie > $e) {
                    if (C.match_start = j, $e = ie, ie >= Ee)
                      break;
                    He = _e[J + $e - 1], it = _e[J + $e];
                  }
                }
              while ((j = pt[j & Le]) > tt && --O !== 0);
              return $e <= C.lookahead ? $e : C.lookahead;
            }, ar = (C) => {
              const j = C.w_size;
              let O, J, se;
              do {
                if (J = C.window_size - C.lookahead - C.strstart, C.strstart >= j + (j - Gt) && (C.window.set(C.window.subarray(j, j + j - J), 0), C.match_start -= j, C.strstart -= j, C.block_start -= j, C.insert > C.strstart && (C.insert = C.strstart), on(C), J += j), C.strm.avail_in === 0)
                  break;
                if (O = Pr(C.strm, C.window, C.strstart + C.lookahead, J), C.lookahead += O, C.lookahead + C.insert >= ut)
                  for (se = C.strstart - C.insert, C.ins_h = C.window[se], C.ins_h = Zt(C, C.ins_h, C.window[se + 1]); C.insert && (C.ins_h = Zt(C, C.ins_h, C.window[se + ut - 1]), C.prev[se & C.w_mask] = C.head[C.ins_h], C.head[C.ins_h] = se, se++, C.insert--, !(C.lookahead + C.insert < ut)); )
                    ;
              } while (C.lookahead < Gt && C.strm.avail_in !== 0);
            }, Qr = (C, j) => {
              let O = C.pending_buf_size - 5 > C.w_size ? C.w_size : C.pending_buf_size - 5, J, se, ie, $e = 0, Ee = C.strm.avail_in;
              do {
                if (J = 65535, ie = C.bi_valid + 42 >> 3, C.strm.avail_out < ie || (ie = C.strm.avail_out - ie, se = C.strstart - C.block_start, J > se + C.strm.avail_in && (J = se + C.strm.avail_in), J > ie && (J = ie), J < O && (J === 0 && j !== st || j === Ke || J !== se + C.strm.avail_in)))
                  break;
                $e = j === st && J === se + C.strm.avail_in ? 1 : 0, de(C, 0, 0, $e), C.pending_buf[C.pending - 4] = J, C.pending_buf[C.pending - 3] = J >> 8, C.pending_buf[C.pending - 2] = ~J, C.pending_buf[C.pending - 1] = ~J >> 8, Bt(C.strm), se && (se > J && (se = J), C.strm.output.set(C.window.subarray(C.block_start, C.block_start + se), C.strm.next_out), C.strm.next_out += se, C.strm.avail_out -= se, C.strm.total_out += se, C.block_start += se, J -= se), J && (Pr(C.strm, C.strm.output, C.strm.next_out, J), C.strm.next_out += J, C.strm.avail_out -= J, C.strm.total_out += J);
              } while ($e === 0);
              return Ee -= C.strm.avail_in, Ee && (Ee >= C.w_size ? (C.matches = 2, C.window.set(C.strm.input.subarray(C.strm.next_in - C.w_size, C.strm.next_in), 0), C.strstart = C.w_size, C.insert = C.strstart) : (C.window_size - C.strstart <= Ee && (C.strstart -= C.w_size, C.window.set(C.window.subarray(C.w_size, C.w_size + C.strstart), 0), C.matches < 2 && C.matches++, C.insert > C.strstart && (C.insert = C.strstart)), C.window.set(C.strm.input.subarray(C.strm.next_in - Ee, C.strm.next_in), C.strstart), C.strstart += Ee, C.insert += Ee > C.w_size - C.insert ? C.w_size - C.insert : Ee), C.block_start = C.strstart), C.high_water < C.strstart && (C.high_water = C.strstart), $e ? nr : j !== Ke && j !== st && C.strm.avail_in === 0 && C.strstart === C.block_start ? ir : (ie = C.window_size - C.strstart, C.strm.avail_in > ie && C.block_start >= C.w_size && (C.block_start -= C.w_size, C.strstart -= C.w_size, C.window.set(C.window.subarray(C.w_size, C.w_size + C.strstart), 0), C.matches < 2 && C.matches++, ie += C.w_size, C.insert > C.strstart && (C.insert = C.strstart)), ie > C.strm.avail_in && (ie = C.strm.avail_in), ie && (Pr(C.strm, C.window, C.strstart, ie), C.strstart += ie, C.insert += ie > C.w_size - C.insert ? C.w_size - C.insert : ie), C.high_water < C.strstart && (C.high_water = C.strstart), ie = C.bi_valid + 42 >> 3, ie = C.pending_buf_size - ie > 65535 ? 65535 : C.pending_buf_size - ie, O = ie > C.w_size ? C.w_size : ie, se = C.strstart - C.block_start, (se >= O || (se || j === st) && j !== Ke && C.strm.avail_in === 0 && se <= ie) && (J = se > ie ? ie : se, $e = j === st && C.strm.avail_in === 0 && J === se ? 1 : 0, de(C, C.block_start, J, $e), C.block_start += J, Bt(C.strm)), $e ? qt : Rt);
            }, Br = (C, j) => {
              let O, J;
              for (; ; ) {
                if (C.lookahead < Gt) {
                  if (ar(C), C.lookahead < Gt && j === Ke)
                    return Rt;
                  if (C.lookahead === 0)
                    break;
                }
                if (O = 0, C.lookahead >= ut && (C.ins_h = Zt(C, C.ins_h, C.window[C.strstart + ut - 1]), O = C.prev[C.strstart & C.w_mask] = C.head[C.ins_h], C.head[C.ins_h] = C.strstart), O !== 0 && C.strstart - O <= C.w_size - Gt && (C.match_length = qr(C, O)), C.match_length >= ut)
                  if (J = Ye(C, C.strstart - C.match_start, C.match_length - ut), C.lookahead -= C.match_length, C.match_length <= C.max_lazy_match && C.lookahead >= ut) {
                    C.match_length--;
                    do
                      C.strstart++, C.ins_h = Zt(C, C.ins_h, C.window[C.strstart + ut - 1]), O = C.prev[C.strstart & C.w_mask] = C.head[C.ins_h], C.head[C.ins_h] = C.strstart;
                    while (--C.match_length !== 0);
                    C.strstart++;
                  } else
                    C.strstart += C.match_length, C.match_length = 0, C.ins_h = C.window[C.strstart], C.ins_h = Zt(C, C.ins_h, C.window[C.strstart + 1]);
                else
                  J = Ye(C, 0, C.window[C.strstart]), C.lookahead--, C.strstart++;
                if (J && (Nt(C, !1), C.strm.avail_out === 0))
                  return Rt;
              }
              return C.insert = C.strstart < ut - 1 ? C.strstart : ut - 1, j === st ? (Nt(C, !0), C.strm.avail_out === 0 ? qt : nr) : C.sym_next && (Nt(C, !1), C.strm.avail_out === 0) ? Rt : ir;
            }, sr = (C, j) => {
              let O, J, se;
              for (; ; ) {
                if (C.lookahead < Gt) {
                  if (ar(C), C.lookahead < Gt && j === Ke)
                    return Rt;
                  if (C.lookahead === 0)
                    break;
                }
                if (O = 0, C.lookahead >= ut && (C.ins_h = Zt(C, C.ins_h, C.window[C.strstart + ut - 1]), O = C.prev[C.strstart & C.w_mask] = C.head[C.ins_h], C.head[C.ins_h] = C.strstart), C.prev_length = C.match_length, C.prev_match = C.match_start, C.match_length = ut - 1, O !== 0 && C.prev_length < C.max_lazy_match && C.strstart - O <= C.w_size - Gt && (C.match_length = qr(C, O), C.match_length <= 5 && (C.strategy === St || C.match_length === ut && C.strstart - C.match_start > 4096) && (C.match_length = ut - 1)), C.prev_length >= ut && C.match_length <= C.prev_length) {
                  se = C.strstart + C.lookahead - ut, J = Ye(C, C.strstart - 1 - C.prev_match, C.prev_length - ut), C.lookahead -= C.prev_length - 1, C.prev_length -= 2;
                  do
                    ++C.strstart <= se && (C.ins_h = Zt(C, C.ins_h, C.window[C.strstart + ut - 1]), O = C.prev[C.strstart & C.w_mask] = C.head[C.ins_h], C.head[C.ins_h] = C.strstart);
                  while (--C.prev_length !== 0);
                  if (C.match_available = 0, C.match_length = ut - 1, C.strstart++, J && (Nt(C, !1), C.strm.avail_out === 0))
                    return Rt;
                } else if (C.match_available) {
                  if (J = Ye(C, 0, C.window[C.strstart - 1]), J && Nt(C, !1), C.strstart++, C.lookahead--, C.strm.avail_out === 0)
                    return Rt;
                } else
                  C.match_available = 1, C.strstart++, C.lookahead--;
              }
              return C.match_available && (J = Ye(C, 0, C.window[C.strstart - 1]), C.match_available = 0), C.insert = C.strstart < ut - 1 ? C.strstart : ut - 1, j === st ? (Nt(C, !0), C.strm.avail_out === 0 ? qt : nr) : C.sym_next && (Nt(C, !1), C.strm.avail_out === 0) ? Rt : ir;
            }, hn = (C, j) => {
              let O, J, se, ie;
              const $e = C.window;
              for (; ; ) {
                if (C.lookahead <= Kt) {
                  if (ar(C), C.lookahead <= Kt && j === Ke)
                    return Rt;
                  if (C.lookahead === 0)
                    break;
                }
                if (C.match_length = 0, C.lookahead >= ut && C.strstart > 0 && (se = C.strstart - 1, J = $e[se], J === $e[++se] && J === $e[++se] && J === $e[++se])) {
                  ie = C.strstart + Kt;
                  do
                    ;
                  while (J === $e[++se] && J === $e[++se] && J === $e[++se] && J === $e[++se] && J === $e[++se] && J === $e[++se] && J === $e[++se] && J === $e[++se] && se < ie);
                  C.match_length = Kt - (ie - se), C.match_length > C.lookahead && (C.match_length = C.lookahead);
                }
                if (C.match_length >= ut ? (O = Ye(C, 1, C.match_length - ut), C.lookahead -= C.match_length, C.strstart += C.match_length, C.match_length = 0) : (O = Ye(C, 0, C.window[C.strstart]), C.lookahead--, C.strstart++), O && (Nt(C, !1), C.strm.avail_out === 0))
                  return Rt;
              }
              return C.insert = 0, j === st ? (Nt(C, !0), C.strm.avail_out === 0 ? qt : nr) : C.sym_next && (Nt(C, !1), C.strm.avail_out === 0) ? Rt : ir;
            }, cn = (C, j) => {
              let O;
              for (; ; ) {
                if (C.lookahead === 0 && (ar(C), C.lookahead === 0)) {
                  if (j === Ke)
                    return Rt;
                  break;
                }
                if (C.match_length = 0, O = Ye(C, 0, C.window[C.strstart]), C.lookahead--, C.strstart++, O && (Nt(C, !1), C.strm.avail_out === 0))
                  return Rt;
              }
              return C.insert = 0, j === st ? (Nt(C, !0), C.strm.avail_out === 0 ? qt : nr) : C.sym_next && (Nt(C, !1), C.strm.avail_out === 0) ? Rt : ir;
            };
            function Wt(C, j, O, J, se) {
              this.good_length = C, this.max_lazy = j, this.nice_length = O, this.max_chain = J, this.func = se;
            }
            const ur = [
              /*      good lazy nice chain */
              new Wt(0, 0, 0, 0, Qr),
              /* 0 store only */
              new Wt(4, 4, 8, 4, Br),
              /* 1 max speed, no lazy matches */
              new Wt(4, 5, 16, 8, Br),
              /* 2 */
              new Wt(4, 6, 32, 32, Br),
              /* 3 */
              new Wt(4, 4, 16, 16, sr),
              /* 4 lazy matches */
              new Wt(8, 16, 32, 32, sr),
              /* 5 */
              new Wt(8, 16, 128, 128, sr),
              /* 6 */
              new Wt(8, 32, 128, 256, sr),
              /* 7 */
              new Wt(32, 128, 258, 1024, sr),
              /* 8 */
              new Wt(32, 258, 258, 4096, sr)
              /* 9 max compression */
            ], un = (C) => {
              C.window_size = 2 * C.w_size, Xt(C.head), C.max_lazy_match = ur[C.level].max_lazy, C.good_match = ur[C.level].good_length, C.nice_match = ur[C.level].nice_length, C.max_chain_length = ur[C.level].max_chain, C.strstart = 0, C.block_start = 0, C.lookahead = 0, C.insert = 0, C.match_length = C.prev_length = ut - 1, C.match_available = 0, C.ins_h = 0;
            };
            function dn() {
              this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = et, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(wr * 2), this.dyn_dtree = new Uint16Array((2 * Ft + 1) * 2), this.bl_tree = new Uint16Array((2 * xr + 1) * 2), Xt(this.dyn_ltree), Xt(this.dyn_dtree), Xt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(an + 1), this.heap = new Uint16Array(2 * Ht + 1), Xt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * Ht + 1), Xt(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
            }
            const dr = (C) => {
              if (!C)
                return 1;
              const j = C.state;
              return !j || j.strm !== C || j.status !== rr && //#ifdef GZIP
              j.status !== Or && //#endif
              j.status !== Fr && j.status !== zr && j.status !== Ir && j.status !== Rr && j.status !== Yt && j.status !== or ? 1 : 0;
            }, Jr = (C) => {
              if (dr(C))
                return Qt(C, gt);
              C.total_in = C.total_out = 0, C.data_type = Ve;
              const j = C.state;
              return j.pending = 0, j.pending_out = 0, j.wrap < 0 && (j.wrap = -j.wrap), j.status = //#ifdef GZIP
              j.wrap === 2 ? Or : (
                //#endif
                j.wrap ? rr : Yt
              ), C.adler = j.wrap === 2 ? 0 : 1, j.last_flush = -2, Y(j), at;
            }, ei = (C) => {
              const j = Jr(C);
              return j === at && un(C.state), j;
            }, fn = (C, j) => dr(C) || C.state.wrap !== 2 ? gt : (C.state.gzhead = j, at), ti = (C, j, O, J, se, ie) => {
              if (!C)
                return gt;
              let $e = 1;
              if (j === Et && (j = 6), J < 0 ? ($e = 0, J = -J) : J > 15 && ($e = 2, J -= 16), se < 1 || se > _t || O !== et || J < 8 || J > 15 || j < 0 || j > 9 || ie < 0 || ie > qe || J === 8 && $e !== 1)
                return Qt(C, gt);
              J === 8 && (J = 9);
              const Ee = new dn();
              return C.state = Ee, Ee.strm = C, Ee.status = rr, Ee.wrap = $e, Ee.gzhead = null, Ee.w_bits = J, Ee.w_size = 1 << Ee.w_bits, Ee.w_mask = Ee.w_size - 1, Ee.hash_bits = se + 7, Ee.hash_size = 1 << Ee.hash_bits, Ee.hash_mask = Ee.hash_size - 1, Ee.hash_shift = ~~((Ee.hash_bits + ut - 1) / ut), Ee.window = new Uint8Array(Ee.w_size * 2), Ee.head = new Uint16Array(Ee.hash_size), Ee.prev = new Uint16Array(Ee.w_size), Ee.lit_bufsize = 1 << se + 6, Ee.pending_buf_size = Ee.lit_bufsize * 4, Ee.pending_buf = new Uint8Array(Ee.pending_buf_size), Ee.sym_buf = Ee.lit_bufsize, Ee.sym_end = (Ee.lit_bufsize - 1) * 3, Ee.level = j, Ee.strategy = ie, Ee.method = O, ei(C);
            }, mn = (C, j) => ti(C, j, et, kt, Tt, be), pn = (C, j) => {
              if (dr(C) || j > ot || j < 0)
                return C ? Qt(C, gt) : gt;
              const O = C.state;
              if (!C.output || C.avail_in !== 0 && !C.input || O.status === or && j !== st)
                return Qt(C, C.avail_out === 0 ? Pt : gt);
              const J = O.last_flush;
              if (O.last_flush = j, O.pending !== 0) {
                if (Bt(C), C.avail_out === 0)
                  return O.last_flush = -1, at;
              } else if (C.avail_in === 0 && Yr(j) <= Yr(J) && j !== st)
                return Qt(C, Pt);
              if (O.status === or && C.avail_in !== 0)
                return Qt(C, Pt);
              if (O.status === rr && O.wrap === 0 && (O.status = Yt), O.status === rr) {
                let se = et + (O.w_bits - 8 << 4) << 8, ie = -1;
                if (O.strategy >= yt || O.level < 2 ? ie = 0 : O.level < 6 ? ie = 1 : O.level === 6 ? ie = 2 : ie = 3, se |= ie << 6, O.strstart !== 0 && (se |= sn), se += 31 - se % 31, cr(O, se), O.strstart !== 0 && (cr(O, C.adler >>> 16), cr(O, C.adler & 65535)), C.adler = 1, O.status = Yt, Bt(C), O.pending !== 0)
                  return O.last_flush = -1, at;
              }
              if (O.status === Or) {
                if (C.adler = 0, vt(O, 31), vt(O, 139), vt(O, 8), O.gzhead)
                  vt(
                    O,
                    (O.gzhead.text ? 1 : 0) + (O.gzhead.hcrc ? 2 : 0) + (O.gzhead.extra ? 4 : 0) + (O.gzhead.name ? 8 : 0) + (O.gzhead.comment ? 16 : 0)
                  ), vt(O, O.gzhead.time & 255), vt(O, O.gzhead.time >> 8 & 255), vt(O, O.gzhead.time >> 16 & 255), vt(O, O.gzhead.time >> 24 & 255), vt(O, O.level === 9 ? 2 : O.strategy >= yt || O.level < 2 ? 4 : 0), vt(O, O.gzhead.os & 255), O.gzhead.extra && O.gzhead.extra.length && (vt(O, O.gzhead.extra.length & 255), vt(O, O.gzhead.extra.length >> 8 & 255)), O.gzhead.hcrc && (C.adler = I(C.adler, O.pending_buf, O.pending, 0)), O.gzindex = 0, O.status = Fr;
                else if (vt(O, 0), vt(O, 0), vt(O, 0), vt(O, 0), vt(O, 0), vt(O, O.level === 9 ? 2 : O.strategy >= yt || O.level < 2 ? 4 : 0), vt(O, ln), O.status = Yt, Bt(C), O.pending !== 0)
                  return O.last_flush = -1, at;
              }
              if (O.status === Fr) {
                if (O.gzhead.extra) {
                  let se = O.pending, ie = (O.gzhead.extra.length & 65535) - O.gzindex;
                  for (; O.pending + ie > O.pending_buf_size; ) {
                    let Ee = O.pending_buf_size - O.pending;
                    if (O.pending_buf.set(O.gzhead.extra.subarray(O.gzindex, O.gzindex + Ee), O.pending), O.pending = O.pending_buf_size, O.gzhead.hcrc && O.pending > se && (C.adler = I(C.adler, O.pending_buf, O.pending - se, se)), O.gzindex += Ee, Bt(C), O.pending !== 0)
                      return O.last_flush = -1, at;
                    se = 0, ie -= Ee;
                  }
                  let $e = new Uint8Array(O.gzhead.extra);
                  O.pending_buf.set($e.subarray(O.gzindex, O.gzindex + ie), O.pending), O.pending += ie, O.gzhead.hcrc && O.pending > se && (C.adler = I(C.adler, O.pending_buf, O.pending - se, se)), O.gzindex = 0;
                }
                O.status = zr;
              }
              if (O.status === zr) {
                if (O.gzhead.name) {
                  let se = O.pending, ie;
                  do {
                    if (O.pending === O.pending_buf_size) {
                      if (O.gzhead.hcrc && O.pending > se && (C.adler = I(C.adler, O.pending_buf, O.pending - se, se)), Bt(C), O.pending !== 0)
                        return O.last_flush = -1, at;
                      se = 0;
                    }
                    O.gzindex < O.gzhead.name.length ? ie = O.gzhead.name.charCodeAt(O.gzindex++) & 255 : ie = 0, vt(O, ie);
                  } while (ie !== 0);
                  O.gzhead.hcrc && O.pending > se && (C.adler = I(C.adler, O.pending_buf, O.pending - se, se)), O.gzindex = 0;
                }
                O.status = Ir;
              }
              if (O.status === Ir) {
                if (O.gzhead.comment) {
                  let se = O.pending, ie;
                  do {
                    if (O.pending === O.pending_buf_size) {
                      if (O.gzhead.hcrc && O.pending > se && (C.adler = I(C.adler, O.pending_buf, O.pending - se, se)), Bt(C), O.pending !== 0)
                        return O.last_flush = -1, at;
                      se = 0;
                    }
                    O.gzindex < O.gzhead.comment.length ? ie = O.gzhead.comment.charCodeAt(O.gzindex++) & 255 : ie = 0, vt(O, ie);
                  } while (ie !== 0);
                  O.gzhead.hcrc && O.pending > se && (C.adler = I(C.adler, O.pending_buf, O.pending - se, se));
                }
                O.status = Rr;
              }
              if (O.status === Rr) {
                if (O.gzhead.hcrc) {
                  if (O.pending + 2 > O.pending_buf_size && (Bt(C), O.pending !== 0))
                    return O.last_flush = -1, at;
                  vt(O, C.adler & 255), vt(O, C.adler >> 8 & 255), C.adler = 0;
                }
                if (O.status = Yt, Bt(C), O.pending !== 0)
                  return O.last_flush = -1, at;
              }
              if (C.avail_in !== 0 || O.lookahead !== 0 || j !== Ke && O.status !== or) {
                let se = O.level === 0 ? Qr(O, j) : O.strategy === yt ? cn(O, j) : O.strategy === zt ? hn(O, j) : ur[O.level].func(O, j);
                if ((se === qt || se === nr) && (O.status = or), se === Rt || se === qt)
                  return C.avail_out === 0 && (O.last_flush = -1), at;
                if (se === ir && (j === rt ? Ze(O) : j !== ot && (de(O, 0, 0, !1), j === wt && (Xt(O.head), O.lookahead === 0 && (O.strstart = 0, O.block_start = 0, O.insert = 0))), Bt(C), C.avail_out === 0))
                  return O.last_flush = -1, at;
              }
              return j !== st ? at : O.wrap <= 0 ? Mt : (O.wrap === 2 ? (vt(O, C.adler & 255), vt(O, C.adler >> 8 & 255), vt(O, C.adler >> 16 & 255), vt(O, C.adler >> 24 & 255), vt(O, C.total_in & 255), vt(O, C.total_in >> 8 & 255), vt(O, C.total_in >> 16 & 255), vt(O, C.total_in >> 24 & 255)) : (cr(O, C.adler >>> 16), cr(O, C.adler & 65535)), Bt(C), O.wrap > 0 && (O.wrap = -O.wrap), O.pending !== 0 ? at : Mt);
            }, gn = (C) => {
              if (dr(C))
                return gt;
              const j = C.state.status;
              return C.state = null, j === Yt ? Qt(C, $t) : at;
            }, _n = (C, j) => {
              let O = j.length;
              if (dr(C))
                return gt;
              const J = C.state, se = J.wrap;
              if (se === 2 || se === 1 && J.status !== rr || J.lookahead)
                return gt;
              if (se === 1 && (C.adler = Ce(C.adler, j, O, 0)), J.wrap = 0, O >= J.w_size) {
                se === 0 && (Xt(J.head), J.strstart = 0, J.block_start = 0, J.insert = 0);
                let tt = new Uint8Array(J.w_size);
                tt.set(j.subarray(O - J.w_size, O), 0), j = tt, O = J.w_size;
              }
              const ie = C.avail_in, $e = C.next_in, Ee = C.input;
              for (C.avail_in = O, C.next_in = 0, C.input = j, ar(J); J.lookahead >= ut; ) {
                let tt = J.strstart, _e = J.lookahead - (ut - 1);
                do
                  J.ins_h = Zt(J, J.ins_h, J.window[tt + ut - 1]), J.prev[tt & J.w_mask] = J.head[J.ins_h], J.head[J.ins_h] = tt, tt++;
                while (--_e);
                J.strstart = tt, J.lookahead = ut - 1, ar(J);
              }
              return J.strstart += J.lookahead, J.block_start = J.strstart, J.insert = J.lookahead, J.lookahead = 0, J.match_length = J.prev_length = ut - 1, J.match_available = 0, C.next_in = $e, C.input = Ee, C.avail_in = ie, J.wrap = se, at;
            };
            var vn = mn, bn = ti, yn = ei, xn = Jr, wn = fn, En = pn, Sn = gn, An = _n, Mn = "pako deflate (from Nodeca project)", fr = {
              deflateInit: vn,
              deflateInit2: bn,
              deflateReset: yn,
              deflateResetKeep: xn,
              deflateSetHeader: wn,
              deflate: En,
              deflateEnd: Sn,
              deflateSetDictionary: An,
              deflateInfo: Mn
            };
            const Dn = (C, j) => Object.prototype.hasOwnProperty.call(C, j);
            var Cn = function(C) {
              const j = Array.prototype.slice.call(arguments, 1);
              for (; j.length; ) {
                const O = j.shift();
                if (O) {
                  if (typeof O != "object")
                    throw new TypeError(O + "must be non-object");
                  for (const J in O)
                    Dn(O, J) && (C[J] = O[J]);
                }
              }
              return C;
            }, Tn = (C) => {
              let j = 0;
              for (let J = 0, se = C.length; J < se; J++)
                j += C[J].length;
              const O = new Uint8Array(j);
              for (let J = 0, se = 0, ie = C.length; J < ie; J++) {
                let $e = C[J];
                O.set($e, se), se += $e.length;
              }
              return O;
            }, Er = {
              assign: Cn,
              flattenChunks: Tn
            };
            let ri = !0;
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch {
              ri = !1;
            }
            const mr = new Uint8Array(256);
            for (let C = 0; C < 256; C++)
              mr[C] = C >= 252 ? 6 : C >= 248 ? 5 : C >= 240 ? 4 : C >= 224 ? 3 : C >= 192 ? 2 : 1;
            mr[254] = mr[254] = 1;
            var kn = (C) => {
              if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
                return new TextEncoder().encode(C);
              let j, O, J, se, ie, $e = C.length, Ee = 0;
              for (se = 0; se < $e; se++)
                O = C.charCodeAt(se), (O & 64512) === 55296 && se + 1 < $e && (J = C.charCodeAt(se + 1), (J & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (J - 56320), se++)), Ee += O < 128 ? 1 : O < 2048 ? 2 : O < 65536 ? 3 : 4;
              for (j = new Uint8Array(Ee), ie = 0, se = 0; ie < Ee; se++)
                O = C.charCodeAt(se), (O & 64512) === 55296 && se + 1 < $e && (J = C.charCodeAt(se + 1), (J & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (J - 56320), se++)), O < 128 ? j[ie++] = O : O < 2048 ? (j[ie++] = 192 | O >>> 6, j[ie++] = 128 | O & 63) : O < 65536 ? (j[ie++] = 224 | O >>> 12, j[ie++] = 128 | O >>> 6 & 63, j[ie++] = 128 | O & 63) : (j[ie++] = 240 | O >>> 18, j[ie++] = 128 | O >>> 12 & 63, j[ie++] = 128 | O >>> 6 & 63, j[ie++] = 128 | O & 63);
              return j;
            };
            const $n = (C, j) => {
              if (j < 65534 && C.subarray && ri)
                return String.fromCharCode.apply(null, C.length === j ? C : C.subarray(0, j));
              let O = "";
              for (let J = 0; J < j; J++)
                O += String.fromCharCode(C[J]);
              return O;
            };
            var Ln = (C, j) => {
              const O = j || C.length;
              if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
                return new TextDecoder().decode(C.subarray(0, j));
              let J, se;
              const ie = new Array(O * 2);
              for (se = 0, J = 0; J < O; ) {
                let $e = C[J++];
                if ($e < 128) {
                  ie[se++] = $e;
                  continue;
                }
                let Ee = mr[$e];
                if (Ee > 4) {
                  ie[se++] = 65533, J += Ee - 1;
                  continue;
                }
                for ($e &= Ee === 2 ? 31 : Ee === 3 ? 15 : 7; Ee > 1 && J < O; )
                  $e = $e << 6 | C[J++] & 63, Ee--;
                if (Ee > 1) {
                  ie[se++] = 65533;
                  continue;
                }
                $e < 65536 ? ie[se++] = $e : ($e -= 65536, ie[se++] = 55296 | $e >> 10 & 1023, ie[se++] = 56320 | $e & 1023);
              }
              return $n(ie, se);
            }, On = (C, j) => {
              j = j || C.length, j > C.length && (j = C.length);
              let O = j - 1;
              for (; O >= 0 && (C[O] & 192) === 128; )
                O--;
              return O < 0 || O === 0 ? j : O + mr[C[O]] > j ? O : j;
            }, pr = {
              string2buf: kn,
              buf2string: Ln,
              utf8border: On
            };
            function Fn() {
              this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
            }
            var ii = Fn;
            const ni = Object.prototype.toString, {
              Z_NO_FLUSH: zn,
              Z_SYNC_FLUSH: In,
              Z_FULL_FLUSH: Rn,
              Z_FINISH: Pn,
              Z_OK: Sr,
              Z_STREAM_END: Bn,
              Z_DEFAULT_COMPRESSION: Nn,
              Z_DEFAULT_STRATEGY: Un,
              Z_DEFLATED: Gn
            } = ve;
            function gr(C) {
              this.options = Er.assign({
                level: Nn,
                method: Gn,
                chunkSize: 16384,
                windowBits: 15,
                memLevel: 8,
                strategy: Un
              }, C || {});
              let j = this.options;
              j.raw && j.windowBits > 0 ? j.windowBits = -j.windowBits : j.gzip && j.windowBits > 0 && j.windowBits < 16 && (j.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ii(), this.strm.avail_out = 0;
              let O = fr.deflateInit2(
                this.strm,
                j.level,
                j.method,
                j.windowBits,
                j.memLevel,
                j.strategy
              );
              if (O !== Sr)
                throw new Error(we[O]);
              if (j.header && fr.deflateSetHeader(this.strm, j.header), j.dictionary) {
                let J;
                if (typeof j.dictionary == "string" ? J = pr.string2buf(j.dictionary) : ni.call(j.dictionary) === "[object ArrayBuffer]" ? J = new Uint8Array(j.dictionary) : J = j.dictionary, O = fr.deflateSetDictionary(this.strm, J), O !== Sr)
                  throw new Error(we[O]);
                this._dict_set = !0;
              }
            }
            gr.prototype.push = function(C, j) {
              const O = this.strm, J = this.options.chunkSize;
              let se, ie;
              if (this.ended)
                return !1;
              for (j === ~~j ? ie = j : ie = j === !0 ? Pn : zn, typeof C == "string" ? O.input = pr.string2buf(C) : ni.call(C) === "[object ArrayBuffer]" ? O.input = new Uint8Array(C) : O.input = C, O.next_in = 0, O.avail_in = O.input.length; ; ) {
                if (O.avail_out === 0 && (O.output = new Uint8Array(J), O.next_out = 0, O.avail_out = J), (ie === In || ie === Rn) && O.avail_out <= 6) {
                  this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0;
                  continue;
                }
                if (se = fr.deflate(O, ie), se === Bn)
                  return O.next_out > 0 && this.onData(O.output.subarray(0, O.next_out)), se = fr.deflateEnd(this.strm), this.onEnd(se), this.ended = !0, se === Sr;
                if (O.avail_out === 0) {
                  this.onData(O.output);
                  continue;
                }
                if (ie > 0 && O.next_out > 0) {
                  this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0;
                  continue;
                }
                if (O.avail_in === 0) break;
              }
              return !0;
            }, gr.prototype.onData = function(C) {
              this.chunks.push(C);
            }, gr.prototype.onEnd = function(C) {
              C === Sr && (this.result = Er.flattenChunks(this.chunks)), this.chunks = [], this.err = C, this.msg = this.strm.msg;
            };
            function Nr(C, j) {
              const O = new gr(j);
              if (O.push(C, !0), O.err)
                throw O.msg || we[O.err];
              return O.result;
            }
            function Wn(C, j) {
              return j = j || {}, j.raw = !0, Nr(C, j);
            }
            function Hn(C, j) {
              return j = j || {}, j.gzip = !0, Nr(C, j);
            }
            var Vn = gr, jn = Nr, Kn = Wn, Xn = Hn, Zn = ve, Yn = {
              Deflate: Vn,
              deflate: jn,
              deflateRaw: Kn,
              gzip: Xn,
              constants: Zn
            };
            const Ar = 16209, qn = 16191;
            var Qn = function(j, O) {
              let J, se, ie, $e, Ee, tt, _e, Le, pt, Je, He, it, Ct, ft, ht, xt, ct, Qe, bt, Ot, nt, At, mt, lt;
              const dt = j.state;
              J = j.next_in, mt = j.input, se = J + (j.avail_in - 5), ie = j.next_out, lt = j.output, $e = ie - (O - j.avail_out), Ee = ie + (j.avail_out - 257), tt = dt.dmax, _e = dt.wsize, Le = dt.whave, pt = dt.wnext, Je = dt.window, He = dt.hold, it = dt.bits, Ct = dt.lencode, ft = dt.distcode, ht = (1 << dt.lenbits) - 1, xt = (1 << dt.distbits) - 1;
              e:
                do {
                  it < 15 && (He += mt[J++] << it, it += 8, He += mt[J++] << it, it += 8), ct = Ct[He & ht];
                  t:
                    for (; ; ) {
                      if (Qe = ct >>> 24, He >>>= Qe, it -= Qe, Qe = ct >>> 16 & 255, Qe === 0)
                        lt[ie++] = ct & 65535;
                      else if (Qe & 16) {
                        bt = ct & 65535, Qe &= 15, Qe && (it < Qe && (He += mt[J++] << it, it += 8), bt += He & (1 << Qe) - 1, He >>>= Qe, it -= Qe), it < 15 && (He += mt[J++] << it, it += 8, He += mt[J++] << it, it += 8), ct = ft[He & xt];
                        r:
                          for (; ; ) {
                            if (Qe = ct >>> 24, He >>>= Qe, it -= Qe, Qe = ct >>> 16 & 255, Qe & 16) {
                              if (Ot = ct & 65535, Qe &= 15, it < Qe && (He += mt[J++] << it, it += 8, it < Qe && (He += mt[J++] << it, it += 8)), Ot += He & (1 << Qe) - 1, Ot > tt) {
                                j.msg = "invalid distance too far back", dt.mode = Ar;
                                break e;
                              }
                              if (He >>>= Qe, it -= Qe, Qe = ie - $e, Ot > Qe) {
                                if (Qe = Ot - Qe, Qe > Le && dt.sane) {
                                  j.msg = "invalid distance too far back", dt.mode = Ar;
                                  break e;
                                }
                                if (nt = 0, At = Je, pt === 0) {
                                  if (nt += _e - Qe, Qe < bt) {
                                    bt -= Qe;
                                    do
                                      lt[ie++] = Je[nt++];
                                    while (--Qe);
                                    nt = ie - Ot, At = lt;
                                  }
                                } else if (pt < Qe) {
                                  if (nt += _e + pt - Qe, Qe -= pt, Qe < bt) {
                                    bt -= Qe;
                                    do
                                      lt[ie++] = Je[nt++];
                                    while (--Qe);
                                    if (nt = 0, pt < bt) {
                                      Qe = pt, bt -= Qe;
                                      do
                                        lt[ie++] = Je[nt++];
                                      while (--Qe);
                                      nt = ie - Ot, At = lt;
                                    }
                                  }
                                } else if (nt += pt - Qe, Qe < bt) {
                                  bt -= Qe;
                                  do
                                    lt[ie++] = Je[nt++];
                                  while (--Qe);
                                  nt = ie - Ot, At = lt;
                                }
                                for (; bt > 2; )
                                  lt[ie++] = At[nt++], lt[ie++] = At[nt++], lt[ie++] = At[nt++], bt -= 3;
                                bt && (lt[ie++] = At[nt++], bt > 1 && (lt[ie++] = At[nt++]));
                              } else {
                                nt = ie - Ot;
                                do
                                  lt[ie++] = lt[nt++], lt[ie++] = lt[nt++], lt[ie++] = lt[nt++], bt -= 3;
                                while (bt > 2);
                                bt && (lt[ie++] = lt[nt++], bt > 1 && (lt[ie++] = lt[nt++]));
                              }
                            } else if (Qe & 64) {
                              j.msg = "invalid distance code", dt.mode = Ar;
                              break e;
                            } else {
                              ct = ft[(ct & 65535) + (He & (1 << Qe) - 1)];
                              continue r;
                            }
                            break;
                          }
                      } else if (Qe & 64)
                        if (Qe & 32) {
                          dt.mode = qn;
                          break e;
                        } else {
                          j.msg = "invalid literal/length code", dt.mode = Ar;
                          break e;
                        }
                      else {
                        ct = Ct[(ct & 65535) + (He & (1 << Qe) - 1)];
                        continue t;
                      }
                      break;
                    }
                } while (J < se && ie < Ee);
              bt = it >> 3, J -= bt, it -= bt << 3, He &= (1 << it) - 1, j.next_in = J, j.next_out = ie, j.avail_in = J < se ? 5 + (se - J) : 5 - (J - se), j.avail_out = ie < Ee ? 257 + (Ee - ie) : 257 - (ie - Ee), dt.hold = He, dt.bits = it;
            };
            const lr = 15, ai = 852, si = 592, li = 0, Ur = 1, oi = 2, Jn = new Uint16Array([
              /* Length codes 257..285 base */
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              13,
              15,
              17,
              19,
              23,
              27,
              31,
              35,
              43,
              51,
              59,
              67,
              83,
              99,
              115,
              131,
              163,
              195,
              227,
              258,
              0,
              0
            ]), ea = new Uint8Array([
              /* Length codes 257..285 extra */
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              16,
              17,
              17,
              17,
              17,
              18,
              18,
              18,
              18,
              19,
              19,
              19,
              19,
              20,
              20,
              20,
              20,
              21,
              21,
              21,
              21,
              16,
              72,
              78
            ]), ta = new Uint16Array([
              /* Distance codes 0..29 base */
              1,
              2,
              3,
              4,
              5,
              7,
              9,
              13,
              17,
              25,
              33,
              49,
              65,
              97,
              129,
              193,
              257,
              385,
              513,
              769,
              1025,
              1537,
              2049,
              3073,
              4097,
              6145,
              8193,
              12289,
              16385,
              24577,
              0,
              0
            ]), ra = new Uint8Array([
              /* Distance codes 0..29 extra */
              16,
              16,
              16,
              16,
              17,
              17,
              18,
              18,
              19,
              19,
              20,
              20,
              21,
              21,
              22,
              22,
              23,
              23,
              24,
              24,
              25,
              25,
              26,
              26,
              27,
              27,
              28,
              28,
              29,
              29,
              64,
              64
            ]);
            var _r = (C, j, O, J, se, ie, $e, Ee) => {
              const tt = Ee.bits;
              let _e = 0, Le = 0, pt = 0, Je = 0, He = 0, it = 0, Ct = 0, ft = 0, ht = 0, xt = 0, ct, Qe, bt, Ot, nt, At = null, mt;
              const lt = new Uint16Array(lr + 1), dt = new Uint16Array(lr + 1);
              let tr = null, nn, $r, Lr;
              for (_e = 0; _e <= lr; _e++)
                lt[_e] = 0;
              for (Le = 0; Le < J; Le++)
                lt[j[O + Le]]++;
              for (He = tt, Je = lr; Je >= 1 && lt[Je] === 0; Je--)
                ;
              if (He > Je && (He = Je), Je === 0)
                return se[ie++] = 1 << 24 | 64 << 16 | 0, se[ie++] = 1 << 24 | 64 << 16 | 0, Ee.bits = 1, 0;
              for (pt = 1; pt < Je && lt[pt] === 0; pt++)
                ;
              for (He < pt && (He = pt), ft = 1, _e = 1; _e <= lr; _e++)
                if (ft <<= 1, ft -= lt[_e], ft < 0)
                  return -1;
              if (ft > 0 && (C === li || Je !== 1))
                return -1;
              for (dt[1] = 0, _e = 1; _e < lr; _e++)
                dt[_e + 1] = dt[_e] + lt[_e];
              for (Le = 0; Le < J; Le++)
                j[O + Le] !== 0 && ($e[dt[j[O + Le]]++] = Le);
              if (C === li ? (At = tr = $e, mt = 20) : C === Ur ? (At = Jn, tr = ea, mt = 257) : (At = ta, tr = ra, mt = 0), xt = 0, Le = 0, _e = pt, nt = ie, it = He, Ct = 0, bt = -1, ht = 1 << He, Ot = ht - 1, C === Ur && ht > ai || C === oi && ht > si)
                return 1;
              for (; ; ) {
                nn = _e - Ct, $e[Le] + 1 < mt ? ($r = 0, Lr = $e[Le]) : $e[Le] >= mt ? ($r = tr[$e[Le] - mt], Lr = At[$e[Le] - mt]) : ($r = 96, Lr = 0), ct = 1 << _e - Ct, Qe = 1 << it, pt = Qe;
                do
                  Qe -= ct, se[nt + (xt >> Ct) + Qe] = nn << 24 | $r << 16 | Lr | 0;
                while (Qe !== 0);
                for (ct = 1 << _e - 1; xt & ct; )
                  ct >>= 1;
                if (ct !== 0 ? (xt &= ct - 1, xt += ct) : xt = 0, Le++, --lt[_e] === 0) {
                  if (_e === Je)
                    break;
                  _e = j[O + $e[Le]];
                }
                if (_e > He && (xt & Ot) !== bt) {
                  for (Ct === 0 && (Ct = He), nt += pt, it = _e - Ct, ft = 1 << it; it + Ct < Je && (ft -= lt[it + Ct], !(ft <= 0)); )
                    it++, ft <<= 1;
                  if (ht += 1 << it, C === Ur && ht > ai || C === oi && ht > si)
                    return 1;
                  bt = xt & Ot, se[bt] = He << 24 | it << 16 | nt - ie | 0;
                }
              }
              return xt !== 0 && (se[nt + xt] = _e - Ct << 24 | 64 << 16 | 0), Ee.bits = He, 0;
            };
            const ia = 0, hi = 1, ci = 2, {
              Z_FINISH: ui,
              Z_BLOCK: na,
              Z_TREES: Mr,
              Z_OK: Jt,
              Z_STREAM_END: aa,
              Z_NEED_DICT: sa,
              Z_STREAM_ERROR: Ut,
              Z_DATA_ERROR: di,
              Z_MEM_ERROR: fi,
              Z_BUF_ERROR: la,
              Z_DEFLATED: mi
            } = ve, Dr = 16180, pi = 16181, gi = 16182, vi = 16183, bi = 16184, yi = 16185, xi = 16186, wi = 16187, Ei = 16188, Si = 16189, Cr = 16190, Vt = 16191, Gr = 16192, Ai = 16193, Wr = 16194, Mi = 16195, Di = 16196, Ci = 16197, Ti = 16198, Tr = 16199, kr = 16200, ki = 16201, $i = 16202, Li = 16203, Oi = 16204, Fi = 16205, Hr = 16206, zi = 16207, Ii = 16208, Dt = 16209, Ri = 16210, Pi = 16211, oa = 852, ha = 592, ca = 15, Bi = (C) => (C >>> 24 & 255) + (C >>> 8 & 65280) + ((C & 65280) << 8) + ((C & 255) << 24);
            function ua() {
              this.strm = null, this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
            }
            const er = (C) => {
              if (!C)
                return 1;
              const j = C.state;
              return !j || j.strm !== C || j.mode < Dr || j.mode > Pi ? 1 : 0;
            }, Ni = (C) => {
              if (er(C))
                return Ut;
              const j = C.state;
              return C.total_in = C.total_out = j.total = 0, C.msg = "", j.wrap && (C.adler = j.wrap & 1), j.mode = Dr, j.last = 0, j.havedict = 0, j.flags = -1, j.dmax = 32768, j.head = null, j.hold = 0, j.bits = 0, j.lencode = j.lendyn = new Int32Array(oa), j.distcode = j.distdyn = new Int32Array(ha), j.sane = 1, j.back = -1, Jt;
            }, Ui = (C) => {
              if (er(C))
                return Ut;
              const j = C.state;
              return j.wsize = 0, j.whave = 0, j.wnext = 0, Ni(C);
            }, Gi = (C, j) => {
              let O;
              if (er(C))
                return Ut;
              const J = C.state;
              return j < 0 ? (O = 0, j = -j) : (O = (j >> 4) + 5, j < 48 && (j &= 15)), j && (j < 8 || j > 15) ? Ut : (J.window !== null && J.wbits !== j && (J.window = null), J.wrap = O, J.wbits = j, Ui(C));
            }, Wi = (C, j) => {
              if (!C)
                return Ut;
              const O = new ua();
              C.state = O, O.strm = C, O.window = null, O.mode = Dr;
              const J = Gi(C, j);
              return J !== Jt && (C.state = null), J;
            }, da = (C) => Wi(C, ca);
            let Hi = !0, Vr, jr;
            const fa = (C) => {
              if (Hi) {
                Vr = new Int32Array(512), jr = new Int32Array(32);
                let j = 0;
                for (; j < 144; )
                  C.lens[j++] = 8;
                for (; j < 256; )
                  C.lens[j++] = 9;
                for (; j < 280; )
                  C.lens[j++] = 7;
                for (; j < 288; )
                  C.lens[j++] = 8;
                for (_r(hi, C.lens, 0, 288, Vr, 0, C.work, { bits: 9 }), j = 0; j < 32; )
                  C.lens[j++] = 5;
                _r(ci, C.lens, 0, 32, jr, 0, C.work, { bits: 5 }), Hi = !1;
              }
              C.lencode = Vr, C.lenbits = 9, C.distcode = jr, C.distbits = 5;
            }, Vi = (C, j, O, J) => {
              let se;
              const ie = C.state;
              return ie.window === null && (ie.wsize = 1 << ie.wbits, ie.wnext = 0, ie.whave = 0, ie.window = new Uint8Array(ie.wsize)), J >= ie.wsize ? (ie.window.set(j.subarray(O - ie.wsize, O), 0), ie.wnext = 0, ie.whave = ie.wsize) : (se = ie.wsize - ie.wnext, se > J && (se = J), ie.window.set(j.subarray(O - J, O - J + se), ie.wnext), J -= se, J ? (ie.window.set(j.subarray(O - J, O), 0), ie.wnext = J, ie.whave = ie.wsize) : (ie.wnext += se, ie.wnext === ie.wsize && (ie.wnext = 0), ie.whave < ie.wsize && (ie.whave += se))), 0;
            }, ma = (C, j) => {
              let O, J, se, ie, $e, Ee, tt, _e, Le, pt, Je, He, it, Ct, ft = 0, ht, xt, ct, Qe, bt, Ot, nt, At;
              const mt = new Uint8Array(4);
              let lt, dt;
              const tr = (
                /* permutation of code lengths */
                new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
              );
              if (er(C) || !C.output || !C.input && C.avail_in !== 0)
                return Ut;
              O = C.state, O.mode === Vt && (O.mode = Gr), $e = C.next_out, se = C.output, tt = C.avail_out, ie = C.next_in, J = C.input, Ee = C.avail_in, _e = O.hold, Le = O.bits, pt = Ee, Je = tt, At = Jt;
              e:
                for (; ; )
                  switch (O.mode) {
                    case Dr:
                      if (O.wrap === 0) {
                        O.mode = Gr;
                        break;
                      }
                      for (; Le < 16; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      if (O.wrap & 2 && _e === 35615) {
                        O.wbits === 0 && (O.wbits = 15), O.check = 0, mt[0] = _e & 255, mt[1] = _e >>> 8 & 255, O.check = I(O.check, mt, 2, 0), _e = 0, Le = 0, O.mode = pi;
                        break;
                      }
                      if (O.head && (O.head.done = !1), !(O.wrap & 1) || /* check if zlib header allowed */
                      (((_e & 255) << 8) + (_e >> 8)) % 31) {
                        C.msg = "incorrect header check", O.mode = Dt;
                        break;
                      }
                      if ((_e & 15) !== mi) {
                        C.msg = "unknown compression method", O.mode = Dt;
                        break;
                      }
                      if (_e >>>= 4, Le -= 4, nt = (_e & 15) + 8, O.wbits === 0 && (O.wbits = nt), nt > 15 || nt > O.wbits) {
                        C.msg = "invalid window size", O.mode = Dt;
                        break;
                      }
                      O.dmax = 1 << O.wbits, O.flags = 0, C.adler = O.check = 1, O.mode = _e & 512 ? Si : Vt, _e = 0, Le = 0;
                      break;
                    case pi:
                      for (; Le < 16; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      if (O.flags = _e, (O.flags & 255) !== mi) {
                        C.msg = "unknown compression method", O.mode = Dt;
                        break;
                      }
                      if (O.flags & 57344) {
                        C.msg = "unknown header flags set", O.mode = Dt;
                        break;
                      }
                      O.head && (O.head.text = _e >> 8 & 1), O.flags & 512 && O.wrap & 4 && (mt[0] = _e & 255, mt[1] = _e >>> 8 & 255, O.check = I(O.check, mt, 2, 0)), _e = 0, Le = 0, O.mode = gi;
                    case gi:
                      for (; Le < 32; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      O.head && (O.head.time = _e), O.flags & 512 && O.wrap & 4 && (mt[0] = _e & 255, mt[1] = _e >>> 8 & 255, mt[2] = _e >>> 16 & 255, mt[3] = _e >>> 24 & 255, O.check = I(O.check, mt, 4, 0)), _e = 0, Le = 0, O.mode = vi;
                    case vi:
                      for (; Le < 16; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      O.head && (O.head.xflags = _e & 255, O.head.os = _e >> 8), O.flags & 512 && O.wrap & 4 && (mt[0] = _e & 255, mt[1] = _e >>> 8 & 255, O.check = I(O.check, mt, 2, 0)), _e = 0, Le = 0, O.mode = bi;
                    case bi:
                      if (O.flags & 1024) {
                        for (; Le < 16; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        O.length = _e, O.head && (O.head.extra_len = _e), O.flags & 512 && O.wrap & 4 && (mt[0] = _e & 255, mt[1] = _e >>> 8 & 255, O.check = I(O.check, mt, 2, 0)), _e = 0, Le = 0;
                      } else O.head && (O.head.extra = null);
                      O.mode = yi;
                    case yi:
                      if (O.flags & 1024 && (He = O.length, He > Ee && (He = Ee), He && (O.head && (nt = O.head.extra_len - O.length, O.head.extra || (O.head.extra = new Uint8Array(O.head.extra_len)), O.head.extra.set(
                        J.subarray(
                          ie,
                          // extra field is limited to 65536 bytes
                          // - no need for additional size check
                          ie + He
                        ),
                        /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                        nt
                      )), O.flags & 512 && O.wrap & 4 && (O.check = I(O.check, J, He, ie)), Ee -= He, ie += He, O.length -= He), O.length))
                        break e;
                      O.length = 0, O.mode = xi;
                    case xi:
                      if (O.flags & 2048) {
                        if (Ee === 0)
                          break e;
                        He = 0;
                        do
                          nt = J[ie + He++], O.head && nt && O.length < 65536 && (O.head.name += String.fromCharCode(nt));
                        while (nt && He < Ee);
                        if (O.flags & 512 && O.wrap & 4 && (O.check = I(O.check, J, He, ie)), Ee -= He, ie += He, nt)
                          break e;
                      } else O.head && (O.head.name = null);
                      O.length = 0, O.mode = wi;
                    case wi:
                      if (O.flags & 4096) {
                        if (Ee === 0)
                          break e;
                        He = 0;
                        do
                          nt = J[ie + He++], O.head && nt && O.length < 65536 && (O.head.comment += String.fromCharCode(nt));
                        while (nt && He < Ee);
                        if (O.flags & 512 && O.wrap & 4 && (O.check = I(O.check, J, He, ie)), Ee -= He, ie += He, nt)
                          break e;
                      } else O.head && (O.head.comment = null);
                      O.mode = Ei;
                    case Ei:
                      if (O.flags & 512) {
                        for (; Le < 16; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        if (O.wrap & 4 && _e !== (O.check & 65535)) {
                          C.msg = "header crc mismatch", O.mode = Dt;
                          break;
                        }
                        _e = 0, Le = 0;
                      }
                      O.head && (O.head.hcrc = O.flags >> 9 & 1, O.head.done = !0), C.adler = O.check = 0, O.mode = Vt;
                      break;
                    case Si:
                      for (; Le < 32; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      C.adler = O.check = Bi(_e), _e = 0, Le = 0, O.mode = Cr;
                    case Cr:
                      if (O.havedict === 0)
                        return C.next_out = $e, C.avail_out = tt, C.next_in = ie, C.avail_in = Ee, O.hold = _e, O.bits = Le, sa;
                      C.adler = O.check = 1, O.mode = Vt;
                    case Vt:
                      if (j === na || j === Mr)
                        break e;
                    case Gr:
                      if (O.last) {
                        _e >>>= Le & 7, Le -= Le & 7, O.mode = Hr;
                        break;
                      }
                      for (; Le < 3; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      switch (O.last = _e & 1, _e >>>= 1, Le -= 1, _e & 3) {
                        case 0:
                          O.mode = Ai;
                          break;
                        case 1:
                          if (fa(O), O.mode = Tr, j === Mr) {
                            _e >>>= 2, Le -= 2;
                            break e;
                          }
                          break;
                        case 2:
                          O.mode = Di;
                          break;
                        case 3:
                          C.msg = "invalid block type", O.mode = Dt;
                      }
                      _e >>>= 2, Le -= 2;
                      break;
                    case Ai:
                      for (_e >>>= Le & 7, Le -= Le & 7; Le < 32; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      if ((_e & 65535) !== (_e >>> 16 ^ 65535)) {
                        C.msg = "invalid stored block lengths", O.mode = Dt;
                        break;
                      }
                      if (O.length = _e & 65535, _e = 0, Le = 0, O.mode = Wr, j === Mr)
                        break e;
                    case Wr:
                      O.mode = Mi;
                    case Mi:
                      if (He = O.length, He) {
                        if (He > Ee && (He = Ee), He > tt && (He = tt), He === 0)
                          break e;
                        se.set(J.subarray(ie, ie + He), $e), Ee -= He, ie += He, tt -= He, $e += He, O.length -= He;
                        break;
                      }
                      O.mode = Vt;
                      break;
                    case Di:
                      for (; Le < 14; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      if (O.nlen = (_e & 31) + 257, _e >>>= 5, Le -= 5, O.ndist = (_e & 31) + 1, _e >>>= 5, Le -= 5, O.ncode = (_e & 15) + 4, _e >>>= 4, Le -= 4, O.nlen > 286 || O.ndist > 30) {
                        C.msg = "too many length or distance symbols", O.mode = Dt;
                        break;
                      }
                      O.have = 0, O.mode = Ci;
                    case Ci:
                      for (; O.have < O.ncode; ) {
                        for (; Le < 3; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        O.lens[tr[O.have++]] = _e & 7, _e >>>= 3, Le -= 3;
                      }
                      for (; O.have < 19; )
                        O.lens[tr[O.have++]] = 0;
                      if (O.lencode = O.lendyn, O.lenbits = 7, lt = { bits: O.lenbits }, At = _r(ia, O.lens, 0, 19, O.lencode, 0, O.work, lt), O.lenbits = lt.bits, At) {
                        C.msg = "invalid code lengths set", O.mode = Dt;
                        break;
                      }
                      O.have = 0, O.mode = Ti;
                    case Ti:
                      for (; O.have < O.nlen + O.ndist; ) {
                        for (; ft = O.lencode[_e & (1 << O.lenbits) - 1], ht = ft >>> 24, xt = ft >>> 16 & 255, ct = ft & 65535, !(ht <= Le); ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        if (ct < 16)
                          _e >>>= ht, Le -= ht, O.lens[O.have++] = ct;
                        else {
                          if (ct === 16) {
                            for (dt = ht + 2; Le < dt; ) {
                              if (Ee === 0)
                                break e;
                              Ee--, _e += J[ie++] << Le, Le += 8;
                            }
                            if (_e >>>= ht, Le -= ht, O.have === 0) {
                              C.msg = "invalid bit length repeat", O.mode = Dt;
                              break;
                            }
                            nt = O.lens[O.have - 1], He = 3 + (_e & 3), _e >>>= 2, Le -= 2;
                          } else if (ct === 17) {
                            for (dt = ht + 3; Le < dt; ) {
                              if (Ee === 0)
                                break e;
                              Ee--, _e += J[ie++] << Le, Le += 8;
                            }
                            _e >>>= ht, Le -= ht, nt = 0, He = 3 + (_e & 7), _e >>>= 3, Le -= 3;
                          } else {
                            for (dt = ht + 7; Le < dt; ) {
                              if (Ee === 0)
                                break e;
                              Ee--, _e += J[ie++] << Le, Le += 8;
                            }
                            _e >>>= ht, Le -= ht, nt = 0, He = 11 + (_e & 127), _e >>>= 7, Le -= 7;
                          }
                          if (O.have + He > O.nlen + O.ndist) {
                            C.msg = "invalid bit length repeat", O.mode = Dt;
                            break;
                          }
                          for (; He--; )
                            O.lens[O.have++] = nt;
                        }
                      }
                      if (O.mode === Dt)
                        break;
                      if (O.lens[256] === 0) {
                        C.msg = "invalid code -- missing end-of-block", O.mode = Dt;
                        break;
                      }
                      if (O.lenbits = 9, lt = { bits: O.lenbits }, At = _r(hi, O.lens, 0, O.nlen, O.lencode, 0, O.work, lt), O.lenbits = lt.bits, At) {
                        C.msg = "invalid literal/lengths set", O.mode = Dt;
                        break;
                      }
                      if (O.distbits = 6, O.distcode = O.distdyn, lt = { bits: O.distbits }, At = _r(ci, O.lens, O.nlen, O.ndist, O.distcode, 0, O.work, lt), O.distbits = lt.bits, At) {
                        C.msg = "invalid distances set", O.mode = Dt;
                        break;
                      }
                      if (O.mode = Tr, j === Mr)
                        break e;
                    case Tr:
                      O.mode = kr;
                    case kr:
                      if (Ee >= 6 && tt >= 258) {
                        C.next_out = $e, C.avail_out = tt, C.next_in = ie, C.avail_in = Ee, O.hold = _e, O.bits = Le, Qn(C, Je), $e = C.next_out, se = C.output, tt = C.avail_out, ie = C.next_in, J = C.input, Ee = C.avail_in, _e = O.hold, Le = O.bits, O.mode === Vt && (O.back = -1);
                        break;
                      }
                      for (O.back = 0; ft = O.lencode[_e & (1 << O.lenbits) - 1], ht = ft >>> 24, xt = ft >>> 16 & 255, ct = ft & 65535, !(ht <= Le); ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      if (xt && !(xt & 240)) {
                        for (Qe = ht, bt = xt, Ot = ct; ft = O.lencode[Ot + ((_e & (1 << Qe + bt) - 1) >> Qe)], ht = ft >>> 24, xt = ft >>> 16 & 255, ct = ft & 65535, !(Qe + ht <= Le); ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        _e >>>= Qe, Le -= Qe, O.back += Qe;
                      }
                      if (_e >>>= ht, Le -= ht, O.back += ht, O.length = ct, xt === 0) {
                        O.mode = Fi;
                        break;
                      }
                      if (xt & 32) {
                        O.back = -1, O.mode = Vt;
                        break;
                      }
                      if (xt & 64) {
                        C.msg = "invalid literal/length code", O.mode = Dt;
                        break;
                      }
                      O.extra = xt & 15, O.mode = ki;
                    case ki:
                      if (O.extra) {
                        for (dt = O.extra; Le < dt; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        O.length += _e & (1 << O.extra) - 1, _e >>>= O.extra, Le -= O.extra, O.back += O.extra;
                      }
                      O.was = O.length, O.mode = $i;
                    case $i:
                      for (; ft = O.distcode[_e & (1 << O.distbits) - 1], ht = ft >>> 24, xt = ft >>> 16 & 255, ct = ft & 65535, !(ht <= Le); ) {
                        if (Ee === 0)
                          break e;
                        Ee--, _e += J[ie++] << Le, Le += 8;
                      }
                      if (!(xt & 240)) {
                        for (Qe = ht, bt = xt, Ot = ct; ft = O.distcode[Ot + ((_e & (1 << Qe + bt) - 1) >> Qe)], ht = ft >>> 24, xt = ft >>> 16 & 255, ct = ft & 65535, !(Qe + ht <= Le); ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        _e >>>= Qe, Le -= Qe, O.back += Qe;
                      }
                      if (_e >>>= ht, Le -= ht, O.back += ht, xt & 64) {
                        C.msg = "invalid distance code", O.mode = Dt;
                        break;
                      }
                      O.offset = ct, O.extra = xt & 15, O.mode = Li;
                    case Li:
                      if (O.extra) {
                        for (dt = O.extra; Le < dt; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        O.offset += _e & (1 << O.extra) - 1, _e >>>= O.extra, Le -= O.extra, O.back += O.extra;
                      }
                      if (O.offset > O.dmax) {
                        C.msg = "invalid distance too far back", O.mode = Dt;
                        break;
                      }
                      O.mode = Oi;
                    case Oi:
                      if (tt === 0)
                        break e;
                      if (He = Je - tt, O.offset > He) {
                        if (He = O.offset - He, He > O.whave && O.sane) {
                          C.msg = "invalid distance too far back", O.mode = Dt;
                          break;
                        }
                        He > O.wnext ? (He -= O.wnext, it = O.wsize - He) : it = O.wnext - He, He > O.length && (He = O.length), Ct = O.window;
                      } else
                        Ct = se, it = $e - O.offset, He = O.length;
                      He > tt && (He = tt), tt -= He, O.length -= He;
                      do
                        se[$e++] = Ct[it++];
                      while (--He);
                      O.length === 0 && (O.mode = kr);
                      break;
                    case Fi:
                      if (tt === 0)
                        break e;
                      se[$e++] = O.length, tt--, O.mode = kr;
                      break;
                    case Hr:
                      if (O.wrap) {
                        for (; Le < 32; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e |= J[ie++] << Le, Le += 8;
                        }
                        if (Je -= tt, C.total_out += Je, O.total += Je, O.wrap & 4 && Je && (C.adler = O.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
                        O.flags ? I(O.check, se, Je, $e - Je) : Ce(O.check, se, Je, $e - Je)), Je = tt, O.wrap & 4 && (O.flags ? _e : Bi(_e)) !== O.check) {
                          C.msg = "incorrect data check", O.mode = Dt;
                          break;
                        }
                        _e = 0, Le = 0;
                      }
                      O.mode = zi;
                    case zi:
                      if (O.wrap && O.flags) {
                        for (; Le < 32; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, _e += J[ie++] << Le, Le += 8;
                        }
                        if (O.wrap & 4 && _e !== (O.total & 4294967295)) {
                          C.msg = "incorrect length check", O.mode = Dt;
                          break;
                        }
                        _e = 0, Le = 0;
                      }
                      O.mode = Ii;
                    case Ii:
                      At = aa;
                      break e;
                    case Dt:
                      At = di;
                      break e;
                    case Ri:
                      return fi;
                    case Pi:
                    default:
                      return Ut;
                  }
              return C.next_out = $e, C.avail_out = tt, C.next_in = ie, C.avail_in = Ee, O.hold = _e, O.bits = Le, (O.wsize || Je !== C.avail_out && O.mode < Dt && (O.mode < Hr || j !== ui)) && Vi(C, C.output, C.next_out, Je - C.avail_out), pt -= C.avail_in, Je -= C.avail_out, C.total_in += pt, C.total_out += Je, O.total += Je, O.wrap & 4 && Je && (C.adler = O.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
              O.flags ? I(O.check, se, Je, C.next_out - Je) : Ce(O.check, se, Je, C.next_out - Je)), C.data_type = O.bits + (O.last ? 64 : 0) + (O.mode === Vt ? 128 : 0) + (O.mode === Tr || O.mode === Wr ? 256 : 0), (pt === 0 && Je === 0 || j === ui) && At === Jt && (At = la), At;
            }, pa = (C) => {
              if (er(C))
                return Ut;
              let j = C.state;
              return j.window && (j.window = null), C.state = null, Jt;
            }, ga = (C, j) => {
              if (er(C))
                return Ut;
              const O = C.state;
              return O.wrap & 2 ? (O.head = j, j.done = !1, Jt) : Ut;
            }, _a = (C, j) => {
              const O = j.length;
              let J, se, ie;
              return er(C) || (J = C.state, J.wrap !== 0 && J.mode !== Cr) ? Ut : J.mode === Cr && (se = 1, se = Ce(se, j, O, 0), se !== J.check) ? di : (ie = Vi(C, j, O, O), ie ? (J.mode = Ri, fi) : (J.havedict = 1, Jt));
            };
            var va = Ui, ba = Gi, ya = Ni, xa = da, wa = Wi, Ea = ma, Sa = pa, Aa = ga, Ma = _a, Da = "pako inflate (from Nodeca project)", jt = {
              inflateReset: va,
              inflateReset2: ba,
              inflateResetKeep: ya,
              inflateInit: xa,
              inflateInit2: wa,
              inflate: Ea,
              inflateEnd: Sa,
              inflateGetHeader: Aa,
              inflateSetDictionary: Ma,
              inflateInfo: Da
            };
            function Ca() {
              this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
            }
            var Ta = Ca;
            const ji = Object.prototype.toString, {
              Z_NO_FLUSH: ka,
              Z_FINISH: $a,
              Z_OK: vr,
              Z_STREAM_END: Kr,
              Z_NEED_DICT: Xr,
              Z_STREAM_ERROR: La,
              Z_DATA_ERROR: Ki,
              Z_MEM_ERROR: Oa
            } = ve;
            function yr(C) {
              this.options = Er.assign({
                chunkSize: 65536,
                windowBits: 15,
                to: ""
              }, C || {});
              const j = this.options;
              j.raw && j.windowBits >= 0 && j.windowBits < 16 && (j.windowBits = -j.windowBits, j.windowBits === 0 && (j.windowBits = -15)), j.windowBits >= 0 && j.windowBits < 16 && !(C && C.windowBits) && (j.windowBits += 32), j.windowBits > 15 && j.windowBits < 48 && (j.windowBits & 15 || (j.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ii(), this.strm.avail_out = 0;
              let O = jt.inflateInit2(
                this.strm,
                j.windowBits
              );
              if (O !== vr)
                throw new Error(we[O]);
              if (this.header = new Ta(), jt.inflateGetHeader(this.strm, this.header), j.dictionary && (typeof j.dictionary == "string" ? j.dictionary = pr.string2buf(j.dictionary) : ji.call(j.dictionary) === "[object ArrayBuffer]" && (j.dictionary = new Uint8Array(j.dictionary)), j.raw && (O = jt.inflateSetDictionary(this.strm, j.dictionary), O !== vr)))
                throw new Error(we[O]);
            }
            yr.prototype.push = function(C, j) {
              const O = this.strm, J = this.options.chunkSize, se = this.options.dictionary;
              let ie, $e, Ee;
              if (this.ended) return !1;
              for (j === ~~j ? $e = j : $e = j === !0 ? $a : ka, ji.call(C) === "[object ArrayBuffer]" ? O.input = new Uint8Array(C) : O.input = C, O.next_in = 0, O.avail_in = O.input.length; ; ) {
                for (O.avail_out === 0 && (O.output = new Uint8Array(J), O.next_out = 0, O.avail_out = J), ie = jt.inflate(O, $e), ie === Xr && se && (ie = jt.inflateSetDictionary(O, se), ie === vr ? ie = jt.inflate(O, $e) : ie === Ki && (ie = Xr)); O.avail_in > 0 && ie === Kr && O.state.wrap > 0 && C[O.next_in] !== 0; )
                  jt.inflateReset(O), ie = jt.inflate(O, $e);
                switch (ie) {
                  case La:
                  case Ki:
                  case Xr:
                  case Oa:
                    return this.onEnd(ie), this.ended = !0, !1;
                }
                if (Ee = O.avail_out, O.next_out && (O.avail_out === 0 || ie === Kr))
                  if (this.options.to === "string") {
                    let tt = pr.utf8border(O.output, O.next_out), _e = O.next_out - tt, Le = pr.buf2string(O.output, tt);
                    O.next_out = _e, O.avail_out = J - _e, _e && O.output.set(O.output.subarray(tt, tt + _e), 0), this.onData(Le);
                  } else
                    this.onData(O.output.length === O.next_out ? O.output : O.output.subarray(0, O.next_out));
                if (!(ie === vr && Ee === 0)) {
                  if (ie === Kr)
                    return ie = jt.inflateEnd(this.strm), this.onEnd(ie), this.ended = !0, !0;
                  if (O.avail_in === 0) break;
                }
              }
              return !0;
            }, yr.prototype.onData = function(C) {
              this.chunks.push(C);
            }, yr.prototype.onEnd = function(C) {
              C === vr && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = Er.flattenChunks(this.chunks)), this.chunks = [], this.err = C, this.msg = this.strm.msg;
            };
            function Zr(C, j) {
              const O = new yr(j);
              if (O.push(C), O.err) throw O.msg || we[O.err];
              return O.result;
            }
            function Fa(C, j) {
              return j = j || {}, j.raw = !0, Zr(C, j);
            }
            var za = yr, Ia = Zr, Ra = Fa, Pa = Zr, Ba = ve, Na = {
              Inflate: za,
              inflate: Ia,
              inflateRaw: Ra,
              ungzip: Pa,
              constants: Ba
            };
            const { Deflate: Ua, deflate: Ga, deflateRaw: Wa, gzip: Ha } = Yn, { Inflate: Va, inflate: ja, inflateRaw: Ka, ungzip: Xa } = Na;
            var Xi = Ua, Zi = Ga, Yi = Wa, qi = Ha, Qi = Va, Ji = ja, en = Ka, tn = Xa, rn = ve, Za = {
              Deflate: Xi,
              deflate: Zi,
              deflateRaw: Yi,
              gzip: qi,
              Inflate: Qi,
              inflate: Ji,
              inflateRaw: en,
              ungzip: tn,
              constants: rn
            };
          }
        )
        /******/
      }, __webpack_module_cache__ = {};
      function __webpack_require__(n) {
        var e = __webpack_module_cache__[n];
        if (e !== void 0)
          return e.exports;
        var t = __webpack_module_cache__[n] = {
          /******/
          // no module.id needed
          /******/
          // no module.loaded needed
          /******/
          exports: {}
          /******/
        };
        return __webpack_modules__[n].call(t.exports, t, t.exports, __webpack_require__), t.exports;
      }
      __webpack_require__.n = (n) => {
        var e = n && n.__esModule ? (
          /******/
          () => n.default
        ) : (
          /******/
          () => n
        );
        return __webpack_require__.d(e, { a: e }), e;
      }, __webpack_require__.d = (n, e) => {
        for (var t in e)
          __webpack_require__.o(e, t) && !__webpack_require__.o(n, t) && Object.defineProperty(n, t, { enumerable: !0, get: e[t] });
      }, __webpack_require__.o = (n, e) => Object.prototype.hasOwnProperty.call(n, e), __webpack_require__.r = (n) => {
        typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(n, "__esModule", { value: !0 });
      }, __webpack_require__("./src/index.ts"), __webpack_require__("./src/SurfaceWorker.js");
      var __webpack_exports__ = __webpack_require__("./src/exporter.js");
      return __webpack_exports__;
    })()
  ));
})(_3Dmol$1);
var _3DmolExports = _3Dmol$1.exports;
const _3Dmol = /* @__PURE__ */ getDefaultExportFromCjs(_3DmolExports), mol = /* @__PURE__ */ _mergeNamespaces({
  __proto__: null,
  default: _3Dmol
}, [_3DmolExports]), {
  SvelteComponent: SvelteComponent$7,
  append_hydration: append_hydration$5,
  attr: attr$6,
  binding_callbacks: binding_callbacks$4,
  children: children$5,
  claim_element: claim_element$6,
  claim_space: claim_space$6,
  claim_text: claim_text$5,
  detach: detach$7,
  element: element$6,
  get_svelte_dataset: get_svelte_dataset$3,
  init: init$7,
  insert_hydration: insert_hydration$7,
  listen: listen$2,
  noop: noop$7,
  run_all: run_all$2,
  safe_not_equal: safe_not_equal$8,
  set_data: set_data$5,
  space: space$6,
  text: text$6,
  toggle_class: toggle_class$5
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$4, afterUpdate: afterUpdate$2 } = window.__gradio__svelte__internal;
function create_if_block$6(n) {
  let e, t = "Covalent Modification", r, a, s = '<svg data-slot="icon" fill="none" stroke-width="1.5" class="w-4 h-4 svelte-oz981t" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672Zm-7.518-.267A8.25 8.25 0 1 1 20.25 10.5M8.288 14.212A5.25 5.25 0 1 1 17.25 10.5" class="svelte-oz981t"></path></svg> <span class="px-2 svelte-oz981t">click on atoms in viewer to select them</span>', h, o, d, v = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mx-1 h-4 w-4 svelte-oz981t"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" class="svelte-oz981t"></path></svg> <span class="svelte-oz981t">Attachment atom</span>', f, y, A = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mx-1 h-4 w-4 svelte-oz981t"><path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" class="svelte-oz981t"></path></svg> <span class="svelte-oz981t">Atoms to delete</span>', x, M, m, l, u = '<tr class="svelte-oz981t"><th scope="col" class="px-6 py-3 svelte-oz981t"></th> <th scope="col" class="px-6 py-3 svelte-oz981t">index</th></tr>', p, g, b, c, _ = "Attachment atom", E, w, k, $, L, z = "Deleted atoms", F, R, P, U;
  function N(Q, te) {
    return (
      /*attachmentIndex*/
      Q[1] !== null ? create_if_block_2$4 : create_else_block_1$3
    );
  }
  let B = N(n), W = B(n);
  function V(Q, te) {
    return (
      /*deleteIndexes*/
      Q[2].length > 0 ? create_if_block_1$5 : create_else_block$5
    );
  }
  let G = V(n), H = G(n);
  return {
    c() {
      e = element$6("div"), e.textContent = t, r = space$6(), a = element$6("div"), a.innerHTML = s, h = space$6(), o = element$6("div"), d = element$6("button"), d.innerHTML = v, f = space$6(), y = element$6("button"), y.innerHTML = A, x = space$6(), M = element$6("div"), m = element$6("table"), l = element$6("thead"), l.innerHTML = u, p = space$6(), g = element$6("tbody"), b = element$6("tr"), c = element$6("th"), c.textContent = _, E = space$6(), w = element$6("td"), W.c(), k = space$6(), $ = element$6("tr"), L = element$6("th"), L.textContent = z, F = space$6(), R = element$6("td"), H.c(), this.h();
    },
    l(Q) {
      e = claim_element$6(Q, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$3(e) !== "svelte-1ws80r8" && (e.textContent = t), r = claim_space$6(Q), a = claim_element$6(Q, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$3(a) !== "svelte-au1964" && (a.innerHTML = s), h = claim_space$6(Q), o = claim_element$6(Q, "DIV", { class: !0 });
      var te = children$5(o);
      d = claim_element$6(te, "BUTTON", {
        class: !0,
        id: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$3(d) !== "svelte-1x319mo" && (d.innerHTML = v), f = claim_space$6(te), y = claim_element$6(te, "BUTTON", {
        class: !0,
        id: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$3(y) !== "svelte-vlrg5g" && (y.innerHTML = A), te.forEach(detach$7), x = claim_space$6(Q), M = claim_element$6(Q, "DIV", { class: !0 });
      var ee = children$5(M);
      m = claim_element$6(ee, "TABLE", { class: !0 });
      var ce = children$5(m);
      l = claim_element$6(ce, "THEAD", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$3(l) !== "svelte-1cl8b2m" && (l.innerHTML = u), p = claim_space$6(ce), g = claim_element$6(ce, "TBODY", { class: !0 });
      var fe = children$5(g);
      b = claim_element$6(fe, "TR", { class: !0 });
      var oe = children$5(b);
      c = claim_element$6(oe, "TH", {
        scope: !0,
        class: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$3(c) !== "svelte-1j0kl0r" && (c.textContent = _), E = claim_space$6(oe), w = claim_element$6(oe, "TD", { class: !0 });
      var he = children$5(w);
      W.l(he), he.forEach(detach$7), oe.forEach(detach$7), k = claim_space$6(fe), $ = claim_element$6(fe, "TR", { class: !0 });
      var Ae = children$5($);
      L = claim_element$6(Ae, "TH", {
        scope: !0,
        class: !0,
        "data-svelte-h": !0
      }), get_svelte_dataset$3(L) !== "svelte-nv6kl6" && (L.textContent = z), F = claim_space$6(Ae), R = claim_element$6(Ae, "TD", { class: !0 });
      var Se = children$5(R);
      H.l(Se), Se.forEach(detach$7), Ae.forEach(detach$7), fe.forEach(detach$7), ce.forEach(detach$7), ee.forEach(detach$7), this.h();
    },
    h() {
      attr$6(e, "class", "w-full text-center text-lg mb-2 svelte-oz981t"), attr$6(a, "class", "flex items-center space-x-2 justify-center mb-2 text-xs svelte-oz981t"), attr$6(d, "class", "w-1/2 flex items-center rounded-l-full px-4 py-2 transition-colors duration-300 ease-in hover:text-orange-600 focus:text-orange-600 focus:outline-none svelte-oz981t"), attr$6(d, "id", "attach"), toggle_class$5(
        d,
        "active",
        /*mode*/
        n[3] === "attach"
      ), attr$6(y, "class", "w-1/2 flex items-center rounded-r-full px-4 py-2 transition-colors duration-300 ease-in hover:text-orange-600 focus:text-orange-600 focus:outline-none svelte-oz981t"), attr$6(y, "id", "delete"), toggle_class$5(
        y,
        "active",
        /*mode*/
        n[3] === "delete"
      ), attr$6(o, "class", "flex rounded-full border-2 border-gray-200 bg-gray-200 text-sm leading-none text-gray-500 svelte-oz981t"), attr$6(l, "class", "text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 svelte-oz981t"), attr$6(c, "scope", "row"), attr$6(c, "class", "px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white text-right svelte-oz981t"), attr$6(w, "class", "px-6 py-4 font-mono svelte-oz981t"), attr$6(b, "class", "bg-white border-b dark:bg-gray-800 dark:border-gray-700 svelte-oz981t"), attr$6(L, "scope", "row"), attr$6(L, "class", "px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white text-right svelte-oz981t"), attr$6(R, "class", "px-6 py-4 font-mono svelte-oz981t"), attr$6($, "class", "bg-white dark:bg-gray-800 svelte-oz981t"), attr$6(g, "class", "svelte-oz981t"), attr$6(m, "class", "w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 svelte-oz981t"), attr$6(M, "class", "relative overflow-x-auto mt-3 svelte-oz981t");
    },
    m(Q, te) {
      insert_hydration$7(Q, e, te), insert_hydration$7(Q, r, te), insert_hydration$7(Q, a, te), insert_hydration$7(Q, h, te), insert_hydration$7(Q, o, te), append_hydration$5(o, d), append_hydration$5(o, f), append_hydration$5(o, y), insert_hydration$7(Q, x, te), insert_hydration$7(Q, M, te), append_hydration$5(M, m), append_hydration$5(m, l), append_hydration$5(m, p), append_hydration$5(m, g), append_hydration$5(g, b), append_hydration$5(b, c), append_hydration$5(b, E), append_hydration$5(b, w), W.m(w, null), append_hydration$5(g, k), append_hydration$5(g, $), append_hydration$5($, L), append_hydration$5($, F), append_hydration$5($, R), H.m(R, null), P || (U = [
        listen$2(
          d,
          "click",
          /*click_handler*/
          n[7]
        ),
        listen$2(
          y,
          "click",
          /*click_handler_1*/
          n[8]
        )
      ], P = !0);
    },
    p(Q, te) {
      te & /*mode*/
      8 && toggle_class$5(
        d,
        "active",
        /*mode*/
        Q[3] === "attach"
      ), te & /*mode*/
      8 && toggle_class$5(
        y,
        "active",
        /*mode*/
        Q[3] === "delete"
      ), B === (B = N(Q)) && W ? W.p(Q, te) : (W.d(1), W = B(Q), W && (W.c(), W.m(w, null))), G === (G = V(Q)) && H ? H.p(Q, te) : (H.d(1), H = G(Q), H && (H.c(), H.m(R, null)));
    },
    d(Q) {
      Q && (detach$7(e), detach$7(r), detach$7(a), detach$7(h), detach$7(o), detach$7(x), detach$7(M)), W.d(), H.d(), P = !1, run_all$2(U);
    }
  };
}
function create_else_block_1$3(n) {
  let e;
  return {
    c() {
      e = text$6("not selected");
    },
    l(t) {
      e = claim_text$5(t, "not selected");
    },
    m(t, r) {
      insert_hydration$7(t, e, r);
    },
    p: noop$7,
    d(t) {
      t && detach$7(e);
    }
  };
}
function create_if_block_2$4(n) {
  let e;
  return {
    c() {
      e = text$6(
        /*attachmentIndex*/
        n[1]
      );
    },
    l(t) {
      e = claim_text$5(
        t,
        /*attachmentIndex*/
        n[1]
      );
    },
    m(t, r) {
      insert_hydration$7(t, e, r);
    },
    p(t, r) {
      r & /*attachmentIndex*/
      2 && set_data$5(
        e,
        /*attachmentIndex*/
        t[1]
      );
    },
    d(t) {
      t && detach$7(e);
    }
  };
}
function create_else_block$5(n) {
  let e;
  return {
    c() {
      e = text$6("no atoms are deleted");
    },
    l(t) {
      e = claim_text$5(t, "no atoms are deleted");
    },
    m(t, r) {
      insert_hydration$7(t, e, r);
    },
    p: noop$7,
    d(t) {
      t && detach$7(e);
    }
  };
}
function create_if_block_1$5(n) {
  let e = (
    /*deleteIndexes*/
    n[2].join(", ") + ""
  ), t;
  return {
    c() {
      t = text$6(e);
    },
    l(r) {
      t = claim_text$5(r, e);
    },
    m(r, a) {
      insert_hydration$7(r, t, a);
    },
    p(r, a) {
      a & /*deleteIndexes*/
      4 && e !== (e = /*deleteIndexes*/
      r[2].join(", ") + "") && set_data$5(t, e);
    },
    d(r) {
      r && detach$7(t);
    }
  };
}
function create_fragment$7(n) {
  let e, t, r, a, s, h = (
    /*showCovMod*/
    n[0] > -1 && create_if_block$6(n)
  );
  return {
    c() {
      e = element$6("div"), t = element$6("div"), r = element$6("div"), a = space$6(), s = element$6("div"), h && h.c(), this.h();
    },
    l(o) {
      e = claim_element$6(o, "DIV", { class: !0 });
      var d = children$5(e);
      t = claim_element$6(d, "DIV", { class: !0 });
      var v = children$5(t);
      r = claim_element$6(v, "DIV", { class: !0 }), children$5(r).forEach(detach$7), v.forEach(detach$7), a = claim_space$6(d), s = claim_element$6(d, "DIV", { class: !0 });
      var f = children$5(s);
      h && h.l(f), f.forEach(detach$7), d.forEach(detach$7), this.h();
    },
    h() {
      attr$6(r, "class", "mol-canvas svelte-oz981t"), attr$6(t, "class", "relative svelte-oz981t"), attr$6(s, "class", "flex flex-col justify-center svelte-oz981t"), attr$6(e, "class", "mol-wrapper svelte-oz981t");
    },
    m(o, d) {
      insert_hydration$7(o, e, d), append_hydration$5(e, t), append_hydration$5(t, r), n[6](r), append_hydration$5(e, a), append_hydration$5(e, s), h && h.m(s, null);
    },
    p(o, [d]) {
      /*showCovMod*/
      o[0] > -1 ? h ? h.p(o, d) : (h = create_if_block$6(o), h.c(), h.m(s, null)) : h && (h.d(1), h = null);
    },
    i: noop$7,
    o: noop$7,
    d(o) {
      o && detach$7(e), n[6](null), h && h.d();
    }
  };
}
function instance$7(n, e, t) {
  const r = createEventDispatcher$4();
  let a = mol;
  console.log(a);
  let s = null, h = [], o = "attach";
  function d(l) {
    l.setStyle({ stick: {} }), y > -1 && (s !== null && l.addStyle({ index: s }, { sphere: { color: "blue", scale: 0.5 } }), l.addStyle({ index: h }, { sphere: { color: "red", scale: 0.5 } }), r("updateMol", {
      attachmentIndex: s,
      deleteIndexes: h,
      index: y,
      mol: l.exportJSON()
    }));
  }
  function v(l, u) {
    let p = a.createViewer(u, {});
    return p.addModel(l, "sdf"), d(p), p.setBackgroundColor("white"), p.zoomTo(), p.getModel(0).setClickable({}, !0, function(g, b, c, _) {
      y > -1 && (o === "attach" ? t(1, s = g.serial) : (h.includes(g.serial) ? t(2, h = h.filter((E) => E !== g.serial)) : h.push(g.serial), t(2, h), d(b)));
    }), p.render(), p;
  }
  let { molvalue: f = "" } = e, { showCovMod: y = -1 } = e, A = null;
  afterUpdate$2(() => {
    v(f, A);
  });
  function x(l) {
    binding_callbacks$4[l ? "unshift" : "push"](() => {
      A = l, t(4, A);
    });
  }
  const M = () => t(3, o = "attach"), m = () => t(3, o = "delete");
  return n.$$set = (l) => {
    "molvalue" in l && t(5, f = l.molvalue), "showCovMod" in l && t(0, y = l.showCovMod);
  }, [
    y,
    s,
    h,
    o,
    A,
    f,
    x,
    M,
    m
  ];
}
class Molecule extends SvelteComponent$7 {
  constructor(e) {
    super(), init$7(this, e, instance$7, create_fragment$7, safe_not_equal$8, { molvalue: 5, showCovMod: 0 });
  }
}
const {
  SvelteComponent: SvelteComponent$6,
  add_render_callback: add_render_callback$2,
  append_hydration: append_hydration$4,
  attr: attr$5,
  check_outros: check_outros$4,
  children: children$4,
  claim_component: claim_component$4,
  claim_element: claim_element$5,
  claim_space: claim_space$5,
  claim_svg_element: claim_svg_element$1,
  claim_text: claim_text$4,
  create_component: create_component$4,
  destroy_component: destroy_component$4,
  destroy_each: destroy_each$2,
  detach: detach$6,
  element: element$5,
  empty: empty$4,
  ensure_array_like: ensure_array_like$2,
  get_svelte_dataset: get_svelte_dataset$2,
  group_outros: group_outros$4,
  init: init$6,
  insert_hydration: insert_hydration$6,
  listen: listen$1,
  mount_component: mount_component$4,
  noop: noop$6,
  run_all: run_all$1,
  safe_not_equal: safe_not_equal$7,
  select_option,
  select_value,
  set_data: set_data$4,
  set_input_value: set_input_value$1,
  space: space$5,
  svg_element: svg_element$1,
  text: text$5,
  toggle_class: toggle_class$4,
  transition_in: transition_in$4,
  transition_out: transition_out$4
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$3 } = window.__gradio__svelte__internal;
function get_each_context$2(n, e, t) {
  const r = n.slice();
  return r[35] = e[t], r[36] = e, r[37] = t, r;
}
function get_each_context_1$1(n, e, t) {
  const r = n.slice();
  return r[38] = e[t], r;
}
function get_each_context_2(n, e, t) {
  const r = n.slice();
  return r[41] = e[t], r;
}
function get_each_context_3(n, e, t) {
  const r = n.slice();
  return r[44] = e[t], r[37] = t, r;
}
function get_each_context_4(n, e, t) {
  const r = n.slice();
  return r[38] = e[t], r;
}
function get_each_context_5(n, e, t) {
  const r = n.slice();
  return r[48] = e[t], r[49] = e, r[37] = t, r;
}
function get_each_context_6(n, e, t) {
  const r = n.slice();
  return r[50] = e[t], r;
}
function create_if_block_11$1(n) {
  let e, t;
  function r(h, o) {
    return o[0] & /*vals*/
    1 && (e = null), e == null && (e = !!/*metals*/
    h[8].includes(
      /*item*/
      h[48].name
    )), e ? create_if_block_12$1 : create_else_block_2;
  }
  let a = r(n, [-1, -1]), s = a(n);
  return {
    c() {
      s.c(), t = empty$4();
    },
    l(h) {
      s.l(h), t = empty$4();
    },
    m(h, o) {
      s.m(h, o), insert_hydration$6(h, t, o);
    },
    p(h, o) {
      a === (a = r(h, o)) && s ? s.p(h, o) : (s.d(1), s = a(h), s && (s.c(), s.m(t.parentNode, t)));
    },
    d(h) {
      h && detach$6(t), s.d(h);
    }
  };
}
function create_else_block_2(n) {
  let e = (
    /*item*/
    n[48].smiles + ""
  ), t;
  return {
    c() {
      t = text$5(e);
    },
    l(r) {
      t = claim_text$4(r, e);
    },
    m(r, a) {
      insert_hydration$6(r, t, a);
    },
    p(r, a) {
      a[0] & /*vals*/
      1 && e !== (e = /*item*/
      r[48].smiles + "") && set_data$4(t, e);
    },
    d(r) {
      r && detach$6(t);
    }
  };
}
function create_if_block_12$1(n) {
  let e = (
    /*item*/
    n[48].name + ""
  ), t;
  return {
    c() {
      t = text$5(e);
    },
    l(r) {
      t = claim_text$4(r, e);
    },
    m(r, a) {
      insert_hydration$6(r, t, a);
    },
    p(r, a) {
      a[0] & /*vals*/
      1 && e !== (e = /*item*/
      r[48].name + "") && set_data$4(t, e);
    },
    d(r) {
      r && detach$6(t);
    }
  };
}
function create_if_block_8$1(n) {
  let e, t, r, a, s, h;
  const o = [create_if_block_9$1, create_if_block_10$1], d = [];
  function v(f, y) {
    return y[0] & /*vals*/
    1 && (r = null), r == null && (r = !!["DNA", "RNA", "protein"].includes(
      /*item*/
      f[48].class
    )), r ? 0 : (
      /*item*/
      f[48].class === "ligand" ? 1 : -1
    );
  }
  return ~(a = v(n, [-1, -1])) && (s = d[a] = o[a](n)), {
    c() {
      e = element$5("div"), t = element$5("div"), s && s.c(), this.h();
    },
    l(f) {
      e = claim_element$5(f, "DIV", {
        id: !0,
        "aria-labelledby": !0,
        class: !0
      });
      var y = children$4(e);
      t = claim_element$5(y, "DIV", { class: !0 });
      var A = children$4(t);
      s && s.l(A), A.forEach(detach$6), y.forEach(detach$6), this.h();
    },
    h() {
      attr$5(t, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900 svelte-bt9x4p"), attr$5(e, "id", `accordion-collapse-body-${/*i*/
      n[37]}`), attr$5(e, "aria-labelledby", `accordion-collapse-heading-${/*i*/
      n[37]}`), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(f, y) {
      insert_hydration$6(f, e, y), append_hydration$4(e, t), ~a && d[a].m(t, null), h = !0;
    },
    p(f, y) {
      let A = a;
      a = v(f, y), a === A ? ~a && d[a].p(f, y) : (s && (group_outros$4(), transition_out$4(d[A], 1, 1, () => {
        d[A] = null;
      }), check_outros$4()), ~a ? (s = d[a], s ? s.p(f, y) : (s = d[a] = o[a](f), s.c()), transition_in$4(s, 1), s.m(t, null)) : s = null);
    },
    i(f) {
      h || (transition_in$4(s), h = !0);
    },
    o(f) {
      transition_out$4(s), h = !1;
    },
    d(f) {
      f && detach$6(e), ~a && d[a].d();
    }
  };
}
function create_if_block_10$1(n) {
  let e, t, r, a, s = "- or -", h, o, d, v, f = "- or -", y, A, x, M, m, l = "- or -", u, p, g = "Metal ion", b, c, _, E, w;
  function k(...F) {
    return (
      /*input_handler_1*/
      n[17](
        /*i*/
        n[37],
        ...F
      )
    );
  }
  o = new SearchInput({
    props: {
      database: "rcsb-3ligand",
      index: (
        /*i*/
        n[37]
      )
    }
  }), o.$on(
    "triggerFetch",
    /*handleMessage*/
    n[13]
  );
  function $(...F) {
    return (
      /*input_handler_2*/
      n[18](
        /*i*/
        n[37],
        ...F
      )
    );
  }
  let L = ensure_array_like$2(
    /*metals*/
    n[8]
  ), z = [];
  for (let F = 0; F < L.length; F += 1)
    z[F] = create_each_block_6(get_each_context_6(n, L, F));
  return {
    c() {
      e = element$5("textarea"), r = space$5(), a = element$5("div"), a.textContent = s, h = space$5(), create_component$4(o.$$.fragment), d = space$5(), v = element$5("div"), v.textContent = f, y = space$5(), A = element$5("textarea"), M = space$5(), m = element$5("div"), m.textContent = l, u = space$5(), p = element$5("div"), p.textContent = g, b = space$5(), c = element$5("div");
      for (let F = 0; F < z.length; F += 1)
        z[F].c();
      this.h();
    },
    l(F) {
      e = claim_element$5(F, "TEXTAREA", {
        rows: !0,
        class: !0,
        placeholder: !0
      }), children$4(e).forEach(detach$6), r = claim_space$5(F), a = claim_element$5(F, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(a) !== "svelte-1f0b7yn" && (a.textContent = s), h = claim_space$5(F), claim_component$4(o.$$.fragment, F), d = claim_space$5(F), v = claim_element$5(F, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(v) !== "svelte-1f0b7yn" && (v.textContent = f), y = claim_space$5(F), A = claim_element$5(F, "TEXTAREA", {
        rows: !0,
        class: !0,
        placeholder: !0
      }), children$4(A).forEach(detach$6), M = claim_space$5(F), m = claim_element$5(F, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(m) !== "svelte-1f0b7yn" && (m.textContent = l), u = claim_space$5(F), p = claim_element$5(F, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(p) !== "svelte-5ik8xi" && (p.textContent = g), b = claim_space$5(F), c = claim_element$5(F, "DIV", { class: !0 });
      var R = children$4(c);
      for (let P = 0; P < z.length; P += 1)
        z[P].l(R);
      R.forEach(detach$6), this.h();
    },
    h() {
      attr$5(e, "rows", "1"), attr$5(e, "class", "block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-bt9x4p"), attr$5(e, "placeholder", "SMILES like CCC ..."), e.value = t = /*item*/
      n[48].smiles, attr$5(a, "class", "text-center text-gray-400 w-full my-2 svelte-bt9x4p"), attr$5(v, "class", "text-center text-gray-400 w-full my-2 svelte-bt9x4p"), attr$5(A, "rows", "3"), attr$5(A, "class", "block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-bt9x4p"), attr$5(A, "placeholder", "SDF format 3D molecule ..."), A.value = x = /*item*/
      n[48].sdf, attr$5(m, "class", "text-center text-gray-400 w-full my-2 svelte-bt9x4p"), attr$5(p, "class", "text-center text-gray-600 font-bold mb-2 svelte-bt9x4p"), attr$5(c, "class", "flex justify-center space-x-2 svelte-bt9x4p");
    },
    m(F, R) {
      insert_hydration$6(F, e, R), insert_hydration$6(F, r, R), insert_hydration$6(F, a, R), insert_hydration$6(F, h, R), mount_component$4(o, F, R), insert_hydration$6(F, d, R), insert_hydration$6(F, v, R), insert_hydration$6(F, y, R), insert_hydration$6(F, A, R), insert_hydration$6(F, M, R), insert_hydration$6(F, m, R), insert_hydration$6(F, u, R), insert_hydration$6(F, p, R), insert_hydration$6(F, b, R), insert_hydration$6(F, c, R);
      for (let P = 0; P < z.length; P += 1)
        z[P] && z[P].m(c, null);
      _ = !0, E || (w = [
        listen$1(e, "input", k),
        listen$1(A, "input", $)
      ], E = !0);
    },
    p(F, R) {
      if (n = F, (!_ || R[0] & /*vals*/
      1 && t !== (t = /*item*/
      n[48].smiles)) && (e.value = t), (!_ || R[0] & /*vals*/
      1 && x !== (x = /*item*/
      n[48].sdf)) && (A.value = x), R[0] & /*vals, metals, dispatch*/
      289) {
        L = ensure_array_like$2(
          /*metals*/
          n[8]
        );
        let P;
        for (P = 0; P < L.length; P += 1) {
          const U = get_each_context_6(n, L, P);
          z[P] ? z[P].p(U, R) : (z[P] = create_each_block_6(U), z[P].c(), z[P].m(c, null));
        }
        for (; P < z.length; P += 1)
          z[P].d(1);
        z.length = L.length;
      }
    },
    i(F) {
      _ || (transition_in$4(o.$$.fragment, F), _ = !0);
    },
    o(F) {
      transition_out$4(o.$$.fragment, F), _ = !1;
    },
    d(F) {
      F && (detach$6(e), detach$6(r), detach$6(a), detach$6(h), detach$6(d), detach$6(v), detach$6(y), detach$6(A), detach$6(M), detach$6(m), detach$6(u), detach$6(p), detach$6(b), detach$6(c)), destroy_component$4(o, F), destroy_each$2(z, F), E = !1, run_all$1(w);
    }
  };
}
function create_if_block_9$1(n) {
  let e, t, r, a;
  function s(...h) {
    return (
      /*input_handler*/
      n[16](
        /*i*/
        n[37],
        ...h
      )
    );
  }
  return {
    c() {
      e = element$5("textarea"), this.h();
    },
    l(h) {
      e = claim_element$5(h, "TEXTAREA", {
        id: !0,
        rows: !0,
        class: !0,
        placeholder: !0
      }), children$4(e).forEach(detach$6), this.h();
    },
    h() {
      attr$5(e, "id", "message"), attr$5(e, "rows", "4"), attr$5(e, "class", "block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-bt9x4p"), attr$5(e, "placeholder", "MSAVGH..."), e.value = t = /*item*/
      n[48].sequence;
    },
    m(h, o) {
      insert_hydration$6(h, e, o), r || (a = listen$1(e, "input", s), r = !0);
    },
    p(h, o) {
      n = h, o[0] & /*vals*/
      1 && t !== (t = /*item*/
      n[48].sequence) && (e.value = t);
    },
    i: noop$6,
    o: noop$6,
    d(h) {
      h && detach$6(e), r = !1, a();
    }
  };
}
function create_each_block_6(n) {
  let e, t, r = (
    /*metal*/
    n[50] + ""
  ), a, s, h, o;
  function d() {
    return (
      /*click_handler_2*/
      n[19](
        /*metal*/
        n[50],
        /*i*/
        n[37]
      )
    );
  }
  return {
    c() {
      e = element$5("button"), t = element$5("span"), a = text$5(r), s = space$5(), this.h();
    },
    l(v) {
      e = claim_element$5(v, "BUTTON", { class: !0 });
      var f = children$4(e);
      t = claim_element$5(f, "SPAN", { class: !0 });
      var y = children$4(t);
      a = claim_text$4(y, r), y.forEach(detach$6), s = claim_space$5(f), f.forEach(detach$6), this.h();
    },
    h() {
      attr$5(t, "class", "font-medium text-gray-600 dark:text-gray-300 svelte-bt9x4p"), attr$5(e, "class", "relative inline-flex items-center justify-center w-10 h-10 overflow-hidden rounded-full dark:bg-gray-600 svelte-bt9x4p"), toggle_class$4(
        e,
        "bg-blue-200",
        /*item*/
        n[48].name === /*metal*/
        n[50]
      ), toggle_class$4(
        e,
        "bg-violet-100",
        /*item*/
        n[48].name !== /*metal*/
        n[50]
      );
    },
    m(v, f) {
      insert_hydration$6(v, e, f), append_hydration$4(e, t), append_hydration$4(t, a), append_hydration$4(e, s), h || (o = listen$1(e, "click", d), h = !0);
    },
    p(v, f) {
      n = v, f[0] & /*vals, metals*/
      257 && toggle_class$4(
        e,
        "bg-blue-200",
        /*item*/
        n[48].name === /*metal*/
        n[50]
      ), f[0] & /*vals, metals*/
      257 && toggle_class$4(
        e,
        "bg-violet-100",
        /*item*/
        n[48].name !== /*metal*/
        n[50]
      );
    },
    d(v) {
      v && detach$6(e), h = !1, o();
    }
  };
}
function create_if_block_3$3(n) {
  let e, t, r, a, s;
  const h = [create_if_block_4$3, create_if_block_6$1], o = [];
  function d(v, f) {
    return f[0] & /*vals*/
    1 && (e = null), e == null && (e = !!["DNA", "RNA", "protein"].includes(
      /*item*/
      v[48].class
    )), e ? 0 : (
      /*item*/
      v[48].class === "ligand" ? 1 : -1
    );
  }
  return ~(t = d(n, [-1, -1])) && (r = o[t] = h[t](n)), {
    c() {
      r && r.c(), a = empty$4();
    },
    l(v) {
      r && r.l(v), a = empty$4();
    },
    m(v, f) {
      ~t && o[t].m(v, f), insert_hydration$6(v, a, f), s = !0;
    },
    p(v, f) {
      let y = t;
      t = d(v, f), t === y ? ~t && o[t].p(v, f) : (r && (group_outros$4(), transition_out$4(o[y], 1, 1, () => {
        o[y] = null;
      }), check_outros$4()), ~t ? (r = o[t], r ? r.p(v, f) : (r = o[t] = h[t](v), r.c()), transition_in$4(r, 1), r.m(a.parentNode, a)) : r = null);
    },
    i(v) {
      s || (transition_in$4(r), s = !0);
    },
    o(v) {
      transition_out$4(r), s = !1;
    },
    d(v) {
      v && detach$6(a), ~t && o[t].d(v);
    }
  };
}
function create_if_block_6$1(n) {
  let e, t, r = (
    /*item*/
    n[48].sdf !== "" && create_if_block_7$1(n)
  );
  return {
    c() {
      r && r.c(), e = empty$4();
    },
    l(a) {
      r && r.l(a), e = empty$4();
    },
    m(a, s) {
      r && r.m(a, s), insert_hydration$6(a, e, s), t = !0;
    },
    p(a, s) {
      /*item*/
      a[48].sdf !== "" ? r ? (r.p(a, s), s[0] & /*vals*/
      1 && transition_in$4(r, 1)) : (r = create_if_block_7$1(a), r.c(), transition_in$4(r, 1), r.m(e.parentNode, e)) : r && (group_outros$4(), transition_out$4(r, 1, 1, () => {
        r = null;
      }), check_outros$4());
    },
    i(a) {
      t || (transition_in$4(r), t = !0);
    },
    o(a) {
      transition_out$4(r), t = !1;
    },
    d(a) {
      a && detach$6(e), r && r.d(a);
    }
  };
}
function create_if_block_4$3(n) {
  let e, t, r, a = (
    /*item*/
    n[48].sequence !== "" && create_if_block_5$3(n)
  );
  return {
    c() {
      e = element$5("div"), t = element$5("div"), a && a.c(), this.h();
    },
    l(s) {
      e = claim_element$5(s, "DIV", {
        id: !0,
        "aria-labelledby": !0,
        class: !0
      });
      var h = children$4(e);
      t = claim_element$5(h, "DIV", { class: !0 });
      var o = children$4(t);
      a && a.l(o), o.forEach(detach$6), h.forEach(detach$6), this.h();
    },
    h() {
      attr$5(t, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 svelte-bt9x4p"), toggle_class$4(
        t,
        "border-b-0",
        /*i*/
        n[37] != /*vals*/
        n[0].length - 1
      ), attr$5(e, "id", `accordion-collapse-body-${/*i*/
      n[37]}`), attr$5(e, "aria-labelledby", `accordion-collapse-heading-${/*i*/
      n[37]}`), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(s, h) {
      insert_hydration$6(s, e, h), append_hydration$4(e, t), a && a.m(t, null), r = !0;
    },
    p(s, h) {
      /*item*/
      s[48].sequence !== "" ? a ? (a.p(s, h), h[0] & /*vals*/
      1 && transition_in$4(a, 1)) : (a = create_if_block_5$3(s), a.c(), transition_in$4(a, 1), a.m(t, null)) : a && (group_outros$4(), transition_out$4(a, 1, 1, () => {
        a = null;
      }), check_outros$4()), (!r || h[0] & /*vals*/
      1) && toggle_class$4(
        t,
        "border-b-0",
        /*i*/
        s[37] != /*vals*/
        s[0].length - 1
      );
    },
    i(s) {
      r || (transition_in$4(a), r = !0);
    },
    o(s) {
      transition_out$4(a), r = !1;
    },
    d(s) {
      s && detach$6(e), a && a.d();
    }
  };
}
function create_if_block_7$1(n) {
  let e, t, r, a;
  return r = new Molecule({
    props: {
      molvalue: (
        /*item*/
        n[48].sdf
      ),
      showCovMod: (
        /*showCovModVals*/
        n[2][
          /*i*/
          n[37]
        ]
      )
    }
  }), r.$on(
    "updateMol",
    /*updateMol*/
    n[12]
  ), {
    c() {
      e = element$5("div"), t = element$5("div"), create_component$4(r.$$.fragment), this.h();
    },
    l(s) {
      e = claim_element$5(s, "DIV", { class: !0 });
      var h = children$4(e);
      t = claim_element$5(h, "DIV", { class: !0 });
      var o = children$4(t);
      claim_component$4(r.$$.fragment, o), o.forEach(detach$6), h.forEach(detach$6), this.h();
    },
    h() {
      attr$5(t, "class", "relative svelte-bt9x4p"), attr$5(e, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 svelte-bt9x4p"), toggle_class$4(
        e,
        "border-b-0",
        /*i*/
        n[37] != /*vals*/
        n[0].length - 1
      );
    },
    m(s, h) {
      insert_hydration$6(s, e, h), append_hydration$4(e, t), mount_component$4(r, t, null), a = !0;
    },
    p(s, h) {
      const o = {};
      h[0] & /*vals*/
      1 && (o.molvalue = /*item*/
      s[48].sdf), h[0] & /*showCovModVals*/
      4 && (o.showCovMod = /*showCovModVals*/
      s[2][
        /*i*/
        s[37]
      ]), r.$set(o), (!a || h[0] & /*vals*/
      1) && toggle_class$4(
        e,
        "border-b-0",
        /*i*/
        s[37] != /*vals*/
        s[0].length - 1
      );
    },
    i(s) {
      a || (transition_in$4(r.$$.fragment, s), a = !0);
    },
    o(s) {
      transition_out$4(r.$$.fragment, s), a = !1;
    },
    d(s) {
      s && detach$6(e), destroy_component$4(r);
    }
  };
}
function create_if_block_5$3(n) {
  let e, t;
  return e = new Sequence({
    props: { seq: (
      /*item*/
      n[48].sequence
    ) }
  }), {
    c() {
      create_component$4(e.$$.fragment);
    },
    l(r) {
      claim_component$4(e.$$.fragment, r);
    },
    m(r, a) {
      mount_component$4(e, r, a), t = !0;
    },
    p(r, a) {
      const s = {};
      a[0] & /*vals*/
      1 && (s.seq = /*item*/
      r[48].sequence), e.$set(s);
    },
    i(r) {
      t || (transition_in$4(e.$$.fragment, r), t = !0);
    },
    o(r) {
      transition_out$4(e.$$.fragment, r), t = !1;
    },
    d(r) {
      destroy_component$4(e, r);
    }
  };
}
function create_each_block_5(n) {
  let e, t, r, a, s = (
    /*item*/
    n[48].chain + ""
  ), h, o, d, v, f = (
    /*labels*/
    n[6][
      /*item*/
      n[48].class
    ] + ""
  ), y, A, x, M, m, l, u, p, g, b, c, _, E, w, k, $, L, z = !/*item*/
  n[48].open && /*item*/
  n[48].class === "ligand" && create_if_block_11$1(n);
  function F(...N) {
    return (
      /*click_handler*/
      n[14](
        /*i*/
        n[37],
        ...N
      )
    );
  }
  function R() {
    return (
      /*click_handler_1*/
      n[15](
        /*item*/
        n[48],
        /*each_value_5*/
        n[49],
        /*i*/
        n[37]
      )
    );
  }
  let P = (
    /*item*/
    n[48].open && create_if_block_8$1(n)
  ), U = !/*item*/
  n[48].open && create_if_block_3$3(n);
  return {
    c() {
      e = element$5("h2"), t = element$5("button"), r = element$5("div"), a = element$5("span"), h = text$5(s), d = space$5(), v = element$5("span"), y = text$5(f), A = space$5(), x = element$5("span"), z && z.c(), M = space$5(), m = element$5("div"), l = svg_element$1("svg"), u = svg_element$1("path"), p = space$5(), g = svg_element$1("svg"), b = svg_element$1("path"), _ = space$5(), P && P.c(), E = space$5(), U && U.c(), w = empty$4(), this.h();
    },
    l(N) {
      e = claim_element$5(N, "H2", { id: !0, class: !0 });
      var B = children$4(e);
      t = claim_element$5(B, "BUTTON", {
        type: !0,
        class: !0,
        "data-accordion-target": !0,
        "aria-expanded": !0,
        "aria-controls": !0
      });
      var W = children$4(t);
      r = claim_element$5(W, "DIV", { class: !0 });
      var V = children$4(r);
      a = claim_element$5(V, "SPAN", { class: !0 });
      var G = children$4(a);
      h = claim_text$4(G, s), G.forEach(detach$6), d = claim_space$5(V), v = claim_element$5(V, "SPAN", { class: !0 });
      var H = children$4(v);
      y = claim_text$4(H, f), H.forEach(detach$6), A = claim_space$5(V), x = claim_element$5(V, "SPAN", { class: !0 });
      var Q = children$4(x);
      z && z.l(Q), Q.forEach(detach$6), V.forEach(detach$6), M = claim_space$5(W), m = claim_element$5(W, "DIV", { class: !0 });
      var te = children$4(m);
      l = claim_svg_element$1(te, "svg", {
        "data-slot": !0,
        fill: !0,
        "stroke-width": !0,
        stroke: !0,
        viewBox: !0,
        xmlns: !0,
        "aria-hidden": !0,
        class: !0
      });
      var ee = children$4(l);
      u = claim_svg_element$1(ee, "path", {
        "stroke-linecap": !0,
        "stroke-linejoin": !0,
        d: !0,
        class: !0
      }), children$4(u).forEach(detach$6), ee.forEach(detach$6), p = claim_space$5(te), g = claim_svg_element$1(te, "svg", {
        "data-accordion-icon": !0,
        class: !0,
        "aria-hidden": !0,
        xmlns: !0,
        fill: !0,
        viewBox: !0
      });
      var ce = children$4(g);
      b = claim_svg_element$1(ce, "path", {
        stroke: !0,
        "stroke-linecap": !0,
        "stroke-linejoin": !0,
        "stroke-width": !0,
        d: !0,
        class: !0
      }), children$4(b).forEach(detach$6), ce.forEach(detach$6), te.forEach(detach$6), W.forEach(detach$6), B.forEach(detach$6), _ = claim_space$5(N), P && P.l(N), E = claim_space$5(N), U && U.l(N), w = empty$4(), this.h();
    },
    h() {
      attr$5(a, "class", o = "inline-flex items-center justify-center p-1 px-2 text-xs font-semibold rounded-full " + /*colorCode*/
      n[7][
        /*item*/
        n[48].class
      ] + " svelte-bt9x4p"), attr$5(v, "class", "svelte-bt9x4p"), attr$5(x, "class", "px-2 text-gray-800 font-bold svelte-bt9x4p"), attr$5(r, "class", "svelte-bt9x4p"), attr$5(u, "stroke-linecap", "round"), attr$5(u, "stroke-linejoin", "round"), attr$5(u, "d", "M6 18 18 6M6 6l12 12"), attr$5(u, "class", "svelte-bt9x4p"), attr$5(l, "data-slot", "icon"), attr$5(l, "fill", "none"), attr$5(l, "stroke-width", "3"), attr$5(l, "stroke", "currentColor"), attr$5(l, "viewBox", "0 0 24 24"), attr$5(l, "xmlns", "http://www.w3.org/2000/svg"), attr$5(l, "aria-hidden", "true"), attr$5(l, "class", "w-4 h-4 text-red-800 svelte-bt9x4p"), attr$5(b, "stroke", "currentColor"), attr$5(b, "stroke-linecap", "round"), attr$5(b, "stroke-linejoin", "round"), attr$5(b, "stroke-width", "2"), attr$5(b, "d", "M9 5 5 1 1 5"), attr$5(b, "class", "svelte-bt9x4p"), attr$5(g, "data-accordion-icon", ""), attr$5(g, "class", "w-3 h-3 shrink-0 svelte-bt9x4p"), attr$5(g, "aria-hidden", "true"), attr$5(g, "xmlns", "http://www.w3.org/2000/svg"), attr$5(g, "fill", "none"), attr$5(g, "viewBox", "0 0 10 6"), toggle_class$4(
        g,
        "rotate-180",
        /*item*/
        n[48].open
      ), toggle_class$4(g, "-rotate-90", !/*item*/
      n[48].open), attr$5(m, "class", "flex items-center space-x-2 svelte-bt9x4p"), attr$5(t, "type", "button"), attr$5(t, "class", "flex items-center justify-between w-full p-5 font-medium rtl:text-right text-gray-500 border border-gray-200 dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 gap-3 svelte-bt9x4p"), attr$5(t, "data-accordion-target", `#accordion-collapse-body-${/*i*/
      n[37]}`), attr$5(t, "aria-expanded", c = /*item*/
      n[48].open), attr$5(t, "aria-controls", `accordion-collapse-body-${/*i*/
      n[37]}`), toggle_class$4(
        t,
        "rounded-t-xl",
        /*i*/
        n[37] === 0
      ), toggle_class$4(
        t,
        "rounded-b-xl",
        /*i*/
        n[37] == /*vals*/
        n[0].length - 1
      ), toggle_class$4(
        t,
        "border-b-0",
        /*i*/
        n[37] != /*vals*/
        n[0].length - 1
      ), attr$5(e, "id", `accordion-collapse-heading-${/*i*/
      n[37]}`), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(N, B) {
      insert_hydration$6(N, e, B), append_hydration$4(e, t), append_hydration$4(t, r), append_hydration$4(r, a), append_hydration$4(a, h), append_hydration$4(r, d), append_hydration$4(r, v), append_hydration$4(v, y), append_hydration$4(r, A), append_hydration$4(r, x), z && z.m(x, null), append_hydration$4(t, M), append_hydration$4(t, m), append_hydration$4(m, l), append_hydration$4(l, u), append_hydration$4(m, p), append_hydration$4(m, g), append_hydration$4(g, b), insert_hydration$6(N, _, B), P && P.m(N, B), insert_hydration$6(N, E, B), U && U.m(N, B), insert_hydration$6(N, w, B), k = !0, $ || (L = [
        listen$1(l, "click", F),
        listen$1(t, "click", R)
      ], $ = !0);
    },
    p(N, B) {
      n = N, (!k || B[0] & /*vals*/
      1) && s !== (s = /*item*/
      n[48].chain + "") && set_data$4(h, s), (!k || B[0] & /*vals*/
      1 && o !== (o = "inline-flex items-center justify-center p-1 px-2 text-xs font-semibold rounded-full " + /*colorCode*/
      n[7][
        /*item*/
        n[48].class
      ] + " svelte-bt9x4p")) && attr$5(a, "class", o), (!k || B[0] & /*vals*/
      1) && f !== (f = /*labels*/
      n[6][
        /*item*/
        n[48].class
      ] + "") && set_data$4(y, f), !/*item*/
      n[48].open && /*item*/
      n[48].class === "ligand" ? z ? z.p(n, B) : (z = create_if_block_11$1(n), z.c(), z.m(x, null)) : z && (z.d(1), z = null), (!k || B[0] & /*vals*/
      1) && toggle_class$4(
        g,
        "rotate-180",
        /*item*/
        n[48].open
      ), (!k || B[0] & /*vals*/
      1) && toggle_class$4(g, "-rotate-90", !/*item*/
      n[48].open), (!k || B[0] & /*vals*/
      1 && c !== (c = /*item*/
      n[48].open)) && attr$5(t, "aria-expanded", c), (!k || B[0] & /*vals*/
      1) && toggle_class$4(
        t,
        "rounded-b-xl",
        /*i*/
        n[37] == /*vals*/
        n[0].length - 1
      ), (!k || B[0] & /*vals*/
      1) && toggle_class$4(
        t,
        "border-b-0",
        /*i*/
        n[37] != /*vals*/
        n[0].length - 1
      ), /*item*/
      n[48].open ? P ? (P.p(n, B), B[0] & /*vals*/
      1 && transition_in$4(P, 1)) : (P = create_if_block_8$1(n), P.c(), transition_in$4(P, 1), P.m(E.parentNode, E)) : P && (group_outros$4(), transition_out$4(P, 1, 1, () => {
        P = null;
      }), check_outros$4()), /*item*/
      n[48].open ? U && (group_outros$4(), transition_out$4(U, 1, 1, () => {
        U = null;
      }), check_outros$4()) : U ? (U.p(n, B), B[0] & /*vals*/
      1 && transition_in$4(U, 1)) : (U = create_if_block_3$3(n), U.c(), transition_in$4(U, 1), U.m(w.parentNode, w));
    },
    i(N) {
      k || (transition_in$4(P), transition_in$4(U), k = !0);
    },
    o(N) {
      transition_out$4(P), transition_out$4(U), k = !1;
    },
    d(N) {
      N && (detach$6(e), detach$6(_), detach$6(E), detach$6(w)), z && z.d(), P && P.d(N), U && U.d(N), $ = !1, run_all$1(L);
    }
  };
}
function create_if_block$5(n) {
  let e, t = "Covalent Modification", r, a, s = ensure_array_like$2(
    /*covMods*/
    n[1]
  ), h = [];
  for (let o = 0; o < s.length; o += 1)
    h[o] = create_each_block$2(get_each_context$2(n, s, o));
  return {
    c() {
      e = element$5("h4"), e.textContent = t, r = space$5();
      for (let o = 0; o < h.length; o += 1)
        h[o].c();
      a = empty$4(), this.h();
    },
    l(o) {
      e = claim_element$5(o, "H4", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(e) !== "svelte-vfdyc9" && (e.textContent = t), r = claim_space$5(o);
      for (let d = 0; d < h.length; d += 1)
        h[d].l(o);
      a = empty$4(), this.h();
    },
    h() {
      attr$5(e, "class", "text-center font-bold text-xl svelte-bt9x4p");
    },
    m(o, d) {
      insert_hydration$6(o, e, d), insert_hydration$6(o, r, d);
      for (let v = 0; v < h.length; v += 1)
        h[v] && h[v].m(o, d);
      insert_hydration$6(o, a, d);
    },
    p(o, d) {
      if (d[0] & /*dispatch, covMods, ligandChains, getResAtoms, getResname, getResidues, proteinChains*/
      3642) {
        s = ensure_array_like$2(
          /*covMods*/
          o[1]
        );
        let v;
        for (v = 0; v < s.length; v += 1) {
          const f = get_each_context$2(o, s, v);
          h[v] ? h[v].p(f, d) : (h[v] = create_each_block$2(f), h[v].c(), h[v].m(a.parentNode, a));
        }
        for (; v < h.length; v += 1)
          h[v].d(1);
        h.length = s.length;
      }
    },
    d(o) {
      o && (detach$6(e), detach$6(r), detach$6(a)), destroy_each$2(h, o);
    }
  };
}
function create_each_block_4(n) {
  let e, t = (
    /*chain*/
    n[38] + ""
  ), r, a;
  return {
    c() {
      e = element$5("option"), r = text$5(t), this.h();
    },
    l(s) {
      e = claim_element$5(s, "OPTION", { class: !0 });
      var h = children$4(e);
      r = claim_text$4(h, t), h.forEach(detach$6), this.h();
    },
    h() {
      e.__value = a = /*chain*/
      n[38], set_input_value$1(e, e.__value), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(s, h) {
      insert_hydration$6(s, e, h), append_hydration$4(e, r);
    },
    p(s, h) {
      h[0] & /*proteinChains*/
      8 && t !== (t = /*chain*/
      s[38] + "") && set_data$4(r, t), h[0] & /*proteinChains*/
      8 && a !== (a = /*chain*/
      s[38]) && (e.__value = a, set_input_value$1(e, e.__value));
    },
    d(s) {
      s && detach$6(e);
    }
  };
}
function create_each_block_3(n) {
  let e, t = (
    /*i*/
    n[37] + 1 + ""
  ), r, a, s = (
    /*resi*/
    n[44] + ""
  ), h;
  return {
    c() {
      e = element$5("option"), r = text$5(t), a = space$5(), h = text$5(s), this.h();
    },
    l(o) {
      e = claim_element$5(o, "OPTION", { class: !0 });
      var d = children$4(e);
      r = claim_text$4(d, t), a = claim_space$5(d), h = claim_text$4(d, s), d.forEach(detach$6), this.h();
    },
    h() {
      e.__value = /*i*/
      n[37] + 1, set_input_value$1(e, e.__value), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(o, d) {
      insert_hydration$6(o, e, d), append_hydration$4(e, r), append_hydration$4(e, a), append_hydration$4(e, h);
    },
    p(o, d) {
      d[0] & /*covMods*/
      2 && s !== (s = /*resi*/
      o[44] + "") && set_data$4(h, s);
    },
    d(o) {
      o && detach$6(e);
    }
  };
}
function create_else_block_1$2(n) {
  let e;
  return {
    c() {
      e = element$5("option"), this.h();
    },
    l(t) {
      e = claim_element$5(t, "OPTION", { class: !0 }), children$4(e).forEach(detach$6), this.h();
    },
    h() {
      e.disabled = !0, e.__value = "", set_input_value$1(e, e.__value), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(t, r) {
      insert_hydration$6(t, e, r);
    },
    p: noop$6,
    d(t) {
      t && detach$6(e);
    }
  };
}
function create_if_block_2$3(n) {
  let e, t = ensure_array_like$2(
    /*getResAtoms*/
    n[9](
      /*covMod*/
      n[35]
    )
  ), r = [];
  for (let a = 0; a < t.length; a += 1)
    r[a] = create_each_block_2(get_each_context_2(n, t, a));
  return {
    c() {
      for (let a = 0; a < r.length; a += 1)
        r[a].c();
      e = empty$4();
    },
    l(a) {
      for (let s = 0; s < r.length; s += 1)
        r[s].l(a);
      e = empty$4();
    },
    m(a, s) {
      for (let h = 0; h < r.length; h += 1)
        r[h] && r[h].m(a, s);
      insert_hydration$6(a, e, s);
    },
    p(a, s) {
      if (s[0] & /*getResAtoms, covMods, getResname*/
      2562) {
        t = ensure_array_like$2(
          /*getResAtoms*/
          a[9](
            /*covMod*/
            a[35]
          )
        );
        let h;
        for (h = 0; h < t.length; h += 1) {
          const o = get_each_context_2(a, t, h);
          r[h] ? r[h].p(o, s) : (r[h] = create_each_block_2(o), r[h].c(), r[h].m(e.parentNode, e));
        }
        for (; h < r.length; h += 1)
          r[h].d(1);
        r.length = t.length;
      }
    },
    d(a) {
      a && detach$6(e), destroy_each$2(r, a);
    }
  };
}
function create_each_block_2(n) {
  let e, t, r = (
    /*getResname*/
    n[11](
      /*covMod*/
      n[35]
    ) + ""
  ), a, s, h = (
    /*atom*/
    n[41] + ""
  ), o, d;
  return {
    c() {
      e = text$5(`}
                      `), t = element$5("option"), a = text$5(r), s = text$5(":"), o = text$5(h), this.h();
    },
    l(v) {
      e = claim_text$4(v, `}
                      `), t = claim_element$5(v, "OPTION", { class: !0 });
      var f = children$4(t);
      a = claim_text$4(f, r), s = claim_text$4(f, ":"), o = claim_text$4(f, h), f.forEach(detach$6), this.h();
    },
    h() {
      t.__value = d = /*atom*/
      n[41], set_input_value$1(t, t.__value), attr$5(t, "class", "svelte-bt9x4p");
    },
    m(v, f) {
      insert_hydration$6(v, e, f), insert_hydration$6(v, t, f), append_hydration$4(t, a), append_hydration$4(t, s), append_hydration$4(t, o);
    },
    p(v, f) {
      f[0] & /*covMods*/
      2 && r !== (r = /*getResname*/
      v[11](
        /*covMod*/
        v[35]
      ) + "") && set_data$4(a, r), f[0] & /*covMods*/
      2 && h !== (h = /*atom*/
      v[41] + "") && set_data$4(o, h), f[0] & /*covMods, proteinChains*/
      10 && d !== (d = /*atom*/
      v[41]) && (t.__value = d, set_input_value$1(t, t.__value));
    },
    d(v) {
      v && (detach$6(e), detach$6(t));
    }
  };
}
function create_each_block_1$1(n) {
  let e, t = (
    /*chain*/
    n[38] + ""
  ), r, a, s;
  return {
    c() {
      e = element$5("option"), r = text$5(t), this.h();
    },
    l(h) {
      e = claim_element$5(h, "OPTION", { class: !0 });
      var o = children$4(e);
      r = claim_text$4(o, t), o.forEach(detach$6), this.h();
    },
    h() {
      e.__value = a = /*chain*/
      n[38], set_input_value$1(e, e.__value), e.selected = s = /*chain*/
      n[38] === /*covMod*/
      n[35].ligand, attr$5(e, "class", "svelte-bt9x4p");
    },
    m(h, o) {
      insert_hydration$6(h, e, o), append_hydration$4(e, r);
    },
    p(h, o) {
      o[0] & /*ligandChains*/
      16 && t !== (t = /*chain*/
      h[38] + "") && set_data$4(r, t), o[0] & /*ligandChains*/
      16 && a !== (a = /*chain*/
      h[38]) && (e.__value = a, set_input_value$1(e, e.__value)), o[0] & /*ligandChains, covMods, proteinChains*/
      26 && s !== (s = /*chain*/
      h[38] === /*covMod*/
      h[35].ligand) && (e.selected = s);
    },
    d(h) {
      h && detach$6(e);
    }
  };
}
function create_else_block$4(n) {
  let e, t = "click on atom";
  return {
    c() {
      e = element$5("p"), e.textContent = t, this.h();
    },
    l(r) {
      e = claim_element$5(r, "P", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(e) !== "svelte-1dm8y5e" && (e.textContent = t), this.h();
    },
    h() {
      attr$5(e, "class", "font-mono svelte-bt9x4p");
    },
    m(r, a) {
      insert_hydration$6(r, e, a);
    },
    p: noop$6,
    d(r) {
      r && detach$6(e);
    }
  };
}
function create_if_block_1$4(n) {
  let e, t, r = (
    /*covMod*/
    n[35].attachmentIndex + ""
  ), a;
  return {
    c() {
      e = element$5("p"), t = text$5("index "), a = text$5(r), this.h();
    },
    l(s) {
      e = claim_element$5(s, "P", { class: !0 });
      var h = children$4(e);
      t = claim_text$4(h, "index "), a = claim_text$4(h, r), h.forEach(detach$6), this.h();
    },
    h() {
      attr$5(e, "class", "font-mono svelte-bt9x4p");
    },
    m(s, h) {
      insert_hydration$6(s, e, h), append_hydration$4(e, t), append_hydration$4(e, a);
    },
    p(s, h) {
      h[0] & /*covMods*/
      2 && r !== (r = /*covMod*/
      s[35].attachmentIndex + "") && set_data$4(a, r);
    },
    d(s) {
      s && detach$6(e);
    }
  };
}
function create_each_block$2(n) {
  let e, t, r, a, s = '<span class="text-base font-medium text-gray-900 svelte-bt9x4p">Protein</span>', h, o, d = '<span class="svelte-bt9x4p">Chain</span> <span class="svelte-bt9x4p">Residue</span> <span class="svelte-bt9x4p">Atom</span> <span class="svelte-bt9x4p">Chirality</span>', v, f, y, A, x, M, m, l, u, p, g = "no chirality defined", b, c = "CW", _, E = "CCW", w, k, $, L, z = '<span class="w-full whitespace-nowrap text-center text-base font-medium text-gray-900 svelte-bt9x4p">Small molecule</span>', F, R, P = '<span class="svelte-bt9x4p">Chain</span> <span title="click on atom in structure" class="svelte-bt9x4p">Atom index</span> <span class="svelte-bt9x4p">Chirality</span>', U, N, B, W, V, G, H, Q, te = "no chirality defined", ee, ce = "CW", fe, oe = "CCW", he, Ae, Se, Ie, pe, le, ne, Te = ensure_array_like$2(
    /*proteinChains*/
    n[3]
  ), Oe = [];
  for (let ae = 0; ae < Te.length; ae += 1)
    Oe[ae] = create_each_block_4(get_each_context_4(n, Te, ae));
  function Be() {
    n[20].call(
      y,
      /*i*/
      n[37]
    );
  }
  let Ue = ensure_array_like$2(
    /*getResidues*/
    n[10](
      /*covMod*/
      n[35]
    )
  ), Pe = [];
  for (let ae = 0; ae < Ue.length; ae += 1)
    Pe[ae] = create_each_block_3(get_each_context_3(n, Ue, ae));
  function Ge() {
    n[22].call(
      x,
      /*i*/
      n[37]
    );
  }
  function Ne(ae, ge) {
    return (
      /*covMod*/
      ae[35].residue != "" ? create_if_block_2$3 : create_else_block_1$2
    );
  }
  let Re = Ne(n), De = Re(n);
  function je() {
    n[24].call(
      m,
      /*i*/
      n[37]
    );
  }
  function Xe() {
    n[26].call(
      u,
      /*i*/
      n[37]
    );
  }
  let X = ensure_array_like$2(
    /*ligandChains*/
    n[4]
  ), q = [];
  for (let ae = 0; ae < X.length; ae += 1)
    q[ae] = create_each_block_1$1(get_each_context_1$1(n, X, ae));
  function re() {
    n[28].call(
      B,
      /*i*/
      n[37]
    );
  }
  function ye(ae, ge) {
    return (
      /*covMod*/
      ae[35].attachmentIndex ? create_if_block_1$4 : create_else_block$4
    );
  }
  let me = ye(n), ze = me(n);
  function ke() {
    n[30].call(
      H,
      /*i*/
      n[37]
    );
  }
  function K(...ae) {
    return (
      /*click_handler_3*/
      n[32](
        /*i*/
        n[37],
        ...ae
      )
    );
  }
  return {
    c() {
      e = element$5("div"), t = element$5("div"), r = element$5("div"), a = element$5("div"), a.innerHTML = s, h = space$5(), o = element$5("div"), o.innerHTML = d, v = space$5(), f = element$5("div"), y = element$5("select");
      for (let ae = 0; ae < Oe.length; ae += 1)
        Oe[ae].c();
      A = space$5(), x = element$5("select");
      for (let ae = 0; ae < Pe.length; ae += 1)
        Pe[ae].c();
      M = space$5(), m = element$5("select"), De.c(), l = space$5(), u = element$5("select"), p = element$5("option"), p.textContent = g, b = element$5("option"), b.textContent = c, _ = element$5("option"), _.textContent = E, w = space$5(), k = element$5("div"), $ = element$5("div"), L = element$5("div"), L.innerHTML = z, F = space$5(), R = element$5("div"), R.innerHTML = P, U = space$5(), N = element$5("div"), B = element$5("select");
      for (let ae = 0; ae < q.length; ae += 1)
        q[ae].c();
      W = space$5(), V = element$5("div"), ze.c(), G = space$5(), H = element$5("select"), Q = element$5("option"), Q.textContent = te, ee = element$5("option"), ee.textContent = ce, fe = element$5("option"), fe.textContent = oe, he = space$5(), Ae = element$5("div"), Se = svg_element$1("svg"), Ie = svg_element$1("path"), pe = space$5(), this.h();
    },
    l(ae) {
      e = claim_element$5(ae, "DIV", { class: !0 });
      var ge = children$4(e);
      t = claim_element$5(ge, "DIV", { class: !0 });
      var xe = children$4(t);
      r = claim_element$5(xe, "DIV", { class: !0 });
      var ue = children$4(r);
      a = claim_element$5(ue, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(a) !== "svelte-1eqot16" && (a.innerHTML = s), h = claim_space$5(ue), o = claim_element$5(ue, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(o) !== "svelte-1k2x92t" && (o.innerHTML = d), v = claim_space$5(ue), f = claim_element$5(ue, "DIV", { class: !0 });
      var Ce = children$4(f);
      y = claim_element$5(Ce, "SELECT", { name: !0, id: !0, class: !0 });
      var Z = children$4(y);
      for (let rt = 0; rt < Oe.length; rt += 1)
        Oe[rt].l(Z);
      Z.forEach(detach$6), A = claim_space$5(Ce), x = claim_element$5(Ce, "SELECT", { name: !0, id: !0, class: !0 });
      var Fe = children$4(x);
      for (let rt = 0; rt < Pe.length; rt += 1)
        Pe[rt].l(Fe);
      Fe.forEach(detach$6), M = claim_space$5(Ce), m = claim_element$5(Ce, "SELECT", { name: !0, id: !0, class: !0 });
      var We = children$4(m);
      De.l(We), We.forEach(detach$6), l = claim_space$5(Ce), u = claim_element$5(Ce, "SELECT", { name: !0, id: !0, class: !0 });
      var I = children$4(u);
      p = claim_element$5(I, "OPTION", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(p) !== "svelte-1d780p1" && (p.textContent = g), b = claim_element$5(I, "OPTION", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(b) !== "svelte-wvq2yy" && (b.textContent = c), _ = claim_element$5(I, "OPTION", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(_) !== "svelte-wxh7b0" && (_.textContent = E), I.forEach(detach$6), Ce.forEach(detach$6), ue.forEach(detach$6), w = claim_space$5(xe), k = claim_element$5(xe, "DIV", { class: !0 });
      var we = children$4(k);
      $ = claim_element$5(we, "DIV", { class: !0 });
      var ve = children$4($);
      L = claim_element$5(ve, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(L) !== "svelte-80ph3f" && (L.innerHTML = z), F = claim_space$5(ve), R = claim_element$5(ve, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(R) !== "svelte-1xhu24v" && (R.innerHTML = P), U = claim_space$5(ve), N = claim_element$5(ve, "DIV", { class: !0 });
      var Y = children$4(N);
      B = claim_element$5(Y, "SELECT", {
        name: !0,
        id: !0,
        title: !0,
        class: !0
      });
      var de = children$4(B);
      for (let rt = 0; rt < q.length; rt += 1)
        q[rt].l(de);
      de.forEach(detach$6), W = claim_space$5(Y), V = claim_element$5(Y, "DIV", { class: !0 });
      var Me = children$4(V);
      ze.l(Me), Me.forEach(detach$6), G = claim_space$5(Y), H = claim_element$5(Y, "SELECT", { name: !0, id: !0, class: !0 });
      var Ye = children$4(H);
      Q = claim_element$5(Ye, "OPTION", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(Q) !== "svelte-1d780p1" && (Q.textContent = te), ee = claim_element$5(Ye, "OPTION", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(ee) !== "svelte-wvq2yy" && (ee.textContent = ce), fe = claim_element$5(Ye, "OPTION", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$2(fe) !== "svelte-wxh7b0" && (fe.textContent = oe), Ye.forEach(detach$6), Y.forEach(detach$6), ve.forEach(detach$6), we.forEach(detach$6), xe.forEach(detach$6), he = claim_space$5(ge), Ae = claim_element$5(ge, "DIV", { class: !0 });
      var Ze = children$4(Ae);
      Se = claim_svg_element$1(Ze, "svg", {
        "data-slot": !0,
        fill: !0,
        "stroke-width": !0,
        stroke: !0,
        viewBox: !0,
        xmlns: !0,
        "aria-hidden": !0,
        class: !0
      });
      var Ke = children$4(Se);
      Ie = claim_svg_element$1(Ke, "path", {
        "stroke-linecap": !0,
        "stroke-linejoin": !0,
        d: !0,
        class: !0
      }), children$4(Ie).forEach(detach$6), Ke.forEach(detach$6), Ze.forEach(detach$6), pe = claim_space$5(ge), ge.forEach(detach$6), this.h();
    },
    h() {
      attr$5(a, "class", "flex justify-center svelte-bt9x4p"), attr$5(o, "class", "grid grid-cols-4 font-bold svelte-bt9x4p"), attr$5(y, "name", ""), attr$5(y, "id", ""), attr$5(y, "class", "svelte-bt9x4p"), /*covMods*/
      n[1][
        /*i*/
        n[37]
      ].protein === void 0 && add_render_callback$2(Be), attr$5(x, "name", ""), attr$5(x, "id", ""), attr$5(x, "class", "svelte-bt9x4p"), /*covMods*/
      n[1][
        /*i*/
        n[37]
      ].residue === void 0 && add_render_callback$2(Ge), attr$5(m, "name", ""), attr$5(m, "id", ""), attr$5(m, "class", "svelte-bt9x4p"), /*covMods*/
      n[1][
        /*i*/
        n[37]
      ].atom === void 0 && add_render_callback$2(je), p.__value = "", set_input_value$1(p, p.__value), attr$5(p, "class", "svelte-bt9x4p"), b.__value = "CW", set_input_value$1(b, b.__value), attr$5(b, "class", "svelte-bt9x4p"), _.__value = "CCW", set_input_value$1(_, _.__value), attr$5(_, "class", "svelte-bt9x4p"), attr$5(u, "name", ""), attr$5(u, "id", ""), attr$5(u, "class", "svelte-bt9x4p"), /*covMods*/
      n[1][
        /*i*/
        n[37]
      ].protein_symmetry === void 0 && add_render_callback$2(Xe), attr$5(f, "class", "grid grid-cols-4 svelte-bt9x4p"), attr$5(r, "class", "w-3/5 flex-col px-2 svelte-bt9x4p"), attr$5(L, "class", "flex justify-center svelte-bt9x4p"), attr$5(R, "class", "grid grid-cols-3 font-bold svelte-bt9x4p"), attr$5(B, "name", ""), attr$5(B, "id", ""), attr$5(B, "title", "click on atom in structure"), attr$5(B, "class", "svelte-bt9x4p"), /*covMods*/
      n[1][
        /*i*/
        n[37]
      ].ligand === void 0 && add_render_callback$2(re), attr$5(V, "class", "svelte-bt9x4p"), Q.__value = "", set_input_value$1(Q, Q.__value), attr$5(Q, "class", "svelte-bt9x4p"), ee.__value = "CW", set_input_value$1(ee, ee.__value), attr$5(ee, "class", "svelte-bt9x4p"), fe.__value = "CCW", set_input_value$1(fe, fe.__value), attr$5(fe, "class", "svelte-bt9x4p"), attr$5(H, "name", ""), attr$5(H, "id", ""), attr$5(H, "class", "svelte-bt9x4p"), /*covMods*/
      n[1][
        /*i*/
        n[37]
      ].ligand_symmetry === void 0 && add_render_callback$2(ke), attr$5(N, "class", "grid grid-cols-3 svelte-bt9x4p"), attr$5($, "class", "flex-col p-1 svelte-bt9x4p"), attr$5(k, "class", "w-2/5 px-2 svelte-bt9x4p"), attr$5(t, "class", "flex divide-x rounded border p-1 w-full svelte-bt9x4p"), attr$5(Ie, "stroke-linecap", "round"), attr$5(Ie, "stroke-linejoin", "round"), attr$5(Ie, "d", "M6 18 18 6M6 6l12 12"), attr$5(Ie, "class", "svelte-bt9x4p"), attr$5(Se, "data-slot", "icon"), attr$5(Se, "fill", "none"), attr$5(Se, "stroke-width", "2"), attr$5(Se, "stroke", "currentColor"), attr$5(Se, "viewBox", "0 0 24 24"), attr$5(Se, "xmlns", "http://www.w3.org/2000/svg"), attr$5(Se, "aria-hidden", "true"), attr$5(Se, "class", "w-8 h-8 text-red-800 cursor-pointer svelte-bt9x4p"), attr$5(Ae, "class", "flex items-center p-2 svelte-bt9x4p"), attr$5(e, "class", "flex p-10 svelte-bt9x4p");
    },
    m(ae, ge) {
      insert_hydration$6(ae, e, ge), append_hydration$4(e, t), append_hydration$4(t, r), append_hydration$4(r, a), append_hydration$4(r, h), append_hydration$4(r, o), append_hydration$4(r, v), append_hydration$4(r, f), append_hydration$4(f, y);
      for (let xe = 0; xe < Oe.length; xe += 1)
        Oe[xe] && Oe[xe].m(y, null);
      select_option(
        y,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].protein,
        !0
      ), append_hydration$4(f, A), append_hydration$4(f, x);
      for (let xe = 0; xe < Pe.length; xe += 1)
        Pe[xe] && Pe[xe].m(x, null);
      select_option(
        x,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].residue,
        !0
      ), append_hydration$4(f, M), append_hydration$4(f, m), De.m(m, null), select_option(
        m,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].atom,
        !0
      ), append_hydration$4(f, l), append_hydration$4(f, u), append_hydration$4(u, p), append_hydration$4(u, b), append_hydration$4(u, _), select_option(
        u,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].protein_symmetry,
        !0
      ), append_hydration$4(t, w), append_hydration$4(t, k), append_hydration$4(k, $), append_hydration$4($, L), append_hydration$4($, F), append_hydration$4($, R), append_hydration$4($, U), append_hydration$4($, N), append_hydration$4(N, B);
      for (let xe = 0; xe < q.length; xe += 1)
        q[xe] && q[xe].m(B, null);
      select_option(
        B,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].ligand,
        !0
      ), append_hydration$4(N, W), append_hydration$4(N, V), ze.m(V, null), append_hydration$4(N, G), append_hydration$4(N, H), append_hydration$4(H, Q), append_hydration$4(H, ee), append_hydration$4(H, fe), select_option(
        H,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].ligand_symmetry,
        !0
      ), append_hydration$4(e, he), append_hydration$4(e, Ae), append_hydration$4(Ae, Se), append_hydration$4(Se, Ie), append_hydration$4(e, pe), le || (ne = [
        listen$1(y, "change", Be),
        listen$1(
          y,
          "change",
          /*change_handler*/
          n[21]
        ),
        listen$1(x, "change", Ge),
        listen$1(
          x,
          "change",
          /*change_handler_1*/
          n[23]
        ),
        listen$1(m, "change", je),
        listen$1(
          m,
          "change",
          /*change_handler_2*/
          n[25]
        ),
        listen$1(u, "change", Xe),
        listen$1(
          u,
          "change",
          /*change_handler_3*/
          n[27]
        ),
        listen$1(B, "change", re),
        listen$1(
          B,
          "change",
          /*change_handler_4*/
          n[29]
        ),
        listen$1(H, "change", ke),
        listen$1(
          H,
          "change",
          /*change_handler_5*/
          n[31]
        ),
        listen$1(Se, "click", K)
      ], le = !0);
    },
    p(ae, ge) {
      if (n = ae, ge[0] & /*proteinChains*/
      8) {
        Te = ensure_array_like$2(
          /*proteinChains*/
          n[3]
        );
        let xe;
        for (xe = 0; xe < Te.length; xe += 1) {
          const ue = get_each_context_4(n, Te, xe);
          Oe[xe] ? Oe[xe].p(ue, ge) : (Oe[xe] = create_each_block_4(ue), Oe[xe].c(), Oe[xe].m(y, null));
        }
        for (; xe < Oe.length; xe += 1)
          Oe[xe].d(1);
        Oe.length = Te.length;
      }
      if (ge[0] & /*covMods, proteinChains*/
      10 && select_option(
        y,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].protein
      ), ge[0] & /*getResidues, covMods*/
      1026) {
        Ue = ensure_array_like$2(
          /*getResidues*/
          n[10](
            /*covMod*/
            n[35]
          )
        );
        let xe;
        for (xe = 0; xe < Ue.length; xe += 1) {
          const ue = get_each_context_3(n, Ue, xe);
          Pe[xe] ? Pe[xe].p(ue, ge) : (Pe[xe] = create_each_block_3(ue), Pe[xe].c(), Pe[xe].m(x, null));
        }
        for (; xe < Pe.length; xe += 1)
          Pe[xe].d(1);
        Pe.length = Ue.length;
      }
      if (ge[0] & /*covMods, proteinChains*/
      10 && select_option(
        x,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].residue
      ), Re === (Re = Ne(n)) && De ? De.p(n, ge) : (De.d(1), De = Re(n), De && (De.c(), De.m(m, null))), ge[0] & /*covMods, proteinChains*/
      10 && select_option(
        m,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].atom
      ), ge[0] & /*covMods, proteinChains*/
      10 && select_option(
        u,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].protein_symmetry
      ), ge[0] & /*ligandChains, covMods*/
      18) {
        X = ensure_array_like$2(
          /*ligandChains*/
          n[4]
        );
        let xe;
        for (xe = 0; xe < X.length; xe += 1) {
          const ue = get_each_context_1$1(n, X, xe);
          q[xe] ? q[xe].p(ue, ge) : (q[xe] = create_each_block_1$1(ue), q[xe].c(), q[xe].m(B, null));
        }
        for (; xe < q.length; xe += 1)
          q[xe].d(1);
        q.length = X.length;
      }
      ge[0] & /*covMods, proteinChains*/
      10 && select_option(
        B,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].ligand
      ), me === (me = ye(n)) && ze ? ze.p(n, ge) : (ze.d(1), ze = me(n), ze && (ze.c(), ze.m(V, null))), ge[0] & /*covMods, proteinChains*/
      10 && select_option(
        H,
        /*covMods*/
        n[1][
          /*i*/
          n[37]
        ].ligand_symmetry
      );
    },
    d(ae) {
      ae && detach$6(e), destroy_each$2(Oe, ae), destroy_each$2(Pe, ae), De.d(), destroy_each$2(q, ae), ze.d(), le = !1, run_all$1(ne);
    }
  };
}
function create_fragment$6(n) {
  let e, t, r, a, s = ensure_array_like$2(
    /*vals*/
    n[0]
  ), h = [];
  for (let v = 0; v < s.length; v += 1)
    h[v] = create_each_block_5(get_each_context_5(n, s, v));
  const o = (v) => transition_out$4(h[v], 1, 1, () => {
    h[v] = null;
  });
  let d = (
    /*covMods*/
    n[1].length > 0 && create_if_block$5(n)
  );
  return {
    c() {
      e = element$5("div");
      for (let v = 0; v < h.length; v += 1)
        h[v].c();
      t = space$5(), r = element$5("div"), d && d.c(), this.h();
    },
    l(v) {
      e = claim_element$5(v, "DIV", {
        id: !0,
        "data-accordion": !0,
        class: !0
      });
      var f = children$4(e);
      for (let A = 0; A < h.length; A += 1)
        h[A].l(f);
      t = claim_space$5(f), r = claim_element$5(f, "DIV", { class: !0 });
      var y = children$4(r);
      d && d.l(y), y.forEach(detach$6), f.forEach(detach$6), this.h();
    },
    h() {
      attr$5(r, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 w-full svelte-bt9x4p"), attr$5(e, "id", "accordion-collapse"), attr$5(e, "data-accordion", "collapse"), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(v, f) {
      insert_hydration$6(v, e, f);
      for (let y = 0; y < h.length; y += 1)
        h[y] && h[y].m(e, null);
      append_hydration$4(e, t), append_hydration$4(e, r), d && d.m(r, null), a = !0;
    },
    p(v, f) {
      if (f[0] & /*vals, showCovModVals, updateMol, dispatch, metals, handleMessage, labels, colorCode*/
      12773) {
        s = ensure_array_like$2(
          /*vals*/
          v[0]
        );
        let y;
        for (y = 0; y < s.length; y += 1) {
          const A = get_each_context_5(v, s, y);
          h[y] ? (h[y].p(A, f), transition_in$4(h[y], 1)) : (h[y] = create_each_block_5(A), h[y].c(), transition_in$4(h[y], 1), h[y].m(e, t));
        }
        for (group_outros$4(), y = s.length; y < h.length; y += 1)
          o(y);
        check_outros$4();
      }
      /*covMods*/
      v[1].length > 0 ? d ? d.p(v, f) : (d = create_if_block$5(v), d.c(), d.m(r, null)) : d && (d.d(1), d = null);
    },
    i(v) {
      if (!a) {
        for (let f = 0; f < s.length; f += 1)
          transition_in$4(h[f]);
        a = !0;
      }
    },
    o(v) {
      h = h.filter(Boolean);
      for (let f = 0; f < h.length; f += 1)
        transition_out$4(h[f]);
      a = !1;
    },
    d(v) {
      v && detach$6(e), destroy_each$2(h, v), d && d.d();
    }
  };
}
function instance$6(n, e, t) {
  const r = createEventDispatcher$3();
  let { vals: a = [] } = e, { covMods: s = [] } = e, h = [], o = {
    DNA: "NA sequence",
    RNA: "NA sequence",
    protein: "Protein sequence",
    ligand: "Small molecule"
  }, d = {
    DNA: "bg-green-200 text-blue-800",
    RNA: "bg-green-200 text-blue-800",
    protein: "bg-blue-200 text-blue-800",
    ligand: "bg-orange-200 text-blue-800"
  }, v = ["ZN", "MG", "CA", "FE", "NA", "K", "CL", "CU", "MN", "CO", "NI"], f = [], y = [], A = {
    A: ["C", "CA", "CB", "N", "O"],
    R: ["C", "CA", "CB", "CG", "CD", "CZ", "N", "NE", "O", "NH1", "NH2"],
    D: ["C", "CA", "CB", "CG", "N", "O", "OD1", "OD2"],
    N: ["C", "CA", "CB", "CG", "N", "ND2", "O", "OD1"],
    C: ["C", "CA", "CB", "N", "O", "SG"],
    E: ["C", "CA", "CB", "CG", "CD", "N", "O", "OE1", "OE2"],
    N: ["C", "CA", "CB", "CG", "CD", "N", "NE2", "O", "OE1"],
    G: ["C", "CA", "N", "O"],
    H: ["C", "CA", "CB", "CG", "CD2", "CE1", "N", "ND1", "NE2", "O"],
    I: ["C", "CA", "CB", "CG1", "CG2", "CD1", "N", "O"],
    L: ["C", "CA", "CB", "CG", "CD1", "CD2", "N", "O"],
    K: ["C", "CA", "CB", "CG", "CD", "CE", "N", "NZ", "O"],
    M: ["C", "CA", "CB", "CG", "CE", "N", "O", "SD"],
    F: ["C", "CA", "CB", "CG", "CD1", "CD2", "CE1", "CE2", "CZ", "N", "O"],
    P: ["C", "CA", "CB", "CG", "CD", "N", "O"],
    S: ["C", "CA", "CB", "N", "O", "OG"],
    T: ["C", "CA", "CB", "CG2", "N", "O", "OG1"],
    W: [
      "C",
      "CA",
      "CB",
      "CG",
      "CD1",
      "CD2",
      "CE2",
      "CE3",
      "CZ2",
      "CZ3",
      "CH2",
      "N",
      "NE1",
      "O"
    ],
    Y: ["C", "CA", "CB", "CG", "CD1", "CD2", "CE1", "CE2", "CZ", "N", "O", "OH"],
    V: ["C", "CA", "CB", "CG1", "CG2", "N", "O"]
  }, x = {
    H: "HIS",
    A: "ALA",
    R: "ARG",
    N: "ASN",
    D: "ASP",
    C: "CYS",
    E: "GLU",
    Q: "GLN",
    G: "GLY",
    H: "HIS",
    I: "ILE",
    L: "LEU",
    K: "LYS",
    M: "MET",
    F: "PHE",
    P: "PRO",
    S: "SER",
    T: "THR",
    W: "TRP",
    Y: "TYR",
    V: "VAL"
  };
  function M(H) {
    let Q = a.find((ee) => ee.chain === H.protein).sequence;
    if (Q.length < H.residue)
      return alert("Residue number is too high"), [];
    let te = Q[H.residue - 1];
    return A[te];
  }
  function m(H) {
    let Q = a.find((te) => te.chain === H.protein).sequence;
    return Array.from(Q).map((te) => x[te]);
  }
  function l(H) {
    let te = a.find((ee) => ee.chain === H.protein).sequence[H.residue - 1];
    return x[te];
  }
  function u(H) {
    let Q = H.detail.index;
    t(1, s[Q].mol = H.detail.mol, s), t(1, s[Q].attachmentIndex = H.detail.attachmentIndex, s), t(1, s[Q].deleteIndexes = H.detail.deleteIndexes, s), r("updateCovMod", s);
  }
  function p(H) {
    fetch(`https://files.rcsb.org/ligands/download/${H.detail.text}_ideal.sdf`).then((Q) => {
      if (!Q.ok)
        throw new Error("Network response was not ok");
      return Q.text();
    }).then((Q) => {
      r("updateVals", {
        sdf: Q,
        index: H.detail.index,
        close: !0
      });
    }).catch((Q) => {
      alert("Error fetching sdf file");
    });
  }
  const g = (H, Q) => {
    r("removeVal", H);
  }, b = (H, Q, te) => t(0, Q[te].open = !H.open, a), c = (H, Q) => {
    r("updateVals", { sequence: Q.target.value, index: H });
  }, _ = (H, Q) => {
    r("updateVals", { smiles: Q.target.value, index: H });
  }, E = (H, Q) => {
    r("updateVals", { sdf: Q.target.value, index: H });
  }, w = (H, Q) => r("updateVals", { name: H, index: Q });
  function k(H) {
    s[H].protein = select_value(this), t(1, s), t(3, f), t(0, a);
  }
  const $ = () => r("updateCovMod", s);
  function L(H) {
    s[H].residue = select_value(this), t(1, s), t(3, f), t(0, a);
  }
  const z = () => r("updateCovMod", s);
  function F(H) {
    s[H].atom = select_value(this), t(1, s), t(3, f), t(0, a);
  }
  const R = () => r("updateCovMod", s);
  function P(H) {
    s[H].protein_symmetry = select_value(this), t(1, s), t(3, f), t(0, a);
  }
  const U = () => r("updateCovMod", s);
  function N(H) {
    s[H].ligand = select_value(this), t(1, s), t(3, f), t(0, a);
  }
  const B = () => r("updateCovMod", s);
  function W(H) {
    s[H].ligand_symmetry = select_value(this), t(1, s), t(3, f), t(0, a);
  }
  const V = () => r("updateCovMod", s), G = (H, Q) => {
    r("removeCovMod", H);
  };
  return n.$$set = (H) => {
    "vals" in H && t(0, a = H.vals), "covMods" in H && t(1, s = H.covMods);
  }, n.$$.update = () => {
    n.$$.dirty[0] & /*covMods, vals*/
    3 && s && t(2, h = a.map((H) => s.findIndex((Q) => Q.ligand === H.chain))), n.$$.dirty[0] & /*vals*/
    1 && t(3, f = a.filter((H) => H.class === "protein").map((H) => H.chain)), n.$$.dirty[0] & /*vals*/
    1 && t(4, y = a.filter((H) => H.class === "ligand").map((H) => H.chain));
  }, [
    a,
    s,
    h,
    f,
    y,
    r,
    o,
    d,
    v,
    M,
    m,
    l,
    u,
    p,
    g,
    b,
    c,
    _,
    E,
    w,
    k,
    $,
    L,
    z,
    F,
    R,
    P,
    U,
    N,
    B,
    W,
    V,
    G
  ];
}
class Accordion extends SvelteComponent$6 {
  constructor(e) {
    super(), init$6(this, e, instance$6, create_fragment$6, safe_not_equal$7, { vals: 0, covMods: 1 }, null, [-1, -1]);
  }
}
const {
  SvelteComponent: SvelteComponent$5,
  attr: attr$4,
  check_outros: check_outros$3,
  claim_component: claim_component$3,
  claim_element: claim_element$4,
  claim_space: claim_space$4,
  create_component: create_component$3,
  destroy_component: destroy_component$3,
  detach: detach$5,
  element: element$4,
  empty: empty$3,
  flush: flush$1,
  get_svelte_dataset: get_svelte_dataset$1,
  group_outros: group_outros$3,
  init: init$5,
  insert_hydration: insert_hydration$5,
  mount_component: mount_component$3,
  noop: noop$5,
  safe_not_equal: safe_not_equal$6,
  space: space$4,
  transition_in: transition_in$3,
  transition_out: transition_out$3
} = window.__gradio__svelte__internal, { tick: tick$2 } = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$2, onMount: onMount$3, afterUpdate: afterUpdate$1 } = window.__gradio__svelte__internal;
function create_if_block$4(n) {
  let e, t, r, a;
  const s = [create_if_block_1$3, create_else_block$3], h = [];
  function o(d, v) {
    return (
      /*vals*/
      d[0].length > 0 ? 0 : 1
    );
  }
  return e = o(n), t = h[e] = s[e](n), {
    c() {
      t.c(), r = empty$3();
    },
    l(d) {
      t.l(d), r = empty$3();
    },
    m(d, v) {
      h[e].m(d, v), insert_hydration$5(d, r, v), a = !0;
    },
    p(d, v) {
      let f = e;
      e = o(d), e === f ? h[e].p(d, v) : (group_outros$3(), transition_out$3(h[f], 1, 1, () => {
        h[f] = null;
      }), check_outros$3(), t = h[e], t ? t.p(d, v) : (t = h[e] = s[e](d), t.c()), transition_in$3(t, 1), t.m(r.parentNode, r));
    },
    i(d) {
      a || (transition_in$3(t), a = !0);
    },
    o(d) {
      transition_out$3(t), a = !1;
    },
    d(d) {
      d && detach$5(r), h[e].d(d);
    }
  };
}
function create_else_block$3(n) {
  let e, t = "Empty input", r, a, s = "You can import a protein from the PDB", h, o, d, v, f = "- or create the input from scratch -", y;
  return o = new SearchInput({ props: { database: "rcsb-bioass" } }), o.$on(
    "triggerFetch",
    /*handleMessage*/
    n[2]
  ), {
    c() {
      e = element$4("div"), e.textContent = t, r = space$4(), a = element$4("div"), a.textContent = s, h = space$4(), create_component$3(o.$$.fragment), d = space$4(), v = element$4("div"), v.textContent = f, this.h();
    },
    l(A) {
      e = claim_element$4(A, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$1(e) !== "svelte-1vyb54w" && (e.textContent = t), r = claim_space$4(A), a = claim_element$4(A, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$1(a) !== "svelte-15ru6yv" && (a.textContent = s), h = claim_space$4(A), claim_component$3(o.$$.fragment, A), d = claim_space$4(A), v = claim_element$4(A, "DIV", { class: !0, "data-svelte-h": !0 }), get_svelte_dataset$1(v) !== "svelte-17yf25u" && (v.textContent = f), this.h();
    },
    h() {
      attr$4(e, "class", "my-8 text-center text-gray-600 svelte-13zuw1o"), attr$4(a, "class", "text-center text-gray-400 svelte-13zuw1o"), attr$4(v, "class", "text-center text-gray-400 w-full my-2 svelte-13zuw1o");
    },
    m(A, x) {
      insert_hydration$5(A, e, x), insert_hydration$5(A, r, x), insert_hydration$5(A, a, x), insert_hydration$5(A, h, x), mount_component$3(o, A, x), insert_hydration$5(A, d, x), insert_hydration$5(A, v, x), y = !0;
    },
    p: noop$5,
    i(A) {
      y || (transition_in$3(o.$$.fragment, A), y = !0);
    },
    o(A) {
      transition_out$3(o.$$.fragment, A), y = !1;
    },
    d(A) {
      A && (detach$5(e), detach$5(r), detach$5(a), detach$5(h), detach$5(d), detach$5(v)), destroy_component$3(o, A);
    }
  };
}
function create_if_block_1$3(n) {
  let e, t;
  return e = new Accordion({
    props: {
      vals: (
        /*vals*/
        n[0]
      ),
      covMods: (
        /*covMods*/
        n[1]
      )
    }
  }), e.$on(
    "updateVals",
    /*update*/
    n[3]
  ), e.$on(
    "removeVal",
    /*remove*/
    n[5]
  ), e.$on(
    "removeCovMod",
    /*removeCovMod*/
    n[7]
  ), e.$on(
    "updateCovMod",
    /*syncCovMod*/
    n[8]
  ), {
    c() {
      create_component$3(e.$$.fragment);
    },
    l(r) {
      claim_component$3(e.$$.fragment, r);
    },
    m(r, a) {
      mount_component$3(e, r, a), t = !0;
    },
    p(r, a) {
      const s = {};
      a & /*vals*/
      1 && (s.vals = /*vals*/
      r[0]), a & /*covMods*/
      2 && (s.covMods = /*covMods*/
      r[1]), e.$set(s);
    },
    i(r) {
      t || (transition_in$3(e.$$.fragment, r), t = !0);
    },
    o(r) {
      transition_out$3(e.$$.fragment, r), t = !1;
    },
    d(r) {
      destroy_component$3(e, r);
    }
  };
}
function create_fragment$5(n) {
  let e, t, r, a = (
    /*vals*/
    n[0] != null && create_if_block$4(n)
  );
  return t = new Button({ props: { vals: (
    /*vals*/
    n[0]
  ) } }), t.$on(
    "addNewChain",
    /*insertChain*/
    n[4]
  ), t.$on(
    "addCovalentModification",
    /*addCovMod*/
    n[6]
  ), {
    c() {
      a && a.c(), e = space$4(), create_component$3(t.$$.fragment);
    },
    l(s) {
      a && a.l(s), e = claim_space$4(s), claim_component$3(t.$$.fragment, s);
    },
    m(s, h) {
      a && a.m(s, h), insert_hydration$5(s, e, h), mount_component$3(t, s, h), r = !0;
    },
    p(s, [h]) {
      /*vals*/
      s[0] != null ? a ? (a.p(s, h), h & /*vals*/
      1 && transition_in$3(a, 1)) : (a = create_if_block$4(s), a.c(), transition_in$3(a, 1), a.m(e.parentNode, e)) : a && (group_outros$3(), transition_out$3(a, 1, 1, () => {
        a = null;
      }), check_outros$3());
      const o = {};
      h & /*vals*/
      1 && (o.vals = /*vals*/
      s[0]), t.$set(o);
    },
    i(s) {
      r || (transition_in$3(a), transition_in$3(t.$$.fragment, s), r = !0);
    },
    o(s) {
      transition_out$3(a), transition_out$3(t.$$.fragment, s), r = !1;
    },
    d(s) {
      s && detach$5(e), a && a.d(s), destroy_component$3(t, s);
    }
  };
}
async function getSDF(n) {
  return await fetch(`https://files.rcsb.org/ligands/download/${n}_ideal.sdf`).then((t) => {
    if (!t.ok)
      throw new Error("Network response was not ok");
    return t.text();
  }).catch((t) => {
    alert("Error fetching sdf file");
  });
}
function nextChainTemp(n) {
  if (n == "")
    return "A";
  let e = "";
  return n == "Z" ? e = "AA" : n.length > 1 && n.slice(-1) === "Z" ? e = String.fromCharCode(n.charCodeAt(0) + 1) + "A" : e = n.slice(0, -1) + String.fromCharCode(n.slice(-1).charCodeAt(0) + 1), e;
}
async function fetchMolecules(n) {
  const e = `https://www.ebi.ac.uk/pdbe/api/pdb/entry/molecules/${n}`;
  try {
    const t = await fetch(e);
    if (!t.ok)
      throw new Error(`Error fetching molecules for PDB ID ${n}: ${t.statusText}`);
    return await t.json();
  } catch (t) {
    console.error("Error fetching molecules:", t);
  }
}
async function fetchXmlText(n) {
  try {
    const e = await fetch(n);
    if (!e.ok)
      throw new Error(`Error fetching XML: ${e.statusText}`);
    return await e.text();
  } catch (e) {
    console.error("Error fetching XML:", e);
  }
}
function parseAssembly(n) {
  const e = {
    id: n.getAttribute("id"),
    composition: n.getAttribute("composition"),
    molecularWeight: n.getAttribute("molecular_weight"),
    name: n.getAttribute("name")
  }, t = [];
  return n.querySelectorAll("entity").forEach((r) => {
    t.push({
      chainIds: r.getAttribute("chain_ids"),
      class: r.getAttribute("class"),
      count: r.getAttribute("count"),
      entityId: Number(r.getAttribute("entity_id"))
      // Added entityId
    });
  }), e.entities = t, e;
}
function extractEntityInfo(n, e) {
  if (n.class === "DNA" || n.class === "RNA" || n.class === "protein") {
    const t = e.find((r) => r.entity_id === n.entityId);
    if (t)
      return t.sequence;
  } else {
    const t = e.find((r) => r.entity_id === n.entityId);
    if (t)
      return t.chem_comp_ids[0];
  }
}
function importBioAssembly(n) {
  const e = fetchMolecules(n).then((s) => s).catch((s) => {
    console.error("Error:", s);
  }), t = `https://www.ebi.ac.uk/pdbe/static/entry/${n}-assembly.xml`, r = fetchXmlText(t).then((s) => {
    const h = [];
    return new DOMParser().parseFromString(s, "text/xml").querySelectorAll("assembly").forEach((f) => {
      h.push(parseAssembly(f));
    }), h;
  });
  return Promise.all([e, r]).then(([s, h]) => {
    let o = [];
    return h[0].entities.forEach((v) => {
      const f = extractEntityInfo(v, s[n]);
      o.push({
        class: v.class,
        entityInfo: f,
        count: v.count
      });
    }), o;
  });
}
function instance$5(n, e, t) {
  let { value: r = { chains: [], covMods: [] } } = e;
  const a = createEventDispatcher$2();
  let s = ["ZN", "MG", "CA", "FE", "NA", "K", "CL", "CU", "MN", "CO", "NI"];
  async function h(u) {
    let p = u.detail.text;
    p = p.toLowerCase();
    let g = await importBioAssembly(p), b = [], c = "";
    await Promise.all(g.map(async (_) => {
      if (["DNA", "RNA", "protein"].includes(_.class))
        for (let E = 0; E < _.count; E++)
          c = nextChainTemp(c), b.push({
            class: _.class,
            name: "",
            smiles: "",
            sdf: "",
            sequence: _.entityInfo,
            open: !1,
            chain: c
          }), await tick$2();
      else if (_.class === "ligand") {
        let E = "", w = "";
        s.includes(_.entityInfo) ? E = _.entityInfo : w = await getSDF(_.entityInfo);
        for (let k = 0; k < _.count; k++)
          c = nextChainTemp(c), b.push({
            class: _.class,
            name: E,
            smiles: "",
            sdf: w,
            sequence: "",
            open: !1,
            chain: c
          });
        await tick$2();
      }
    })), t(0, o = b), a("updateVals", o);
  }
  let o = [], d = [];
  function v(u) {
    u.detail.sequence !== void 0 && t(0, o[u.detail.index].sequence = u.detail.sequence, o), u.detail.name !== void 0 && (t(0, o[u.detail.index].name = u.detail.name, o), t(0, o[u.detail.index].open = u.detail.open, o), t(0, o[u.detail.index].sdf = "", o), t(0, o[u.detail.index].smiles = "", o)), u.detail.smiles !== void 0 && (t(0, o[u.detail.index].smiles = u.detail.smiles, o), t(0, o[u.detail.index].sdf = "", o), t(0, o[u.detail.index].name = "", o)), u.detail.sdf !== void 0 && (u.detail.close == !0 && t(0, o[u.detail.index].open = !1, o), t(0, o[u.detail.index].sdf = u.detail.sdf, o), t(0, o[u.detail.index].name = "", o), t(0, o[u.detail.index].smiles = "", o)), a("updateVals", o);
  }
  function f() {
    let u = "A";
    for (let g of o)
      g.chain > u && (u = g.chain);
    let p = "";
    if (u < "Z")
      p = String.fromCharCode(u.charCodeAt(0) + 1);
    else {
      let g = u.slice(-1);
      g < "Z" ? p = u.slice(0, -1) + String.fromCharCode(g.charCodeAt(0) + 1) : p = u + "A";
    }
    return p;
  }
  function y(u) {
    let p = f();
    o.push({
      class: u.detail.type,
      name: "",
      smiles: "",
      sdf: "",
      sequence: "",
      open: !0,
      chain: p
    }), t(0, o), t(10, l), t(9, r);
  }
  function A(u) {
    o.splice(u.detail, 1), t(0, o), t(10, l), t(9, r), a("updateVals", o);
  }
  function x(u) {
    let p = o.find((c) => c.class === "protein").chain;
    if (p === void 0) {
      alert("Please add a protein chain first");
      return;
    }
    let g = o.find((c) => c.class === "ligand").chain;
    if (g === void 0) {
      alert("Please add a ligand chain first");
      return;
    }
    let b = {
      protein: p,
      residue: "1",
      atom: "N",
      protein_symmetry: "CW",
      ligand: g,
      attachmentIndex: 1,
      deleteIndexes: [],
      ligand_symmetry: "CW"
    };
    d.push(b), t(1, d), t(10, l), t(9, r), t(0, o), t(10, l), t(9, r), a("updateCovMod", d);
  }
  function M(u) {
    d.splice(u.detail, 1), t(1, d), t(10, l), t(9, r);
  }
  function m(u) {
    t(1, d = u.detail), a("updateCovMod", d);
  }
  onMount$3(async () => {
    t(0, o = r.chains), t(1, d = r.covMods);
  });
  let l = r;
  return n.$$set = (u) => {
    "value" in u && t(9, r = u.value);
  }, n.$$.update = () => {
    n.$$.dirty & /*old_value, value*/
    1536 && JSON.stringify(l) !== JSON.stringify(r) && (t(0, o = r.chains), t(1, d = r.covMods), t(10, l = r));
  }, [
    o,
    d,
    h,
    v,
    y,
    A,
    x,
    M,
    m,
    r,
    l
  ];
}
class SequenceInput extends SvelteComponent$5 {
  constructor(e) {
    super(), init$5(this, e, instance$5, create_fragment$5, safe_not_equal$6, { value: 9 });
  }
  get value() {
    return this.$$.ctx[9];
  }
  set value(e) {
    this.$$set({ value: e }), flush$1();
  }
}
function pretty_si(n) {
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
  for (; n > 1e3 && t < e.length - 1; )
    n /= 1e3, t++;
  let r = e[t];
  return (Number.isInteger(n) ? n : n.toFixed(1)) + r;
}
function noop$4() {
}
const identity = (n) => n;
function safe_not_equal$5(n, e) {
  return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
}
const is_client = typeof window < "u";
let now = is_client ? () => window.performance.now() : () => Date.now(), raf$1 = is_client ? (n) => requestAnimationFrame(n) : noop$4;
const tasks = /* @__PURE__ */ new Set();
function run_tasks(n) {
  tasks.forEach((e) => {
    e.c(n) || (tasks.delete(e), e.f());
  }), tasks.size !== 0 && raf$1(run_tasks);
}
function loop(n) {
  let e;
  return tasks.size === 0 && raf$1(run_tasks), {
    promise: new Promise((t) => {
      tasks.add(e = { c: n, f: t });
    }),
    abort() {
      tasks.delete(e);
    }
  };
}
function fade(n, { delay: e = 0, duration: t = 400, easing: r = identity } = {}) {
  const a = +getComputedStyle(n).opacity;
  return {
    delay: e,
    duration: t,
    easing: r,
    css: (s) => `opacity: ${s * a}`
  };
}
const subscriber_queue = [];
function writable(n, e = noop$4) {
  let t;
  const r = /* @__PURE__ */ new Set();
  function a(o) {
    if (safe_not_equal$5(n, o) && (n = o, t)) {
      const d = !subscriber_queue.length;
      for (const v of r)
        v[1](), subscriber_queue.push(v, n);
      if (d) {
        for (let v = 0; v < subscriber_queue.length; v += 2)
          subscriber_queue[v][0](subscriber_queue[v + 1]);
        subscriber_queue.length = 0;
      }
    }
  }
  function s(o) {
    a(o(n));
  }
  function h(o, d = noop$4) {
    const v = [o, d];
    return r.add(v), r.size === 1 && (t = e(a, s) || noop$4), o(n), () => {
      r.delete(v), r.size === 0 && t && (t(), t = null);
    };
  }
  return { set: a, update: s, subscribe: h };
}
function is_date(n) {
  return Object.prototype.toString.call(n) === "[object Date]";
}
function tick_spring(n, e, t, r) {
  if (typeof t == "number" || is_date(t)) {
    const a = r - t, s = (t - e) / (n.dt || 1 / 60), h = n.opts.stiffness * a, o = n.opts.damping * s, d = (h - o) * n.inv_mass, v = (s + d) * n.dt;
    return Math.abs(v) < n.opts.precision && Math.abs(a) < n.opts.precision ? r : (n.settled = !1, is_date(t) ? new Date(t.getTime() + v) : t + v);
  } else {
    if (Array.isArray(t))
      return t.map(
        (a, s) => tick_spring(n, e[s], t[s], r[s])
      );
    if (typeof t == "object") {
      const a = {};
      for (const s in t)
        a[s] = tick_spring(n, e[s], t[s], r[s]);
      return a;
    } else
      throw new Error(`Cannot spring ${typeof t} values`);
  }
}
function spring(n, e = {}) {
  const t = writable(n), { stiffness: r = 0.15, damping: a = 0.8, precision: s = 0.01 } = e;
  let h, o, d, v = n, f = n, y = 1, A = 0, x = !1;
  function M(l, u = {}) {
    f = l;
    const p = d = {};
    return n == null || u.hard || m.stiffness >= 1 && m.damping >= 1 ? (x = !0, h = now(), v = l, t.set(n = f), Promise.resolve()) : (u.soft && (A = 1 / ((u.soft === !0 ? 0.5 : +u.soft) * 60), y = 0), o || (h = now(), x = !1, o = loop((g) => {
      if (x)
        return x = !1, o = null, !1;
      y = Math.min(y + A, 1);
      const b = {
        inv_mass: y,
        opts: m,
        settled: !0,
        dt: (g - h) * 60 / 1e3
      }, c = tick_spring(b, v, n, f);
      return h = g, v = n, t.set(n = c), b.settled && (o = null), !b.settled;
    })), new Promise((g) => {
      o.promise.then(() => {
        p === d && g();
      });
    }));
  }
  const m = {
    set: M,
    update: (l, u) => M(l(f, n), u),
    subscribe: t.subscribe,
    stiffness: r,
    damping: a,
    precision: s
  };
  return m;
}
const {
  SvelteComponent: SvelteComponent$4,
  append_hydration: append_hydration$3,
  attr: attr$3,
  children: children$3,
  claim_element: claim_element$3,
  claim_svg_element,
  component_subscribe,
  detach: detach$4,
  element: element$3,
  init: init$4,
  insert_hydration: insert_hydration$4,
  noop: noop$3,
  safe_not_equal: safe_not_equal$4,
  set_style: set_style$1,
  svg_element,
  toggle_class: toggle_class$3
} = window.__gradio__svelte__internal, { onMount: onMount$2 } = window.__gradio__svelte__internal;
function create_fragment$4(n) {
  let e, t, r, a, s, h, o, d, v, f, y, A;
  return {
    c() {
      e = element$3("div"), t = svg_element("svg"), r = svg_element("g"), a = svg_element("path"), s = svg_element("path"), h = svg_element("path"), o = svg_element("path"), d = svg_element("g"), v = svg_element("path"), f = svg_element("path"), y = svg_element("path"), A = svg_element("path"), this.h();
    },
    l(x) {
      e = claim_element$3(x, "DIV", { class: !0 });
      var M = children$3(e);
      t = claim_svg_element(M, "svg", {
        viewBox: !0,
        fill: !0,
        xmlns: !0,
        class: !0
      });
      var m = children$3(t);
      r = claim_svg_element(m, "g", { style: !0 });
      var l = children$3(r);
      a = claim_svg_element(l, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$3(a).forEach(detach$4), s = claim_svg_element(l, "path", { d: !0, fill: !0, class: !0 }), children$3(s).forEach(detach$4), h = claim_svg_element(l, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$3(h).forEach(detach$4), o = claim_svg_element(l, "path", { d: !0, fill: !0, class: !0 }), children$3(o).forEach(detach$4), l.forEach(detach$4), d = claim_svg_element(m, "g", { style: !0 });
      var u = children$3(d);
      v = claim_svg_element(u, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$3(v).forEach(detach$4), f = claim_svg_element(u, "path", { d: !0, fill: !0, class: !0 }), children$3(f).forEach(detach$4), y = claim_svg_element(u, "path", {
        d: !0,
        fill: !0,
        "fill-opacity": !0,
        class: !0
      }), children$3(y).forEach(detach$4), A = claim_svg_element(u, "path", { d: !0, fill: !0, class: !0 }), children$3(A).forEach(detach$4), u.forEach(detach$4), m.forEach(detach$4), M.forEach(detach$4), this.h();
    },
    h() {
      attr$3(a, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), attr$3(a, "fill", "#FF7C00"), attr$3(a, "fill-opacity", "0.4"), attr$3(a, "class", "svelte-43sxxs"), attr$3(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), attr$3(s, "fill", "#FF7C00"), attr$3(s, "class", "svelte-43sxxs"), attr$3(h, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), attr$3(h, "fill", "#FF7C00"), attr$3(h, "fill-opacity", "0.4"), attr$3(h, "class", "svelte-43sxxs"), attr$3(o, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), attr$3(o, "fill", "#FF7C00"), attr$3(o, "class", "svelte-43sxxs"), set_style$1(r, "transform", "translate(" + /*$top*/
      n[1][0] + "px, " + /*$top*/
      n[1][1] + "px)"), attr$3(v, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), attr$3(v, "fill", "#FF7C00"), attr$3(v, "fill-opacity", "0.4"), attr$3(v, "class", "svelte-43sxxs"), attr$3(f, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), attr$3(f, "fill", "#FF7C00"), attr$3(f, "class", "svelte-43sxxs"), attr$3(y, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), attr$3(y, "fill", "#FF7C00"), attr$3(y, "fill-opacity", "0.4"), attr$3(y, "class", "svelte-43sxxs"), attr$3(A, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), attr$3(A, "fill", "#FF7C00"), attr$3(A, "class", "svelte-43sxxs"), set_style$1(d, "transform", "translate(" + /*$bottom*/
      n[2][0] + "px, " + /*$bottom*/
      n[2][1] + "px)"), attr$3(t, "viewBox", "-1200 -1200 3000 3000"), attr$3(t, "fill", "none"), attr$3(t, "xmlns", "http://www.w3.org/2000/svg"), attr$3(t, "class", "svelte-43sxxs"), attr$3(e, "class", "svelte-43sxxs"), toggle_class$3(
        e,
        "margin",
        /*margin*/
        n[0]
      );
    },
    m(x, M) {
      insert_hydration$4(x, e, M), append_hydration$3(e, t), append_hydration$3(t, r), append_hydration$3(r, a), append_hydration$3(r, s), append_hydration$3(r, h), append_hydration$3(r, o), append_hydration$3(t, d), append_hydration$3(d, v), append_hydration$3(d, f), append_hydration$3(d, y), append_hydration$3(d, A);
    },
    p(x, [M]) {
      M & /*$top*/
      2 && set_style$1(r, "transform", "translate(" + /*$top*/
      x[1][0] + "px, " + /*$top*/
      x[1][1] + "px)"), M & /*$bottom*/
      4 && set_style$1(d, "transform", "translate(" + /*$bottom*/
      x[2][0] + "px, " + /*$bottom*/
      x[2][1] + "px)"), M & /*margin*/
      1 && toggle_class$3(
        e,
        "margin",
        /*margin*/
        x[0]
      );
    },
    i: noop$3,
    o: noop$3,
    d(x) {
      x && detach$4(e);
    }
  };
}
function instance$4(n, e, t) {
  let r, a, { margin: s = !0 } = e;
  const h = spring([0, 0]);
  component_subscribe(n, h, (A) => t(1, r = A));
  const o = spring([0, 0]);
  component_subscribe(n, o, (A) => t(2, a = A));
  let d;
  async function v() {
    await Promise.all([h.set([125, 140]), o.set([-125, -140])]), await Promise.all([h.set([-125, 140]), o.set([125, -140])]), await Promise.all([h.set([-125, 0]), o.set([125, -0])]), await Promise.all([h.set([125, 0]), o.set([-125, 0])]);
  }
  async function f() {
    await v(), d || f();
  }
  async function y() {
    await Promise.all([h.set([125, 0]), o.set([-125, 0])]), f();
  }
  return onMount$2(() => (y(), () => d = !0)), n.$$set = (A) => {
    "margin" in A && t(0, s = A.margin);
  }, [s, r, a, h, o];
}
class Loader extends SvelteComponent$4 {
  constructor(e) {
    super(), init$4(this, e, instance$4, create_fragment$4, safe_not_equal$4, { margin: 0 });
  }
}
const {
  SvelteComponent: SvelteComponent$3,
  append_hydration: append_hydration$2,
  attr: attr$2,
  binding_callbacks: binding_callbacks$3,
  check_outros: check_outros$2,
  children: children$2,
  claim_component: claim_component$2,
  claim_element: claim_element$2,
  claim_space: claim_space$3,
  claim_text: claim_text$3,
  create_component: create_component$2,
  create_slot,
  destroy_component: destroy_component$2,
  destroy_each: destroy_each$1,
  detach: detach$3,
  element: element$2,
  empty: empty$2,
  ensure_array_like: ensure_array_like$1,
  get_all_dirty_from_scope,
  get_slot_changes,
  group_outros: group_outros$2,
  init: init$3,
  insert_hydration: insert_hydration$3,
  mount_component: mount_component$2,
  noop: noop$2,
  safe_not_equal: safe_not_equal$3,
  set_data: set_data$3,
  set_style,
  space: space$3,
  text: text$4,
  toggle_class: toggle_class$2,
  transition_in: transition_in$2,
  transition_out: transition_out$2,
  update_slot_base
} = window.__gradio__svelte__internal, { tick: tick$1 } = window.__gradio__svelte__internal, { onDestroy } = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal, get_error_slot_changes = (n) => ({}), get_error_slot_context = (n) => ({}), get_additional_loading_text_slot_changes = (n) => ({}), get_additional_loading_text_slot_context = (n) => ({});
function get_each_context$1(n, e, t) {
  const r = n.slice();
  return r[40] = e[t], r[42] = t, r;
}
function get_each_context_1(n, e, t) {
  const r = n.slice();
  return r[40] = e[t], r;
}
function create_if_block_17(n) {
  let e, t, r, a, s = (
    /*i18n*/
    n[1]("common.error") + ""
  ), h, o, d;
  t = new IconButton({
    props: {
      Icon: Clear,
      label: (
        /*i18n*/
        n[1]("common.clear")
      ),
      disabled: !1
    }
  }), t.$on(
    "click",
    /*click_handler*/
    n[32]
  );
  const v = (
    /*#slots*/
    n[30].error
  ), f = create_slot(
    v,
    n,
    /*$$scope*/
    n[29],
    get_error_slot_context
  );
  return {
    c() {
      e = element$2("div"), create_component$2(t.$$.fragment), r = space$3(), a = element$2("span"), h = text$4(s), o = space$3(), f && f.c(), this.h();
    },
    l(y) {
      e = claim_element$2(y, "DIV", { class: !0 });
      var A = children$2(e);
      claim_component$2(t.$$.fragment, A), A.forEach(detach$3), r = claim_space$3(y), a = claim_element$2(y, "SPAN", { class: !0 });
      var x = children$2(a);
      h = claim_text$3(x, s), x.forEach(detach$3), o = claim_space$3(y), f && f.l(y), this.h();
    },
    h() {
      attr$2(e, "class", "clear-status svelte-17v219f"), attr$2(a, "class", "error svelte-17v219f");
    },
    m(y, A) {
      insert_hydration$3(y, e, A), mount_component$2(t, e, null), insert_hydration$3(y, r, A), insert_hydration$3(y, a, A), append_hydration$2(a, h), insert_hydration$3(y, o, A), f && f.m(y, A), d = !0;
    },
    p(y, A) {
      const x = {};
      A[0] & /*i18n*/
      2 && (x.label = /*i18n*/
      y[1]("common.clear")), t.$set(x), (!d || A[0] & /*i18n*/
      2) && s !== (s = /*i18n*/
      y[1]("common.error") + "") && set_data$3(h, s), f && f.p && (!d || A[0] & /*$$scope*/
      536870912) && update_slot_base(
        f,
        v,
        y,
        /*$$scope*/
        y[29],
        d ? get_slot_changes(
          v,
          /*$$scope*/
          y[29],
          A,
          get_error_slot_changes
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          y[29]
        ),
        get_error_slot_context
      );
    },
    i(y) {
      d || (transition_in$2(t.$$.fragment, y), transition_in$2(f, y), d = !0);
    },
    o(y) {
      transition_out$2(t.$$.fragment, y), transition_out$2(f, y), d = !1;
    },
    d(y) {
      y && (detach$3(e), detach$3(r), detach$3(a), detach$3(o)), destroy_component$2(t), f && f.d(y);
    }
  };
}
function create_if_block$3(n) {
  let e, t, r, a, s, h, o, d, v, f = (
    /*variant*/
    n[8] === "default" && /*show_eta_bar*/
    n[18] && /*show_progress*/
    n[6] === "full" && create_if_block_16(n)
  );
  function y(g, b) {
    if (
      /*progress*/
      g[7]
    ) return create_if_block_11;
    if (
      /*queue_position*/
      g[2] !== null && /*queue_size*/
      g[3] !== void 0 && /*queue_position*/
      g[2] >= 0
    ) return create_if_block_14;
    if (
      /*queue_position*/
      g[2] === 0
    ) return create_if_block_15;
  }
  let A = y(n), x = A && A(n), M = (
    /*timer*/
    n[5] && create_if_block_10(n)
  );
  const m = [create_if_block_2$2, create_if_block_9], l = [];
  function u(g, b) {
    return (
      /*last_progress_level*/
      g[15] != null ? 0 : (
        /*show_progress*/
        g[6] === "full" ? 1 : -1
      )
    );
  }
  ~(s = u(n)) && (h = l[s] = m[s](n));
  let p = !/*timer*/
  n[5] && create_if_block_1$2(n);
  return {
    c() {
      f && f.c(), e = space$3(), t = element$2("div"), x && x.c(), r = space$3(), M && M.c(), a = space$3(), h && h.c(), o = space$3(), p && p.c(), d = empty$2(), this.h();
    },
    l(g) {
      f && f.l(g), e = claim_space$3(g), t = claim_element$2(g, "DIV", { class: !0 });
      var b = children$2(t);
      x && x.l(b), r = claim_space$3(b), M && M.l(b), b.forEach(detach$3), a = claim_space$3(g), h && h.l(g), o = claim_space$3(g), p && p.l(g), d = empty$2(), this.h();
    },
    h() {
      attr$2(t, "class", "progress-text svelte-17v219f"), toggle_class$2(
        t,
        "meta-text-center",
        /*variant*/
        n[8] === "center"
      ), toggle_class$2(
        t,
        "meta-text",
        /*variant*/
        n[8] === "default"
      );
    },
    m(g, b) {
      f && f.m(g, b), insert_hydration$3(g, e, b), insert_hydration$3(g, t, b), x && x.m(t, null), append_hydration$2(t, r), M && M.m(t, null), insert_hydration$3(g, a, b), ~s && l[s].m(g, b), insert_hydration$3(g, o, b), p && p.m(g, b), insert_hydration$3(g, d, b), v = !0;
    },
    p(g, b) {
      /*variant*/
      g[8] === "default" && /*show_eta_bar*/
      g[18] && /*show_progress*/
      g[6] === "full" ? f ? f.p(g, b) : (f = create_if_block_16(g), f.c(), f.m(e.parentNode, e)) : f && (f.d(1), f = null), A === (A = y(g)) && x ? x.p(g, b) : (x && x.d(1), x = A && A(g), x && (x.c(), x.m(t, r))), /*timer*/
      g[5] ? M ? M.p(g, b) : (M = create_if_block_10(g), M.c(), M.m(t, null)) : M && (M.d(1), M = null), (!v || b[0] & /*variant*/
      256) && toggle_class$2(
        t,
        "meta-text-center",
        /*variant*/
        g[8] === "center"
      ), (!v || b[0] & /*variant*/
      256) && toggle_class$2(
        t,
        "meta-text",
        /*variant*/
        g[8] === "default"
      );
      let c = s;
      s = u(g), s === c ? ~s && l[s].p(g, b) : (h && (group_outros$2(), transition_out$2(l[c], 1, 1, () => {
        l[c] = null;
      }), check_outros$2()), ~s ? (h = l[s], h ? h.p(g, b) : (h = l[s] = m[s](g), h.c()), transition_in$2(h, 1), h.m(o.parentNode, o)) : h = null), /*timer*/
      g[5] ? p && (group_outros$2(), transition_out$2(p, 1, 1, () => {
        p = null;
      }), check_outros$2()) : p ? (p.p(g, b), b[0] & /*timer*/
      32 && transition_in$2(p, 1)) : (p = create_if_block_1$2(g), p.c(), transition_in$2(p, 1), p.m(d.parentNode, d));
    },
    i(g) {
      v || (transition_in$2(h), transition_in$2(p), v = !0);
    },
    o(g) {
      transition_out$2(h), transition_out$2(p), v = !1;
    },
    d(g) {
      g && (detach$3(e), detach$3(t), detach$3(a), detach$3(o), detach$3(d)), f && f.d(g), x && x.d(), M && M.d(), ~s && l[s].d(g), p && p.d(g);
    }
  };
}
function create_if_block_16(n) {
  let e, t = `translateX(${/*eta_level*/
  (n[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      e = element$2("div"), this.h();
    },
    l(r) {
      e = claim_element$2(r, "DIV", { class: !0 }), children$2(e).forEach(detach$3), this.h();
    },
    h() {
      attr$2(e, "class", "eta-bar svelte-17v219f"), set_style(e, "transform", t);
    },
    m(r, a) {
      insert_hydration$3(r, e, a);
    },
    p(r, a) {
      a[0] & /*eta_level*/
      131072 && t !== (t = `translateX(${/*eta_level*/
      (r[17] || 0) * 100 - 100}%)`) && set_style(e, "transform", t);
    },
    d(r) {
      r && detach$3(e);
    }
  };
}
function create_if_block_15(n) {
  let e;
  return {
    c() {
      e = text$4("processing |");
    },
    l(t) {
      e = claim_text$3(t, "processing |");
    },
    m(t, r) {
      insert_hydration$3(t, e, r);
    },
    p: noop$2,
    d(t) {
      t && detach$3(e);
    }
  };
}
function create_if_block_14(n) {
  let e, t = (
    /*queue_position*/
    n[2] + 1 + ""
  ), r, a, s, h;
  return {
    c() {
      e = text$4("queue: "), r = text$4(t), a = text$4("/"), s = text$4(
        /*queue_size*/
        n[3]
      ), h = text$4(" |");
    },
    l(o) {
      e = claim_text$3(o, "queue: "), r = claim_text$3(o, t), a = claim_text$3(o, "/"), s = claim_text$3(
        o,
        /*queue_size*/
        n[3]
      ), h = claim_text$3(o, " |");
    },
    m(o, d) {
      insert_hydration$3(o, e, d), insert_hydration$3(o, r, d), insert_hydration$3(o, a, d), insert_hydration$3(o, s, d), insert_hydration$3(o, h, d);
    },
    p(o, d) {
      d[0] & /*queue_position*/
      4 && t !== (t = /*queue_position*/
      o[2] + 1 + "") && set_data$3(r, t), d[0] & /*queue_size*/
      8 && set_data$3(
        s,
        /*queue_size*/
        o[3]
      );
    },
    d(o) {
      o && (detach$3(e), detach$3(r), detach$3(a), detach$3(s), detach$3(h));
    }
  };
}
function create_if_block_11(n) {
  let e, t = ensure_array_like$1(
    /*progress*/
    n[7]
  ), r = [];
  for (let a = 0; a < t.length; a += 1)
    r[a] = create_each_block_1(get_each_context_1(n, t, a));
  return {
    c() {
      for (let a = 0; a < r.length; a += 1)
        r[a].c();
      e = empty$2();
    },
    l(a) {
      for (let s = 0; s < r.length; s += 1)
        r[s].l(a);
      e = empty$2();
    },
    m(a, s) {
      for (let h = 0; h < r.length; h += 1)
        r[h] && r[h].m(a, s);
      insert_hydration$3(a, e, s);
    },
    p(a, s) {
      if (s[0] & /*progress*/
      128) {
        t = ensure_array_like$1(
          /*progress*/
          a[7]
        );
        let h;
        for (h = 0; h < t.length; h += 1) {
          const o = get_each_context_1(a, t, h);
          r[h] ? r[h].p(o, s) : (r[h] = create_each_block_1(o), r[h].c(), r[h].m(e.parentNode, e));
        }
        for (; h < r.length; h += 1)
          r[h].d(1);
        r.length = t.length;
      }
    },
    d(a) {
      a && detach$3(e), destroy_each$1(r, a);
    }
  };
}
function create_if_block_12(n) {
  let e, t = (
    /*p*/
    n[40].unit + ""
  ), r, a, s = " ", h;
  function o(f, y) {
    return (
      /*p*/
      f[40].length != null ? create_if_block_13 : create_else_block$2
    );
  }
  let d = o(n), v = d(n);
  return {
    c() {
      v.c(), e = space$3(), r = text$4(t), a = text$4(" | "), h = text$4(s);
    },
    l(f) {
      v.l(f), e = claim_space$3(f), r = claim_text$3(f, t), a = claim_text$3(f, " | "), h = claim_text$3(f, s);
    },
    m(f, y) {
      v.m(f, y), insert_hydration$3(f, e, y), insert_hydration$3(f, r, y), insert_hydration$3(f, a, y), insert_hydration$3(f, h, y);
    },
    p(f, y) {
      d === (d = o(f)) && v ? v.p(f, y) : (v.d(1), v = d(f), v && (v.c(), v.m(e.parentNode, e))), y[0] & /*progress*/
      128 && t !== (t = /*p*/
      f[40].unit + "") && set_data$3(r, t);
    },
    d(f) {
      f && (detach$3(e), detach$3(r), detach$3(a), detach$3(h)), v.d(f);
    }
  };
}
function create_else_block$2(n) {
  let e = pretty_si(
    /*p*/
    n[40].index || 0
  ) + "", t;
  return {
    c() {
      t = text$4(e);
    },
    l(r) {
      t = claim_text$3(r, e);
    },
    m(r, a) {
      insert_hydration$3(r, t, a);
    },
    p(r, a) {
      a[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        r[40].index || 0
      ) + "") && set_data$3(t, e);
    },
    d(r) {
      r && detach$3(t);
    }
  };
}
function create_if_block_13(n) {
  let e = pretty_si(
    /*p*/
    n[40].index || 0
  ) + "", t, r, a = pretty_si(
    /*p*/
    n[40].length
  ) + "", s;
  return {
    c() {
      t = text$4(e), r = text$4("/"), s = text$4(a);
    },
    l(h) {
      t = claim_text$3(h, e), r = claim_text$3(h, "/"), s = claim_text$3(h, a);
    },
    m(h, o) {
      insert_hydration$3(h, t, o), insert_hydration$3(h, r, o), insert_hydration$3(h, s, o);
    },
    p(h, o) {
      o[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        h[40].index || 0
      ) + "") && set_data$3(t, e), o[0] & /*progress*/
      128 && a !== (a = pretty_si(
        /*p*/
        h[40].length
      ) + "") && set_data$3(s, a);
    },
    d(h) {
      h && (detach$3(t), detach$3(r), detach$3(s));
    }
  };
}
function create_each_block_1(n) {
  let e, t = (
    /*p*/
    n[40].index != null && create_if_block_12(n)
  );
  return {
    c() {
      t && t.c(), e = empty$2();
    },
    l(r) {
      t && t.l(r), e = empty$2();
    },
    m(r, a) {
      t && t.m(r, a), insert_hydration$3(r, e, a);
    },
    p(r, a) {
      /*p*/
      r[40].index != null ? t ? t.p(r, a) : (t = create_if_block_12(r), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
    },
    d(r) {
      r && detach$3(e), t && t.d(r);
    }
  };
}
function create_if_block_10(n) {
  let e, t = (
    /*eta*/
    n[0] ? `/${/*formatted_eta*/
    n[19]}` : ""
  ), r, a;
  return {
    c() {
      e = text$4(
        /*formatted_timer*/
        n[20]
      ), r = text$4(t), a = text$4("s");
    },
    l(s) {
      e = claim_text$3(
        s,
        /*formatted_timer*/
        n[20]
      ), r = claim_text$3(s, t), a = claim_text$3(s, "s");
    },
    m(s, h) {
      insert_hydration$3(s, e, h), insert_hydration$3(s, r, h), insert_hydration$3(s, a, h);
    },
    p(s, h) {
      h[0] & /*formatted_timer*/
      1048576 && set_data$3(
        e,
        /*formatted_timer*/
        s[20]
      ), h[0] & /*eta, formatted_eta*/
      524289 && t !== (t = /*eta*/
      s[0] ? `/${/*formatted_eta*/
      s[19]}` : "") && set_data$3(r, t);
    },
    d(s) {
      s && (detach$3(e), detach$3(r), detach$3(a));
    }
  };
}
function create_if_block_9(n) {
  let e, t;
  return e = new Loader({
    props: { margin: (
      /*variant*/
      n[8] === "default"
    ) }
  }), {
    c() {
      create_component$2(e.$$.fragment);
    },
    l(r) {
      claim_component$2(e.$$.fragment, r);
    },
    m(r, a) {
      mount_component$2(e, r, a), t = !0;
    },
    p(r, a) {
      const s = {};
      a[0] & /*variant*/
      256 && (s.margin = /*variant*/
      r[8] === "default"), e.$set(s);
    },
    i(r) {
      t || (transition_in$2(e.$$.fragment, r), t = !0);
    },
    o(r) {
      transition_out$2(e.$$.fragment, r), t = !1;
    },
    d(r) {
      destroy_component$2(e, r);
    }
  };
}
function create_if_block_2$2(n) {
  let e, t, r, a, s, h = `${/*last_progress_level*/
  n[15] * 100}%`, o = (
    /*progress*/
    n[7] != null && create_if_block_3$2(n)
  );
  return {
    c() {
      e = element$2("div"), t = element$2("div"), o && o.c(), r = space$3(), a = element$2("div"), s = element$2("div"), this.h();
    },
    l(d) {
      e = claim_element$2(d, "DIV", { class: !0 });
      var v = children$2(e);
      t = claim_element$2(v, "DIV", { class: !0 });
      var f = children$2(t);
      o && o.l(f), f.forEach(detach$3), r = claim_space$3(v), a = claim_element$2(v, "DIV", { class: !0 });
      var y = children$2(a);
      s = claim_element$2(y, "DIV", { class: !0 }), children$2(s).forEach(detach$3), y.forEach(detach$3), v.forEach(detach$3), this.h();
    },
    h() {
      attr$2(t, "class", "progress-level-inner svelte-17v219f"), attr$2(s, "class", "progress-bar svelte-17v219f"), set_style(s, "width", h), attr$2(a, "class", "progress-bar-wrap svelte-17v219f"), attr$2(e, "class", "progress-level svelte-17v219f");
    },
    m(d, v) {
      insert_hydration$3(d, e, v), append_hydration$2(e, t), o && o.m(t, null), append_hydration$2(e, r), append_hydration$2(e, a), append_hydration$2(a, s), n[31](s);
    },
    p(d, v) {
      /*progress*/
      d[7] != null ? o ? o.p(d, v) : (o = create_if_block_3$2(d), o.c(), o.m(t, null)) : o && (o.d(1), o = null), v[0] & /*last_progress_level*/
      32768 && h !== (h = `${/*last_progress_level*/
      d[15] * 100}%`) && set_style(s, "width", h);
    },
    i: noop$2,
    o: noop$2,
    d(d) {
      d && detach$3(e), o && o.d(), n[31](null);
    }
  };
}
function create_if_block_3$2(n) {
  let e, t = ensure_array_like$1(
    /*progress*/
    n[7]
  ), r = [];
  for (let a = 0; a < t.length; a += 1)
    r[a] = create_each_block$1(get_each_context$1(n, t, a));
  return {
    c() {
      for (let a = 0; a < r.length; a += 1)
        r[a].c();
      e = empty$2();
    },
    l(a) {
      for (let s = 0; s < r.length; s += 1)
        r[s].l(a);
      e = empty$2();
    },
    m(a, s) {
      for (let h = 0; h < r.length; h += 1)
        r[h] && r[h].m(a, s);
      insert_hydration$3(a, e, s);
    },
    p(a, s) {
      if (s[0] & /*progress_level, progress*/
      16512) {
        t = ensure_array_like$1(
          /*progress*/
          a[7]
        );
        let h;
        for (h = 0; h < t.length; h += 1) {
          const o = get_each_context$1(a, t, h);
          r[h] ? r[h].p(o, s) : (r[h] = create_each_block$1(o), r[h].c(), r[h].m(e.parentNode, e));
        }
        for (; h < r.length; h += 1)
          r[h].d(1);
        r.length = t.length;
      }
    },
    d(a) {
      a && detach$3(e), destroy_each$1(r, a);
    }
  };
}
function create_if_block_4$2(n) {
  let e, t, r, a, s = (
    /*i*/
    n[42] !== 0 && create_if_block_8()
  ), h = (
    /*p*/
    n[40].desc != null && create_if_block_7(n)
  ), o = (
    /*p*/
    n[40].desc != null && /*progress_level*/
    n[14] && /*progress_level*/
    n[14][
      /*i*/
      n[42]
    ] != null && create_if_block_6()
  ), d = (
    /*progress_level*/
    n[14] != null && create_if_block_5$2(n)
  );
  return {
    c() {
      s && s.c(), e = space$3(), h && h.c(), t = space$3(), o && o.c(), r = space$3(), d && d.c(), a = empty$2();
    },
    l(v) {
      s && s.l(v), e = claim_space$3(v), h && h.l(v), t = claim_space$3(v), o && o.l(v), r = claim_space$3(v), d && d.l(v), a = empty$2();
    },
    m(v, f) {
      s && s.m(v, f), insert_hydration$3(v, e, f), h && h.m(v, f), insert_hydration$3(v, t, f), o && o.m(v, f), insert_hydration$3(v, r, f), d && d.m(v, f), insert_hydration$3(v, a, f);
    },
    p(v, f) {
      /*p*/
      v[40].desc != null ? h ? h.p(v, f) : (h = create_if_block_7(v), h.c(), h.m(t.parentNode, t)) : h && (h.d(1), h = null), /*p*/
      v[40].desc != null && /*progress_level*/
      v[14] && /*progress_level*/
      v[14][
        /*i*/
        v[42]
      ] != null ? o || (o = create_if_block_6(), o.c(), o.m(r.parentNode, r)) : o && (o.d(1), o = null), /*progress_level*/
      v[14] != null ? d ? d.p(v, f) : (d = create_if_block_5$2(v), d.c(), d.m(a.parentNode, a)) : d && (d.d(1), d = null);
    },
    d(v) {
      v && (detach$3(e), detach$3(t), detach$3(r), detach$3(a)), s && s.d(v), h && h.d(v), o && o.d(v), d && d.d(v);
    }
  };
}
function create_if_block_8(n) {
  let e;
  return {
    c() {
      e = text$4(" /");
    },
    l(t) {
      e = claim_text$3(t, " /");
    },
    m(t, r) {
      insert_hydration$3(t, e, r);
    },
    d(t) {
      t && detach$3(e);
    }
  };
}
function create_if_block_7(n) {
  let e = (
    /*p*/
    n[40].desc + ""
  ), t;
  return {
    c() {
      t = text$4(e);
    },
    l(r) {
      t = claim_text$3(r, e);
    },
    m(r, a) {
      insert_hydration$3(r, t, a);
    },
    p(r, a) {
      a[0] & /*progress*/
      128 && e !== (e = /*p*/
      r[40].desc + "") && set_data$3(t, e);
    },
    d(r) {
      r && detach$3(t);
    }
  };
}
function create_if_block_6(n) {
  let e;
  return {
    c() {
      e = text$4("-");
    },
    l(t) {
      e = claim_text$3(t, "-");
    },
    m(t, r) {
      insert_hydration$3(t, e, r);
    },
    d(t) {
      t && detach$3(e);
    }
  };
}
function create_if_block_5$2(n) {
  let e = (100 * /*progress_level*/
  (n[14][
    /*i*/
    n[42]
  ] || 0)).toFixed(1) + "", t, r;
  return {
    c() {
      t = text$4(e), r = text$4("%");
    },
    l(a) {
      t = claim_text$3(a, e), r = claim_text$3(a, "%");
    },
    m(a, s) {
      insert_hydration$3(a, t, s), insert_hydration$3(a, r, s);
    },
    p(a, s) {
      s[0] & /*progress_level*/
      16384 && e !== (e = (100 * /*progress_level*/
      (a[14][
        /*i*/
        a[42]
      ] || 0)).toFixed(1) + "") && set_data$3(t, e);
    },
    d(a) {
      a && (detach$3(t), detach$3(r));
    }
  };
}
function create_each_block$1(n) {
  let e, t = (
    /*p*/
    (n[40].desc != null || /*progress_level*/
    n[14] && /*progress_level*/
    n[14][
      /*i*/
      n[42]
    ] != null) && create_if_block_4$2(n)
  );
  return {
    c() {
      t && t.c(), e = empty$2();
    },
    l(r) {
      t && t.l(r), e = empty$2();
    },
    m(r, a) {
      t && t.m(r, a), insert_hydration$3(r, e, a);
    },
    p(r, a) {
      /*p*/
      r[40].desc != null || /*progress_level*/
      r[14] && /*progress_level*/
      r[14][
        /*i*/
        r[42]
      ] != null ? t ? t.p(r, a) : (t = create_if_block_4$2(r), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
    },
    d(r) {
      r && detach$3(e), t && t.d(r);
    }
  };
}
function create_if_block_1$2(n) {
  let e, t, r, a;
  const s = (
    /*#slots*/
    n[30]["additional-loading-text"]
  ), h = create_slot(
    s,
    n,
    /*$$scope*/
    n[29],
    get_additional_loading_text_slot_context
  );
  return {
    c() {
      e = element$2("p"), t = text$4(
        /*loading_text*/
        n[9]
      ), r = space$3(), h && h.c(), this.h();
    },
    l(o) {
      e = claim_element$2(o, "P", { class: !0 });
      var d = children$2(e);
      t = claim_text$3(
        d,
        /*loading_text*/
        n[9]
      ), d.forEach(detach$3), r = claim_space$3(o), h && h.l(o), this.h();
    },
    h() {
      attr$2(e, "class", "loading svelte-17v219f");
    },
    m(o, d) {
      insert_hydration$3(o, e, d), append_hydration$2(e, t), insert_hydration$3(o, r, d), h && h.m(o, d), a = !0;
    },
    p(o, d) {
      (!a || d[0] & /*loading_text*/
      512) && set_data$3(
        t,
        /*loading_text*/
        o[9]
      ), h && h.p && (!a || d[0] & /*$$scope*/
      536870912) && update_slot_base(
        h,
        s,
        o,
        /*$$scope*/
        o[29],
        a ? get_slot_changes(
          s,
          /*$$scope*/
          o[29],
          d,
          get_additional_loading_text_slot_changes
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          o[29]
        ),
        get_additional_loading_text_slot_context
      );
    },
    i(o) {
      a || (transition_in$2(h, o), a = !0);
    },
    o(o) {
      transition_out$2(h, o), a = !1;
    },
    d(o) {
      o && (detach$3(e), detach$3(r)), h && h.d(o);
    }
  };
}
function create_fragment$3(n) {
  let e, t, r, a, s;
  const h = [create_if_block$3, create_if_block_17], o = [];
  function d(v, f) {
    return (
      /*status*/
      v[4] === "pending" ? 0 : (
        /*status*/
        v[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(t = d(n)) && (r = o[t] = h[t](n)), {
    c() {
      e = element$2("div"), r && r.c(), this.h();
    },
    l(v) {
      e = claim_element$2(v, "DIV", { class: !0 });
      var f = children$2(e);
      r && r.l(f), f.forEach(detach$3), this.h();
    },
    h() {
      attr$2(e, "class", a = "wrap " + /*variant*/
      n[8] + " " + /*show_progress*/
      n[6] + " svelte-17v219f"), toggle_class$2(e, "hide", !/*status*/
      n[4] || /*status*/
      n[4] === "complete" || /*show_progress*/
      n[6] === "hidden" || /*status*/
      n[4] == "streaming"), toggle_class$2(
        e,
        "translucent",
        /*variant*/
        n[8] === "center" && /*status*/
        (n[4] === "pending" || /*status*/
        n[4] === "error") || /*translucent*/
        n[11] || /*show_progress*/
        n[6] === "minimal"
      ), toggle_class$2(
        e,
        "generating",
        /*status*/
        n[4] === "generating" && /*show_progress*/
        n[6] === "full"
      ), toggle_class$2(
        e,
        "border",
        /*border*/
        n[12]
      ), set_style(
        e,
        "position",
        /*absolute*/
        n[10] ? "absolute" : "static"
      ), set_style(
        e,
        "padding",
        /*absolute*/
        n[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(v, f) {
      insert_hydration$3(v, e, f), ~t && o[t].m(e, null), n[33](e), s = !0;
    },
    p(v, f) {
      let y = t;
      t = d(v), t === y ? ~t && o[t].p(v, f) : (r && (group_outros$2(), transition_out$2(o[y], 1, 1, () => {
        o[y] = null;
      }), check_outros$2()), ~t ? (r = o[t], r ? r.p(v, f) : (r = o[t] = h[t](v), r.c()), transition_in$2(r, 1), r.m(e, null)) : r = null), (!s || f[0] & /*variant, show_progress*/
      320 && a !== (a = "wrap " + /*variant*/
      v[8] + " " + /*show_progress*/
      v[6] + " svelte-17v219f")) && attr$2(e, "class", a), (!s || f[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$2(e, "hide", !/*status*/
      v[4] || /*status*/
      v[4] === "complete" || /*show_progress*/
      v[6] === "hidden" || /*status*/
      v[4] == "streaming"), (!s || f[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && toggle_class$2(
        e,
        "translucent",
        /*variant*/
        v[8] === "center" && /*status*/
        (v[4] === "pending" || /*status*/
        v[4] === "error") || /*translucent*/
        v[11] || /*show_progress*/
        v[6] === "minimal"
      ), (!s || f[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$2(
        e,
        "generating",
        /*status*/
        v[4] === "generating" && /*show_progress*/
        v[6] === "full"
      ), (!s || f[0] & /*variant, show_progress, border*/
      4416) && toggle_class$2(
        e,
        "border",
        /*border*/
        v[12]
      ), f[0] & /*absolute*/
      1024 && set_style(
        e,
        "position",
        /*absolute*/
        v[10] ? "absolute" : "static"
      ), f[0] & /*absolute*/
      1024 && set_style(
        e,
        "padding",
        /*absolute*/
        v[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(v) {
      s || (transition_in$2(r), s = !0);
    },
    o(v) {
      transition_out$2(r), s = !1;
    },
    d(v) {
      v && detach$3(e), ~t && o[t].d(), n[33](null);
    }
  };
}
let items = [], called = !1;
const is_browser = typeof window < "u", raf = is_browser ? window.requestAnimationFrame : (n) => {
};
async function scroll_into_view(n, e = !0) {
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && e !== !0)) {
    if (items.push(n), !called) called = !0;
    else return;
    await tick$1(), raf(() => {
      let t = [0, 0];
      for (let r = 0; r < items.length; r++) {
        const s = items[r].getBoundingClientRect();
        (r === 0 || s.top + window.scrollY <= t[0]) && (t[0] = s.top + window.scrollY, t[1] = r);
      }
      window.scrollTo({ top: t[0] - 20, behavior: "smooth" }), called = !1, items = [];
    });
  }
}
function instance$3(n, e, t) {
  let r, { $$slots: a = {}, $$scope: s } = e;
  const h = createEventDispatcher$1();
  let { i18n: o } = e, { eta: d = null } = e, { queue_position: v } = e, { queue_size: f } = e, { status: y } = e, { scroll_to_output: A = !1 } = e, { timer: x = !0 } = e, { show_progress: M = "full" } = e, { message: m = null } = e, { progress: l = null } = e, { variant: u = "default" } = e, { loading_text: p = "Loading..." } = e, { absolute: g = !0 } = e, { translucent: b = !1 } = e, { border: c = !1 } = e, { autoscroll: _ } = e, E, w = !1, k = 0, $ = 0, L = null, z = null, F = 0, R = null, P, U = null, N = !0;
  const B = () => {
    t(0, d = t(27, L = t(19, G = null))), t(25, k = performance.now()), t(26, $ = 0), w = !0, W();
  };
  function W() {
    raf(() => {
      t(26, $ = (performance.now() - k) / 1e3), w && W();
    });
  }
  function V() {
    t(26, $ = 0), t(0, d = t(27, L = t(19, G = null))), w && (w = !1);
  }
  onDestroy(() => {
    w && V();
  });
  let G = null;
  function H(ee) {
    binding_callbacks$3[ee ? "unshift" : "push"](() => {
      U = ee, t(16, U), t(7, l), t(14, R), t(15, P);
    });
  }
  const Q = () => {
    h("clear_status");
  };
  function te(ee) {
    binding_callbacks$3[ee ? "unshift" : "push"](() => {
      E = ee, t(13, E);
    });
  }
  return n.$$set = (ee) => {
    "i18n" in ee && t(1, o = ee.i18n), "eta" in ee && t(0, d = ee.eta), "queue_position" in ee && t(2, v = ee.queue_position), "queue_size" in ee && t(3, f = ee.queue_size), "status" in ee && t(4, y = ee.status), "scroll_to_output" in ee && t(22, A = ee.scroll_to_output), "timer" in ee && t(5, x = ee.timer), "show_progress" in ee && t(6, M = ee.show_progress), "message" in ee && t(23, m = ee.message), "progress" in ee && t(7, l = ee.progress), "variant" in ee && t(8, u = ee.variant), "loading_text" in ee && t(9, p = ee.loading_text), "absolute" in ee && t(10, g = ee.absolute), "translucent" in ee && t(11, b = ee.translucent), "border" in ee && t(12, c = ee.border), "autoscroll" in ee && t(24, _ = ee.autoscroll), "$$scope" in ee && t(29, s = ee.$$scope);
  }, n.$$.update = () => {
    n.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
    436207617 && (d === null && t(0, d = L), d != null && L !== d && (t(28, z = (performance.now() - k) / 1e3 + d), t(19, G = z.toFixed(1)), t(27, L = d))), n.$$.dirty[0] & /*eta_from_start, timer_diff*/
    335544320 && t(17, F = z === null || z <= 0 || !$ ? null : Math.min($ / z, 1)), n.$$.dirty[0] & /*progress*/
    128 && l != null && t(18, N = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (l != null ? t(14, R = l.map((ee) => {
      if (ee.index != null && ee.length != null)
        return ee.index / ee.length;
      if (ee.progress != null)
        return ee.progress;
    })) : t(14, R = null), R ? (t(15, P = R[R.length - 1]), U && (P === 0 ? t(16, U.style.transition = "0", U) : t(16, U.style.transition = "150ms", U))) : t(15, P = void 0)), n.$$.dirty[0] & /*status*/
    16 && (y === "pending" ? B() : V()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    20979728 && E && A && (y === "pending" || y === "complete") && scroll_into_view(E, _), n.$$.dirty[0] & /*status, message*/
    8388624, n.$$.dirty[0] & /*timer_diff*/
    67108864 && t(20, r = $.toFixed(1));
  }, [
    d,
    o,
    v,
    f,
    y,
    x,
    M,
    l,
    u,
    p,
    g,
    b,
    c,
    E,
    R,
    P,
    U,
    F,
    N,
    G,
    r,
    h,
    A,
    m,
    _,
    k,
    $,
    L,
    z,
    s,
    a,
    H,
    Q,
    te
  ];
}
class Static extends SvelteComponent$3 {
  constructor(e) {
    super(), init$3(
      this,
      e,
      instance$3,
      create_fragment$3,
      safe_not_equal$3,
      {
        i18n: 1,
        eta: 0,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 22,
        timer: 5,
        show_progress: 6,
        message: 23,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 24
      },
      null,
      [-1, -1]
    );
  }
}
/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */
const {
  entries,
  setPrototypeOf,
  isFrozen,
  getPrototypeOf,
  getOwnPropertyDescriptor
} = Object;
let {
  freeze,
  seal,
  create
} = Object, {
  apply,
  construct
} = typeof Reflect < "u" && Reflect;
freeze || (freeze = function(e) {
  return e;
});
seal || (seal = function(e) {
  return e;
});
apply || (apply = function(e, t, r) {
  return e.apply(t, r);
});
construct || (construct = function(e, t) {
  return new e(...t);
});
const arrayForEach = unapply(Array.prototype.forEach), arrayPop = unapply(Array.prototype.pop), arrayPush = unapply(Array.prototype.push), stringToLowerCase = unapply(String.prototype.toLowerCase), stringToString = unapply(String.prototype.toString), stringMatch = unapply(String.prototype.match), stringReplace = unapply(String.prototype.replace), stringIndexOf = unapply(String.prototype.indexOf), stringTrim = unapply(String.prototype.trim), objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty), regExpTest = unapply(RegExp.prototype.test), typeErrorCreate = unconstruct(TypeError);
function unapply(n) {
  return function(e) {
    for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++)
      r[a - 1] = arguments[a];
    return apply(n, e, r);
  };
}
function unconstruct(n) {
  return function() {
    for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
      t[r] = arguments[r];
    return construct(n, t);
  };
}
function addToSet(n, e) {
  let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
  setPrototypeOf && setPrototypeOf(n, null);
  let r = e.length;
  for (; r--; ) {
    let a = e[r];
    if (typeof a == "string") {
      const s = t(a);
      s !== a && (isFrozen(e) || (e[r] = s), a = s);
    }
    n[a] = !0;
  }
  return n;
}
function cleanArray(n) {
  for (let e = 0; e < n.length; e++)
    objectHasOwnProperty(n, e) || (n[e] = null);
  return n;
}
function clone(n) {
  const e = create(null);
  for (const [t, r] of entries(n))
    objectHasOwnProperty(n, t) && (Array.isArray(r) ? e[t] = cleanArray(r) : r && typeof r == "object" && r.constructor === Object ? e[t] = clone(r) : e[t] = r);
  return e;
}
function lookupGetter(n, e) {
  for (; n !== null; ) {
    const r = getOwnPropertyDescriptor(n, e);
    if (r) {
      if (r.get)
        return unapply(r.get);
      if (typeof r.value == "function")
        return unapply(r.value);
    }
    n = getPrototypeOf(n);
  }
  function t() {
    return null;
  }
  return t;
}
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), svgFilters = freeze(["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"]), svgDisallowed = freeze(["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"]), mathMl$1 = freeze(["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"]), mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), text$3 = freeze(["#text"]), html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), svg = freeze(["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", "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"]), mathMl = freeze(["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"]), xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm), ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm), TMPLIT_EXPR = seal(/\${[\w\W]*}/gm), DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/), ARIA_ATTR = seal(/^aria-[\-\w]+$/), IS_ALLOWED_URI = seal(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i), ATTR_WHITESPACE = seal(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), DOCTYPE_NAME = seal(/^html$/i), CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  MUSTACHE_EXPR,
  ERB_EXPR,
  TMPLIT_EXPR,
  DATA_ATTR,
  ARIA_ATTR,
  IS_ALLOWED_URI,
  IS_SCRIPT_OR_DATA,
  ATTR_WHITESPACE,
  DOCTYPE_NAME,
  CUSTOM_ELEMENT
});
const NODE_TYPE = {
  element: 1,
  attribute: 2,
  text: 3,
  cdataSection: 4,
  entityReference: 5,
  // Deprecated
  entityNode: 6,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9,
  documentType: 10,
  documentFragment: 11,
  notation: 12
  // Deprecated
}, getGlobal = function n() {
  return typeof window > "u" ? null : window;
}, _createTrustedTypesPolicy = function n(e, t) {
  if (typeof e != "object" || typeof e.createPolicy != "function")
    return null;
  let r = null;
  const a = "data-tt-policy-suffix";
  t && t.hasAttribute(a) && (r = t.getAttribute(a));
  const s = "dompurify" + (r ? "#" + r : "");
  try {
    return e.createPolicy(s, {
      createHTML(h) {
        return h;
      },
      createScriptURL(h) {
        return h;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + s + " could not be created."), null;
  }
};
function createDOMPurify() {
  let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
  const e = (qe) => createDOMPurify(qe);
  if (e.version = "3.1.7", e.removed = [], !n || !n.document || n.document.nodeType !== NODE_TYPE.document)
    return e.isSupported = !1, e;
  let {
    document: t
  } = n;
  const r = t, a = r.currentScript, {
    DocumentFragment: s,
    HTMLTemplateElement: h,
    Node: o,
    Element: d,
    NodeFilter: v,
    NamedNodeMap: f = n.NamedNodeMap || n.MozNamedAttrMap,
    HTMLFormElement: y,
    DOMParser: A,
    trustedTypes: x
  } = n, M = d.prototype, m = lookupGetter(M, "cloneNode"), l = lookupGetter(M, "remove"), u = lookupGetter(M, "nextSibling"), p = lookupGetter(M, "childNodes"), g = lookupGetter(M, "parentNode");
  if (typeof h == "function") {
    const qe = t.createElement("template");
    qe.content && qe.content.ownerDocument && (t = qe.content.ownerDocument);
  }
  let b, c = "";
  const {
    implementation: _,
    createNodeIterator: E,
    createDocumentFragment: w,
    getElementsByTagName: k
  } = t, {
    importNode: $
  } = r;
  let L = {};
  e.isSupported = typeof entries == "function" && typeof g == "function" && _ && _.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: z,
    ERB_EXPR: F,
    TMPLIT_EXPR: R,
    DATA_ATTR: P,
    ARIA_ATTR: U,
    IS_SCRIPT_OR_DATA: N,
    ATTR_WHITESPACE: B,
    CUSTOM_ELEMENT: W
  } = EXPRESSIONS;
  let {
    IS_ALLOWED_URI: V
  } = EXPRESSIONS, G = null;
  const H = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text$3]);
  let Q = null;
  const te = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
  let ee = Object.seal(create(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
    }
  })), ce = null, fe = null, oe = !0, he = !0, Ae = !1, Se = !0, Ie = !1, pe = !0, le = !1, ne = !1, Te = !1, Oe = !1, Be = !1, Ue = !1, Pe = !0, Ge = !1;
  const Ne = "user-content-";
  let Re = !0, De = !1, je = {}, Xe = null;
  const X = addToSet({}, ["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 q = null;
  const re = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
  let ye = null;
  const me = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ze = "http://www.w3.org/1998/Math/MathML", ke = "http://www.w3.org/2000/svg", K = "http://www.w3.org/1999/xhtml";
  let ae = K, ge = !1, xe = null;
  const ue = addToSet({}, [ze, ke, K], stringToString);
  let Ce = null;
  const Z = ["application/xhtml+xml", "text/html"], Fe = "text/html";
  let We = null, I = null;
  const we = t.createElement("form"), ve = function(be) {
    return be instanceof RegExp || be instanceof Function;
  }, Y = function() {
    let be = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(I && I === be)) {
      if ((!be || typeof be != "object") && (be = {}), be = clone(be), Ce = // eslint-disable-next-line unicorn/prefer-includes
      Z.indexOf(be.PARSER_MEDIA_TYPE) === -1 ? Fe : be.PARSER_MEDIA_TYPE, We = Ce === "application/xhtml+xml" ? stringToString : stringToLowerCase, G = objectHasOwnProperty(be, "ALLOWED_TAGS") ? addToSet({}, be.ALLOWED_TAGS, We) : H, Q = objectHasOwnProperty(be, "ALLOWED_ATTR") ? addToSet({}, be.ALLOWED_ATTR, We) : te, xe = objectHasOwnProperty(be, "ALLOWED_NAMESPACES") ? addToSet({}, be.ALLOWED_NAMESPACES, stringToString) : ue, ye = objectHasOwnProperty(be, "ADD_URI_SAFE_ATTR") ? addToSet(
        clone(me),
        // eslint-disable-line indent
        be.ADD_URI_SAFE_ATTR,
        // eslint-disable-line indent
        We
        // eslint-disable-line indent
      ) : me, q = objectHasOwnProperty(be, "ADD_DATA_URI_TAGS") ? addToSet(
        clone(re),
        // eslint-disable-line indent
        be.ADD_DATA_URI_TAGS,
        // eslint-disable-line indent
        We
        // eslint-disable-line indent
      ) : re, Xe = objectHasOwnProperty(be, "FORBID_CONTENTS") ? addToSet({}, be.FORBID_CONTENTS, We) : X, ce = objectHasOwnProperty(be, "FORBID_TAGS") ? addToSet({}, be.FORBID_TAGS, We) : {}, fe = objectHasOwnProperty(be, "FORBID_ATTR") ? addToSet({}, be.FORBID_ATTR, We) : {}, je = objectHasOwnProperty(be, "USE_PROFILES") ? be.USE_PROFILES : !1, oe = be.ALLOW_ARIA_ATTR !== !1, he = be.ALLOW_DATA_ATTR !== !1, Ae = be.ALLOW_UNKNOWN_PROTOCOLS || !1, Se = be.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ie = be.SAFE_FOR_TEMPLATES || !1, pe = be.SAFE_FOR_XML !== !1, le = be.WHOLE_DOCUMENT || !1, Oe = be.RETURN_DOM || !1, Be = be.RETURN_DOM_FRAGMENT || !1, Ue = be.RETURN_TRUSTED_TYPE || !1, Te = be.FORCE_BODY || !1, Pe = be.SANITIZE_DOM !== !1, Ge = be.SANITIZE_NAMED_PROPS || !1, Re = be.KEEP_CONTENT !== !1, De = be.IN_PLACE || !1, V = be.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, ae = be.NAMESPACE || K, ee = be.CUSTOM_ELEMENT_HANDLING || {}, be.CUSTOM_ELEMENT_HANDLING && ve(be.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (ee.tagNameCheck = be.CUSTOM_ELEMENT_HANDLING.tagNameCheck), be.CUSTOM_ELEMENT_HANDLING && ve(be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (ee.attributeNameCheck = be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), be.CUSTOM_ELEMENT_HANDLING && typeof be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (ee.allowCustomizedBuiltInElements = be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ie && (he = !1), Be && (Oe = !0), je && (G = addToSet({}, text$3), Q = [], je.html === !0 && (addToSet(G, html$1), addToSet(Q, html)), je.svg === !0 && (addToSet(G, svg$1), addToSet(Q, svg), addToSet(Q, xml)), je.svgFilters === !0 && (addToSet(G, svgFilters), addToSet(Q, svg), addToSet(Q, xml)), je.mathMl === !0 && (addToSet(G, mathMl$1), addToSet(Q, mathMl), addToSet(Q, xml))), be.ADD_TAGS && (G === H && (G = clone(G)), addToSet(G, be.ADD_TAGS, We)), be.ADD_ATTR && (Q === te && (Q = clone(Q)), addToSet(Q, be.ADD_ATTR, We)), be.ADD_URI_SAFE_ATTR && addToSet(ye, be.ADD_URI_SAFE_ATTR, We), be.FORBID_CONTENTS && (Xe === X && (Xe = clone(Xe)), addToSet(Xe, be.FORBID_CONTENTS, We)), Re && (G["#text"] = !0), le && addToSet(G, ["html", "head", "body"]), G.table && (addToSet(G, ["tbody"]), delete ce.tbody), be.TRUSTED_TYPES_POLICY) {
        if (typeof be.TRUSTED_TYPES_POLICY.createHTML != "function")
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        if (typeof be.TRUSTED_TYPES_POLICY.createScriptURL != "function")
          throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        b = be.TRUSTED_TYPES_POLICY, c = b.createHTML("");
      } else
        b === void 0 && (b = _createTrustedTypesPolicy(x, a)), b !== null && typeof c == "string" && (c = b.createHTML(""));
      freeze && freeze(be), I = be;
    }
  }, de = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]), Me = addToSet({}, ["annotation-xml"]), Ye = addToSet({}, ["title", "style", "font", "a", "script"]), Ze = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]), Ke = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), rt = function(be) {
    let Ve = g(be);
    (!Ve || !Ve.tagName) && (Ve = {
      namespaceURI: ae,
      tagName: "template"
    });
    const et = stringToLowerCase(be.tagName), _t = stringToLowerCase(Ve.tagName);
    return xe[be.namespaceURI] ? be.namespaceURI === ke ? Ve.namespaceURI === K ? et === "svg" : Ve.namespaceURI === ze ? et === "svg" && (_t === "annotation-xml" || de[_t]) : !!Ze[et] : be.namespaceURI === ze ? Ve.namespaceURI === K ? et === "math" : Ve.namespaceURI === ke ? et === "math" && Me[_t] : !!Ke[et] : be.namespaceURI === K ? Ve.namespaceURI === ke && !Me[_t] || Ve.namespaceURI === ze && !de[_t] ? !1 : !Ke[et] && (Ye[et] || !Ze[et]) : !!(Ce === "application/xhtml+xml" && xe[be.namespaceURI]) : !1;
  }, wt = function(be) {
    arrayPush(e.removed, {
      element: be
    });
    try {
      g(be).removeChild(be);
    } catch {
      l(be);
    }
  }, st = function(be, Ve) {
    try {
      arrayPush(e.removed, {
        attribute: Ve.getAttributeNode(be),
        from: Ve
      });
    } catch {
      arrayPush(e.removed, {
        attribute: null,
        from: Ve
      });
    }
    if (Ve.removeAttribute(be), be === "is" && !Q[be])
      if (Oe || Be)
        try {
          wt(Ve);
        } catch {
        }
      else
        try {
          Ve.setAttribute(be, "");
        } catch {
        }
  }, ot = function(be) {
    let Ve = null, et = null;
    if (Te)
      be = "<remove></remove>" + be;
    else {
      const Tt = stringMatch(be, /^[\r\n\t ]+/);
      et = Tt && Tt[0];
    }
    Ce === "application/xhtml+xml" && ae === K && (be = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + be + "</body></html>");
    const _t = b ? b.createHTML(be) : be;
    if (ae === K)
      try {
        Ve = new A().parseFromString(_t, Ce);
      } catch {
      }
    if (!Ve || !Ve.documentElement) {
      Ve = _.createDocument(ae, "template", null);
      try {
        Ve.documentElement.innerHTML = ge ? c : _t;
      } catch {
      }
    }
    const kt = Ve.body || Ve.documentElement;
    return be && et && kt.insertBefore(t.createTextNode(et), kt.childNodes[0] || null), ae === K ? k.call(Ve, le ? "html" : "body")[0] : le ? Ve.documentElement : kt;
  }, at = function(be) {
    return E.call(
      be.ownerDocument || be,
      be,
      // eslint-disable-next-line no-bitwise
      v.SHOW_ELEMENT | v.SHOW_COMMENT | v.SHOW_TEXT | v.SHOW_PROCESSING_INSTRUCTION | v.SHOW_CDATA_SECTION,
      null
    );
  }, Mt = function(be) {
    return be instanceof y && (typeof be.nodeName != "string" || typeof be.textContent != "string" || typeof be.removeChild != "function" || !(be.attributes instanceof f) || typeof be.removeAttribute != "function" || typeof be.setAttribute != "function" || typeof be.namespaceURI != "string" || typeof be.insertBefore != "function" || typeof be.hasChildNodes != "function");
  }, gt = function(be) {
    return typeof o == "function" && be instanceof o;
  }, $t = function(be, Ve, et) {
    L[be] && arrayForEach(L[be], (_t) => {
      _t.call(e, Ve, et, I);
    });
  }, Pt = function(be) {
    let Ve = null;
    if ($t("beforeSanitizeElements", be, null), Mt(be))
      return wt(be), !0;
    const et = We(be.nodeName);
    if ($t("uponSanitizeElement", be, {
      tagName: et,
      allowedTags: G
    }), be.hasChildNodes() && !gt(be.firstElementChild) && regExpTest(/<[/\w]/g, be.innerHTML) && regExpTest(/<[/\w]/g, be.textContent) || be.nodeType === NODE_TYPE.progressingInstruction || pe && be.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, be.data))
      return wt(be), !0;
    if (!G[et] || ce[et]) {
      if (!ce[et] && St(et) && (ee.tagNameCheck instanceof RegExp && regExpTest(ee.tagNameCheck, et) || ee.tagNameCheck instanceof Function && ee.tagNameCheck(et)))
        return !1;
      if (Re && !Xe[et]) {
        const _t = g(be) || be.parentNode, kt = p(be) || be.childNodes;
        if (kt && _t) {
          const Tt = kt.length;
          for (let Lt = Tt - 1; Lt >= 0; --Lt) {
            const It = m(kt[Lt], !0);
            It.__removalCount = (be.__removalCount || 0) + 1, _t.insertBefore(It, u(be));
          }
        }
      }
      return wt(be), !0;
    }
    return be instanceof d && !rt(be) || (et === "noscript" || et === "noembed" || et === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, be.innerHTML) ? (wt(be), !0) : (Ie && be.nodeType === NODE_TYPE.text && (Ve = be.textContent, arrayForEach([z, F, R], (_t) => {
      Ve = stringReplace(Ve, _t, " ");
    }), be.textContent !== Ve && (arrayPush(e.removed, {
      element: be.cloneNode()
    }), be.textContent = Ve)), $t("afterSanitizeElements", be, null), !1);
  }, Et = function(be, Ve, et) {
    if (Pe && (Ve === "id" || Ve === "name") && (et in t || et in we))
      return !1;
    if (!(he && !fe[Ve] && regExpTest(P, Ve))) {
      if (!(oe && regExpTest(U, Ve))) {
        if (!Q[Ve] || fe[Ve]) {
          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
            !(St(be) && (ee.tagNameCheck instanceof RegExp && regExpTest(ee.tagNameCheck, be) || ee.tagNameCheck instanceof Function && ee.tagNameCheck(be)) && (ee.attributeNameCheck instanceof RegExp && regExpTest(ee.attributeNameCheck, Ve) || ee.attributeNameCheck instanceof Function && ee.attributeNameCheck(Ve)) || // Alternative, second condition checks if it's an `is`-attribute, AND
            // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            Ve === "is" && ee.allowCustomizedBuiltInElements && (ee.tagNameCheck instanceof RegExp && regExpTest(ee.tagNameCheck, et) || ee.tagNameCheck instanceof Function && ee.tagNameCheck(et)))
          ) return !1;
        } else if (!ye[Ve]) {
          if (!regExpTest(V, stringReplace(et, B, ""))) {
            if (!((Ve === "src" || Ve === "xlink:href" || Ve === "href") && be !== "script" && stringIndexOf(et, "data:") === 0 && q[be])) {
              if (!(Ae && !regExpTest(N, stringReplace(et, B, "")))) {
                if (et)
                  return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, St = function(be) {
    return be !== "annotation-xml" && stringMatch(be, W);
  }, yt = function(be) {
    $t("beforeSanitizeAttributes", be, null);
    const {
      attributes: Ve
    } = be;
    if (!Ve)
      return;
    const et = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: Q
    };
    let _t = Ve.length;
    for (; _t--; ) {
      const kt = Ve[_t], {
        name: Tt,
        namespaceURI: Lt,
        value: It
      } = kt, Ht = We(Tt);
      let Ft = Tt === "value" ? It : stringTrim(It);
      if (et.attrName = Ht, et.attrValue = Ft, et.keepAttr = !0, et.forceKeepAttr = void 0, $t("uponSanitizeAttribute", be, et), Ft = et.attrValue, et.forceKeepAttr || (st(Tt, be), !et.keepAttr))
        continue;
      if (!Se && regExpTest(/\/>/i, Ft)) {
        st(Tt, be);
        continue;
      }
      Ie && arrayForEach([z, F, R], (wr) => {
        Ft = stringReplace(Ft, wr, " ");
      });
      const xr = We(be.nodeName);
      if (Et(xr, Ht, Ft)) {
        if (Ge && (Ht === "id" || Ht === "name") && (st(Tt, be), Ft = Ne + Ft), pe && regExpTest(/((--!?|])>)|<\/(style|title)/i, Ft)) {
          st(Tt, be);
          continue;
        }
        if (b && typeof x == "object" && typeof x.getAttributeType == "function" && !Lt)
          switch (x.getAttributeType(xr, Ht)) {
            case "TrustedHTML": {
              Ft = b.createHTML(Ft);
              break;
            }
            case "TrustedScriptURL": {
              Ft = b.createScriptURL(Ft);
              break;
            }
          }
        try {
          Lt ? be.setAttributeNS(Lt, Tt, Ft) : be.setAttribute(Tt, Ft), Mt(be) ? wt(be) : arrayPop(e.removed);
        } catch {
        }
      }
    }
    $t("afterSanitizeAttributes", be, null);
  }, zt = function qe(be) {
    let Ve = null;
    const et = at(be);
    for ($t("beforeSanitizeShadowDOM", be, null); Ve = et.nextNode(); )
      $t("uponSanitizeShadowNode", Ve, null), !Pt(Ve) && (Ve.content instanceof s && qe(Ve.content), yt(Ve));
    $t("afterSanitizeShadowDOM", be, null);
  };
  return e.sanitize = function(qe) {
    let be = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, Ve = null, et = null, _t = null, kt = null;
    if (ge = !qe, ge && (qe = "<!-->"), typeof qe != "string" && !gt(qe))
      if (typeof qe.toString == "function") {
        if (qe = qe.toString(), typeof qe != "string")
          throw typeErrorCreate("dirty is not a string, aborting");
      } else
        throw typeErrorCreate("toString is not a function");
    if (!e.isSupported)
      return qe;
    if (ne || Y(be), e.removed = [], typeof qe == "string" && (De = !1), De) {
      if (qe.nodeName) {
        const It = We(qe.nodeName);
        if (!G[It] || ce[It])
          throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (qe instanceof o)
      Ve = ot("<!---->"), et = Ve.ownerDocument.importNode(qe, !0), et.nodeType === NODE_TYPE.element && et.nodeName === "BODY" || et.nodeName === "HTML" ? Ve = et : Ve.appendChild(et);
    else {
      if (!Oe && !Ie && !le && // eslint-disable-next-line unicorn/prefer-includes
      qe.indexOf("<") === -1)
        return b && Ue ? b.createHTML(qe) : qe;
      if (Ve = ot(qe), !Ve)
        return Oe ? null : Ue ? c : "";
    }
    Ve && Te && wt(Ve.firstChild);
    const Tt = at(De ? qe : Ve);
    for (; _t = Tt.nextNode(); )
      Pt(_t) || (_t.content instanceof s && zt(_t.content), yt(_t));
    if (De)
      return qe;
    if (Oe) {
      if (Be)
        for (kt = w.call(Ve.ownerDocument); Ve.firstChild; )
          kt.appendChild(Ve.firstChild);
      else
        kt = Ve;
      return (Q.shadowroot || Q.shadowrootmode) && (kt = $.call(r, kt, !0)), kt;
    }
    let Lt = le ? Ve.outerHTML : Ve.innerHTML;
    return le && G["!doctype"] && Ve.ownerDocument && Ve.ownerDocument.doctype && Ve.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, Ve.ownerDocument.doctype.name) && (Lt = "<!DOCTYPE " + Ve.ownerDocument.doctype.name + `>
` + Lt), Ie && arrayForEach([z, F, R], (It) => {
      Lt = stringReplace(Lt, It, " ");
    }), b && Ue ? b.createHTML(Lt) : Lt;
  }, e.setConfig = function() {
    let qe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    Y(qe), ne = !0;
  }, e.clearConfig = function() {
    I = null, ne = !1;
  }, e.isValidAttribute = function(qe, be, Ve) {
    I || Y({});
    const et = We(qe), _t = We(be);
    return Et(et, _t, Ve);
  }, e.addHook = function(qe, be) {
    typeof be == "function" && (L[qe] = L[qe] || [], arrayPush(L[qe], be));
  }, e.removeHook = function(qe) {
    if (L[qe])
      return arrayPop(L[qe]);
  }, e.removeHooks = function(qe) {
    L[qe] && (L[qe] = []);
  }, e.removeAllHooks = function() {
    L = {};
  }, e;
}
createDOMPurify();
const {
  SvelteComponent: SvelteComponent$2,
  add_iframe_resize_listener,
  add_render_callback: add_render_callback$1,
  append_hydration: append_hydration$1,
  attr: attr$1,
  binding_callbacks: binding_callbacks$2,
  children: children$1,
  claim_element: claim_element$1,
  claim_space: claim_space$2,
  claim_text: claim_text$2,
  destroy_each,
  detach: detach$2,
  element: element$1,
  empty: empty$1,
  ensure_array_like,
  get_svelte_dataset,
  init: init$2,
  insert_hydration: insert_hydration$2,
  noop: noop$1,
  safe_not_equal: safe_not_equal$2,
  set_data: set_data$2,
  space: space$2,
  text: text$2,
  toggle_class: toggle_class$1
} = window.__gradio__svelte__internal, { onMount: onMount$1 } = window.__gradio__svelte__internal;
function get_each_context(n, e, t) {
  const r = n.slice();
  return r[8] = e[t], r;
}
function create_if_block$2(n) {
  let e, t, r, a, s, h = (
    /*value*/
    n[0].covMods.length + ""
  ), o, d;
  function v(M, m) {
    return (
      /*value*/
      M[0].chains.length > 1 ? create_if_block_5$1 : create_else_block_1$1
    );
  }
  let f = v(n), y = f(n), A = ensure_array_like(
    /*value*/
    n[0].chains
  ), x = [];
  for (let M = 0; M < A.length; M += 1)
    x[M] = create_each_block(get_each_context(n, A, M));
  return {
    c() {
      y.c(), e = space$2(), t = element$1("ul");
      for (let M = 0; M < x.length; M += 1)
        x[M].c();
      r = space$2(), a = element$1("ul"), s = element$1("li"), o = text$2(h), d = text$2(" covalent modifications");
    },
    l(M) {
      y.l(M), e = claim_space$2(M), t = claim_element$1(M, "UL", {});
      var m = children$1(t);
      for (let p = 0; p < x.length; p += 1)
        x[p].l(m);
      m.forEach(detach$2), r = claim_space$2(M), a = claim_element$1(M, "UL", {});
      var l = children$1(a);
      s = claim_element$1(l, "LI", {});
      var u = children$1(s);
      o = claim_text$2(u, h), d = claim_text$2(u, " covalent modifications"), u.forEach(detach$2), l.forEach(detach$2);
    },
    m(M, m) {
      y.m(M, m), insert_hydration$2(M, e, m), insert_hydration$2(M, t, m);
      for (let l = 0; l < x.length; l += 1)
        x[l] && x[l].m(t, null);
      insert_hydration$2(M, r, m), insert_hydration$2(M, a, m), append_hydration$1(a, s), append_hydration$1(s, o), append_hydration$1(s, d);
    },
    p(M, m) {
      if (f === (f = v(M)) && y ? y.p(M, m) : (y.d(1), y = f(M), y && (y.c(), y.m(e.parentNode, e))), m & /*value, undefined*/
      1) {
        A = ensure_array_like(
          /*value*/
          M[0].chains
        );
        let l;
        for (l = 0; l < A.length; l += 1) {
          const u = get_each_context(M, A, l);
          x[l] ? x[l].p(u, m) : (x[l] = create_each_block(u), x[l].c(), x[l].m(t, null));
        }
        for (; l < x.length; l += 1)
          x[l].d(1);
        x.length = A.length;
      }
      m & /*value*/
      1 && h !== (h = /*value*/
      M[0].covMods.length + "") && set_data$2(o, h);
    },
    d(M) {
      M && (detach$2(e), detach$2(t), detach$2(r), detach$2(a)), y.d(M), destroy_each(x, M);
    }
  };
}
function create_else_block_1$1(n) {
  let e, t, r = (
    /*value*/
    n[0].chains.length + ""
  ), a, s, h;
  return {
    c() {
      e = element$1("b"), t = text$2("Input composed of "), a = text$2(r), s = text$2(" chain "), h = element$1("br");
    },
    l(o) {
      e = claim_element$1(o, "B", {});
      var d = children$1(e);
      t = claim_text$2(d, "Input composed of "), a = claim_text$2(d, r), s = claim_text$2(d, " chain "), d.forEach(detach$2), h = claim_element$1(o, "BR", {});
    },
    m(o, d) {
      insert_hydration$2(o, e, d), append_hydration$1(e, t), append_hydration$1(e, a), append_hydration$1(e, s), insert_hydration$2(o, h, d);
    },
    p(o, d) {
      d & /*value*/
      1 && r !== (r = /*value*/
      o[0].chains.length + "") && set_data$2(a, r);
    },
    d(o) {
      o && (detach$2(e), detach$2(h));
    }
  };
}
function create_if_block_5$1(n) {
  let e, t, r = (
    /*value*/
    n[0].chains.length + ""
  ), a, s, h, o;
  return {
    c() {
      e = element$1("b"), t = text$2("Input composed of "), a = text$2(r), s = text$2(" chains"), h = space$2(), o = element$1("br");
    },
    l(d) {
      e = claim_element$1(d, "B", {});
      var v = children$1(e);
      t = claim_text$2(v, "Input composed of "), a = claim_text$2(v, r), s = claim_text$2(v, " chains"), v.forEach(detach$2), h = claim_space$2(d), o = claim_element$1(d, "BR", {});
    },
    m(d, v) {
      insert_hydration$2(d, e, v), append_hydration$1(e, t), append_hydration$1(e, a), append_hydration$1(e, s), insert_hydration$2(d, h, v), insert_hydration$2(d, o, v);
    },
    p(d, v) {
      v & /*value*/
      1 && r !== (r = /*value*/
      d[0].chains.length + "") && set_data$2(a, r);
    },
    d(d) {
      d && (detach$2(e), detach$2(h), detach$2(o));
    }
  };
}
function create_if_block_4$1(n) {
  let e, t, r = (
    /*val*/
    n[8].class + ""
  ), a, s, h = (
    /*val*/
    n[8].sequence.length + ""
  ), o, d;
  return {
    c() {
      e = element$1("li"), t = element$1("div"), a = text$2(r), s = space$2(), o = text$2(h), d = text$2(" residues"), this.h();
    },
    l(v) {
      e = claim_element$1(v, "LI", {});
      var f = children$1(e);
      t = claim_element$1(f, "DIV", { class: !0 });
      var y = children$1(t);
      a = claim_text$2(y, r), s = claim_space$2(y), o = claim_text$2(y, h), d = claim_text$2(y, " residues"), y.forEach(detach$2), f.forEach(detach$2), this.h();
    },
    h() {
      attr$1(t, "class", "svelte-1r1gryw");
    },
    m(v, f) {
      insert_hydration$2(v, e, f), append_hydration$1(e, t), append_hydration$1(t, a), append_hydration$1(t, s), append_hydration$1(t, o), append_hydration$1(t, d);
    },
    p(v, f) {
      f & /*value*/
      1 && r !== (r = /*val*/
      v[8].class + "") && set_data$2(a, r), f & /*value*/
      1 && h !== (h = /*val*/
      v[8].sequence.length + "") && set_data$2(o, h);
    },
    d(v) {
      v && detach$2(e);
    }
  };
}
function create_if_block_1$1(n) {
  let e;
  function t(s, h) {
    return (
      /*val*/
      s[8].name != null ? create_if_block_2$1 : (
        /*val*/
        s[8].smiles != null ? create_if_block_3$1 : create_else_block$1
      )
    );
  }
  let r = t(n), a = r(n);
  return {
    c() {
      a.c(), e = empty$1();
    },
    l(s) {
      a.l(s), e = empty$1();
    },
    m(s, h) {
      a.m(s, h), insert_hydration$2(s, e, h);
    },
    p(s, h) {
      r === (r = t(s)) && a ? a.p(s, h) : (a.d(1), a = r(s), a && (a.c(), a.m(e.parentNode, e)));
    },
    d(s) {
      s && detach$2(e), a.d(s);
    }
  };
}
function create_else_block$1(n) {
  let e, t = '<div class="svelte-1r1gryw">Ligand</div>';
  return {
    c() {
      e = element$1("li"), e.innerHTML = t;
    },
    l(r) {
      e = claim_element$1(r, "LI", { "data-svelte-h": !0 }), get_svelte_dataset(e) !== "svelte-z73xb2" && (e.innerHTML = t);
    },
    m(r, a) {
      insert_hydration$2(r, e, a);
    },
    p: noop$1,
    d(r) {
      r && detach$2(e);
    }
  };
}
function create_if_block_3$1(n) {
  let e, t, r, a = (
    /*val*/
    n[8].smiles.length + ""
  ), s, h;
  return {
    c() {
      e = element$1("li"), t = element$1("div"), r = text$2("Ligand SMILES with "), s = text$2(a), h = text$2(" atoms"), this.h();
    },
    l(o) {
      e = claim_element$1(o, "LI", {});
      var d = children$1(e);
      t = claim_element$1(d, "DIV", { class: !0 });
      var v = children$1(t);
      r = claim_text$2(v, "Ligand SMILES with "), s = claim_text$2(v, a), h = claim_text$2(v, " atoms"), v.forEach(detach$2), d.forEach(detach$2), this.h();
    },
    h() {
      attr$1(t, "class", "svelte-1r1gryw");
    },
    m(o, d) {
      insert_hydration$2(o, e, d), append_hydration$1(e, t), append_hydration$1(t, r), append_hydration$1(t, s), append_hydration$1(t, h);
    },
    p(o, d) {
      d & /*value*/
      1 && a !== (a = /*val*/
      o[8].smiles.length + "") && set_data$2(s, a);
    },
    d(o) {
      o && detach$2(e);
    }
  };
}
function create_if_block_2$1(n) {
  let e, t, r, a = (
    /*val*/
    n[8].name + ""
  ), s;
  return {
    c() {
      e = element$1("li"), t = element$1("div"), r = text$2("Ligand "), s = text$2(a), this.h();
    },
    l(h) {
      e = claim_element$1(h, "LI", {});
      var o = children$1(e);
      t = claim_element$1(o, "DIV", { class: !0 });
      var d = children$1(t);
      r = claim_text$2(d, "Ligand "), s = claim_text$2(d, a), d.forEach(detach$2), o.forEach(detach$2), this.h();
    },
    h() {
      attr$1(t, "class", "svelte-1r1gryw");
    },
    m(h, o) {
      insert_hydration$2(h, e, o), append_hydration$1(e, t), append_hydration$1(t, r), append_hydration$1(t, s);
    },
    p(h, o) {
      o & /*value*/
      1 && a !== (a = /*val*/
      h[8].name + "") && set_data$2(s, a);
    },
    d(h) {
      h && detach$2(e);
    }
  };
}
function create_each_block(n) {
  let e = ["protein", "DNA", "RNA"].includes(
    /*val*/
    n[8].class
  ), t, r, a = e && create_if_block_4$1(n), s = (
    /*val*/
    n[8].class == "ligand" && create_if_block_1$1(n)
  );
  return {
    c() {
      a && a.c(), t = space$2(), s && s.c(), r = empty$1();
    },
    l(h) {
      a && a.l(h), t = claim_space$2(h), s && s.l(h), r = empty$1();
    },
    m(h, o) {
      a && a.m(h, o), insert_hydration$2(h, t, o), s && s.m(h, o), insert_hydration$2(h, r, o);
    },
    p(h, o) {
      o & /*value*/
      1 && (e = ["protein", "DNA", "RNA"].includes(
        /*val*/
        h[8].class
      )), e ? a ? a.p(h, o) : (a = create_if_block_4$1(h), a.c(), a.m(t.parentNode, t)) : a && (a.d(1), a = null), /*val*/
      h[8].class == "ligand" ? s ? s.p(h, o) : (s = create_if_block_1$1(h), s.c(), s.m(r.parentNode, r)) : s && (s.d(1), s = null);
    },
    d(h) {
      h && (detach$2(t), detach$2(r)), a && a.d(h), s && s.d(h);
    }
  };
}
function create_fragment$2(n) {
  let e, t, r = (
    /*value*/
    n[0] && create_if_block$2(n)
  );
  return {
    c() {
      e = element$1("div"), r && r.c(), this.h();
    },
    l(a) {
      e = claim_element$1(a, "DIV", { class: !0 });
      var s = children$1(e);
      r && r.l(s), s.forEach(detach$2), this.h();
    },
    h() {
      attr$1(e, "class", "svelte-1r1gryw"), add_render_callback$1(() => (
        /*div_elementresize_handler*/
        n[5].call(e)
      )), toggle_class$1(
        e,
        "table",
        /*type*/
        n[1] === "table"
      ), toggle_class$1(
        e,
        "gallery",
        /*type*/
        n[1] === "gallery"
      ), toggle_class$1(
        e,
        "selected",
        /*selected*/
        n[2]
      );
    },
    m(a, s) {
      insert_hydration$2(a, e, s), r && r.m(e, null), t = add_iframe_resize_listener(
        e,
        /*div_elementresize_handler*/
        n[5].bind(e)
      ), n[6](e);
    },
    p(a, [s]) {
      /*value*/
      a[0] ? r ? r.p(a, s) : (r = create_if_block$2(a), r.c(), r.m(e, null)) : r && (r.d(1), r = null), s & /*type*/
      2 && toggle_class$1(
        e,
        "table",
        /*type*/
        a[1] === "table"
      ), s & /*type*/
      2 && toggle_class$1(
        e,
        "gallery",
        /*type*/
        a[1] === "gallery"
      ), s & /*selected*/
      4 && toggle_class$1(
        e,
        "selected",
        /*selected*/
        a[2]
      );
    },
    i: noop$1,
    o: noop$1,
    d(a) {
      a && detach$2(e), r && r.d(), t(), n[6](null);
    }
  };
}
function instance$2(n, e, t) {
  let { value: r } = e, { type: a } = e, { selected: s = !1 } = e, h, o;
  function d(y, A) {
    !y || !A || (o.style.setProperty("--local-text-width", `${A < 150 ? A : 200}px`), t(4, o.style.whiteSpace = "unset", o));
  }
  onMount$1(() => {
    d(o, h);
  });
  function v() {
    h = this.clientWidth, t(3, h);
  }
  function f(y) {
    binding_callbacks$2[y ? "unshift" : "push"](() => {
      o = y, t(4, o);
    });
  }
  return n.$$set = (y) => {
    "value" in y && t(0, r = y.value), "type" in y && t(1, a = y.type), "selected" in y && t(2, s = y.selected);
  }, [r, a, s, h, o, v, f];
}
class Example extends SvelteComponent$2 {
  constructor(e) {
    super(), init$2(this, e, instance$2, create_fragment$2, safe_not_equal$2, { value: 0, type: 1, selected: 2 });
  }
}
const {
  SvelteComponent: SvelteComponent$1,
  action_destroyer,
  add_render_callback,
  append_hydration,
  attr,
  binding_callbacks: binding_callbacks$1,
  bubble,
  check_outros: check_outros$1,
  children,
  claim_component: claim_component$1,
  claim_element,
  claim_space: claim_space$1,
  claim_text: claim_text$1,
  create_component: create_component$1,
  create_in_transition,
  destroy_component: destroy_component$1,
  detach: detach$1,
  element,
  empty,
  group_outros: group_outros$1,
  init: init$1,
  insert_hydration: insert_hydration$1,
  is_function,
  listen,
  mount_component: mount_component$1,
  noop,
  run_all,
  safe_not_equal: safe_not_equal$1,
  set_data: set_data$1,
  set_input_value,
  space: space$1,
  text: text$1,
  toggle_class,
  transition_in: transition_in$1,
  transition_out: transition_out$1
} = window.__gradio__svelte__internal, { beforeUpdate, afterUpdate, createEventDispatcher, tick } = window.__gradio__svelte__internal;
function create_default_slot$1(n) {
  let e;
  return {
    c() {
      e = text$1(
        /*label*/
        n[3]
      );
    },
    l(t) {
      e = claim_text$1(
        t,
        /*label*/
        n[3]
      );
    },
    m(t, r) {
      insert_hydration$1(t, e, r);
    },
    p(t, r) {
      r[0] & /*label*/
      8 && set_data$1(
        e,
        /*label*/
        t[3]
      );
    },
    d(t) {
      t && detach$1(e);
    }
  };
}
function create_else_block(n) {
  let e, t, r, a, s, h, o, d, v = (
    /*show_label*/
    n[6] && /*show_copy_button*/
    n[10] && create_if_block_4(n)
  );
  return {
    c() {
      v && v.c(), e = space$1(), t = element("textarea"), this.h();
    },
    l(f) {
      v && v.l(f), e = claim_space$1(f), t = claim_element(f, "TEXTAREA", {
        "data-testid": !0,
        class: !0,
        dir: !0,
        placeholder: !0,
        rows: !0,
        style: !0
      }), children(t).forEach(detach$1), this.h();
    },
    h() {
      attr(t, "data-testid", "textbox"), attr(t, "class", "scroll-hide svelte-18tqgac"), attr(t, "dir", r = /*rtl*/
      n[11] ? "rtl" : "ltr"), attr(
        t,
        "placeholder",
        /*placeholder*/
        n[2]
      ), attr(
        t,
        "rows",
        /*lines*/
        n[1]
      ), t.disabled = /*disabled*/
      n[5], t.autofocus = /*autofocus*/
      n[12], attr(t, "style", a = /*text_align*/
      n[13] ? "text-align: " + /*text_align*/
      n[13] : "");
    },
    m(f, y) {
      v && v.m(f, y), insert_hydration$1(f, e, y), insert_hydration$1(f, t, y), set_input_value(
        t,
        /*value*/
        n[0]
      ), n[38](t), h = !0, /*autofocus*/
      n[12] && t.focus(), o || (d = [
        action_destroyer(s = /*text_area_resize*/
        n[20].call(
          null,
          t,
          /*value*/
          n[0]
        )),
        listen(
          t,
          "input",
          /*textarea_input_handler*/
          n[37]
        ),
        listen(
          t,
          "keypress",
          /*handle_keypress*/
          n[18]
        ),
        listen(
          t,
          "blur",
          /*blur_handler_3*/
          n[29]
        ),
        listen(
          t,
          "select",
          /*handle_select*/
          n[17]
        ),
        listen(
          t,
          "focus",
          /*focus_handler_3*/
          n[30]
        ),
        listen(
          t,
          "scroll",
          /*handle_scroll*/
          n[19]
        )
      ], o = !0);
    },
    p(f, y) {
      /*show_label*/
      f[6] && /*show_copy_button*/
      f[10] ? v ? (v.p(f, y), y[0] & /*show_label, show_copy_button*/
      1088 && transition_in$1(v, 1)) : (v = create_if_block_4(f), v.c(), transition_in$1(v, 1), v.m(e.parentNode, e)) : v && (group_outros$1(), transition_out$1(v, 1, 1, () => {
        v = null;
      }), check_outros$1()), (!h || y[0] & /*rtl*/
      2048 && r !== (r = /*rtl*/
      f[11] ? "rtl" : "ltr")) && attr(t, "dir", r), (!h || y[0] & /*placeholder*/
      4) && attr(
        t,
        "placeholder",
        /*placeholder*/
        f[2]
      ), (!h || y[0] & /*lines*/
      2) && attr(
        t,
        "rows",
        /*lines*/
        f[1]
      ), (!h || y[0] & /*disabled*/
      32) && (t.disabled = /*disabled*/
      f[5]), (!h || y[0] & /*autofocus*/
      4096) && (t.autofocus = /*autofocus*/
      f[12]), (!h || y[0] & /*text_align*/
      8192 && a !== (a = /*text_align*/
      f[13] ? "text-align: " + /*text_align*/
      f[13] : "")) && attr(t, "style", a), s && is_function(s.update) && y[0] & /*value*/
      1 && s.update.call(
        null,
        /*value*/
        f[0]
      ), y[0] & /*value*/
      1 && set_input_value(
        t,
        /*value*/
        f[0]
      );
    },
    i(f) {
      h || (transition_in$1(v), h = !0);
    },
    o(f) {
      transition_out$1(v), h = !1;
    },
    d(f) {
      f && (detach$1(e), detach$1(t)), v && v.d(f), n[38](null), o = !1, run_all(d);
    }
  };
}
function create_if_block$1(n) {
  let e;
  function t(s, h) {
    if (
      /*type*/
      s[9] === "text"
    ) return create_if_block_1;
    if (
      /*type*/
      s[9] === "password"
    ) return create_if_block_2;
    if (
      /*type*/
      s[9] === "email"
    ) return create_if_block_3;
  }
  let r = t(n), a = r && r(n);
  return {
    c() {
      a && a.c(), e = empty();
    },
    l(s) {
      a && a.l(s), e = empty();
    },
    m(s, h) {
      a && a.m(s, h), insert_hydration$1(s, e, h);
    },
    p(s, h) {
      r === (r = t(s)) && a ? a.p(s, h) : (a && a.d(1), a = r && r(s), a && (a.c(), a.m(e.parentNode, e)));
    },
    i: noop,
    o: noop,
    d(s) {
      s && detach$1(e), a && a.d(s);
    }
  };
}
function create_if_block_4(n) {
  let e, t, r, a;
  const s = [create_if_block_5, create_else_block_1], h = [];
  function o(d, v) {
    return (
      /*copied*/
      d[15] ? 0 : 1
    );
  }
  return e = o(n), t = h[e] = s[e](n), {
    c() {
      t.c(), r = empty();
    },
    l(d) {
      t.l(d), r = empty();
    },
    m(d, v) {
      h[e].m(d, v), insert_hydration$1(d, r, v), a = !0;
    },
    p(d, v) {
      let f = e;
      e = o(d), e === f ? h[e].p(d, v) : (group_outros$1(), transition_out$1(h[f], 1, 1, () => {
        h[f] = null;
      }), check_outros$1(), t = h[e], t ? t.p(d, v) : (t = h[e] = s[e](d), t.c()), transition_in$1(t, 1), t.m(r.parentNode, r));
    },
    i(d) {
      a || (transition_in$1(t), a = !0);
    },
    o(d) {
      transition_out$1(t), a = !1;
    },
    d(d) {
      d && detach$1(r), h[e].d(d);
    }
  };
}
function create_else_block_1(n) {
  let e, t, r, a, s;
  return t = new Copy({}), {
    c() {
      e = element("button"), create_component$1(t.$$.fragment), this.h();
    },
    l(h) {
      e = claim_element(h, "BUTTON", {
        "aria-label": !0,
        "aria-roledescription": !0,
        class: !0
      });
      var o = children(e);
      claim_component$1(t.$$.fragment, o), o.forEach(detach$1), this.h();
    },
    h() {
      attr(e, "aria-label", "Copy"), attr(e, "aria-roledescription", "Copy text"), attr(e, "class", "svelte-18tqgac");
    },
    m(h, o) {
      insert_hydration$1(h, e, o), mount_component$1(t, e, null), r = !0, a || (s = listen(
        e,
        "click",
        /*handle_copy*/
        n[16]
      ), a = !0);
    },
    p: noop,
    i(h) {
      r || (transition_in$1(t.$$.fragment, h), r = !0);
    },
    o(h) {
      transition_out$1(t.$$.fragment, h), r = !1;
    },
    d(h) {
      h && detach$1(e), destroy_component$1(t), a = !1, s();
    }
  };
}
function create_if_block_5(n) {
  let e, t, r, a;
  return t = new Check({}), {
    c() {
      e = element("button"), create_component$1(t.$$.fragment), this.h();
    },
    l(s) {
      e = claim_element(s, "BUTTON", {
        "aria-label": !0,
        "aria-roledescription": !0,
        class: !0
      });
      var h = children(e);
      claim_component$1(t.$$.fragment, h), h.forEach(detach$1), this.h();
    },
    h() {
      attr(e, "aria-label", "Copied"), attr(e, "aria-roledescription", "Text copied"), attr(e, "class", "svelte-18tqgac");
    },
    m(s, h) {
      insert_hydration$1(s, e, h), mount_component$1(t, e, null), a = !0;
    },
    p: noop,
    i(s) {
      a || (transition_in$1(t.$$.fragment, s), s && (r || add_render_callback(() => {
        r = create_in_transition(e, fade, { duration: 300 }), r.start();
      })), a = !0);
    },
    o(s) {
      transition_out$1(t.$$.fragment, s), a = !1;
    },
    d(s) {
      s && detach$1(e), destroy_component$1(t);
    }
  };
}
function create_if_block_3(n) {
  let e, t, r;
  return {
    c() {
      e = element("input"), this.h();
    },
    l(a) {
      e = claim_element(a, "INPUT", {
        "data-testid": !0,
        type: !0,
        class: !0,
        placeholder: !0,
        autocomplete: !0
      }), this.h();
    },
    h() {
      attr(e, "data-testid", "textbox"), attr(e, "type", "email"), attr(e, "class", "scroll-hide svelte-18tqgac"), attr(
        e,
        "placeholder",
        /*placeholder*/
        n[2]
      ), e.disabled = /*disabled*/
      n[5], e.autofocus = /*autofocus*/
      n[12], attr(e, "autocomplete", "email");
    },
    m(a, s) {
      insert_hydration$1(a, e, s), set_input_value(
        e,
        /*value*/
        n[0]
      ), n[36](e), /*autofocus*/
      n[12] && e.focus(), t || (r = [
        listen(
          e,
          "input",
          /*input_input_handler_2*/
          n[35]
        ),
        listen(
          e,
          "keypress",
          /*handle_keypress*/
          n[18]
        ),
        listen(
          e,
          "blur",
          /*blur_handler_2*/
          n[27]
        ),
        listen(
          e,
          "select",
          /*handle_select*/
          n[17]
        ),
        listen(
          e,
          "focus",
          /*focus_handler_2*/
          n[28]
        )
      ], t = !0);
    },
    p(a, s) {
      s[0] & /*placeholder*/
      4 && attr(
        e,
        "placeholder",
        /*placeholder*/
        a[2]
      ), s[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      a[5]), s[0] & /*autofocus*/
      4096 && (e.autofocus = /*autofocus*/
      a[12]), s[0] & /*value*/
      1 && e.value !== /*value*/
      a[0] && set_input_value(
        e,
        /*value*/
        a[0]
      );
    },
    d(a) {
      a && detach$1(e), n[36](null), t = !1, run_all(r);
    }
  };
}
function create_if_block_2(n) {
  let e, t, r;
  return {
    c() {
      e = element("input"), this.h();
    },
    l(a) {
      e = claim_element(a, "INPUT", {
        "data-testid": !0,
        type: !0,
        class: !0,
        placeholder: !0,
        autocomplete: !0
      }), this.h();
    },
    h() {
      attr(e, "data-testid", "password"), attr(e, "type", "password"), attr(e, "class", "scroll-hide svelte-18tqgac"), attr(
        e,
        "placeholder",
        /*placeholder*/
        n[2]
      ), e.disabled = /*disabled*/
      n[5], e.autofocus = /*autofocus*/
      n[12], attr(e, "autocomplete", "");
    },
    m(a, s) {
      insert_hydration$1(a, e, s), set_input_value(
        e,
        /*value*/
        n[0]
      ), n[34](e), /*autofocus*/
      n[12] && e.focus(), t || (r = [
        listen(
          e,
          "input",
          /*input_input_handler_1*/
          n[33]
        ),
        listen(
          e,
          "keypress",
          /*handle_keypress*/
          n[18]
        ),
        listen(
          e,
          "blur",
          /*blur_handler_1*/
          n[25]
        ),
        listen(
          e,
          "select",
          /*handle_select*/
          n[17]
        ),
        listen(
          e,
          "focus",
          /*focus_handler_1*/
          n[26]
        )
      ], t = !0);
    },
    p(a, s) {
      s[0] & /*placeholder*/
      4 && attr(
        e,
        "placeholder",
        /*placeholder*/
        a[2]
      ), s[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      a[5]), s[0] & /*autofocus*/
      4096 && (e.autofocus = /*autofocus*/
      a[12]), s[0] & /*value*/
      1 && e.value !== /*value*/
      a[0] && set_input_value(
        e,
        /*value*/
        a[0]
      );
    },
    d(a) {
      a && detach$1(e), n[34](null), t = !1, run_all(r);
    }
  };
}
function create_if_block_1(n) {
  let e, t, r, a, s;
  return {
    c() {
      e = element("input"), this.h();
    },
    l(h) {
      e = claim_element(h, "INPUT", {
        "data-testid": !0,
        type: !0,
        class: !0,
        dir: !0,
        placeholder: !0,
        style: !0
      }), this.h();
    },
    h() {
      attr(e, "data-testid", "textbox"), attr(e, "type", "text"), attr(e, "class", "scroll-hide svelte-18tqgac"), attr(e, "dir", t = /*rtl*/
      n[11] ? "rtl" : "ltr"), attr(
        e,
        "placeholder",
        /*placeholder*/
        n[2]
      ), e.disabled = /*disabled*/
      n[5], e.autofocus = /*autofocus*/
      n[12], attr(e, "style", r = /*text_align*/
      n[13] ? "text-align: " + /*text_align*/
      n[13] : "");
    },
    m(h, o) {
      insert_hydration$1(h, e, o), set_input_value(
        e,
        /*value*/
        n[0]
      ), n[32](e), /*autofocus*/
      n[12] && e.focus(), a || (s = [
        listen(
          e,
          "input",
          /*input_input_handler*/
          n[31]
        ),
        listen(
          e,
          "keypress",
          /*handle_keypress*/
          n[18]
        ),
        listen(
          e,
          "blur",
          /*blur_handler*/
          n[23]
        ),
        listen(
          e,
          "select",
          /*handle_select*/
          n[17]
        ),
        listen(
          e,
          "focus",
          /*focus_handler*/
          n[24]
        )
      ], a = !0);
    },
    p(h, o) {
      o[0] & /*rtl*/
      2048 && t !== (t = /*rtl*/
      h[11] ? "rtl" : "ltr") && attr(e, "dir", t), o[0] & /*placeholder*/
      4 && attr(
        e,
        "placeholder",
        /*placeholder*/
        h[2]
      ), o[0] & /*disabled*/
      32 && (e.disabled = /*disabled*/
      h[5]), o[0] & /*autofocus*/
      4096 && (e.autofocus = /*autofocus*/
      h[12]), o[0] & /*text_align*/
      8192 && r !== (r = /*text_align*/
      h[13] ? "text-align: " + /*text_align*/
      h[13] : "") && attr(e, "style", r), o[0] & /*value*/
      1 && e.value !== /*value*/
      h[0] && set_input_value(
        e,
        /*value*/
        h[0]
      );
    },
    d(h) {
      h && detach$1(e), n[32](null), a = !1, run_all(s);
    }
  };
}
function create_fragment$1(n) {
  let e, t, r, a, s, h;
  t = new BlockTitle({
    props: {
      show_label: (
        /*show_label*/
        n[6]
      ),
      info: (
        /*info*/
        n[4]
      ),
      $$slots: { default: [create_default_slot$1] },
      $$scope: { ctx: n }
    }
  });
  const o = [create_if_block$1, create_else_block], d = [];
  function v(f, y) {
    return (
      /*lines*/
      f[1] === 1 && /*max_lines*/
      f[8] === 1 ? 0 : 1
    );
  }
  return a = v(n), s = d[a] = o[a](n), {
    c() {
      e = element("label"), create_component$1(t.$$.fragment), r = space$1(), s.c(), this.h();
    },
    l(f) {
      e = claim_element(f, "LABEL", { class: !0 });
      var y = children(e);
      claim_component$1(t.$$.fragment, y), r = claim_space$1(y), s.l(y), y.forEach(detach$1), this.h();
    },
    h() {
      attr(e, "class", "svelte-18tqgac"), toggle_class(
        e,
        "container",
        /*container*/
        n[7]
      );
    },
    m(f, y) {
      insert_hydration$1(f, e, y), mount_component$1(t, e, null), append_hydration(e, r), d[a].m(e, null), h = !0;
    },
    p(f, y) {
      const A = {};
      y[0] & /*show_label*/
      64 && (A.show_label = /*show_label*/
      f[6]), y[0] & /*info*/
      16 && (A.info = /*info*/
      f[4]), y[0] & /*label*/
      8 | y[1] & /*$$scope*/
      131072 && (A.$$scope = { dirty: y, ctx: f }), t.$set(A);
      let x = a;
      a = v(f), a === x ? d[a].p(f, y) : (group_outros$1(), transition_out$1(d[x], 1, 1, () => {
        d[x] = null;
      }), check_outros$1(), s = d[a], s ? s.p(f, y) : (s = d[a] = o[a](f), s.c()), transition_in$1(s, 1), s.m(e, null)), (!h || y[0] & /*container*/
      128) && toggle_class(
        e,
        "container",
        /*container*/
        f[7]
      );
    },
    i(f) {
      h || (transition_in$1(t.$$.fragment, f), transition_in$1(s), h = !0);
    },
    o(f) {
      transition_out$1(t.$$.fragment, f), transition_out$1(s), h = !1;
    },
    d(f) {
      f && detach$1(e), destroy_component$1(t), d[a].d();
    }
  };
}
function instance$1(n, e, t) {
  let { value: r = "" } = e, { value_is_output: a = !1 } = e, { lines: s = 1 } = e, { placeholder: h = "Type here..." } = e, { label: o } = e, { info: d = void 0 } = e, { disabled: v = !1 } = e, { show_label: f = !0 } = e, { container: y = !0 } = e, { max_lines: A } = e, { type: x = "text" } = e, { show_copy_button: M = !1 } = e, { rtl: m = !1 } = e, { autofocus: l = !1 } = e, { text_align: u = void 0 } = e, { autoscroll: p = !0 } = e, g, b = !1, c, _, E = 0, w = !1;
  const k = createEventDispatcher();
  beforeUpdate(() => {
    _ = g && g.offsetHeight + g.scrollTop > g.scrollHeight - 100;
  });
  const $ = () => {
    _ && p && !w && g.scrollTo(0, g.scrollHeight);
  };
  function L() {
    k("change", r), a || k("input");
  }
  afterUpdate(() => {
    l && g.focus(), _ && p && $(), t(21, a = !1);
  });
  async function z() {
    "clipboard" in navigator && (await navigator.clipboard.writeText(r), F());
  }
  function F() {
    t(15, b = !0), c && clearTimeout(c), c = setTimeout(
      () => {
        t(15, b = !1);
      },
      1e3
    );
  }
  function R(ne) {
    const Te = ne.target, Oe = Te.value, Be = [Te.selectionStart, Te.selectionEnd];
    k("select", { value: Oe.substring(...Be), index: Be });
  }
  async function P(ne) {
    await tick(), (ne.key === "Enter" && ne.shiftKey && s > 1 || ne.key === "Enter" && !ne.shiftKey && s === 1 && A >= 1) && (ne.preventDefault(), k("submit"));
  }
  function U(ne) {
    const Te = ne.target, Oe = Te.scrollTop;
    Oe < E && (w = !0), E = Oe;
    const Be = Te.scrollHeight - Te.clientHeight;
    Oe >= Be && (w = !1);
  }
  async function N(ne) {
    if (await tick(), s === A) return;
    let Te = A === void 0 ? !1 : A === void 0 ? 21 * 11 : 21 * (A + 1), Oe = 21 * (s + 1);
    const Be = ne.target;
    Be.style.height = "1px";
    let Ue;
    Te && Be.scrollHeight > Te ? Ue = Te : Be.scrollHeight < Oe ? Ue = Oe : Ue = Be.scrollHeight, Be.style.height = `${Ue}px`;
  }
  function B(ne, Te) {
    if (s !== A && (ne.style.overflowY = "scroll", ne.addEventListener("input", N), !!Te.trim()))
      return N({ target: ne }), {
        destroy: () => ne.removeEventListener("input", N)
      };
  }
  function W(ne) {
    bubble.call(this, n, ne);
  }
  function V(ne) {
    bubble.call(this, n, ne);
  }
  function G(ne) {
    bubble.call(this, n, ne);
  }
  function H(ne) {
    bubble.call(this, n, ne);
  }
  function Q(ne) {
    bubble.call(this, n, ne);
  }
  function te(ne) {
    bubble.call(this, n, ne);
  }
  function ee(ne) {
    bubble.call(this, n, ne);
  }
  function ce(ne) {
    bubble.call(this, n, ne);
  }
  function fe() {
    r = this.value, t(0, r);
  }
  function oe(ne) {
    binding_callbacks$1[ne ? "unshift" : "push"](() => {
      g = ne, t(14, g);
    });
  }
  function he() {
    r = this.value, t(0, r);
  }
  function Ae(ne) {
    binding_callbacks$1[ne ? "unshift" : "push"](() => {
      g = ne, t(14, g);
    });
  }
  function Se() {
    r = this.value, t(0, r);
  }
  function Ie(ne) {
    binding_callbacks$1[ne ? "unshift" : "push"](() => {
      g = ne, t(14, g);
    });
  }
  function pe() {
    r = this.value, t(0, r);
  }
  function le(ne) {
    binding_callbacks$1[ne ? "unshift" : "push"](() => {
      g = ne, t(14, g);
    });
  }
  return n.$$set = (ne) => {
    "value" in ne && t(0, r = ne.value), "value_is_output" in ne && t(21, a = ne.value_is_output), "lines" in ne && t(1, s = ne.lines), "placeholder" in ne && t(2, h = ne.placeholder), "label" in ne && t(3, o = ne.label), "info" in ne && t(4, d = ne.info), "disabled" in ne && t(5, v = ne.disabled), "show_label" in ne && t(6, f = ne.show_label), "container" in ne && t(7, y = ne.container), "max_lines" in ne && t(8, A = ne.max_lines), "type" in ne && t(9, x = ne.type), "show_copy_button" in ne && t(10, M = ne.show_copy_button), "rtl" in ne && t(11, m = ne.rtl), "autofocus" in ne && t(12, l = ne.autofocus), "text_align" in ne && t(13, u = ne.text_align), "autoscroll" in ne && t(22, p = ne.autoscroll);
  }, n.$$.update = () => {
    n.$$.dirty[0] & /*value*/
    1 && r === null && t(0, r = ""), n.$$.dirty[0] & /*value, el, lines, max_lines*/
    16643 && g && s !== A && N({ target: g }), n.$$.dirty[0] & /*value*/
    1 && L();
  }, [
    r,
    s,
    h,
    o,
    d,
    v,
    f,
    y,
    A,
    x,
    M,
    m,
    l,
    u,
    g,
    b,
    z,
    R,
    P,
    U,
    B,
    a,
    p,
    W,
    V,
    G,
    H,
    Q,
    te,
    ee,
    ce,
    fe,
    oe,
    he,
    Ae,
    Se,
    Ie,
    pe,
    le
  ];
}
class Textbox extends SvelteComponent$1 {
  constructor(e) {
    super(), init$1(
      this,
      e,
      instance$1,
      create_fragment$1,
      safe_not_equal$1,
      {
        value: 0,
        value_is_output: 21,
        lines: 1,
        placeholder: 2,
        label: 3,
        info: 4,
        disabled: 5,
        show_label: 6,
        container: 7,
        max_lines: 8,
        type: 9,
        show_copy_button: 10,
        rtl: 11,
        autofocus: 12,
        text_align: 13,
        autoscroll: 22
      },
      null,
      [-1, -1]
    );
  }
}
const {
  SvelteComponent,
  add_flush_callback,
  assign,
  bind,
  binding_callbacks,
  check_outros,
  claim_component,
  claim_space,
  claim_text,
  create_component,
  destroy_component,
  detach,
  flush,
  get_spread_object,
  get_spread_update,
  group_outros,
  init,
  insert_hydration,
  mount_component,
  safe_not_equal,
  set_data,
  space,
  text,
  transition_in,
  transition_out
} = window.__gradio__svelte__internal, { onMount } = window.__gradio__svelte__internal;
function create_if_block(n) {
  let e, t;
  const r = [
    { autoscroll: (
      /*gradio*/
      n[1].autoscroll
    ) },
    { i18n: (
      /*gradio*/
      n[1].i18n
    ) },
    /*loading_status*/
    n[11]
  ];
  let a = {};
  for (let s = 0; s < r.length; s += 1)
    a = assign(a, r[s]);
  return e = new Static({ props: a }), {
    c() {
      create_component(e.$$.fragment);
    },
    l(s) {
      claim_component(e.$$.fragment, s);
    },
    m(s, h) {
      mount_component(e, s, h), t = !0;
    },
    p(s, h) {
      const o = h & /*gradio, loading_status*/
      2050 ? get_spread_update(r, [
        h & /*gradio*/
        2 && { autoscroll: (
          /*gradio*/
          s[1].autoscroll
        ) },
        h & /*gradio*/
        2 && { i18n: (
          /*gradio*/
          s[1].i18n
        ) },
        h & /*loading_status*/
        2048 && get_spread_object(
          /*loading_status*/
          s[11]
        )
      ]) : {};
      e.$set(o);
    },
    i(s) {
      t || (transition_in(e.$$.fragment, s), t = !0);
    },
    o(s) {
      transition_out(e.$$.fragment, s), t = !1;
    },
    d(s) {
      destroy_component(e, s);
    }
  };
}
function create_default_slot_1(n) {
  let e;
  return {
    c() {
      e = text(
        /*label*/
        n[2]
      );
    },
    l(t) {
      e = claim_text(
        t,
        /*label*/
        n[2]
      );
    },
    m(t, r) {
      insert_hydration(t, e, r);
    },
    p(t, r) {
      r & /*label*/
      4 && set_data(
        e,
        /*label*/
        t[2]
      );
    },
    d(t) {
      t && detach(e);
    }
  };
}
function create_default_slot(n) {
  let e, t, r, a, s, h, o = (
    /*loading_status*/
    n[11] && create_if_block(n)
  );
  t = new BlockTitle({
    props: {
      show_label: (
        /*show_label*/
        n[7]
      ),
      info: (
        /*info*/
        n[3]
      ),
      $$slots: { default: [create_default_slot_1] },
      $$scope: { ctx: n }
    }
  });
  function d(f) {
    n[14](f);
  }
  let v = {};
  return (
    /*value*/
    n[0] !== void 0 && (v.value = /*value*/
    n[0]), a = new SequenceInput({ props: v }), binding_callbacks.push(() => bind(a, "value", d)), a.$on(
      "updateVals",
      /*syncValue*/
      n[12]
    ), a.$on(
      "updateCovMod",
      /*syncCovMod*/
      n[13]
    ), {
      c() {
        o && o.c(), e = space(), create_component(t.$$.fragment), r = space(), create_component(a.$$.fragment);
      },
      l(f) {
        o && o.l(f), e = claim_space(f), claim_component(t.$$.fragment, f), r = claim_space(f), claim_component(a.$$.fragment, f);
      },
      m(f, y) {
        o && o.m(f, y), insert_hydration(f, e, y), mount_component(t, f, y), insert_hydration(f, r, y), mount_component(a, f, y), h = !0;
      },
      p(f, y) {
        /*loading_status*/
        f[11] ? o ? (o.p(f, y), y & /*loading_status*/
        2048 && transition_in(o, 1)) : (o = create_if_block(f), o.c(), transition_in(o, 1), o.m(e.parentNode, e)) : o && (group_outros(), transition_out(o, 1, 1, () => {
          o = null;
        }), check_outros());
        const A = {};
        y & /*show_label*/
        128 && (A.show_label = /*show_label*/
        f[7]), y & /*info*/
        8 && (A.info = /*info*/
        f[3]), y & /*$$scope, label*/
        32772 && (A.$$scope = { dirty: y, ctx: f }), t.$set(A);
        const x = {};
        !s && y & /*value*/
        1 && (s = !0, x.value = /*value*/
        f[0], add_flush_callback(() => s = !1)), a.$set(x);
      },
      i(f) {
        h || (transition_in(o), transition_in(t.$$.fragment, f), transition_in(a.$$.fragment, f), h = !0);
      },
      o(f) {
        transition_out(o), transition_out(t.$$.fragment, f), transition_out(a.$$.fragment, f), h = !1;
      },
      d(f) {
        f && (detach(e), detach(r)), o && o.d(f), destroy_component(t, f), destroy_component(a, f);
      }
    }
  );
}
function create_fragment(n) {
  let e, t;
  return e = new Block({
    props: {
      visible: (
        /*visible*/
        n[6]
      ),
      elem_id: (
        /*elem_id*/
        n[4]
      ),
      elem_classes: (
        /*elem_classes*/
        n[5]
      ),
      scale: (
        /*scale*/
        n[9]
      ),
      min_width: (
        /*min_width*/
        n[10]
      ),
      allow_overflow: !1,
      padding: (
        /*container*/
        n[8]
      ),
      $$slots: { default: [create_default_slot] },
      $$scope: { ctx: n }
    }
  }), {
    c() {
      create_component(e.$$.fragment);
    },
    l(r) {
      claim_component(e.$$.fragment, r);
    },
    m(r, a) {
      mount_component(e, r, a), t = !0;
    },
    p(r, [a]) {
      const s = {};
      a & /*visible*/
      64 && (s.visible = /*visible*/
      r[6]), a & /*elem_id*/
      16 && (s.elem_id = /*elem_id*/
      r[4]), a & /*elem_classes*/
      32 && (s.elem_classes = /*elem_classes*/
      r[5]), a & /*scale*/
      512 && (s.scale = /*scale*/
      r[9]), a & /*min_width*/
      1024 && (s.min_width = /*min_width*/
      r[10]), a & /*container*/
      256 && (s.padding = /*container*/
      r[8]), a & /*$$scope, value, show_label, info, label, gradio, loading_status*/
      34959 && (s.$$scope = { dirty: a, ctx: r }), e.$set(s);
    },
    i(r) {
      t || (transition_in(e.$$.fragment, r), t = !0);
    },
    o(r) {
      transition_out(e.$$.fragment, r), t = !1;
    },
    d(r) {
      destroy_component(e, r);
    }
  };
}
function instance(n, e, t) {
  let { gradio: r } = e, { label: a = "CofoldingInput" } = e, { info: s = void 0 } = e, { elem_id: h = "" } = e, { elem_classes: o = [] } = e, { visible: d = !0 } = e, { value: v = { chains: [], covMods: [] } } = e, { show_label: f } = e, { container: y = !0 } = e, { scale: A = null } = e, { min_width: x = void 0 } = e, { loading_status: M = void 0 } = e;
  function m(p) {
    let g = p.detail.map((b) => Object.fromEntries(Object.entries(b).filter(([c, _]) => c !== "open" && _ !== "")));
    t(0, v.chains = g, v);
  }
  function l(p) {
    t(0, v.covMods = p.detail, v);
  }
  onMount(() => {
  });
  function u(p) {
    v = p, t(0, v);
  }
  return n.$$set = (p) => {
    "gradio" in p && t(1, r = p.gradio), "label" in p && t(2, a = p.label), "info" in p && t(3, s = p.info), "elem_id" in p && t(4, h = p.elem_id), "elem_classes" in p && t(5, o = p.elem_classes), "visible" in p && t(6, d = p.visible), "value" in p && t(0, v = p.value), "show_label" in p && t(7, f = p.show_label), "container" in p && t(8, y = p.container), "scale" in p && t(9, A = p.scale), "min_width" in p && t(10, x = p.min_width), "loading_status" in p && t(11, M = p.loading_status);
  }, n.$$.update = () => {
    n.$$.dirty & /*value*/
    1 && console.log(v);
  }, [
    v,
    r,
    a,
    s,
    h,
    o,
    d,
    f,
    y,
    A,
    x,
    M,
    m,
    l,
    u
  ];
}
class Index extends SvelteComponent {
  constructor(e) {
    super(), init(this, e, instance, create_fragment, safe_not_equal, {
      gradio: 1,
      label: 2,
      info: 3,
      elem_id: 4,
      elem_classes: 5,
      visible: 6,
      value: 0,
      show_label: 7,
      container: 8,
      scale: 9,
      min_width: 10,
      loading_status: 11
    });
  }
  get gradio() {
    return this.$$.ctx[1];
  }
  set gradio(e) {
    this.$$set({ gradio: e }), flush();
  }
  get label() {
    return this.$$.ctx[2];
  }
  set label(e) {
    this.$$set({ label: e }), flush();
  }
  get info() {
    return this.$$.ctx[3];
  }
  set info(e) {
    this.$$set({ info: e }), flush();
  }
  get elem_id() {
    return this.$$.ctx[4];
  }
  set elem_id(e) {
    this.$$set({ elem_id: e }), flush();
  }
  get elem_classes() {
    return this.$$.ctx[5];
  }
  set elem_classes(e) {
    this.$$set({ elem_classes: e }), flush();
  }
  get visible() {
    return this.$$.ctx[6];
  }
  set visible(e) {
    this.$$set({ visible: e }), flush();
  }
  get value() {
    return this.$$.ctx[0];
  }
  set value(e) {
    this.$$set({ value: e }), flush();
  }
  get show_label() {
    return this.$$.ctx[7];
  }
  set show_label(e) {
    this.$$set({ show_label: e }), flush();
  }
  get container() {
    return this.$$.ctx[8];
  }
  set container(e) {
    this.$$set({ container: e }), flush();
  }
  get scale() {
    return this.$$.ctx[9];
  }
  set scale(e) {
    this.$$set({ scale: e }), flush();
  }
  get min_width() {
    return this.$$.ctx[10];
  }
  set min_width(e) {
    this.$$set({ min_width: e }), flush();
  }
  get loading_status() {
    return this.$$.ctx[11];
  }
  set loading_status(e) {
    this.$$set({ loading_status: e }), flush();
  }
}
export {
  Example as BaseExample,
  Textbox as BaseTextbox,
  Index as default
};
